"use strict";const e=require("../../common/vendor.js"),o=require("../../utils/fun.js"),s=require("../../uni_modules/wot-design-uni/components/composables/useCountDown.js");require("../../uni_modules/wot-design-uni/locale/index.js"),require("../../uni_modules/wot-design-uni/dayjs/index.js");const a=require("../../api/index.js"),n=require("../../store/index.js"),t=e.defineComponent({__name:"mobile",setup(t){const u=n.Store(),i=e.computed((()=>u.userInfo||{inviteCode:"",nickname:"",mobile:"",avatar:"",paywallet:{balance:0}}));e.onShow((async()=>{await u.usersGetInfo()}));const l=e.ref("获取验证码"),d=e.ref("获取验证码"),c=e.ref({code:"",mobile:"",oldCode:""}),{start:r,pause:m,reset:v,current:b}=s.useCountDown({time:6e4,onChange(e){},onFinish(){l.value="重新发送"}}),{start:p,pause:h,reset:w,current:C}=s.useCountDown({time:6e4,onChange(e){},onFinish(){d.value="重新发送"}}),f=e=>{i.value.mobile?b.value.seconds?o.toast("请等待倒计时结束"):a.api.smsCode({mobile:i.value.mobile,scene:2}).then((e=>{r(),o.toast("验证码发送成功")})).catch((e=>{console.log(e),o.toast("验证码发送失败")})):o.toast("请输入旧手机号")},g=e=>{c.value.mobile?C.value.seconds?o.toast("请等待倒计时结束"):a.api.smsCode({mobile:c.value.mobile,scene:2}).then((e=>{p(),o.toast("验证码发送成功")})).catch((e=>{console.log(e),o.toast("验证码发送失败")})):o.toast("请输入旧手机号")},j=()=>{a.api.updateMobile(c.value).then((o=>{e.index.showModal({title:"提示",content:"修改成功",showCancel:!1,success:async()=>{await u.usersGetInfo(),e.index.navigateBack()}})}))};return(o,s)=>({a:i.value.mobile,b:c.value.oldCode,c:e.o((e=>c.value.oldCode=e.detail.value)),d:e.t(e.unref(b).seconds||l.value),e:e.o(f),f:c.value.mobile,g:e.o((e=>c.value.mobile=e.detail.value)),h:c.value.code,i:e.o((e=>c.value.code=e.detail.value)),j:e.t(e.unref(C).seconds||d.value),k:e.o(g),l:e.o(j)})}}),u=e._export_sfc(t,[["__scopeId","data-v-54d890b4"]]);wx.createPage(u);
