"use strict";const e=require("../../../../common/vendor.js"),r=require("../../../index.js"),i=require("../../../hooks/useModal.js"),a=require("../../../api/infra/file.js"),o=require("../../../api/member/user.js");if(require("../../../url/index.js"),require("../../../store/index.js"),require("../../../store/app.js"),require("../../../api/promotion/diy.js"),require("../../../request/index.js"),require("../../../config/index.js"),require("../../../platform/index.js"),require("../../../platform/provider/wechat/index.js"),require("../../../platform/provider/wechat/miniProgram.js"),require("../../../api/member/auth.js"),require("../../../api/member/social.js"),require("../../../platform/provider/apple/index.js"),require("../../../platform/share.js"),require("../../../router/index.js"),require("../../../helper/throttle.js"),require("../../../platform/pay.js"),require("../../../helper/index.js"),require("../../../helper/test.js"),require("../../../helper/digit.js"),require("../../../api/pay/order.js"),require("../../../store/user.js"),require("../../../store/cart.js"),require("../../../api/trade/cart.js"),require("../../../api/pay/wallet.js"),require("../../../api/trade/order.js"),require("../../../api/promotion/coupon.js"),require("../../../store/sys.js"),require("../../../store/modal.js"),require("../../../config/zIndex.js"),require("../../../api/member/signin.js"),!Array){(e.resolveComponent("uni-forms-item")+e.resolveComponent("uni-easyinput")+e.resolveComponent("uni-forms"))()}Math||((()=>"../../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js")+(()=>"../../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"../../../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"))();const s={__name:"mp-authorization",props:{agreeStatus:{type:Boolean,default:!1}},setup(s){const n=e.computed((()=>r.sheep.$store("user").userInfo)),t=e.ref(null),u=e.reactive({model:{nickname:n.value.nickname,avatar:n.value.avatar},rules:{},disabledStyle:{color:"#999",disableColor:"#fff"}});function l(e){!async function(e){if(!e)return;let{data:r}=await a.FileApi.uploadFile(e);u.model.avatar=r}(e.detail.avatarUrl||"")}async function p(){const{model:e}=u,{nickname:a,avatar:s}=e;if(!a)return void r.sheep.$helper.toast("请输入昵称");if(!s)return void r.sheep.$helper.toast("请选择头像");const{code:n}=await o.UserApi.updateUser({avatar:u.model.avatar,nickname:u.model.nickname});0===n&&(r.sheep.$helper.toast("授权成功"),await r.sheep.$store("user").getInfo(),i.closeAuthModal())}return(i,a)=>({a:e.unref(r.sheep).$url.cdn(u.model.avatar),b:e.o((i=>e.unref(r.sheep).$router.go("/pages/user/info"))),c:e.o(l),d:e.p({name:"avatar",label:"头像"}),e:e.o((e=>u.model.nickname=e)),f:e.p({type:"nickname",placeholder:"请输入昵称",inputBorder:!1,modelValue:u.model.nickname}),g:e.p({name:"nickname",label:"昵称"}),h:e.o(p),i:e.sr(t,"b00d5530-0",{k:"accountLoginRef"}),j:e.o((e=>u.model=e)),k:e.p({rules:u.rules,validateTrigger:"bind",labelWidth:"140",labelAlign:"center",modelValue:u.model})})}},n=e._export_sfc(s,[["__scopeId","data-v-b00d5530"]]);wx.createComponent(n);
