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
1.5 KiB

"use strict";const t=require("../store/index.js"),u=require("../helper/index.js"),c=require("../../common/vendor.js"),m=require("../helper/test.js"),f=require("../api/member/auth.js");function p(e="smsLogin"){const o=t.$store("modal");o.auth!==""?(i(),setTimeout(()=>{o.$patch(s=>{s.auth=e})},100)):o.$patch(s=>{s.auth=e})}function i(){t.$store("modal").$patch(e=>{e.auth=""})}function $(){t.$store("modal").$patch(e=>{e.share=!0})}function S(){t.$store("modal").$patch(e=>{e.share=!1})}function M(){t.$store("modal").$patch(e=>{e.menu=!0})}function T(){t.$store("modal").$patch(e=>{e.menu=!1})}function _(e,o){const s=t.$store("modal"),a=s.lastTimer[e];if(typeof a>"u"){u.$helper.toast("短信发送事件错误");return}if(!(c.dayjs().unix()-a>=60)){u.$helper.toast("请稍后再试");return}if(o&&!m.test.mobile(o)){u.$helper.toast("手机号码格式不正确");return}let n=-1;switch(e){case"resetPassword":n=4;break;case"changePassword":n=3;break;case"changeMobile":n=2;break;case"smsLogin":n=1;break}f.AuthUtil.sendSmsCode(o,n).then(d=>{d.code===0&&s.$patch(h=>{h.lastTimer[e]=c.dayjs().unix()})})}function g(e,o=""){const a=t.$store("modal").lastTimer[e];if(typeof a>"u"){u.$helper.toast("短信发送事件错误");return}const r=c.ref(c.dayjs().unix()-a-60),l=r.value>=0;if(l)return"获取验证码";if(!l)return setTimeout(()=>{r.value++},1e3),-r.value.toString()+" 秒"}exports.closeAuthModal=i;exports.closeMenuTools=T;exports.closeShareModal=S;exports.getSmsCode=_;exports.getSmsTimer=g;exports.showAuthModal=p;exports.showMenuTools=M;exports.showShareModal=$;