95 lines
3.1 KiB
JavaScript
95 lines
3.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_loginApi = require("../../api/loginApi.js");
|
|
if (!Array) {
|
|
const _component_transition = common_vendor.resolveComponent("transition");
|
|
_component_transition();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "index",
|
|
setup(__props) {
|
|
const isTarget = common_vendor.ref(false);
|
|
const isFadingOut = common_vendor.ref(false);
|
|
const maskColor = common_vendor.ref("rgba(0, 0, 0, 0.5)");
|
|
function closeModal() {
|
|
isFadingOut.value = false;
|
|
}
|
|
const getCode = () => {
|
|
common_vendor.index.login({
|
|
provider: "weixin",
|
|
success(res) {
|
|
api_loginApi.getOpenid(res.code).then((res2) => {
|
|
let openid = res2.data.openid;
|
|
common_vendor.index.setStorageSync("openid", openid);
|
|
api_loginApi.getMessage(openid).then((res3) => {
|
|
if (!res3.result.tel) {
|
|
common_vendor.index.redirectTo({
|
|
url: `/pages/login/phonebumber`
|
|
});
|
|
} else {
|
|
common_vendor.index.setStorageSync("tel", res3.result.tel);
|
|
common_vendor.index.setStorageSync("token", res3.result.token);
|
|
common_vendor.index.setStorageSync("serverUrl", res3.result.serverUrl);
|
|
common_vendor.index.redirectTo({
|
|
url: `/pages/login/threeselectone`
|
|
});
|
|
}
|
|
});
|
|
});
|
|
},
|
|
fail(err) {
|
|
common_vendor.index.__f__("error", "at pages/login/index.vue:115", "获取 code 失败:", err);
|
|
}
|
|
});
|
|
};
|
|
const loginIt = () => {
|
|
if (!isTarget.value) {
|
|
isFadingOut.value = true;
|
|
} else {
|
|
getCode();
|
|
}
|
|
};
|
|
const jumpToPro = () => {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/login/protocol"
|
|
});
|
|
};
|
|
common_vendor.onLoad((options) => {
|
|
superLogin();
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.o(loginIt),
|
|
b: common_vendor.n(isTarget.value ? "radio-circle-target" : "radio-circle"),
|
|
c: common_vendor.o(($event) => isTarget.value = !isTarget.value),
|
|
d: common_vendor.o(($event) => isTarget.value = !isTarget.value),
|
|
e: common_vendor.o(jumpToPro),
|
|
f: common_vendor.o(($event) => isTarget.value = !isTarget.value),
|
|
g: isFadingOut.value
|
|
}, isFadingOut.value ? {
|
|
h: common_vendor.o(closeModal),
|
|
i: maskColor.value
|
|
} : {}, {
|
|
j: common_vendor.p({
|
|
name: "fade"
|
|
}),
|
|
k: isFadingOut.value
|
|
}, isFadingOut.value ? {
|
|
l: common_vendor.o(jumpToPro),
|
|
m: common_vendor.o(closeModal),
|
|
n: common_vendor.o(($event) => {
|
|
closeModal();
|
|
isTarget.value = true;
|
|
})
|
|
} : {}, {
|
|
o: common_vendor.p({
|
|
name: "slide-up"
|
|
})
|
|
});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d08ef7d4"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/index.js.map
|