职业素养功能修改
This commit is contained in:
@@ -1,39 +1,13 @@
|
||||
let baseUrl = ""
|
||||
let baseUrl1 = ""
|
||||
let baseUrl2 = ""
|
||||
let baseUrl3 = ""
|
||||
let baseUrl4 = ""
|
||||
let baseUrl5 = ""
|
||||
let baseUrl6 = ""
|
||||
let baseUrl7 = ""
|
||||
let baseUrl8 = ""
|
||||
let filestore_site = "";
|
||||
// #ifdef MP-WEIXIN
|
||||
// 编译项目,因为使用插件lime-echart,echart文件过大,需要非压缩代码方式编译,不然会很慢,发布的时候才压缩代码方式编译
|
||||
if (wx.getAccountInfoSync().miniProgram.envVersion === 'develop') {
|
||||
baseUrl = 'http://dev.51xuanxiao.com:8005/api' // 开发环境
|
||||
baseUrl3 = 'http://dev.51xuanxiao.com:8007/api' // 职业环境
|
||||
baseUrl4 = 'http://dev.51xuanxiao.com:8009/api' // 用户环境
|
||||
baseUrl5 = 'http://dev.51xuanxiao.com:8006/api' // 测评环境
|
||||
filestore_site = 'http://192.168.1.168:31128' //文件地址
|
||||
baseUrl = 'https://localhost:7026' // 开发环境
|
||||
} else {
|
||||
baseUrl = 'https://yanxueapi.51xuanxiao.com/api' // 生产环境
|
||||
baseUrl3 = "https://jobapi.51xuanxiao.com/api"// 职业环境
|
||||
baseUrl4 = "https://authapi.51xuanxiao.com/api"// 用户环境
|
||||
baseUrl5 = "https://testapi.51xuanxiao.com/api"// 测评环境
|
||||
filestore_site = 'https://filestore.plan.51xuanxiao.com' //文件地址
|
||||
baseUrl = 'https://yanxueapi.51xuanxiao.com' // 生产环境
|
||||
}
|
||||
// #endif
|
||||
|
||||
export {
|
||||
baseUrl,
|
||||
baseUrl1,
|
||||
baseUrl2,
|
||||
baseUrl3,
|
||||
baseUrl4,
|
||||
baseUrl5,
|
||||
baseUrl6,
|
||||
baseUrl7,
|
||||
baseUrl8,
|
||||
filestore_site
|
||||
baseUrl
|
||||
}
|
||||
@@ -1,14 +1,4 @@
|
||||
import {
|
||||
baseUrl,
|
||||
baseUrl1,
|
||||
baseUrl2,
|
||||
baseUrl3,
|
||||
baseUrl4,
|
||||
baseUrl5,
|
||||
baseUrl6,
|
||||
baseUrl7,
|
||||
baseUrl8
|
||||
} from './config.js'
|
||||
import { baseUrl} from './config.js'
|
||||
|
||||
const request = {}
|
||||
const headers = {}
|
||||
@@ -18,77 +8,20 @@ request.globalRequest = (url, method, data, power, type) => {
|
||||
// 1 == 不通过access_token校验的接口
|
||||
// 2 == 文件下载接口列表
|
||||
const userInfo = uni.getStorageSync('CAuserInfo')
|
||||
// console.log('缓存userinfo:',userInfo);
|
||||
switch (power) {
|
||||
case 1:
|
||||
case 3:
|
||||
headers['Token'] = userInfo.token
|
||||
// if(power == 3){
|
||||
// const deviceInfo = wx.getDeviceInfo()
|
||||
// let data = {
|
||||
// model: deviceInfo.model,
|
||||
// system: deviceInfo.system,
|
||||
// platform: deviceInfo.platform
|
||||
// }
|
||||
// headers['DeviceInfo'] = JSON.stringify(data)
|
||||
// }
|
||||
break;
|
||||
case 2:
|
||||
headers['Authorization'] = userInfo.userToken
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
let host = "";
|
||||
let key = "";
|
||||
if (type == 1) {
|
||||
host = baseUrl1;
|
||||
} else if (type == 2) {
|
||||
host = baseUrl2;
|
||||
} else if (type == 3) {
|
||||
host = baseUrl3;
|
||||
} else if (type == 4) {
|
||||
host = baseUrl4;
|
||||
} else if (type == 5) {
|
||||
host = baseUrl5;
|
||||
} else if (type == 7) {
|
||||
host = baseUrl7;
|
||||
key = `?PartnerKey=51xuanxiao&PartnerSecret=mC6XRjDWUzGAdxcCqRBWGb88uR`;
|
||||
} else if (type == 8) {
|
||||
host = baseUrl8;
|
||||
//key = `?AppKey=51xuanxiao&AppSecret=mC6XRjDWUzGAdxcCqRBWGb88uR`;
|
||||
} else {
|
||||
host = baseUrl;
|
||||
}
|
||||
headers['Token'] = userInfo.token
|
||||
return uni.request({
|
||||
timeout: 60000,
|
||||
url: host + url + key,
|
||||
url: baseUrl + url,
|
||||
method,
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
header: headers
|
||||
}).then(res => {
|
||||
//console.log("ressss===="+JSON.stringify(res.data));
|
||||
// console.log("type===="+type);
|
||||
if (type == 7) {
|
||||
if (res[1].data.code == 0) {
|
||||
return res[1].data
|
||||
} else {
|
||||
throw res[1].data
|
||||
}
|
||||
} else if (type == 8) {
|
||||
if (res[1].data.Code == 0) {
|
||||
return res[1].data
|
||||
} else {
|
||||
throw res[1].data
|
||||
}
|
||||
} else {
|
||||
if (res.data.Result) {
|
||||
return res.data
|
||||
} else {
|
||||
throw res.data
|
||||
}
|
||||
}
|
||||
if (res.data.Result) {
|
||||
return res.data
|
||||
} else {
|
||||
throw res.data
|
||||
}
|
||||
}).catch(parmas => {
|
||||
switch (parmas.status) {
|
||||
case 401:
|
||||
|
||||
Reference in New Issue
Block a user