From cc20dfa25b659fa7aa3a53c50e44ac7701ed985f Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Mon, 1 Sep 2025 17:44:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/trials/trials-myinfo/account.vue | 162 +++++++++------------ 1 file changed, 69 insertions(+), 93 deletions(-) diff --git a/src/views/trials/trials-myinfo/account.vue b/src/views/trials/trials-myinfo/account.vue index d927ffc..5f6b571 100644 --- a/src/views/trials/trials-myinfo/account.vue +++ b/src/views/trials/trials-myinfo/account.vue @@ -7,130 +7,72 @@ - + {{ user.UserName }} - + - + {{ $t("trials:trials-myinfo:button:update") }} - + {{ user.CheckCode }} - + - + {{ $t("trials:trials-myinfo:button:update") }} - + {{ user.Phone }} - + - + {{ $t("trials:trials-myinfo:button:update") }} - + {{ user.EMail }} - - - {{ sendTitle }} + + + {{ sendTitle }} - - + + - + {{ $t("trials:trials-myinfo:button:update") }} + + + + {{ item.UserTypeShortName }} + + + + + {{ $t('trials:trials-myinfo:button:toggleRole') }} + + @@ -168,9 +110,43 @@ export default { userForm: {}, sendDisabled: true, sendTitle: this.$t("trials:trials-myinfo:button:getVCode"), + userRoleId: null, + toggleRoleLoading: false, }; }, + created() { + this.userRoleId = zzSessionStorage.getItem('userId') + }, + computed: { + roles() { + return this.$store.state.user.roles + }, + hasRole() { + return this.roles && this.roles.length > 1 + }, + saveDisabled() { + return this.userRoleId === zzSessionStorage.getItem('userId') + }, + }, methods: { + // 切换角色 + toggleRole() { + if ( + this.userRoleId === zzSessionStorage.getItem('userId') || + this.toggleRoleLoading + ) + return false + this.toggleRoleLoading = true + this.$store + .dispatch('user/loginByRole', { userRoleId: this.userRoleId }) + .then((res) => { + zzSessionStorage.removeItem('lastWorkbench') + window.location.reload() + }) + .catch(() => { + this.toggleRoleLoading = false + }) + }, // 修改校验码 async setNewUserCheckCode() { try {