Files
tk-mini-program/unpackage/dist/build/mp-weixin/pages/loginWithEmailOrAccount/loginWithEmailOrAccount.js
pengxiaolong 0044f8f334 优化代码
2025-09-29 20:48:31 +08:00

2 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";const o=require("../../common/vendor.js"),e=require("../../components/request.js"),t=require("../../components/goEasyTool/tool.js"),n=require("../../stores/counter.js").useCounterStore(),a={data:()=>({title:"Hello",EmailOrAccount:"",Password:""}),onLoad(){},methods:{onLogin(){/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,16}$/.test(this.Password)?(o.index.showLoading({title:"登录中...",mask:!0}),e.request({url:"user/loginWithMail",method:"POST",data:{userNameOrEmail:this.EmailOrAccount,password:this.Password},userInfo:!1}).then((e=>{o.index.hideLoading(),console.log(e),this.info=e;const a=Date.now();o.index.setStorageSync("last_clean_time",a),n.$patch({myitem:this.info.data}),200===e.code?(o.index.setStorageSync("userinfo",this.info.data),o.index.setStorageSync("token",this.info.data.token),t.goEasylogin(this.$goeasy,String(this.info.data.id),this.info.data.headerIcon,this.info.data.nickName),o.index.reLaunch({url:this.lastPage||"/pages/Home/Home"})):o.index.showToast({title:e.msg,icon:"none"})})).catch((e=>{o.index.hideLoading(),o.index.showToast({title:e.msg,icon:"none"})}))):o.index.showToast({title:"密码必须包含大小写字母和数字长度6-16位",icon:"none"})},onBack(){o.index.navigateBack({delta:1})}}};const i=o._export_sfc(a,[["render",function(e,t,n,a,i,s){return{a:o.o(((...o)=>s.onBack&&s.onBack(...o))),b:i.EmailOrAccount,c:o.o((o=>i.EmailOrAccount=o.detail.value)),d:i.Password,e:o.o((o=>i.Password=o.detail.value)),f:o.o(((...o)=>s.onLogin&&s.onLogin(...o)))}}],["__scopeId","data-v-c50a090c"]]);wx.createPage(i);