fix(个人信息): 三方信息保存

--bug=1008394 --user=郭雨琦 【github#8173】user bind Jira id with
'not_authorized' error 用户绑定JIRA账号报未授权错误
This commit is contained in:
guoyuqi 2021-11-26 19:21:50 +08:00 committed by xiaomeinvG
parent c238ac0640
commit 944d5428d3
2 changed files with 46 additions and 28 deletions

View File

@ -6,7 +6,7 @@
<el-tab-pane name="third_account" :label="$t('commons.third_account')" class="setting-item"></el-tab-pane> <el-tab-pane name="third_account" :label="$t('commons.third_account')" class="setting-item"></el-tab-pane>
</el-tabs> </el-tabs>
<ms-main-container> <ms-main-container>
<ms-person-from-setting v-if="activeIndex==='commons.personal_setting'" @getPlatformInfo = "getPlatformInfo" @cancel = "cancel"/> <ms-person-from-setting v-if="activeIndex==='commons.personal_setting'" :form = form @getPlatformInfo = "getPlatformInfo" @cancel = "cancel" />
<ms-api-keys v-if="activeIndex==='commons.api_keys'"/> <ms-api-keys v-if="activeIndex==='commons.api_keys'"/>
<password-info v-if="activeIndex==='change_password'" :rule-form = "ruleForm"></password-info> <password-info v-if="activeIndex==='change_password'" :rule-form = "ruleForm"></password-info>
<el-form v-if="activeIndex==='third_account'"> <el-form v-if="activeIndex==='third_account'">
@ -31,7 +31,7 @@
import MsApiKeys from "@/business/components/settings/personal/ApiKeys"; import MsApiKeys from "@/business/components/settings/personal/ApiKeys";
import MsMainContainer from "@/business/components/common/components/MsMainContainer"; import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import PasswordInfo from "@/business/components/settings/personal/PasswordInfo"; 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 ZentaoUserInfo from "@/business/components/settings/personal/ZentaoUserInfo";
import TapdUserInfo from "@/business/components/settings/personal/TapdUserInfo"; import TapdUserInfo from "@/business/components/settings/personal/TapdUserInfo";
import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo"; import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo";
@ -78,10 +78,15 @@
zentaoPassword: '', zentaoPassword: '',
azureDevopsPat: '' azureDevopsPat: ''
}, },
result:{} result:{},
workspaceList:[],
projectList:[]
} }
}, },
methods:{ methods:{
currentUser: () => {
return getCurrentUser();
},
handleAuth(type) { handleAuth(type) {
let param = {...this.currentPlatformInfo}; let param = {...this.currentPlatformInfo};
param.workspaceId = getCurrentWorkspaceId(); param.workspaceId = getCurrentWorkspaceId();
@ -91,13 +96,15 @@
}); });
}, },
getPlatformInfo(row) { getPlatformInfo(row) {
let orgId = getCurrentWorkspaceId();
if (row.platformInfo) { if (row.platformInfo) {
this.form = row; this.form = row;
this.form.platformInfo = JSON.parse(row.platformInfo); if (!row.platformInfo[orgId]) {
this.form.platformInfo = JSON.parse(row.platformInfo);
}
} else { } else {
this.form.platformInfo = {}; this.form.platformInfo = {};
} }
let orgId = getCurrentWorkspaceId();
if (!this.form.platformInfo[orgId]) { if (!this.form.platformInfo[orgId]) {
this.form.platformInfo[orgId] = {}; this.form.platformInfo[orgId] = {};
} }
@ -123,15 +130,43 @@
}, },
updateUser(updateUserForm) { updateUser(updateUserForm) {
let param = {}; 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); Object.assign(param, this.form);
param.platformInfo = JSON.stringify(this.form.platformInfo); param.platformInfo = JSON.stringify(this.form.platformInfo);
this.result = this.$post(this.updatePath, param, response => { this.result = this.$post(this.updatePath, param, response => {
this.$success(this.$t('commons.modify_success')); this.$success(this.$t('commons.modify_success'));
localStorage.setItem(TokenKey, JSON.stringify(response.data)); localStorage.setItem(TokenKey, JSON.stringify(response.data));
this.$emit('closeDialog', false); this.$emit('closeDialog', false);
this.initTableData()
this.reload(); 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();
} }
} }

View File

@ -58,12 +58,16 @@ export default {
'reload', 'reload',
'reloadTopMenus' 'reloadTopMenus'
], ],
props:{
form:{
type:Object
}
},
data() { data() {
return { return {
result: {}, result: {},
isLocalUser: false, isLocalUser: false,
updatePath: '/user/update/current', updatePath: '/user/update/current',
form: {platformInfo: {}},
ruleForm: {}, ruleForm: {},
rule: { rule: {
name: [ name: [
@ -93,13 +97,11 @@ export default {
} }
], ],
}, },
workspaceList:[],
projectList:[]
}; };
}, },
created() { created() {
this.initTableData();
}, },
methods: { methods: {
currentUser: () => { currentUser: () => {
@ -118,7 +120,6 @@ export default {
this.result = this.$post(this.updatePath, param, response => { this.result = this.$post(this.updatePath, param, response => {
this.$success(this.$t('commons.modify_success')); this.$success(this.$t('commons.modify_success'));
localStorage.setItem(TokenKey, JSON.stringify(response.data)); localStorage.setItem(TokenKey, JSON.stringify(response.data));
this.initTableData();
this.reload(); this.reload();
}); });
} else { } 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() { handleClose() {
this.form = {}; this.form = {};
this.ruleForm = {}; this.ruleForm = {};