66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_user = require("../../api/user.js");
|
|
if (!Array) {
|
|
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
|
|
_easycom_nut_button2();
|
|
}
|
|
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
|
|
if (!Math) {
|
|
_easycom_nut_button();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "phoneAuthorization",
|
|
setup(__props) {
|
|
const code = common_vendor.ref("");
|
|
const redirect_url = common_vendor.ref("");
|
|
common_vendor.onLoad((options) => {
|
|
redirect_url.value = options.redirect_url;
|
|
});
|
|
common_vendor.onMounted(() => {
|
|
common_vendor.index.login({
|
|
provider: "weixin",
|
|
success(res) {
|
|
if (res.errMsg === "login:ok") {
|
|
code.value = res.code;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
const getPhoneNumber = (res) => {
|
|
if (res.detail.code) {
|
|
api_user.fetchUserPhone(res.detail.code).then((res2) => {
|
|
common_vendor.index.__f__("log", "at pages/login/phoneAuthorization.vue:54", res2);
|
|
if (res2.msg === "success" && res2.code === 1) {
|
|
common_vendor.index.showToast({
|
|
title: "授权成功",
|
|
icon: "none"
|
|
});
|
|
common_vendor.index.__f__("log", "at pages/login/phoneAuthorization.vue:60", "code");
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/mine/index"
|
|
});
|
|
} else {
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/mine/index"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.o(getPhoneNumber),
|
|
b: common_vendor.p({
|
|
type: "success",
|
|
size: "large",
|
|
["open-type"]: "getPhoneNumber"
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9edfa882"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/phoneAuthorization.js.map
|