"use strict";const e=require("../../common/vendor.js"),r=require("../../sheep/index.js"),s=require("../../sheep/hooks/useModal.js"),o=require("../../sheep/validate/form.js"),i=require("../../sheep/api/member/auth.js");if(require("../../sheep/url/index.js"),require("../../sheep/store/index.js"),require("../../sheep/store/app.js"),require("../../sheep/api/promotion/diy.js"),require("../../sheep/request/index.js"),require("../../sheep/config/index.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/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/config/zIndex.js"),require("../../sheep/api/member/signin.js"),!Array){(e.resolveComponent("su-popup")+e.resolveComponent("uni-easyinput")+e.resolveComponent("uni-forms-item")+e.resolveComponent("uni-forms"))()}Math||((()=>"../../sheep/ui/su-popup/su-popup.js")+(()=>"../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js")+n+(()=>"../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"))();const n=()=>"../../sheep/components/s-auth-modal/components/phone-international-input.js",a={__name:"login",setup(n){const a=(e,r)=>{t.model.mobile=e,t.mobileErrorMsg=r},t=e.reactive({verifyUsername:!1,usernameErrorMsg:"",mobileErrorMsg:"",openid:"",socialUsers:[],registerReqVO:{type:31,code:"",state:"",username:""},isMobileEnd:!1,codeText:"获取验证码",model:{mobile:"",code:"",scene:1},rules:{code:o.code,mobile:o.mobile}}),u=e.ref(!1),p=e.ref(!1);let l=e.ref("");async function m(e){const r=e.detail.value;if(""==r||r==l.value)return!1;l.value=r;const{data:s}=await i.AuthUtil.verifyUsername(r);console.log(s),s?(t.usernameErrorMsg="",t.verifyUsername=s):(t.usernameErrorMsg="已存在用户名!",t.verifyUsername=s)}async function c(){const o=e.index.getStorageSync("linkId");if(!o)return r.sheep.$helper.toast("您只能通过分享注册"),!1;t.registerReqVO.linkId=o;const{code:n}=await i.AuthUtil.OfficialEnterLogin(t.model,t.registerReqVO);if(0===n){s.closeAuthModal();let r=e.index.getStorageSync("returnUrl");r?(e.index.removeStorage("returnUrl"),location.replace(r)):e.index.switchTab({url:"/"})}}return e.onBeforeMount((async()=>{const e={};new URLSearchParams(location.search).forEach(((r,s)=>{e[s]=r})),t.registerReqVO.code=e.code,t.registerReqVO.state=e.state})),e.onLoad((async e=>{})),(s,o)=>e.e({a:e.f(t.socialUsers,((r,s,o)=>({a:r.avatar,b:e.t(r.username),c:r.username,d:e.o((s=>async function(r){console.log(r);const{code:s}=await i.AuthUtil.selectUsernameLogin({openId:t.openid,username:r});if(0===s){let r=e.index.getStorageSync("returnUrl");r?(e.index.removeStorage("returnUrl"),location.replace(r)):e.index.switchTab({url:"/"})}}(r.username)),r.username)}))),b:!t.socialUsers.length},(t.socialUsers.length,{}),{c:e.p({show:p.value,type:"center",round:"10",isMaskClick:!1}),d:!t.verifyUsername},t.verifyUsername?{f:e.unref(r.sheep).$url.static("/static/images/chenggong.png")}:{e:e.unref(r.sheep).$url.static("/static/images/shibai.png")},{g:e.o(m),h:e.o((e=>t.registerReqVO.username=e)),i:e.p({placeholder:"请输入用户名",inputBorder:!1,clearable:!1,modelValue:t.registerReqVO.username}),j:e.p({name:"username",label:"用户名","error-message":t.usernameErrorMsg}),k:e.o(a),l:e.p({"verify-username":t.verifyUsername}),m:e.p({name:"mobile",label:"手机号","error-message":t.mobileErrorMsg}),n:e.o((e=>t.model.code=e)),o:e.p({placeholder:"请输入验证码",inputBorder:!1,type:"number",maxlength:"4",modelValue:t.model.code}),p:e.p({name:"code",label:"验证码"}),q:e.o((e=>t.model=e)),r:e.p({rules:t.rules,validateTrigger:"bind",labelWidth:"140",labelAlign:"center",modelValue:t.model}),s:e.o(c),t:e.p({show:u.value,round:"10",isMaskClick:!1})})}},t=e._export_sfc(a,[["__scopeId","data-v-81e75dc0"]]);wx.createPage(t);
