cyl/master-im
jscyl13849007907 5 months ago
parent 7bd2d625e2
commit 6b83382927

@ -2,9 +2,9 @@ import App from './App'
import Vue from 'vue' import Vue from 'vue'
import './uni.promisify.adaptor' import './uni.promisify.adaptor'
import uView from './uni_modules/vk-uview-ui'; import uView from './uni_modules/vk-uview-ui';
// import uView from "uview-ui";
import G from './utils/common.js'; import G from './utils/common.js';
import Ajax from './utils/ajax.js'; import Ajax from './utils/ajax.js';
import wyyx from './utils/wyyx.js';
import apiInfo from './api/index.js'; import apiInfo from './api/index.js';
import gEmpty from './components/empty.vue'; import gEmpty from './components/empty.vue';
@ -65,9 +65,7 @@ export function createApp () {
uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res)); uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res));
uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id方便获取 uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id方便获取
uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号 uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号
console.log('resresresresresresresres', res);
G.Get(apiInfo.login_agencyInfo, {}, (aRes) => { G.Get(apiInfo.login_agencyInfo, {}, (aRes) => {
console.log("获取团队信息:", aRes);
uni.setStorageSync("agencyInfo", aRes.agency); // 1是创建者 2是普通成员 uni.setStorageSync("agencyInfo", aRes.agency); // 1是创建者 2是普通成员
uni.setStorageSync("IS_CREATOR", aRes.agency.userId == res.user.id || res.admin == true ? 1 : 2); // 1是创建者 2是普通成员 uni.setStorageSync("IS_CREATOR", aRes.agency.userId == res.user.id || res.admin == true ? 1 : 2); // 1是创建者 2是普通成员
@ -89,17 +87,13 @@ export function createApp () {
checkTokenNew () { checkTokenNew () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
G.Get('/appLoginByToken', '', (res) => { G.Get('/appLoginByToken', '', (res) => {
console.log('res', res);
uni.setStorageSync("apply-userinfo", res) uni.setStorageSync("apply-userinfo", res)
uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res)); uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res));
uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id方便获取 uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id方便获取
uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号 uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号
G.Get(apiInfo.login_agencyInfo, {}, (aRes) => { G.Get(apiInfo.login_agencyInfo, {}, (aRes) => {
console.log("获取团队信息:", aRes);
uni.setStorageSync("agencyInfo", aRes.agency); // 1是创建者 2是普通成员 uni.setStorageSync("agencyInfo", aRes.agency); // 1是创建者 2是普通成员
uni.setStorageSync("IS_CREATOR", aRes.agency.userId == res.user.id || res.admin == true ? 1 : 2); // 1是创建者 2是普通成员 uni.setStorageSync("IS_CREATOR", aRes.agency.userId == res.user.id || res.admin == true ? 1 : 2); // 1是创建者 2是普通成员
// 登录跳转到首页的判断 // 登录跳转到首页的判断
uni.setStorageSync("SHOW_INVITE", 1); uni.setStorageSync("SHOW_INVITE", 1);
resolve(res) resolve(res)
@ -166,7 +160,6 @@ export function createApp () {
uploadImgByCamera (callback = () => { }, type = 'default', $num = 1, $sourceType = ['camera']) { uploadImgByCamera (callback = () => { }, type = 'default', $num = 1, $sourceType = ['camera']) {
var that = this; var that = this;
G.uploadImage($num, (imgRes) => { G.uploadImage($num, (imgRes) => {
console.log('imgRes', imgRes);
uni.showLoading({ uni.showLoading({
title: '上传中...', title: '上传中...',
}) })
@ -187,7 +180,6 @@ export function createApp () {
success: function (res) { success: function (res) {
let imageStr = '' let imageStr = ''
imageStr = JSON.parse(res.data).data; imageStr = JSON.parse(res.data).data;
console.log('imageStr', imageStr);
uni.hideLoading() uni.hideLoading()
callback({ callback({
status: '上传成功', status: '上传成功',
@ -197,8 +189,6 @@ export function createApp () {
fail: function (res) { }, fail: function (res) { },
}); });
} }
}, $sourceType); }, $sourceType);
}, },
/* /*
@ -206,7 +196,6 @@ export function createApp () {
uploadImgByAlbum (callback = () => { }, type = 'default', $num = 1, $sourceType = ['album']) { uploadImgByAlbum (callback = () => { }, type = 'default', $num = 1, $sourceType = ['album']) {
var that = this; var that = this;
G.uploadImage($num, (imgRes) => { G.uploadImage($num, (imgRes) => {
console.log('imgRes', imgRes);
uni.showLoading({ uni.showLoading({
title: '上传中...', title: '上传中...',
}) })
@ -227,7 +216,6 @@ export function createApp () {
success: function (res) { success: function (res) {
let imageStr = '' let imageStr = ''
imageStr = JSON.parse(res.data).data; imageStr = JSON.parse(res.data).data;
console.log('imageStr', imageStr);
uni.hideLoading() uni.hideLoading()
callback({ callback({
status: '上传成功', status: '上传成功',
@ -237,8 +225,6 @@ export function createApp () {
fail: function (res) { }, fail: function (res) { },
}); });
} }
}, $sourceType); }, $sourceType);
}, },
/** /**
@ -281,22 +267,19 @@ export function createApp () {
success: function (res) { success: function (res) {
let imageStr = '' let imageStr = ''
imageStr = JSON.parse(res.data).data; imageStr = JSON.parse(res.data).data;
console.log('imageStr', imageStr);
uni.uploadFile({ uni.uploadFile({
url: G.ajaxUrl + apiInfo.getIDcard, url: G.ajaxUrl + apiInfo.getIDcard,
filePath: Array.isArray($fileName) ? $fileName[0] : JSON.parse($fileName)[0], filePath: Array.isArray($fileName) ? $fileName[0] : JSON.parse($fileName)[0],
name: 'uploadFile', name: 'uploadFile',
header: Object.assign({ header: Object.assign({
Authorization: 'Bearer ' + uni Authorization: 'Bearer ' + uni.getStorageSync("apply-token")
.getStorageSync("apply-token")
}, Ajax.setPublicParams()), }, Ajax.setPublicParams()),
formData: Ajax.setPublicParams(), formData: Ajax.setPublicParams(),
success: (uploadFileRes) => { success: (uploadFileRes) => {
let cardData = { let cardData = {
status: '上传成功', status: '上传成功',
image: imageStr, image: imageStr,
info: JSON.parse(uploadFileRes.data) info: JSON.parse(uploadFileRes.data).data
.data
} }
uni.hideLoading() uni.hideLoading()
callback(cardData); callback(cardData);
@ -314,15 +297,9 @@ export function createApp () {
uni.showLoading({ uni.showLoading({
title: '上传中...', title: '上传中...',
}) })
console.log('imgRes', imgRes)
let args = Array.from(JSON.parse(imgRes)); let args = Array.from(JSON.parse(imgRes));
console.log('args', args)
// return
let imgList = [] let imgList = []
args.forEach((item, index) => { args.forEach((item, index) => {
console.log('item,', item)
uni.uploadFile({ uni.uploadFile({
url: G.ajaxUrl + apiInfo.uploadImage, url: G.ajaxUrl + apiInfo.uploadImage,
method: "post", method: "post",
@ -333,7 +310,6 @@ export function createApp () {
}, Ajax.setPublicParams()), }, Ajax.setPublicParams()),
formData: Ajax.setPublicParams(), formData: Ajax.setPublicParams(),
success: function (res) { success: function (res) {
console.log('uploadFileRes', res)
imgList.push(JSON.parse(res.data).data) imgList.push(JSON.parse(res.data).data)
if (imgList.length == args.length) { if (imgList.length == args.length) {
callback({ callback({
@ -341,7 +317,6 @@ export function createApp () {
imgList: imgList imgList: imgList
}); });
} }
}, },
fail: function (res) { fail: function (res) {
console.log('res', res) console.log('res', res)
@ -351,198 +326,14 @@ export function createApp () {
}); });
} }
}); });
app.config.globalProperties.F = wyyx;
app.use(uView) app.use(uView)
return { return {
app app
} }
} }
/**
* Vue2
*/
// Vue.component('g-empty', gEmpty);
// Vue.component('g-loading', gLoading);
// Vue.component('g-button', gButton);
// Vue.component('g-list-job', gListJob);
// Vue.component('g-list-apply', gListApply);
// Vue.component('g-panel-server', gPanelServer);
// Vue.component('g-panel-image', gPanelImage);
// Vue.component('g-panel-form-item', gPanelFormItem);
// Vue.component('g-panel-form-slot', gPanelFormSlot);
// Vue.component('g-panel-card-num', gPanelCardNum);
// Vue.component('g-panel-card-info', gPanelCardInfo);
// Vue.component('g-panel-hr', gPanelHr);
// Vue.component('g-panel-fond', gPanelFond);
// Vue.component('g-panel-about', gPanelAbout);
// Vue.component('g-panel-detail-item', gPanelDetailItem);
// Vue.component('g-panel-record', gPanelRecord);
// Vue.component('g-panel-time', gPanelTime);
// Vue.component('g-panel-tabbar', gPanelTabbar);
// Vue.component('g-panel-fixed', gPanelFixed);
// Vue.prototype.api = apiInfo;
// Vue.prototype.G = Object.assign(G, Ajax, {
// /*
// * 检查token,获取最新登录者信息
// */
// checkToken () {
// return new Promise((resolve, reject) => {
// G.Get('/checkToken', '', (res) => {
// uni.setStorageSync("apply-userinfo", res)
// uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res));
// uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id方便获取
// uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号
// resolve(res)
// })
// })
// },
// /*
// * 新的检查token,获取最新登录者信息
// */
// checkTokenNew () {
// return new Promise((resolve, reject) => {
// G.Get('/appLoginByToken', '', (res) => {
// console.log('res', res);
// uni.setStorageSync("apply-userinfo", res)
// uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res));
// uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id方便获取
// uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号
// resolve(res)
// })
// })
// },
// /* 上传图片
// */
// uploadImg (callback = () => { }, type = 'default', $num = 1, $sourceType = ['album', 'camera']) {
// G.uploadImage($num, (imgRes) => {
// uni.showLoading({
// title: '上传中...',
// })
// uni.uploadFile({
// url: G.ajaxUrl + apiInfo.uploadImage,
// method: "post",
// filePath: JSON.parse(imgRes)[0],
// name: "uploadFile",
// header: Object.assign({
// Authorization: 'Bearer ' + uni.getStorageSync("apply-token")
// }, Ajax.setPublicParams()),
// formData: Ajax.setPublicParams(),
// success: function (res) {
// let imageStr = ''
// imageStr = JSON.parse(res.data).data;
// if (type == 'idcard') {
// // 调用身份证识别
// uni.uploadFile({
// url: G.ajaxUrl + apiInfo.getIDcard,
// filePath: JSON.parse(imgRes)[0],
// name: 'uploadFile',
// header: Object.assign({
// Authorization: 'Bearer ' + uni.getStorageSync("apply-token")
// }, Ajax.setPublicParams()),
// formData: Ajax.setPublicParams(),
// success: (uploadFileRes) => {
// let cardData = {
// status: '上传成功',
// image: imageStr,
// info: JSON.parse(uploadFileRes.data).data
// }
// uni.hideLoading()
// callback(cardData);
// }
// });
// } else {
// uni.hideLoading()
// callback({
// status: '上传成功',
// image: imageStr
// });
// }
// },
// fail: function (res) { },
// });
// }, $sourceType);
// },
// /**
// * 上传临时文件(不需要选择图库)
// */
// uploadTmpImg ($fileName, callback = () => { }) {
// uni.uploadFile({
// url: G.ajaxUrl + apiInfo.uploadImage,
// method: "post",
// filePath: $fileName,
// name: "uploadFile",
// header: Object.assign({
// Authorization: 'Bearer ' + uni.getStorageSync("apply-token")
// }, Ajax.setPublicParams()),
// formData: Ajax.setPublicParams(),
// success: function (res) {
// let imageStr = ''
// imageStr = JSON.parse(res.data).data;
// callback({
// status: '上传成功',
// image: imageStr
// });
// },
// fail: function (res) { },
// });
// },
// /* 上传媒体文件
// */
// uploadMedia (callback = () => { }, type = 'default', $num = 9) {
// G.uploadM($num, (imgRes) => {
// uni.showLoading({
// title: '上传中...',
// })
// console.log('imgRes', imgRes)
// let args = Array.from(JSON.parse(imgRes));
// console.log('args', args)
// // return
// let imgList = []
// args.forEach((item, index) => {
// console.log('item,', item)
// uni.uploadFile({
// url: G.ajaxUrl + apiInfo.uploadImage,
// method: "post",
// filePath: item.tempFilePath,
// name: "uploadFile",
// header: Object.assign({
// Authorization: 'Bearer ' + uni.getStorageSync("apply-token")
// }, Ajax.setPublicParams()),
// formData: Ajax.setPublicParams(),
// success: function (res) {
// console.log('uploadFileRes', res)
// imgList.push(JSON.parse(res.data).data)
// if (imgList.length == args.length) {
// callback({
// status: '上传成功',
// imgList: imgList
// });
// }
// },
// fail: function (res) {
// console.log('res', res)
// },
// });
// })
// });
// }
// });
// Vue.use(uView)
// const app = new Vue({
// ...App
// })
// app.$mount()

2923
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,9 +1,28 @@
{ {
"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"
} }

@ -41,14 +41,11 @@ let data = {
params = {}; params = {};
let uuid_new = ""; let uuid_new = "";
// #ifdef APP-PLUS // #ifdef APP-PLUS
// let mainActivity = plus.android.runtimeMainActivity();
// let Settings = plus.android.importClass("android.provider.Settings");
if (uni.getSystemInfoSync().osName == "android") { if (uni.getSystemInfoSync().osName == "android") {
uuid_new = "from_android_applyAssistantUniapp" uuid_new = "from_android_applyAssistantUniapp"
} else { } else {
uuid_new = "from_ios_applyAssistantUniapp" uuid_new = "from_ios_applyAssistantUniapp"
} }
// let uuid = Settings.Secure.getString(mainActivity.getContentResolver(),Settings.Secure.ANDROID_ID);
// #endif // #endif
params = { params = {
'requestComeFrom':'assistant_miniapp', 'requestComeFrom':'assistant_miniapp',

@ -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…
Cancel
Save