import{U as o}from"./upload-gray.de03a559.js";import{n as c}from"./index.13f93d3a.js";const r={name:"change-avatar",props:{display:Boolean,callback:Function},components:{Upload:o},data(){return{data:{tag:"avatar"}}},methods:{onupload(t){if(typeof this.callback=="function")this.callback(t);else{const a=this.$t("common.failure");this.$axios.post("/api/users/avatar",{avatar:t}).then(s=>{const{code:n,msg:e}=s.data;n==0?(this.$message.success(e),this.$store.dispatch("syncUserinfo"),this.hideThis()):this.$message.error(e||a)}).catch(()=>{this.$message.error(a)})}},hideThis(){this.$emit("toggleShowChangeAvatar",!1)}}};var i=function(){var a=this,s=a._self._c;return s("div",{staticClass:"change-avatar",style:{display:a.display?"block":"none"}},[s("div",{staticClass:"avatar-content"},[s("b",[a._v(a._s(a.$t("me.space.changeThumb")))]),s("br"),s("Upload",{attrs:{data:a.data},on:{onupload:a.onupload}},[s("el-button",{attrs:{type:"primary",round:""}},[a._v(a._s(a.$t("me.space.selectPic")))])],1)],1),s("div",{staticClass:"avatar-mask",on:{click:a.hideThis}})])},l=[],d=c(r,i,l,!1,null,"23c8eed7",null,null);const _=d.exports;export{_ as C};
