qian yi
parent
7bd2d625e2
commit
6b83382927
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,29 @@
|
|||||||
{
|
{
|
||||||
|
"name": "imv10uniapp",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "main.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"html2canvas": "^1.4.1"
|
"html2canvas": "^1.4.1",
|
||||||
|
"@xkit-yx/im-store-v2": "^0.4.0",
|
||||||
|
"@xkit-yx/utils": "^0.5.6",
|
||||||
|
"dayjs": "^1.11.7",
|
||||||
|
"fetch-event-source": "^1.0.0-alpha.2",
|
||||||
|
"mobx": "^6.6.1",
|
||||||
|
"nim-web-sdk-ng": "^10.4.0",
|
||||||
|
"pinyin": "^3.1.0",
|
||||||
|
"recorder-core": "^1.3.25011100"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
|
"pako": "^2.1.0",
|
||||||
"sass": "^1.86.0",
|
"sass": "^1.86.0",
|
||||||
"sass-loader": "^16.0.5"
|
"sass-loader": "^16.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,199 @@
|
|||||||
|
let ajaxUrl = "http://192.168.3.83:8001";
|
||||||
|
// let ajaxUrl = "https://daotian.matripe.com.cn";
|
||||||
|
let data = {
|
||||||
|
wyyxajaxUrl: ajaxUrl,
|
||||||
|
wyyxGet ($url = '', $parmas = {}, callback = () => { }, failback = () => { }) {
|
||||||
|
let that = this,
|
||||||
|
params = {};
|
||||||
|
let promise = new Promise((resolve, reject) => {
|
||||||
|
params = $parmas;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
promise.then(() => {
|
||||||
|
that.wyyxpostData($url, params, callback, failback, 'GET');
|
||||||
|
}).catch();
|
||||||
|
},
|
||||||
|
wyyxPost ($url = '', $parmas = {}, callback = () => { }, failback = () => { }) {
|
||||||
|
let that = this,
|
||||||
|
params = {};
|
||||||
|
let promise = new Promise((resolve, reject) => {
|
||||||
|
params = $parmas;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
promise.then(() => {
|
||||||
|
that.wyyxpostData($url, params, callback, failback, 'POST');
|
||||||
|
}).catch();
|
||||||
|
},
|
||||||
|
wyyxPut ($url = '', $parmas = {}, callback = () => { }, failback = () => { }) {
|
||||||
|
let that = this,
|
||||||
|
params = {};
|
||||||
|
let promise = new Promise((resolve, reject) => {
|
||||||
|
params = $parmas;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
promise.then(() => {
|
||||||
|
that.wyyxpostData($url, params, callback, failback, 'PUT');
|
||||||
|
}).catch();
|
||||||
|
},
|
||||||
|
|
||||||
|
wyyxsetPublicParams () {
|
||||||
|
let that = this,
|
||||||
|
params = {},
|
||||||
|
appName = '';
|
||||||
|
let uuid_new = "";
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (uni.getSystemInfoSync().osName == "android") {
|
||||||
|
uuid_new = "from_android_applyAssistantUniapp"
|
||||||
|
} else {
|
||||||
|
uuid_new = "from_ios_applyAssistantUniapp"
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
appName = uni.getStorageSync('miniApp-info').fullName || uni.getStorageSync('miniApp-info').agencyName || '伯才供应链';
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
params = {
|
||||||
|
'requestComeFrom':'assistant_miniapp',
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
'g-open-env': 'APP-PLUS',
|
||||||
|
appId: uuid_new,
|
||||||
|
// 请求来源标识 1.小程序 2.app 3.网页
|
||||||
|
appClassify: 2,
|
||||||
|
appName: encodeURIComponent('报名助手')
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
'g-open-env': 'H5',
|
||||||
|
appId: '',
|
||||||
|
appClassify: 3,
|
||||||
|
appName: encodeURIComponent('报名助手')
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
'g-open-env': 'MP-MINI',
|
||||||
|
appId: uni.getAccountInfoSync().miniProgram.appId,
|
||||||
|
appClassify: 1,
|
||||||
|
appName: encodeURIComponent('报名助手')
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-TOUTIAO
|
||||||
|
'g-open-env': 'MP-TOUTIAO',
|
||||||
|
appId: tt.getEnvInfoSync().microapp.appId,
|
||||||
|
subAppId: uni.getStorageSync('subAppId'),
|
||||||
|
appClassify: 1,
|
||||||
|
appName: encodeURIComponent('报名助手')
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-KUAISHOU
|
||||||
|
'g-open-env': 'MP-KUAISHOU',
|
||||||
|
appId: "",
|
||||||
|
appClassify: 1,
|
||||||
|
appName: encodeURIComponent('报名助手')
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
},
|
||||||
|
// 发送请求
|
||||||
|
wyyxpostData ($url = '', $parmas = {}, callback = () => { }, failback = () => { }, $method) {
|
||||||
|
let that = this,
|
||||||
|
$header = {};
|
||||||
|
if (uni.getStorageSync("apply-token")) {
|
||||||
|
$header.Authorization = 'Bearer ' + uni.getStorageSync("apply-token");
|
||||||
|
}
|
||||||
|
if (uni.getStorageSync("apply-agencyId")) {
|
||||||
|
// console.log('uni.getStorageSync("apply-agencyId")', uni.getStorageSync("apply-agencyId"));
|
||||||
|
$header.Agencyid = uni.getStorageSync("apply-agencyId");
|
||||||
|
}
|
||||||
|
if ($parmas == '') {
|
||||||
|
$parmas = {};
|
||||||
|
}
|
||||||
|
if ($parmas.formdata || $method == "POST" || $method == "PUT") {
|
||||||
|
$header['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||||
|
}
|
||||||
|
for (const k in $parmas) {
|
||||||
|
if ($parmas[k] == undefined || $parmas[k] == 'undefined') {
|
||||||
|
$parmas[k] = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("公共参数,+++++", Object.assign($parmas, that.wyyxsetPublicParams()));
|
||||||
|
uni.request({
|
||||||
|
url: ajaxUrl + $url,
|
||||||
|
data: Object.assign($parmas, that.wyyxsetPublicParams()),
|
||||||
|
header: Object.assign($header, that.wyyxsetPublicParams()),
|
||||||
|
method: $method,
|
||||||
|
success: (res) => {
|
||||||
|
// console.log('测试报错123123123123123123',res);
|
||||||
|
// console.log('测试报错123123123123123123$url',$url);
|
||||||
|
let resData = res.data;
|
||||||
|
if (resData.status == 200) {// 正常
|
||||||
|
callback(resData.data, resData.msg);
|
||||||
|
} else if (resData.status == 9999) {// 登录过期或者身份变动等需要登录的场景
|
||||||
|
uni.showToast({
|
||||||
|
title: resData.msg,
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
failback(resData);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/index?path=/' + that.wyyxgetPathCopy().path + '&level=' + that.wyyxgetPathCopy().level
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
} else if (resData.status == 500 || resData.status == 502) {// 某种原因导致接口提示该状态码
|
||||||
|
// if (resData.msg == '系统异常,请稍后') {
|
||||||
|
// uni.reLaunch({
|
||||||
|
// url: '/root/other/error'
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
uni.showToast({
|
||||||
|
title: resData.msg,
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
failback(resData.msg);
|
||||||
|
// }
|
||||||
|
} else if (resData.status == 2002) {
|
||||||
|
uni.showToast({
|
||||||
|
title:'已切换团队,需要重新登录',
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/index?path=/pages/home/index&level=' + that.wyyxgetPathCopy().level
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
} else {// 其他异常
|
||||||
|
uni.showToast({
|
||||||
|
title: resData.msg,
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
failback(resData.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: error.errMsg,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
failback(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/* 获取当前path
|
||||||
|
*/
|
||||||
|
wyyxgetPathCopy () {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if (pages.length > 0) {
|
||||||
|
let _path = pages[pages.length - 1].route;
|
||||||
|
return {
|
||||||
|
path: _path,
|
||||||
|
level: _path.slice(0, 4)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
path: '',
|
||||||
|
level: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default data;
|
||||||
Loading…
Reference in New Issue