运营平台兼容问题修复

dev
刘博 2 years ago
parent 16f621c4be
commit 8a8fbf5ee3

@ -30,6 +30,7 @@ export default {
// 驿 // 驿
const token = { const token = {
isSelfSupport: 1, // isSelfSupport: 1, //
platform: 'employ',
access_token: JSON.parse(sessionStorage.getItem("CX_STAGE_USERINFO")) access_token: JSON.parse(sessionStorage.getItem("CX_STAGE_USERINFO"))
.authorization .authorization
}; };
@ -39,6 +40,7 @@ export default {
// //
const token = { const token = {
isSelfSupport: 0, // isSelfSupport: 0, //
platform: 'front',
access_token: JSON.parse(sessionStorage.getItem("CX_STAGE_USERINFO")) access_token: JSON.parse(sessionStorage.getItem("CX_STAGE_USERINFO"))
.authorization .authorization
}; };

@ -37,11 +37,15 @@ instance.interceptors.request.use(
// 基础请求参数 // 基础请求参数
const tokenInfo = vm.getSession('CX_Common_UserInfo'), const tokenInfo = vm.getSession('CX_Common_UserInfo'),
base = {}, base = {},
postData = {...base, ...config.data }; postData = { ...base,
tokenInfo.access_token && (config.headers[`Authorization`] = `Bearer:${tokenInfo.access_token}`); ...config.data
};
tokenInfo.access_token && (config.headers[`Authorization`] = `Bearer${tokenInfo.platform === 'front' ? ' ' : ':'}${tokenInfo.access_token}`);
config.method === 'post' ? config.method === 'post' ?
config.data = config.headers['Content-Type'] == 'application/x-www-form-urlencoded' ? qs.stringify(postData) : JSON.stringify(postData) : config.data = config.headers['Content-Type'] == 'application/x-www-form-urlencoded' ? qs.stringify(postData) : JSON.stringify(postData) :
config.params = {...base, ...config.params }; config.params = { ...base,
...config.params
};
return config; return config;
}, },
error => Promise.error(error)) error => Promise.error(error))
@ -119,7 +123,9 @@ instance.interceptors.response.use(
// vm.$message.error(other) // vm.$message.error(other)
} }
} }
const { response } = error; const {
response
} = error;
if (response.status == 500 && apiOne == 1) { if (response.status == 500 && apiOne == 1) {
let id = JSON.parse(sessionStorage.getItem('CX_CoopUserInfo')).id let id = JSON.parse(sessionStorage.getItem('CX_CoopUserInfo')).id
instance.get(`/auth/token/checkTokenIsExesists?clientId=${id}`).then(res => { instance.get(`/auth/token/checkTokenIsExesists?clientId=${id}`).then(res => {

@ -204,6 +204,7 @@ export default {
return { return {
visible: false, visible: false,
isSelfSupport: this.getSession("CX_Common_UserInfo").isSelfSupport, // //01 isSelfSupport: this.getSession("CX_Common_UserInfo").isSelfSupport, // //01
platform: this.getSession("CX_Common_UserInfo").platform,
recordList: null, recordList: null,
isRecordEmpty: false, isRecordEmpty: false,
basicInfo: null, basicInfo: null,
@ -229,7 +230,11 @@ export default {
// //
async getQuerySysMemberBase() { async getQuerySysMemberBase() {
try { try {
const url = `${this.$basUrl.member}member-api/sysMember/sysMemberInfo`; const url = `${this.$basUrl.member}${
this.platform === "front"
? "posthouse-api/member/getMemberInfo"
: "member-api/sysMember/sysMemberInfo"
}`;
const params = { memberId: this.vipID }; const params = { memberId: this.vipID };
const res = await this.$http.get(url, { params: params }); const res = await this.$http.get(url, { params: params });
const { code, data } = res; const { code, data } = res;

Loading…
Cancel
Save