/**
|
* 从服务器加载动态配置
|
*/
|
|
import configservice from '../service/configservice';
|
|
const app = getApp();
|
|
function loadConfig() {
|
const pList = [];
|
const userId = app.globalData.accessToken.userId;
|
const f1 = new Promise((resolve, reject) => {
|
configservice.fetchUserSetting(userId, {
|
success: res => {
|
if (res.data) {
|
app.globalData.userSetting = res.data
|
} else {
|
app.globalData.userSetting = {}
|
}
|
// 台账提交期限
|
if (app.globalData.userSetting.ledgerDeadline == undefined) {
|
app.globalData.userSetting.ledgerDeadline = 10
|
}
|
// 自巡查是否允许承诺一年内无需重复提交
|
if (app.globalData.userSetting.selfPatrolPromise == undefined) {
|
app.globalData.userSetting.selfPatrolPromise = false
|
}
|
wx.setStorage({
|
key: 'user_setting',
|
data: res.data,
|
});
|
console.log('app.globalData.userSetting', app.globalData.userSetting);
|
resolve()
|
},
|
fail: e => {
|
reject(e)
|
}
|
});
|
});
|
|
pList.push(f1);
|
return Promise.all(pList);
|
}
|
|
export {
|
loadConfig
|
};
|