主包未使用的js文件删除
This commit is contained in:
40
packageCa/utilCa/config.js
Normal file
40
packageCa/utilCa/config.js
Normal file
@@ -0,0 +1,40 @@
|
||||
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' //文件地址
|
||||
} 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' //文件地址
|
||||
}
|
||||
// #endif
|
||||
|
||||
export {
|
||||
baseUrl,
|
||||
baseUrl1,
|
||||
baseUrl2,
|
||||
baseUrl3,
|
||||
baseUrl4,
|
||||
baseUrl5,
|
||||
baseUrl6,
|
||||
baseUrl7,
|
||||
baseUrl8,
|
||||
filestore_site
|
||||
}
|
||||
|
||||
1
packageCa/utilCa/echarts.min.js
vendored
Normal file
1
packageCa/utilCa/echarts.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
20
packageCa/utilCa/imageUrl.js
Normal file
20
packageCa/utilCa/imageUrl.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// 公共图片基地址
|
||||
const BASE_IMAGE_URL = 'https://51xuanxiao.oss-cn-hangzhou.aliyuncs.com/Resource/xcx_sygh';
|
||||
|
||||
/**
|
||||
* 图片地址拼接方法
|
||||
* @param {string} path - 图片路径(相对于基地址的路径)
|
||||
* @param {string} [process] - OSS图片处理参数,例如:'image/resize,m_fixed,w_348/quality,q_80'
|
||||
* @returns {string} 完整的图片URL
|
||||
*/
|
||||
export function ossImageUrl(path, process) {
|
||||
|
||||
// 如果有处理参数,拼接处理参数
|
||||
if (process) {
|
||||
return `${BASE_IMAGE_URL}/${path}?x-oss-process=${process}`;
|
||||
}
|
||||
|
||||
// 没有处理参数时,直接返回原始路径
|
||||
return `${BASE_IMAGE_URL}/${path}`;
|
||||
}
|
||||
|
||||
115
packageCa/utilCa/request.js
Normal file
115
packageCa/utilCa/request.js
Normal file
@@ -0,0 +1,115 @@
|
||||
import {
|
||||
baseUrl,
|
||||
baseUrl1,
|
||||
baseUrl2,
|
||||
baseUrl3,
|
||||
baseUrl4,
|
||||
baseUrl5,
|
||||
baseUrl6,
|
||||
baseUrl7,
|
||||
baseUrl8
|
||||
} from './config.js'
|
||||
|
||||
const request = {}
|
||||
const headers = {}
|
||||
|
||||
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;
|
||||
}
|
||||
return uni.request({
|
||||
timeout: 60000,
|
||||
url: host + url + key,
|
||||
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
|
||||
}
|
||||
}
|
||||
}).catch(parmas => {
|
||||
switch (parmas.status) {
|
||||
case 401:
|
||||
uni.showToast({
|
||||
title: parmas.msg,
|
||||
icon: 'none',
|
||||
duration: 3500
|
||||
})
|
||||
uni.removeStorageSync("CAuserInfo");
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index"
|
||||
})
|
||||
}, 2800)
|
||||
break
|
||||
default:
|
||||
console.error(parmas);
|
||||
return Promise.reject()
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
export default request
|
||||
|
||||
Reference in New Issue
Block a user