You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
5.0 KiB

"use strict";const e=require("../../common/vendor.js"),s=require("../../sheep/config/index.js");require("../../sheep/index.js");require("../../sheep/url/index.js");require("../../sheep/store/index.js");require("../../sheep/store/app.js");require("../../sheep/platform/index.js");require("../../sheep/platform/provider/wechat/index.js");require("../../sheep/platform/provider/wechat/miniProgram.js");require("../../sheep/api/member/auth.js");require("../../sheep/request/index.js");require("../../sheep/helper/index.js");require("../../sheep/helper/test.js");require("../../sheep/helper/digit.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/hooks/useModal.js");require("../../sheep/helper/throttle.js");require("../../sheep/platform/pay.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/store/sys.js");require("../../sheep/store/modal.js");require("../../sheep/config/zIndex.js");if(!Array){const d=e.resolveComponent("uni-forms-item"),r=e.resolveComponent("uni-forms");(d+r)()}const b=()=>"../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js",S=()=>"../../uni_modules/uni-forms/components/uni-forms/uni-forms.js";Math||(b+S)();const T={__name:"phone",setup(d){const r=e.ref({phone:"",password:""}),u=e.ref("获取验证码"),i=e.ref(!0),l=e.ref("切换手机密码登录"),n=e.ref(!1),f={phone:{rules:[{required:!0,errorMessage:"请输入"}]},password:{rules:[{required:!0,errorMessage:"请输入"}]}},c=e.ref(null);function g(){}function h(){}function p(){c.value.validate().then(a=>{i.value?v():_()}).catch(a=>{})}function v(){e.index.request({url:`${s.baseUrl+s.apiPath}/member/auth/sms-login`,method:"POST",data:{mobile:r.value.phone,code:r.value.password,socialType:"",socialCode:"1024",socialState:"9b2ffbc1-7425-4155-9894-9d5c08541d62",socialCodeValid:!0},header:{"tenant-id":1},success:a=>{a.data.code==0?(e.index.showToast({icon:"success",title:"登录成功"}),e.index.setStorageSync("token",a.data.data.accessToken),e.index.setStorageSync("refresh-token",a.data.data.refreshToken),e.index.setStorageSync("userId",a.data.data.userId),m(a.data.data.accessToken)):e.index.showToast({title:a.data.msg,icon:"error"})},fail:a=>{console.log(a,"error")}})}function _(){e.index.request({url:`${s.baseUrl+s.apiPath}/member/auth/login`,method:"POST",data:{mobile:r.value.phone,password:r.value.password,socialType:"",socialCode:"1024",socialState:"9b2ffbc1-7425-4155-9894-9d5c08541d62",socialCodeValid:!0},header:{"tenant-id":1},success:a=>{a.data.code==0?(e.index.showToast({icon:"success",title:"登录成功"}),e.index.setStorageSync("token",a.data.data.accessToken),e.index.setStorageSync("refresh-token",a.data.data.refreshToken),e.index.setStorageSync("userId",a.data.data.userId),m(a.data.data.accessToken)):e.index.showToast({title:a.data.msg,icon:"error"})},fail:a=>{console.log(a,"error")}})}function q(){n.value==!1&&r.value.phone!=""&&e.index.request({url:`${s.baseUrl+s.apiPath}/member/auth/send-sms-code`,method:"POST",data:{mobile:r.value.phone,scene:1},header:{"tenant-id":1},success:a=>{if(a.data.code==0){n.value=!0;let o=10;const t=setInterval(()=>{o--,u.value=o+"s",o==0&&(clearInterval(t),u.value="获取验证码",n.value=!1)},1e3)}else e.index.showToast({icon:"error",title:"获取失败"})}})}function x(){i.value=!i.value,i.value?l.value="切换密码登录":l.value="切换手机验证码登录"}function m(a){e.index.request({url:`${s.baseUrl+s.apiPath}/member/user/get-ext`,method:"GET",header:{"tenant-id":1,Authorization:a},success:o=>{o.data.code==0?(e.index.setStorageSync("avatar",o.data.data.avatar),o.data.data.realNameAuthFlag==1?e.index.switchTab({url:"/pages/subpackages/mapnvue"}):o.data.data.realNameAuthFlag==2?(e.index.showModal({title:"账号未审核",content:"您的账号当前处于待审核状态,请联系客服,审核后重试",success:t=>{e.index.redirectTo({url:"/pages/subpackages/login"})}}),e.index.removeStorageSync("token")):e.index.navigateTo({url:"/pages/index/authentication"})):e.index.showToast({icon:"error",title:o.data.msg})},fail:o=>{console.log(o,"error")}})}return(a,o)=>e.e({a:r.value.phone,b:e.o(t=>r.value.phone=t.detail.value),c:e.p({name:"phone"}),d:i.value},i.value?{e:r.value.password,f:e.o(t=>r.value.password=t.detail.value),g:e.t(u.value),h:e.n(n.value==!1?"getCode":"getCode dis_code"),i:e.o(q)}:{j:r.value.password,k:e.o(t=>r.value.password=t.detail.value)},{l:e.p({name:"password"}),m:e.sr(c,"de7bf4c0-0",{k:"loginform"}),n:e.p({modelValue:r.value,rules:f,["validate-trigger"]:"blur"}),o:e.t(l.value),p:e.o(x),q:e.o(p),r:e.o(g),s:e.o(h)})}},w=e._export_sfc(T,[["__scopeId","data-v-de7bf4c0"],["__file","D:/xiangmu/佰安出行/app/s-applet/pages/index/phone.vue"]]);wx.createPage(w);