|
@@ -1,53 +0,0 @@
|
|
|
-/*
|
|
|
- * CRM微服务接入
|
|
|
- * 一、设计目标
|
|
|
- * 1、拦截重复请求
|
|
|
- * 2、支持可配置的登陆校验
|
|
|
- * 3、可配置的header
|
|
|
- * 4、根据环境切换
|
|
|
- * 5、同时需要支持 KIP 接口
|
|
|
- * */
|
|
|
-
|
|
|
-// import axios from 'axios'
|
|
|
-
|
|
|
-// export default function ( ) {
|
|
|
-// window.profileApi
|
|
|
-// // https://{kip-service-host}/c/api/temporary-parking-service/parking-lots
|
|
|
-// return axios
|
|
|
-// }
|
|
|
-
|
|
|
-import uni from "@/utils/uniHooks";
|
|
|
-import axios from 'axios';
|
|
|
-import { v4 as uuidv4 } from 'uuid';
|
|
|
-function createdHeader(axiosConfig) {
|
|
|
- const headerConfig = {
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- // 'X-Conversation-Id': uuidv4(),
|
|
|
- 'X-Conversation-Id': '8aaa87bb8051012901805a0d7f610001',
|
|
|
- 'X-User': JSON.stringify({
|
|
|
- 'userId': '3aaa87bb8051012901805a0d7f610001', // K+用户ID
|
|
|
- "nickName":"%E6%9A%AE%E4%BA%91%E6%B7%B1",
|
|
|
- // "vipCode":"KIP0099923",
|
|
|
- sourceType: 'WECHAT', // 登录来源: WECHAT/ALIPAY/H5/APP
|
|
|
- "phoneNumber":"15090631337","cId":"8aaa87bb8051012901805a0d7f610001",
|
|
|
- "projectId":"ZYJXQV2",
|
|
|
- "buildingId":"%E6%B2%AAA99999",
|
|
|
- cid:'', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- mobile:'', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- vipCode:'', // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
|
|
|
- // projectId: uni.getStorageSync('groupId'), // groupId: 项目id
|
|
|
- // buildingId:uni.getStorageSync('mallid') // mallId:楼栋id
|
|
|
- })
|
|
|
- }
|
|
|
- axiosConfig.headers = headerConfig
|
|
|
-}
|
|
|
-function myAxios(axiosConfig) {
|
|
|
- const service = axios.create({
|
|
|
- baseURL: `${window.profileApi}/temporary-parking-service`, // 设置统一的请求前缀
|
|
|
- timeout: 10000, // 设置统一的超时时长
|
|
|
- });
|
|
|
- createdHeader(axiosConfig);
|
|
|
- return service(axiosConfig);
|
|
|
-}
|
|
|
-
|
|
|
-export default myAxios;
|