|
|
|
|
@ -34,7 +34,7 @@ export function createApp () {
|
|
|
|
|
app.config.productionTip = false;
|
|
|
|
|
|
|
|
|
|
app.component('g-empty', gEmpty);
|
|
|
|
|
app.component('g-tabbar', gTabbar);
|
|
|
|
|
app.component('g-tabbar', gTabbar);
|
|
|
|
|
app.component('g-loading', gLoading);
|
|
|
|
|
app.component('g-button', gButton);
|
|
|
|
|
app.component('g-list-job', gListJob);
|
|
|
|
|
@ -85,7 +85,8 @@ export function createApp () {
|
|
|
|
|
console.log(err);
|
|
|
|
|
resolve(err)
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/*
|
|
|
|
|
@ -99,7 +100,7 @@ export function createApp () {
|
|
|
|
|
uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id,方便获取
|
|
|
|
|
uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号
|
|
|
|
|
if (res.agencyId) {
|
|
|
|
|
// if (res.agencyStatus == 1) {
|
|
|
|
|
// if (res.agencyStatus == 1) {
|
|
|
|
|
G.Get(apiInfo.login_agencyInfo, {}, (aRes) => {
|
|
|
|
|
uni.setStorageSync("agencyInfo", aRes.agency); // 1是创建者 2是普通成员
|
|
|
|
|
uni.setStorageSync("IS_CREATOR", aRes.agency.userId == res.user.id || res.admin == true ? 1 : 2); // 1是创建者 2是普通成员
|
|
|
|
|
@ -167,59 +168,7 @@ export function createApp () {
|
|
|
|
|
});
|
|
|
|
|
}, $sourceType);
|
|
|
|
|
},
|
|
|
|
|
// 新增方法:生成 UUID
|
|
|
|
|
getUUID () {
|
|
|
|
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
|
|
|
const r = (Math.random() * 16) | 0;
|
|
|
|
|
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
|
|
|
return v.toString(16);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 上传到oss
|
|
|
|
|
*/
|
|
|
|
|
uploadImgToOss (callback = () => { }, customDir = '', type = 'default', $num = 1, $sourceType = ['album', 'camera']) {
|
|
|
|
|
var that = this;
|
|
|
|
|
G.uploadImage($num, (imgRes) => {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '上传中...',
|
|
|
|
|
})
|
|
|
|
|
console.log('imgRes', imgRes);
|
|
|
|
|
let imgPath = JSON.parse(imgRes)[0]
|
|
|
|
|
console.log('imgPath', imgPath);
|
|
|
|
|
G.Get(apiInfo.getOssInfo, { prefix: customDir }, ({ data }) => {
|
|
|
|
|
console.log('uploadImgToOssresresresres', data);
|
|
|
|
|
const { policy, signature, accessid, dir, host } = data;
|
|
|
|
|
let key = dir + that.getUUID()
|
|
|
|
|
const formData = {
|
|
|
|
|
"key": key + "_${filename}",
|
|
|
|
|
"policy": policy,
|
|
|
|
|
"OSSAccessKeyId": accessid,
|
|
|
|
|
signature,
|
|
|
|
|
"success_action_status": "200",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
uni.uploadFile({
|
|
|
|
|
url: host,
|
|
|
|
|
filePath: imgPath,
|
|
|
|
|
name: "file",
|
|
|
|
|
|
|
|
|
|
formData: formData,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.errMsg = "uploadFile:ok") {
|
|
|
|
|
const imgUrl = `${host}/${key}_${imgPath.split('/').pop()}`;
|
|
|
|
|
callback({
|
|
|
|
|
status: '上传成功',
|
|
|
|
|
image: imgUrl
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log('resresresresresresres', res);
|
|
|
|
|
},
|
|
|
|
|
fail: function (res) { },
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/* 上传图片
|
|
|
|
|
*/
|
|
|
|
|
uploadImgByCamera (callback = () => { }, type = 'default', $num = 1, $sourceType = ['camera']) {
|
|
|
|
|
|