"use strict"; const common_vendor = require("../../common/vendor.js"); const api_loginApi = require("../../api/loginApi.js"); if (!Array) { const _easycom_u_message_input2 = common_vendor.resolveComponent("u-message-input"); _easycom_u_message_input2(); } const _easycom_u_message_input = () => "../../uni_modules/vk-uview-ui/components/u-message-input/u-message-input.js"; if (!Math) { _easycom_u_message_input(); } const _sfc_main = { __name: "code", setup(__props) { const mobile = common_vendor.ref(""); const hkcode = common_vendor.ref(""); common_vendor.ref(["", "", "", ""]); const focusedIndex = common_vendor.ref(-1); const isFadingOut = common_vendor.ref(false); const maskColor = common_vendor.ref("rgba(0, 0, 0, 0.5)"); function closeModal() { isFadingOut.value = false; } const finshinput = (res) => { submitCaptcha(res); }; const rightCode = common_vendor.ref(""); const submitCaptcha = (res0) => { const code = res0; if (code.length === 4) { let openid = common_vendor.index.getStorageSync("openid"); if (rightCode.value != code) { rightCode.value = code; api_loginApi.checkPhoneCode({ mobile: mobile.value, openId: openid, smscode: code }).then((res) => { if (res.success) { api_loginApi.getMessage(openid).then((res2) => { if (common_vendor.index.getStorageSync("special")) { common_vendor.index.setStorageSync("tel", res2.result.tel); common_vendor.index.setStorageSync("token", res2.result.token); common_vendor.index.setStorageSync("serverUrl", res2.result.serverUrl); common_vendor.index.redirectTo({ url: `/pages/login/special` }); } else { common_vendor.index.setStorageSync("tel", res2.result.tel); common_vendor.index.setStorageSync("token", res2.result.token); common_vendor.index.setStorageSync("serverUrl", res2.result.serverUrl); common_vendor.index.redirectTo({ url: `/pages/login/threeselectone` }); } }); } else { common_vendor.index.showToast({ title: "验证码错误", icon: "none", // 不显示图标(提示信息) duration: 2e3 // 显示时长(毫秒) }); } }); } } else { common_vendor.index.__f__("log", "at pages/login/code.vue:207", "验证码未输入完整"); } }; const getcode = () => { api_loginApi.smsCode({ mobile: mobile.value, hkcode: hkcode.value, smsmode: 1 }).then((res) => { if (res.success) { common_vendor.index.showToast({ title: "发送成功", icon: "none", // 不显示图标(提示信息) duration: 2e3 // 显示时长(毫秒) }); focusedIndex.value = 0; countdown.value = 60; timerId = setInterval(() => { if (countdown.value > 0) { countdown.value--; } else { clearInterval(timerId); timerId = null; } }, 1e3); } else { common_vendor.index.showToast({ title: res.message, icon: "none", // 不显示图标(提示信息) duration: 2e3 // 显示时长(毫秒) }); } }); }; const goback = () => { common_vendor.index.navigateBack(); }; const countdown = common_vendor.ref(0); let timerId = null; common_vendor.onUnmounted(() => { if (timerId) { clearInterval(timerId); } }); common_vendor.onLoad((options) => { mobile.value = options.mobile; hkcode.value = options.hkcode; getcode(); }); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.o(goback), b: common_vendor.t(mobile.value), c: common_vendor.o(finshinput), d: common_vendor.p({ ["active-color"]: "#333333", ["inactive-color"]: "rgb(175,179,189)", width: "150", focus: true, mode: "bottomLine" }), e: !countdown.value }, !countdown.value ? { f: common_vendor.o(getcode) } : {}, { g: countdown.value }, countdown.value ? { h: common_vendor.t(countdown.value) } : {}, { i: common_vendor.o(($event) => isFadingOut.value = true), j: isFadingOut.value }, isFadingOut.value ? { k: common_vendor.o(closeModal), l: maskColor.value } : {}, { m: isFadingOut.value }, isFadingOut.value ? {} : {}); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7f72106f"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/code.js.map