|
@@ -11,7 +11,7 @@ import { Toast } from 'vant';
|
|
|
import vue from 'vue';
|
|
|
import store from '@/store';
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
-
|
|
|
+import { wxToLoginCallback } from '@/utils/index.js'
|
|
|
let loadingInstance = null;
|
|
|
let requestNum = 0;
|
|
|
|
|
@@ -83,63 +83,26 @@ const cancelLoading = () => {
|
|
|
};
|
|
|
|
|
|
function XUser(config) {
|
|
|
- /*'X-User': JSON.stringify({"userId": "5106534569910475","sourceType": "WECHAT","nickName": "yedUsFwdkelQbxeTeQOvaScfqIOOmaa","mobile": "18521563898","projectId": "paroject1","buildingId": "shenzhen01","cid": "8aaa809d835ba76d018378bc57180006","vipCode":"KERRY100213505"})*/
|
|
|
- /*'X-User': JSON.stringify({
|
|
|
- // userId: store.state.member.id, // K+用户ID
|
|
|
- userId: '36cec68f3a9a4f4b9e04a59268ba20f2', // K+用户ID
|
|
|
- sourceType: 'WECHAT', // 登录来源: WECHAT/ALIPAY/H5/APP
|
|
|
- cId: store.state.openid, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- // projectId: store.state.member.groupId, // 楼盘id
|
|
|
- projectId: store.state.projectId || '4028e3817c2b3f79017c2b48c54c0000', // 楼盘id
|
|
|
- // buildingId: store.state.member.mallid, // 楼栋id
|
|
|
- // buildingId: '8aaa80b47c784020017c78b00d060022', // 楼栋id
|
|
|
- // buildingId: store.state.buildingId || 'shenzhen01', // 楼栋id
|
|
|
- buildingId: store.state.buildingId || 'QHKC-P1', // 楼栋id
|
|
|
- phoneNumber: store.state.mobile, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- // vipCode: store.state.member.vipcode, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- // vipCode: 'KERRY100213815', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- vipCode: 'KERRY100213505', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- lbsId: '8aaa87bc7ce98224017ce995fd8a0002', // 楼盘ID
|
|
|
- })*/
|
|
|
- // console.log('101101101101', store.state.member);
|
|
|
const params = {
|
|
|
- // userId: '8aaa828583bbbc030183cf34b536000a',
|
|
|
- // userId: store.state.kipUserId, // K+用户ID
|
|
|
- userId: '2c9d85868652dee50186532bdbbb0001', // K+用户ID
|
|
|
+ userId: store.state?.kipUserId || '', // K+用户ID
|
|
|
+ // userId: '2c9d85868652dee50186532bdbbb0001', // K+用户ID
|
|
|
sourceType: 'WECHAT',
|
|
|
// phoneNumber: '18521563898',
|
|
|
- phoneNumber: store.state.mobile, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- // projectId: 'paroject1',
|
|
|
- projectId: store.state.projectId || '4028e3817c2b3f79017c2b48c54c0000', // 楼盘id
|
|
|
- // buildingId: 'QHKC-P1',
|
|
|
- // buildingId: window.localStorage.getItem('buildingId'),
|
|
|
+ phoneNumber: store.state?.mobile || '', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
+ // projectId: store.state.projectId || '4028e3817c2b3f79017c2b48c54c0000', // 楼盘id
|
|
|
+ projectId: store.state.projectId || '', // 楼盘id
|
|
|
brandId: store.state.groupId,
|
|
|
- // brandId: '8aaa81947c6e1ca0017c73c13cc30006',
|
|
|
- // brandId: store.state.brandId,
|
|
|
// cid: '8aaa809d835ba76d018378bc57180006',
|
|
|
- cid: store.state.openid, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
+ cid: store.state?.openid || '', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
// vipCode: 'KERRY100213505',
|
|
|
- // vipCode: store.state.member.vipcode, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- vipCode: 'KERRY100213853', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- // vipCode: 'KERRY100213851', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- lbsId: '8aaa82ea804d07cd0180516ff03b0008',
|
|
|
- // lbsId: store.state.lbsId,
|
|
|
+ vipCode: store.state?.member?.vipcode || '', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
+ // vipCode: 'KERRY100213853', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
+ // lbsId: '8aaa82ea804d07cd0180516ff03b0008',
|
|
|
+ lbsId: store.state?.lbsId || '',
|
|
|
};
|
|
|
- /*const params = {
|
|
|
- userId: '5106534569910475',
|
|
|
- sourceType: 'WECHAT',
|
|
|
- nickName: 'yedUsFwdkelQbxeTeQOvaScfqIOOmaa',
|
|
|
- mobile: '18521563898',
|
|
|
- projectId: 'paroject1',
|
|
|
- buildingId: 'shenyang01',
|
|
|
- cid: '8aaa809d835ba76d018378bc57180006',
|
|
|
- vipCode: 'KERRY100213853',
|
|
|
- lbsId: '8aaa82ea804d07cd0180516ff03b0008',
|
|
|
- };*/
|
|
|
if (/orders-and-prepay|calculate-discount|unlicensed-car-check-in/.test(config.url)) {
|
|
|
params.buildingId = window.localStorage.getItem('buildingId');
|
|
|
}
|
|
|
- console.log(140140140140, params);
|
|
|
return JSON.stringify(params);
|
|
|
}
|
|
|
function getSign(config) {
|
|
@@ -148,14 +111,12 @@ function getSign(config) {
|
|
|
params = config.params
|
|
|
}
|
|
|
if(config.method === 'post' && config?.data) {
|
|
|
- // params = JSON.parse(config.data)
|
|
|
params = config.data
|
|
|
}
|
|
|
const newHeader = md(params, true)
|
|
|
return newHeader
|
|
|
}
|
|
|
export const createAxiosByinterceptors = (config) => {
|
|
|
- console.log('接口返送出去的config', config);
|
|
|
const instance = axios.create({
|
|
|
timeout: 100000, //超时配置
|
|
|
baseURL: `${window.profileApi}/temporary-parking-service`,
|
|
@@ -168,7 +129,6 @@ export const createAxiosByinterceptors = (config) => {
|
|
|
function (config) {
|
|
|
// 在发送请求之前做些什么
|
|
|
const { loading = true } = config;
|
|
|
- console.log('接口返送出去的config160:', config);
|
|
|
if (loading) addLoading();
|
|
|
// 设置 headers
|
|
|
config.headers = {
|
|
@@ -178,9 +138,6 @@ export const createAxiosByinterceptors = (config) => {
|
|
|
'XConversationId': uuidv4(),
|
|
|
'X-User': XUser(config),
|
|
|
};
|
|
|
- // console.log(111111, config.headers, handleConfig().header)
|
|
|
- // console.log(111111, handleConfig().header)
|
|
|
- // console.log(123, config);
|
|
|
return config;
|
|
|
},
|
|
|
function (error) {
|
|
@@ -201,29 +158,14 @@ export const createAxiosByinterceptors = (config) => {
|
|
|
// TODO: 临时注释
|
|
|
// Promise.reject(response.data)
|
|
|
return response.data;
|
|
|
- /*if (code === 200) return data;
|
|
|
- else if (code === 401) {
|
|
|
- // 跳转到登陆
|
|
|
- // jumpLogin();
|
|
|
- } else {
|
|
|
- // 错误信息提示
|
|
|
- // Message.error(message);
|
|
|
- Toast({
|
|
|
- message: message,
|
|
|
- });
|
|
|
- return Promise.reject(response.data);
|
|
|
- }*/
|
|
|
},
|
|
|
function (error) {
|
|
|
- // console.log(158, error.response.data)
|
|
|
-
|
|
|
// 对响应错误做点什么
|
|
|
console.log('error-response:', error.response);
|
|
|
console.log('error-config:', error.config);
|
|
|
console.log('error-request:', error.request);
|
|
|
const { loading = true } = error.config || {};
|
|
|
if (loading) cancelLoading();
|
|
|
- console.log('79error', error);
|
|
|
if (error.response) {
|
|
|
if (error.response.status === 401) {
|
|
|
// 跳转到登陆
|