"use strict";const e=require("../../../../common/vendor.js"),n=require("../../../../components/NationalDictionary.js"),o=require("../../../../components/request.js"),t={data:()=>({genders:0,Gender:[{label:"男",value:1},{label:"女",value:2}],Country:n.optionsArray,countrys:"",nameAnchor:"",Display:!1,Hint:!1,id:null,filterable:!0,AnchorProfilePicture:"",uid:null}),props:{message:{type:Object}},watch:{message(e,n){this.id=e.id,this.nameAnchor=e.anchorId,this.genders=e.gender,this.AnchorProfilePicture=e.headerIcon.split("/").pop(),this.countrys=e.country}},mounted(){e.index.getStorage({key:"userinfo",success:e=>{this.uid=e.data.id}})},methods:{gender(e){this.genders=e.value},country(e){this.countrys=e.value},handleOverlayClick(e){e.target===this.$el&&(this.Display=!1,this.Hint=!1)},open(){this.Display?(this.Display=!1,this.Hint=!1,this.nameAnchor="",this.genders=0,this.countrys=""):this.Display=!0},blur(n){this.nameAnchor!==n.target.value&&(this.nameAnchor=n.target.value,e.index.showLoading({title:"正在验证主播",mask:!0}),e.index.request({url:"https://python.yolojt.com/api/"+this.nameAnchor,success:n=>{200===n.data.code?(e.index.hideLoading(),e.index.showToast({title:"查询成功",icon:"none",duration:3e3}),this.AnchorProfilePicture=n.data.data):(e.index.hideLoading(),e.index.showToast({title:"未查询到该主播",icon:"none",duration:3e3}))},fail:function(n){e.index.hideLoading(),e.index.showToast({title:"网络请求失败",icon:"none",duration:3e3})}}))},async Publish(){""!==this.nameAnchor&&0!==this.genders&&""!==this.countrys&&""!==this.AnchorProfilePicture?(e.index.showLoading({title:"修改中...",mask:!0}),await o.request({url:"anchor/updateAnchorInfo",method:"POST",data:{id:this.id,anchorId:this.nameAnchor,headerIcon:this.AnchorProfilePicture,gender:this.genders,country:this.countrys,createUserId:this.uid},userInfo:!0}).then((n=>{200===n.code?(this.Display=!1,this.Hint=!1,this.nameAnchor="",this.genders=0,this.AnchorProfilePicture="",this.country="",e.index.hideLoading(),e.index.showToast({title:"修改成功",icon:"success",duration:2e3}),this.$emit("Refresh")):(e.index.hideLoading(),e.index.showToast({title:"修改失败"+n.msg,icon:"none",duration:2e3}))}))):this.Hint=!0}}};if(!Array){e.resolveComponent("wht-select")()}Math;const i=e._export_sfc(t,[["render",function(n,o,t,i,r,s){return e.e({a:r.Display},r.Display?e.e({b:e.o$1((e=>s.open())),c:e.o$1(((...e)=>n.NameAnchor&&n.NameAnchor(...e))),d:e.o$1(((...e)=>s.blur&&s.blur(...e))),e:r.nameAnchor,f:""===r.nameAnchor&&!0===r.Hint},(""===r.nameAnchor&&r.Hint,{}),{g:e.o$1(s.country),h:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:r.Country,filterable:r.filterable,placeholder:"请选择国家",value:r.countrys}),i:""===r.countrys&&!0===r.Hint},(""===r.countrys&&r.Hint,{}),{j:e.o$1(s.gender),k:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:r.Gender,placeholder:"性别",value:r.genders}),l:0===r.genders},(r.genders,{}),{m:1===r.genders},(r.genders,{}),{n:2===r.genders},(r.genders,{}),{o:0===r.genders&&!0===r.Hint},(0===r.genders&&r.Hint,{}),{p:e.o$1((e=>s.Publish())),q:e.o$1((()=>{})),r:e.n(r.Display?"create-module":"close-animation "),s:e.o$1((e=>s.open()))}):{})}],["__scopeId","data-v-8bbfbbe4"]]);wx.createComponent(i);
