riku
2026-01-19 068be2757aa2d51e3f6604dae54287683160ad0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
 * 从服务器加载动态配置
 */
 
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
};