1 |
- import{z as e,av as a,c as s,f as l,g as t,w as r,ah as o,E as n,i as u,k as c,B as i,u as d,v as m,j as f,y as p,aw as b,N as g,p as y,o as h,s as v,a6 as _,m as w,x,l as k,r as V,F as B,t as $,ax as S,ay as U,V as j,az as I,ao as C,W as M,n as E,J as z,ap as P,I as F,K as G,L}from"./index-a116b7fa.js";import{_ as N}from"./su-image.cf5517c4.js";import{a as O,b as T,d as W}from"./phone-international-input.b9f6c8e6.js";import{_ as D}from"./_plugin-vue_export-helper.1b428a4d.js";import{a as H,_ as J}from"./s-layout.4ae51839.js";import"./useGoods.6b315a78.js";const K=D({__name:"su-radio",props:{customStyle:{type:Object,default:()=>({})},ui:{type:String,default:"check"},modelValue:{type:[String,Number,Boolean],default:!1},disabled:{type:Boolean,default:!1},bg:{type:String,default:"ui-BG-Main"},unbg:{type:String,default:"borderss"},src:{type:String,default:""},label:{type:String,default:""},labelStyle:{type:Object,default:()=>({})},none:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(b,{emit:g}){const y=e({currentValue:!1}),h=g,v=b;a((()=>{y.currentValue=v.modelValue,h("update:modelValue",y.currentValue)}));const _=s((()=>y.currentValue)),w=()=>{v.disabled||(y.currentValue=!y.currentValue,h("update:modelValue",y.currentValue),h("change",{label:v.label,value:y.currentValue}))};return(e,a)=>{const s=f,g=p;return l(),t(s,{class:n(["ui-radio ss-flex ss-col-center",[{disabled:b.disabled},{img:b.src},b.ui]]),onClick:w,style:i([b.customStyle])},{default:r((()=>[o(e.$slots,"leftLabel",{},void 0,!0),b.none?u("",!0):(l(),t(s,{key:0,class:n(["ui-radio-input",[_.value?"cur "+b.bg:b.unbg,b.src?"radius":"round"]])},null,8,["class"])),b.src?(l(),t(g,{key:1,class:"ui-radio-img radius",src:b.src,mode:"aspectFill"},null,8,["src"])):(l(),t(s,{key:2,class:"ui-radio-content"},{default:r((()=>[o(e.$slots,"default",{},(()=>[c(s,{class:"ui-label-text",style:i([b.labelStyle])},{default:r((()=>[d(m(b.label),1)])),_:1},8,["style"])]),!0)])),_:3})),b.ui.includes("card")?(l(),t(s,{key:3,class:n(["ui-radio-bg round",[_.value?"cur "+b.bg:""]])},null,8,["class"])):u("",!0)])),_:3},8,["class","style"])}}},[["__scopeId","data-v-2c6d6010"]]),R="color:#BBBBBB;font-size:28rpx;line-height:normal",q=D({__name:"info",setup(a){const{t:o}=b(),n=e({verifyUsername:!0,usernameErrorMsg:"",model:{},rules:{},thirdInfo:{}}),u=s((()=>v.$store("user").userInfo)),i=[{name:o("user.male"),value:"1"},{name:o("user.female"),value:"2"}];function D(e){n.model.sex=e.detail.value}const q=()=>{$("changeMobile")};function A(){S({success:async e=>{const a=e.tempFilePaths[0];await async function(e){if(!e)return;const a=await function(e,a=.5){return new Promise(((s,l)=>{const t=document.createElement("canvas"),r=t.getContext("2d"),o=new Image;o.src=e,o.onload=()=>{const e=o.width,l=o.height,n=e*a,u=l*a;t.width=n,t.height=u,r.drawImage(o,0,0,n,u);const c=t.toDataURL("image/jpeg",.7);s(c)},o.onerror=e=>{l(e)}}))}(e);let{data:s}=await U.uploadFile(a);n.model.avatar=s}(a)}})}function Q(){$("changePassword")}let X=g("");async function Y(e){const a=e.detail.value;if(""==a||a==X.value)return!1;if(a===n.username)return n.usernameErrorMsg="",n.verifyUsername=!0,!1;X.value=a;const{data:s}=await j.verifyUsername(a);s?(n.usernameErrorMsg="",n.verifyUsername=s):(n.usernameErrorMsg=o("rules.username_taken"),n.verifyUsername=s)}async function Z(){const{code:e}=await I.updateUser({avatar:n.model.avatar,nickname:n.model.nickname,username:n.model.username,sex:n.model.sex});0===e&&n.model.username!==n.username&&(C({icon:"success",title:o("rules.modify_success")}),setTimeout((function(){v.$store("user").logout(),M(),v.$router.go("/pages/index/user")}),1e3)),0===e&&await ee()}const ee=async()=>{const e=await v.$store("user").getInfo();if(n.model=_.clone(e),n.username=e.username,"H5"!==v.$platform.name){let e=await v.$platform.useProvider("wechat").getInfo();n.thirdInfo=e||{}}};return y((async()=>{await ee()})),h((async e=>{ee()})),(e,a)=>{const s=w(E("su-image"),N),b=z,g=f,y=p,h=w(E("uni-easyinput"),O),_=w(E("uni-forms-item"),T),$=G,S=L,U=P,j=w(E("su-radio"),K),I=F,C=w(E("uni-forms"),W),M=w(E("su-fixed"),H),X=w(E("s-layout"),J);return l(),t(X,{title:e.$t("user.user_info"),class:"set-userinfo-wrap"},{default:r((()=>[c(C,{model:n.model,rules:n.rules,labelPosition:"left",border:"",class:"form-box",labelWidth:"160"},{default:r((()=>[c(g,{class:"ss-flex ss-row-center ss-col-center ss-p-t-60 ss-p-b-0 bg-white"},{default:r((()=>[c(g,{class:"header-box-content"},{default:r((()=>{var a;return[c(s,{class:"content-img",isPreview:"",current:0,src:null==(a=n.model)?void 0:a.avatar,height:160,width:160,radius:80,mode:"scaleToFill"},null,8,["src"]),c(g,{class:"avatar-action"},{default:r((()=>[c(b,{class:"ss-reset-button avatar-action-btn",onClick:A},{default:r((()=>[d(m(e.$t("user.change")),1)])),_:1})])),_:1})]})),_:1})])),_:1}),c(g,{class:"bg-white ss-p-x-30"},{default:r((()=>[c(_,{name:"username",label:e.$t("user.username"),"error-message":n.usernameErrorMsg},{default:r((()=>[c(h,{modelValue:n.model.username,"onUpdate:modelValue":a[0]||(a[0]=e=>n.model.username=e),placeholder:e.$t("rules.username"),inputBorder:!1,placeholderStyle:R,onBlur:Y,clearable:!1},{right:r((()=>[n.verifyUsername?(l(),t(g,{key:1,class:"icon"},{default:r((()=>[c(y,{src:x(v).$url.static("/static/images/chenggong.png")},null,8,["src"])])),_:1})):(l(),t(g,{key:0,class:"icon"},{default:r((()=>[c(y,{style:"",src:x(v).$url.static("/static/images/shibai.png")},null,8,["src"])])),_:1}))])),_:1},8,["modelValue","placeholder"])])),_:1},8,["label","error-message"]),c(_,{name:"nickname",label:e.$t("user.nickname")},{default:r((()=>[c(h,{modelValue:n.model.nickname,"onUpdate:modelValue":a[1]||(a[1]=e=>n.model.nickname=e),type:"nickname",placeholder:x(o)("rules.nickname"),inputBorder:!1,placeholderStyle:R,clearable:!1},null,8,["modelValue","placeholder"])])),_:1},8,["label"]),c(_,{name:"sex",label:e.$t("user.sex")},{default:r((()=>[c(g,{class:"ss-flex ss-col-center ss-h-100"},{default:r((()=>[c(U,{onChange:D,class:"ss-flex ss-col-center"},{default:r((()=>[(l(),k(B,null,V(i,(e=>c(S,{class:"radio",key:e.value},{default:r((()=>[c(g,{class:"ss-flex ss-col-center ss-m-r-32"},{default:r((()=>{var a;return[c($,{value:e.value,color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},checked:parseInt(e.value)===(null==(a=n.model)?void 0:a.sex)},null,8,["value","checked"]),c(g,{class:"gender-name"},{default:r((()=>[d(m(e.name),1)])),_:2},1024)]})),_:2},1024)])),_:2},1024))),64))])),_:1})])),_:1})])),_:1},8,["label"]),c(_,{name:"mobile",label:e.$t("user.phone"),onClick:q},{default:r((()=>[c(h,{modelValue:u.value.mobile,"onUpdate:modelValue":a[2]||(a[2]=e=>u.value.mobile=e),placeholder:x(o)("user.bind_phone"),inputBorder:!1,disabled:"",styles:{disableColor:"#fff"},placeholderStyle:R,clearable:!1},{right:r((()=>[c(g,{class:"ss-flex ss-col-center"},{default:r((()=>{var e;return[(null==(e=u.value.verification)?void 0:e.mobile)?(l(),t(j,{key:0,modelValue:!0})):(l(),t(b,{key:1,class:"ss-reset-button ss-flex ss-col-center ss-row-center"},{default:r((()=>[c(I,{class:"_icon-forward",style:{color:"#bbbbbb","font-size":"26rpx"}})])),_:1}))]})),_:1})])),_:1},8,["modelValue","placeholder"])])),_:1},8,["label"]),c(_,{name:"password",label:e.$t("user.password"),onClick:Q},{default:r((()=>[c(h,{modelValue:u.value.password,"onUpdate:modelValue":a[3]||(a[3]=e=>u.value.password=e),placeholder:e.$t("rules.click_change_password"),inputBorder:!1,styles:{disableColor:"#fff"},disabled:"",placeholderStyle:"color:#BBBBBB;font-size:28rpx;line-height:normal",clearable:!1},{right:r((()=>[c(g,{class:"ss-flex ss-col-center"},{default:r((()=>{var e;return[(null==(e=u.value.verification)?void 0:e.password)?(l(),t(j,{key:0,class:"ss-flex",modelValue:!0})):(l(),t(b,{key:1,class:"ss-reset-button ss-flex ss-col-center ss-row-center"},{default:r((()=>[c(I,{class:"_icon-forward",style:{color:"#bbbbbb","font-size":"26rpx"}})])),_:1}))]})),_:1})])),_:1},8,["modelValue","placeholder"])])),_:1},8,["label"])])),_:1})])),_:1},8,["model","rules"]),c(M,{bottom:"",placeholder:"",bg:"none"},{default:r((()=>[c(g,{class:"footer-box ss-p-20"},{default:r((()=>[c(b,{class:"ss-rest-button logout-btn",onClick:Z},{default:r((()=>[d(m(e.$t("common.save")),1)])),_:1})])),_:1})])),_:1})])),_:1},8,["title"])}}},[["__scopeId","data-v-b834f020"]]);export{q as default};
|