|
|
|
|
@ -53,66 +53,70 @@ export function createApp () {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
G.Get('/checkToken', '', (res) => {
|
|
|
|
|
console.log('checkToken', res);
|
|
|
|
|
uni.setStorageSync("apply-userinfo", res)
|
|
|
|
|
uni.setStorageSync("apply-uid", res.id)
|
|
|
|
|
uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res));
|
|
|
|
|
uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id,方便获取
|
|
|
|
|
uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号
|
|
|
|
|
if (res.agencyId == uni.getStorageSync("miniApp-info").id) {
|
|
|
|
|
let _env = uni.getAccountInfoSync().miniProgram.envVersion;
|
|
|
|
|
G.Get(apiInfo.user_getUserQRCode, { env: _env }, (userqrcode) => {
|
|
|
|
|
uni.setStorageSync("user_qrcode", "https://daotian.matripe.com.cn" + userqrcode.qrcode); // 用户分享时候的二维码
|
|
|
|
|
});
|
|
|
|
|
G.Get(apiInfo.user_checkServicePermission, {}, (res) => {
|
|
|
|
|
// console.log('userqrcodeuserqrcode', res);
|
|
|
|
|
uni.setStorageSync("user_ServicePermission", res); // 用户是否是客服的判断
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (res.agencyId) {
|
|
|
|
|
G.Get('/yishoudan/agency/role/checkDeptAdmin', {}, (val) => {
|
|
|
|
|
console.log('/yishoudan/agency/role/checkDeptAdmin', val);
|
|
|
|
|
uni.setStorageSync("is_teamleader", val === true ? 1 : 0); // 是否是部门管理员的判断
|
|
|
|
|
})
|
|
|
|
|
G.Get(apiInfo.login_agencyInfo, {}, (aRes) => {
|
|
|
|
|
console.log("获取团队信息:", aRes);
|
|
|
|
|
uni.setStorageSync("agencyInfo", aRes.agency); // 1是创建者 2是普通成员
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
G.Post("/assistant/circle/agency/checkUserTypeForAssistant", {
|
|
|
|
|
upAgencyId:uni.getStorageSync("miniApp-info").id
|
|
|
|
|
}, (fensiRes) => {
|
|
|
|
|
console.log("isFans", fensiRes);
|
|
|
|
|
res.isfensi = fensiRes;
|
|
|
|
|
uni.setStorageSync("apply-userinfo", res)
|
|
|
|
|
uni.setStorageSync("apply-uid", res.id)
|
|
|
|
|
uni.setStorageSync('apply-userinfo-copy', JSON.stringify(res));
|
|
|
|
|
uni.setStorageSync("apply-agencyId", res.user.agencyId); // 单独存储 -- 代理id,方便获取
|
|
|
|
|
uni.setStorageSync("apply-supplierAccount", res.supplierAccount); // 单独存储 -- 是否是发单号,方便获取 0.不是发单号 1.是发单号
|
|
|
|
|
if (res.agencyId == uni.getStorageSync("miniApp-info").id) {
|
|
|
|
|
let _env = uni.getAccountInfoSync().miniProgram.envVersion;
|
|
|
|
|
G.Get(apiInfo.user_getUserQRCode, { env: _env }, (userqrcode) => {
|
|
|
|
|
uni.setStorageSync("user_qrcode", "https://daotian.matripe.com.cn" + userqrcode.qrcode); // 用户分享时候的二维码
|
|
|
|
|
});
|
|
|
|
|
G.Get(apiInfo.user_checkServicePermission, {}, (res) => {
|
|
|
|
|
// console.log('userqrcodeuserqrcode', res);
|
|
|
|
|
uni.setStorageSync("user_ServicePermission", res); // 用户是否是客服的判断
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (res.agencyId) {
|
|
|
|
|
G.Get('/yishoudan/agency/role/checkDeptAdmin', {}, (val) => {
|
|
|
|
|
console.log('/yishoudan/agency/role/checkDeptAdmin', val);
|
|
|
|
|
uni.setStorageSync("is_teamleader", val === true ? 1 : 0); // 是否是部门管理员的判断
|
|
|
|
|
})
|
|
|
|
|
G.Get(apiInfo.login_agencyInfo, {}, (aRes) => {
|
|
|
|
|
console.log("获取团队信息:", aRes);
|
|
|
|
|
uni.setStorageSync("agencyInfo", aRes.agency); // 1是创建者 2是普通成员
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
G.Get(
|
|
|
|
|
apiInfo.user_checkPermission,
|
|
|
|
|
{},
|
|
|
|
|
(rea) => {
|
|
|
|
|
// console.log('rearearearearearea', rea);
|
|
|
|
|
if (rea.hasPermission == true) {
|
|
|
|
|
uni.setStorageSync("HAS_PERMISSION", 1); // 1.有权限 2.无权限
|
|
|
|
|
} else {
|
|
|
|
|
uni.setStorageSync("HAS_PERMISSION", 2); // 1.有权限 2.无权限
|
|
|
|
|
}
|
|
|
|
|
if (rea.member == true) {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_MEMBER", true); // 1.有权限 2.无权限
|
|
|
|
|
if (rea.isCreatorOrAdmin == true) {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_ADMIN", true); // 1.有权限 2.无权限
|
|
|
|
|
G.Get(
|
|
|
|
|
apiInfo.user_checkPermission,
|
|
|
|
|
{},
|
|
|
|
|
(rea) => {
|
|
|
|
|
// console.log('rearearearearearea', rea);
|
|
|
|
|
if (rea.hasPermission == true) {
|
|
|
|
|
uni.setStorageSync("HAS_PERMISSION", 1); // 1.有权限 2.无权限
|
|
|
|
|
} else {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_ADMIN", false); // 1.有权限 2.无权限
|
|
|
|
|
uni.setStorageSync("HAS_PERMISSION", 2); // 1.有权限 2.无权限
|
|
|
|
|
}
|
|
|
|
|
if (rea.member == true) {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_MEMBER", true); // 1.有权限 2.无权限
|
|
|
|
|
if (rea.isCreatorOrAdmin == true) {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_ADMIN", true); // 1.有权限 2.无权限
|
|
|
|
|
} else {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_ADMIN", false); // 1.有权限 2.无权限
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_MEMBER", false); // 1.有权限 2.无权限
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
uni.setStorageSync("IS_MINIAPP_MEMBER", false); // 1.有权限 2.无权限
|
|
|
|
|
}
|
|
|
|
|
resolve(res)
|
|
|
|
|
},
|
|
|
|
|
(err) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
uni.setStorageSync("HAS_PERMISSION", 2);
|
|
|
|
|
resolve(res)
|
|
|
|
|
},
|
|
|
|
|
(err) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
uni.setStorageSync("HAS_PERMISSION", 2);
|
|
|
|
|
resolve(res)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}, function fail (err) {
|
|
|
|
|
// console.log(err);
|
|
|
|
|
resolve(err)
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|