"use strict";const e=require("../../common/vendor.js"),n=require("../../utils/api.js");if(!Array){(e.resolveComponent("t-input")+e.resolveComponent("t-button"))()}Math||((()=>"../../uni_modules/tdesign-uniapp/components/input/input.js")+(()=>"../../uni_modules/tdesign-uniapp/components/button/button.js"))();const t=e.defineComponent({__name:"register",setup(t){const a=e.ref(""),o=e.ref(""),i=e.ref(!1),l=async()=>{if(a.value&&11===String(a.value).length)if(o.value&&0!==o.value.trim().length){i.value=!0;try{const t=await n.api.auth.register("+86"+a.value,o.value.trim());e.index.setStorageSync("token",t.token),e.index.setStorageSync("user",t.user),e.index.showToast({title:"注册成功",icon:"success"}),e.index.reLaunch({url:"/pages/index/index"})}catch(t){console.error("注册失败",t)}finally{i.value=!1}}else e.index.showToast({title:"请输入昵称",icon:"none"});else e.index.showToast({title:"请输入正确的手机号",icon:"none"})},s=()=>{e.index.navigateBack()};return(n,t)=>({a:e.o((e=>a.value=e)),b:e.p({placeholder:"请输入手机号",type:"number",maxlength:11,clearable:!0,value:a.value}),c:e.o((e=>o.value=e)),d:e.p({placeholder:"请输入昵称",maxlength:20,clearable:!0,value:o.value}),e:e.o(l),f:e.p({theme:"primary",size:"large",block:!0,loading:i.value}),g:e.o(s)})}}),a=e._export_sfc(t,[["__scopeId","data-v-c8de2d17"]]);wx.createPage(a);
