import{n as r,i as c}from"./index.13f93d3a.js";const n={name:"me-account",data(){return{isSend:!1,isVerify:!1,emailForm:{data:{email:""},rules:{email:[{required:!0,trigger:"blur"},{pattern:c.email,trigger:"blur"}]}},codeForm:{data:{code:""},rules:{code:[{required:!0,trigger:"blur"}]}}}},methods:{destroyAccount(){const{id:o}=this.$store.state.userInfo,t=this.$t("common.failure");this.$axios.post("/api/users/destroy",{id:o}).then(e=>{const{code:s,msg:a}=e.data;s==0?(this.$message.success(a),this.$store.dispatch("logout"),this.$router.push({path:"/"})):this.$message.error(a||t)}).catch(()=>{this.$message.error(t)})},disableAccount(){const o=this.$t("common.failure");this.$axios.post("/api/users/up_user_info",{status:0}).then(t=>{const{code:e,msg:s}=t.data;e==0?(this.$message.success(s),this.$router.push({path:"/"})):this.$message.error(s||o)}).catch(()=>{this.$message.error(o)})},toJoin(){this.$router.push({path:"/me/member/join"})},verifyCode(){this.codeForm.data;const o=this.$t("common.failure");this.$refs.codeForm.validate(t=>{t&&this.$axios.post("/api/email/send",{email}).then(e=>{const{code:s,msg:a}=e.data;s==0?this.isVerify=!0:this.$message.error(a||o)}).catch(()=>{this.$message.error(o)})})},sendEmailCode(){const{email:o}=this.emailForm.data,t=this.$t("common.failure");this.$refs.emailForm.validate(e=>{e&&this.$axios.post("/api/email/send",{email:o}).then(s=>{const{code:a,msg:i}=s.data;a==0?this.isSend=!0:this.$message.error(i||t)}).catch(()=>{this.$message.error(t)})})},doLogout(){this.$store.dispatch("logout"),this.$router.push({path:"/"})}}};var l=function(){var t=this,e=t._self._c;return e("div",{staticClass:"me-account"},[e("div",{staticClass:"top"},[e("b",[t._v(t._s(t.$t("me.menu.account")))]),t._v(" "+t._s(t.$t("me.account.tip"))+" ")]),e("div",{staticClass:"account-region-item"},[t.isSend?[e("div",{staticClass:"region-item-top"},[t._v(" "+t._s(t.$t("me.account.codeTip"))+" "),e("el-button",{staticClass:"change",attrs:{type:"primary",round:""},on:{click:t.verifyCode}},[t._v(t._s(t.$t("common.change")))])],1),e("div",{staticClass:"region-item-bottom"},[e("el-form",{ref:"codeForm",attrs:{model:t.codeForm.data,rules:t.codeForm.rules}},[e("el-form-item",{staticClass:"email",attrs:{prop:"code"}},[e("el-input",{attrs:{clearable:""},model:{value:t.codeForm.data.code,callback:function(s){t.$set(t.codeForm.data,"code",s)},expression:"codeForm.data.code"}})],1)],1)],1)]:[e("div",{staticClass:"region-item-top"},[t._v(" "+t._s(t.$t("me.account.emailTip"))+" "),e("el-button",{staticClass:"change",attrs:{type:"primary",round:""},on:{click:t.sendEmailCode}},[t._v(t._s(t.$t("common.change")))])],1),e("div",{staticClass:"region-item-bottom"},[e("el-form",{ref:"emailForm",attrs:{model:t.emailForm.data,rules:t.emailForm.rules}},[e("el-form-item",{staticClass:"email",attrs:{prop:"email"}},[e("el-input",{attrs:{placeholder:"fashiney88@huabook.net",clearable:""},model:{value:t.emailForm.data.email,callback:function(s){t.$set(t.emailForm.data,"email",s)},expression:"emailForm.data.email"}})],1)],1)],1)]],2),e("div",{staticClass:"account-region-item"},[e("div",{staticClass:"region-top"},[e("b",[t._v(t._s(t.$t("me.account.memberChange")))]),e("el-button",{staticClass:"change",attrs:{type:"primary",disabled:!t.isVerify,round:""},on:{click:t.toJoin}},[t._v(t._s(t.$t("common.change")))])],1),e("div",{staticClass:"region-bottom"},[e("div",{staticClass:"region-tip-item"},[t._v(" "+t._s(t.$t("me.account.joinMember1"))+" ")]),e("div",{staticClass:"region-tip-item"},[t._v(" "+t._s(t.$t("me.account.joinMember2"))+" "),e("br"),t._v(" "+t._s(t.$t("me.account.joinMember3"))+" ")])])]),e("div",{staticClass:"account-region-item"},[e("div",{staticClass:"region-top"},[e("b",[t._v(t._s(t.$t("me.account.acountDisable")))]),e("el-button",{staticClass:"acountDisable",attrs:{type:"primary",disabled:!t.isVerify,round:""},on:{click:t.disableAccount}},[t._v(t._s(t.$t("me.account.acountDisable")))])],1),e("div",{staticClass:"region-bottom"},[e("div",{staticClass:"region-tip-item"},[t._v(" "+t._s(t.$t("me.account.acountDisableTip"))+" ")])])]),e("div",{staticClass:"account-region-item"},[e("div",{staticClass:"region-top"},[e("b",[t._v(t._s(t.$t("me.account.logoutAccount")))]),e("el-button",{staticClass:"logoutAccount",attrs:{type:"primary",disabled:!t.isVerify,round:""},on:{click:t.destroyAccount}},[t._v(t._s(t.$t("me.account.logoutAccount")))])],1),e("div",{staticClass:"region-bottom"},[e("div",{staticClass:"region-tip-item"},[t._v(" "+t._s(t.$t("me.account.logoutAccountTip"))+" ")])])]),e("div",{staticClass:"account-region-item"},[e("div",{staticClass:"region-top"},[e("b",[t._v(t._s(t.$t("me.account.logout")))]),e("el-button",{staticClass:"logoutAccount",attrs:{type:"primary",round:""},on:{click:t.doLogout}},[t._v(t._s(t.$t("me.account.logout")))])],1)])])},m=[],u=r(n,l,m,!1,null,"49086ebb",null,null);const _=u.exports;export{_ as default};
