"use strict"; const common_vendor = require("../../common/vendor.js"); const sheep_index = require("../../sheep/index.js"); const sheep_hooks_useModal = require("../../sheep/hooks/useModal.js"); const sheep_validate_form = require("../../sheep/validate/form.js"); const sheep_api_member_auth = require("../../sheep/api/member/auth.js"); require("../../sheep/api/index.js"); require("../../sheep/api/distri/score.js"); require("../../sheep/request/index.js"); require("../../sheep/config/index.js"); require("../../sheep/store/index.js"); require("../../sheep/store/app.js"); require("../../sheep/api/promotion/diy.js"); require("../../sheep/platform/index.js"); require("../../sheep/platform/provider/wechat/index.js"); require("../../sheep/platform/provider/wechat/miniProgram.js"); require("../../sheep/api/member/social.js"); require("../../sheep/api/member/user.js"); require("../../sheep/platform/provider/apple/index.js"); require("../../sheep/platform/share.js"); require("../../sheep/router/index.js"); require("../../sheep/helper/throttle.js"); require("../../sheep/url/index.js"); require("../../sheep/platform/pay.js"); require("../../sheep/helper/index.js"); require("../../sheep/helper/test.js"); require("../../sheep/helper/digit.js"); require("../../sheep/api/pay/order.js"); require("../../sheep/store/user.js"); require("../../sheep/store/cart.js"); require("../../sheep/api/trade/cart.js"); require("../../sheep/api/pay/wallet.js"); require("../../sheep/api/trade/order.js"); require("../../sheep/api/promotion/coupon.js"); require("../../sheep/store/sys.js"); require("../../sheep/store/modal.js"); require("../../sheep/api/distri/share.js"); require("../../sheep/api/distri/team.js"); require("../../sheep/api/infra/file.js"); require("../../sheep/api/member/address.js"); require("../../sheep/api/member/point.js"); require("../../sheep/api/member/signin.js"); require("../../sheep/api/migration/app.js"); require("../../sheep/api/migration/chat.js"); require("../../sheep/api/migration/index.js"); require("../../sheep/api/migration/third.js"); require("../../sheep/api/pay/channel.js"); require("../../sheep/api/product/category.js"); require("../../sheep/api/product/comment.js"); require("../../sheep/api/product/favorite.js"); require("../../sheep/api/product/history.js"); require("../../sheep/api/product/spu.js"); require("../../sheep/api/promotion/activity.js"); require("../../sheep/api/promotion/article.js"); require("../../sheep/api/promotion/bargain.js"); require("../../sheep/api/promotion/combination.js"); require("../../sheep/api/promotion/rewardActivity.js"); require("../../sheep/api/promotion/seckill.js"); require("../../sheep/api/system/area.js"); require("../../sheep/api/system/voice.js"); require("../../sheep/api/trade/afterSale.js"); require("../../sheep/api/trade/brokerage.js"); require("../../sheep/api/trade/config.js"); require("../../sheep/api/trade/delivery.js"); require("../../sheep/config/zIndex.js"); if (!Array) { const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup"); const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput"); const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item"); const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms"); (_easycom_su_popup2 + _easycom_uni_easyinput2 + _easycom_uni_forms_item2 + _easycom_uni_forms2)(); } const _easycom_su_popup = () => "../../sheep/ui/su-popup/su-popup.js"; const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js"; const _easycom_uni_forms_item = () => "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js"; const _easycom_uni_forms = () => "../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"; if (!Math) { (_easycom_su_popup + _easycom_uni_easyinput + _easycom_uni_forms_item + phoneInternationalInput + _easycom_uni_forms)(); } const phoneInternationalInput = () => "../../sheep/components/s-auth-modal/components/phone-international-input.js"; const _sfc_main = { __name: "login", setup(__props) { const mobileInput = (mobile, mobileError) => { state.model.mobile = mobile; state.mobileErrorMsg = mobileError; }; const state = common_vendor.reactive({ verifyUsername: false, usernameErrorMsg: "", mobileErrorMsg: "", openid: "", socialUsers: [], registerReqVO: { type: 31, code: "", state: "", username: "" }, isMobileEnd: false, // 手机号输入完毕 codeText: "获取验证码", model: { mobile: "", // 手机号 code: "", // 验证码 scene: 1 }, rules: { code: sheep_validate_form.code, mobile: sheep_validate_form.mobile } }); const isPopup = common_vendor.ref(false); const selectSocialUsers = common_vendor.ref(false); async function selectUser(username) { console.log(username); const { code } = await sheep_api_member_auth.AuthUtil.selectUsernameLogin({ openId: state.openid, username }); if (code === 0) { let returnUrl = common_vendor.index.getStorageSync("returnUrl"); if (returnUrl) { common_vendor.index.removeStorage("returnUrl"); location.replace(returnUrl); } else { common_vendor.index.switchTab({ url: "/" }); } } } let lastUsername = common_vendor.ref(""); async function verifyUsername(e) { const username = e.detail.value; if (username == "" || username == lastUsername.value) { return false; } lastUsername.value = username; const { data } = await sheep_api_member_auth.AuthUtil.verifyUsername(username); console.log(data); if (data) { state.usernameErrorMsg = ""; state.verifyUsername = data; } else { state.usernameErrorMsg = "已存在用户名!"; state.verifyUsername = data; } } async function officialRegister() { const linkId = common_vendor.index.getStorageSync("linkId"); if (!linkId) { sheep_index.sheep.$helper.toast("您只能通过分享注册"); return false; } state.registerReqVO.linkId = linkId; const { code } = await sheep_api_member_auth.AuthUtil.OfficialEnterLogin(state.model, state.registerReqVO); if (code === 0) { sheep_hooks_useModal.closeAuthModal(); let returnUrl = common_vendor.index.getStorageSync("returnUrl"); if (returnUrl) { common_vendor.index.removeStorage("returnUrl"); location.replace(returnUrl); } else { common_vendor.index.switchTab({ url: "/" }); } } } common_vendor.onBeforeMount(async () => { const options = {}; new URLSearchParams(location.search).forEach((value, key) => { options[key] = value; }); state.registerReqVO.code = options.code; state.registerReqVO.state = options.state; }); common_vendor.onLoad(async (options) => { }); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.f(state.socialUsers, (user, k0, i0) => { return { a: user.avatar, b: common_vendor.t(user.username), c: user.username, d: common_vendor.o(($event) => selectUser(user.username), user.username) }; }), b: !state.socialUsers.length }, !state.socialUsers.length ? {} : {}, { c: common_vendor.p({ show: selectSocialUsers.value, type: "center", round: "10", isMaskClick: false }), d: !state.verifyUsername }, !state.verifyUsername ? { e: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/shibai.png") } : { f: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/chenggong.png") }, { g: common_vendor.o(verifyUsername), h: common_vendor.o(($event) => state.registerReqVO.username = $event), i: common_vendor.p({ placeholder: "请输入用户名", inputBorder: false, clearable: false, modelValue: state.registerReqVO.username }), j: common_vendor.p({ name: "username", label: "用户名", ["error-message"]: state.usernameErrorMsg }), k: common_vendor.o(mobileInput), l: common_vendor.p({ ["verify-username"]: state.verifyUsername }), m: common_vendor.p({ name: "mobile", label: "手机号", ["error-message"]: state.mobileErrorMsg }), n: common_vendor.o(($event) => state.model.code = $event), o: common_vendor.p({ placeholder: "请输入验证码", inputBorder: false, type: "number", maxlength: "4", modelValue: state.model.code }), p: common_vendor.p({ name: "code", label: "验证码" }), q: common_vendor.o(($event) => state.model = $event), r: common_vendor.p({ rules: state.rules, validateTrigger: "bind", labelWidth: "140", labelAlign: "center", modelValue: state.model }), s: common_vendor.o(officialRegister), t: common_vendor.p({ show: isPopup.value, round: "10", isMaskClick: false }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-fa14255b"], ["__file", "D:/zx/mall-front-app/pages/index/login.vue"]]); wx.createPage(MiniProgramPage);