素质测评,生涯规划,个人档案,职业库功能完成

This commit is contained in:
2025-11-05 11:09:27 +08:00
parent 328721e6e9
commit 17f393df45
54 changed files with 18573 additions and 17 deletions

38
utilCa/config.js Normal file
View File

@@ -0,0 +1,38 @@
let baseUrl = ""
let baseUrl1 = ""
let baseUrl2 = ""
let baseUrl3 = ""
let baseUrl4 = ""
let baseUrl5 = ""
let baseUrl6 = ""
let baseUrl7 = ""
let baseUrl8 = ""
let filestore_site = "";
// #ifdef MP-WEIXIN
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
}

19
utilCa/imageUrl.js Normal file
View File

@@ -0,0 +1,19 @@
// 公共图片基地址
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}`;
}

114
utilCa/request.js Normal file
View File

@@ -0,0 +1,114 @@
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