From 944d5428d34f78e607edf7c2b795774927285819 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 26 Nov 2021 19:21:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF):=20?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E4=BF=A1=E6=81=AF=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1008394 --user=郭雨琦 【github#8173】user bind Jira id with 'not_authorized' error 用户绑定JIRA账号报未授权错误 --- .../settings/components/PersonRouter.vue | 45 ++++++++++++++++--- .../settings/personal/PersonFromSetting.vue | 29 +++--------- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/frontend/src/business/components/settings/components/PersonRouter.vue b/frontend/src/business/components/settings/components/PersonRouter.vue index 8efd1136b6..3862728108 100644 --- a/frontend/src/business/components/settings/components/PersonRouter.vue +++ b/frontend/src/business/components/settings/components/PersonRouter.vue @@ -6,7 +6,7 @@ - + @@ -31,7 +31,7 @@ import MsApiKeys from "@/business/components/settings/personal/ApiKeys"; import MsMainContainer from "@/business/components/common/components/MsMainContainer"; import PasswordInfo from "@/business/components/settings/personal/PasswordInfo"; - import {getCurrentWorkspaceId} from "@/common/js/utils"; + import {getCurrentUser, getCurrentWorkspaceId} from "@/common/js/utils"; import ZentaoUserInfo from "@/business/components/settings/personal/ZentaoUserInfo"; import TapdUserInfo from "@/business/components/settings/personal/TapdUserInfo"; import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo"; @@ -78,10 +78,15 @@ zentaoPassword: '', azureDevopsPat: '' }, - result:{} + result:{}, + workspaceList:[], + projectList:[] } }, methods:{ + currentUser: () => { + return getCurrentUser(); + }, handleAuth(type) { let param = {...this.currentPlatformInfo}; param.workspaceId = getCurrentWorkspaceId(); @@ -91,13 +96,15 @@ }); }, getPlatformInfo(row) { + let orgId = getCurrentWorkspaceId(); if (row.platformInfo) { this.form = row; - this.form.platformInfo = JSON.parse(row.platformInfo); + if (!row.platformInfo[orgId]) { + this.form.platformInfo = JSON.parse(row.platformInfo); + } } else { this.form.platformInfo = {}; } - let orgId = getCurrentWorkspaceId(); if (!this.form.platformInfo[orgId]) { this.form.platformInfo[orgId] = {}; } @@ -123,15 +130,43 @@ }, updateUser(updateUserForm) { let param = {}; + if(!this.form.id){ + console.log(this.$refs.personFrom) + //this.form.id = this.$refs.personFrom.form.id + } + console.log("this.form") + console.log(this.form) Object.assign(param, this.form); param.platformInfo = JSON.stringify(this.form.platformInfo); this.result = this.$post(this.updatePath, param, response => { this.$success(this.$t('commons.modify_success')); localStorage.setItem(TokenKey, JSON.stringify(response.data)); this.$emit('closeDialog', false); + this.initTableData() this.reload(); }); }, + initTableData() { + this.result = this.$get("/user/info/" + encodeURIComponent(this.currentUser().id), response => { + let data = response.data; + this.isLocalUser = response.data.source === 'LOCAL'; + let dataList = []; + dataList[0] = data; + this.form = data; + this.getPlatformInfo(data); + this.getWsAndPj(); + }); + }, + getWsAndPj(){ + this.$get("/user/get/ws_pj/" + encodeURIComponent(this.currentUser().id), response => { + let data = response.data; + this.workspaceList = data.workspace; + this.projectList = data.project + }); + }, + }, + created() { + this.initTableData(); } } diff --git a/frontend/src/business/components/settings/personal/PersonFromSetting.vue b/frontend/src/business/components/settings/personal/PersonFromSetting.vue index c173bc9845..8b13038496 100644 --- a/frontend/src/business/components/settings/personal/PersonFromSetting.vue +++ b/frontend/src/business/components/settings/personal/PersonFromSetting.vue @@ -58,12 +58,16 @@ export default { 'reload', 'reloadTopMenus' ], + props:{ + form:{ + type:Object + } + }, data() { return { result: {}, isLocalUser: false, updatePath: '/user/update/current', - form: {platformInfo: {}}, ruleForm: {}, rule: { name: [ @@ -93,13 +97,11 @@ export default { } ], }, - workspaceList:[], - projectList:[] }; }, created() { - this.initTableData(); + }, methods: { currentUser: () => { @@ -118,7 +120,6 @@ export default { this.result = this.$post(this.updatePath, param, response => { this.$success(this.$t('commons.modify_success')); localStorage.setItem(TokenKey, JSON.stringify(response.data)); - this.initTableData(); this.reload(); }); } else { @@ -126,24 +127,6 @@ export default { } }); }, - initTableData() { - this.result = this.$get("/user/info/" + encodeURIComponent(this.currentUser().id), response => { - let data = response.data; - this.isLocalUser = response.data.source === 'LOCAL'; - let dataList = []; - dataList[0] = data; - this.form = data; - this.$emit('getPlatformInfo', data); - this.getWsAndPj(); - }); - }, - getWsAndPj(){ - this.$get("/user/get/ws_pj/" + encodeURIComponent(this.currentUser().id), response => { - let data = response.data; - this.workspaceList = data.workspace; - this.projectList = data.project - }); - }, handleClose() { this.form = {}; this.ruleForm = {};