xusd
7 days ago 998218675eb243d43912c203174a6b72b299c0f8
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
48
49
50
51
52
53
54
55
// app.js
const $$ = require('./utils/util');
 
App({
  onLaunch() {
    // 字体
    wx.loadFontFace({
      family: 'DingTalk', // 字体名称
      source: 'url("../../font/DingTalk_JinBuTi_Regular.ttf")',
      global: true, // 是否全局生效
    })
    // 小程序更新
    const updateManager = wx.getUpdateManager();
    updateManager.onCheckForUpdate(function (res) {
      // 请求完新版本信息的回调
      if (res.hasUpdate == true) {
        updateManager.onUpdateReady(function () {
          $$.loginOutClearData();
          wx.showModal({
            title: '更新提示',
            content: '检测到新版本更新',
            showCancel: false,
            success(res) {
              if (res.confirm) {
                // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
                updateManager.applyUpdate();
              }
            },
          });
        });
      }
    });
    updateManager.onUpdateFailed(function () {
      // 新版本下载失败
      wx.showModal({
        title: '已经有新版本了哟~',
        content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
      });
    });
    // 获取缓存的token
    let userInfo = wx.getStorageSync('userInfo');
    if (userInfo) {
      this.globalData.token = userInfo.token;
    }
  },
  globalData: {
    token: '', // 用户token
    material: {
      uploadVisible: false,
      data: [], // 材料上传的数据
      person: [], // 申请调解页面进入附件上传页面时,需要传递的申请人,代理人,被申请人的数据,便于身份材料时选择
    },
    caseMsg: {}, // 案件详情,用于我的申请时跳转到其他页面传输案件的数据。
  },
});