2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
import{c as e,I as re,d as le,o as ie,b as ce,e as m,f as n,r as f,i as s,B as de,Q as ue,M as j,j as D,s as F,Y as fe,as as ve,at as pe,au as he,av as me,t as y,O as ge,m as be,aw as _e,R as we,F as Ce,p as Pe,q as ye,l as B,A as ke,D as R,u as Se,G as Ie}from"./index-bPsB4P3d.js";import{u as g}from"./user-BRXmSDmz.js";import{L as k}from"./LockOutlined-CTRDfVcq.js";var Oe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M877.1 238.7L770.6 132.3c-13-13-30.4-20.3-48.8-20.3s-35.8 7.2-48.8 20.3L558.3 246.8c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l89.6 89.7a405.46 405.46 0 01-86.4 127.3c-36.7 36.9-79.6 66-127.2 86.6l-89.6-89.7c-13-13-30.4-20.3-48.8-20.3a68.2 68.2 0 00-48.8 20.3L132.3 673c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l106.4 106.4c22.2 22.2 52.8 34.9 84.2 34.9 6.5 0 12.8-.5 19.2-1.6 132.4-21.8 263.8-92.3 369.9-198.3C818 606 888.4 474.6 910.4 342.1c6.3-37.6-6.3-76.3-33.3-103.4zm-37.6 91.5c-19.5 117.9-82.9 235.5-178.4 331s-213 158.9-330.9 178.4c-14.8 2.5-30-2.5-40.8-13.2L184.9 721.9 295.7 611l119.8 120 .9.9 21.6-8a481.29 481.29 0 00285.7-285.8l8-21.6-120.8-120.7 110.8-110.9 104.5 104.5c10.8 10.8 15.8 26 13.3 40.8z"}}]},name:"phone",theme:"outlined"};function z(v){for(var i=1;i<arguments.length;i++){var r=arguments[i]!=null?Object(arguments[i]):{},p=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(r).filter(function(b){return Object.getOwnPropertyDescriptor(r,b).enumerable}))),p.forEach(function(b){xe(v,b,r[b])})}return v}function xe(v,i,r){return i in v?Object.defineProperty(v,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):v[i]=r,v}var S=function(i,r){var p=z({},i,r.attrs);return e(re,z({},p,{icon:Oe}),null)};S.displayName="PhoneOutlined";S.inheritAttrs=!1;const Le={class:"mobile-container"},Ve={class:"header"},Ae={class:"account-settings"},Ue=le({__name:"AccountSettingsView",setup(v){const i=Se(),r=f({id:0,nickname:"",account:"",avatar:"",type:0,status:0,createTime:"",updateTime:""}),p=f(!1),b=f(!1),w=f(!1),O=f(!1),c=R({phone:"",verificationCode:""}),C=f(!1),x=f(!1),d=R({newPhone:"",verificationCode:""}),P=f(!1),L=f(!1),l=R({verificationCode:"",password:"",confirmPassword:""}),u=f(0),$=f([{key:"changePhone",title:"修改手机号",icon:S,bgColor:"#e6f7ff"},{key:"changePassword",title:"修改密码",icon:k,bgColor:"#f6ffed"},{key:"deactivateAccount",title:"注销账号",icon:k,bgColor:"#fff1f0"}]),N=()=>{const a=[];b.value?a.push({key:"changePhone",title:"修改手机号",icon:S,bgColor:"#e6f7ff"}):a.push({key:"bindPhone",title:"绑定手机号",icon:S,bgColor:"#e6f7ff"}),p.value?a.push({key:"changePassword",title:"修改密码",icon:k,bgColor:"#f6ffed"}):a.push({key:"setPassword",title:"设置密码",icon:k,bgColor:"#fff7e6"}),a.push({key:"deactivateAccount",title:"注销账号",icon:k,bgColor:"#fff1f0"}),$.value=a},V=async()=>{try{const a=await g.getUserInfo();r.value=a,b.value=!!r.value.phone,p.value=localStorage.getItem("needSetPassword")!=="true",N()}catch(a){console.error("获取用户信息失败:",a),s.error("获取用户信息失败")}},E=()=>{i.back()},q=a=>{switch(a){case"bindPhone":w.value=!0;break;case"changePhone":C.value=!0;break;case"setPassword":G();break;case"changePassword":P.value=!0;break;case"deactivateAccount":oe();break}},G=()=>{i.push("/settings/password")},Q=async()=>{if(!c.phone){s.error("请输入手机号");return}if(!/^1[3-9]\d{9}$/.test(c.phone)){s.error("手机号格式不正确");return}try{await g.sendVerificationCode({phone:c.phone}),s.success("验证码发送成功"),A()}catch(o){console.error("发送验证码失败:",o),s.error("发送验证码失败")}},Y=async()=>{if(!d.newPhone){s.error("请输入新手机号");return}if(!/^1[3-9]\d{9}$/.test(d.newPhone)){s.error("手机号格式不正确");return}try{await g.sendVerificationCode({phone:d.newPhone}),s.success("验证码发送成功"),A()}catch(o){console.error("发送验证码失败:",o),s.error("发送验证码失败")}},H=async()=>{if(!r.value.phone){s.error("请先绑定手机号");return}
|