riku
2026-01-21 a2c5def7cf9562312a54216bc195a6ea071a26c5
app.js
@@ -1,19 +1,50 @@
// app.js
import moment from './utils/moment.min';
import $f from './service/baserequest';
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    moment.updateLocale('en', {
      weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
    });
    // 登录
    wx.login({
    wx.getStorage({
      key: 'userProfile',
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
        this.globalData.userProfile = res.data;
      },
    });
  },
  globalData: {
    userInfo: null
  }
})
    perPage: 5,
    userInfo: null,
    accessToken: null,
    isLogin: false,
    version: '体验版 1.0.0',
    agreement:
      $f.baseFileUrl +
      '/agreement/中小微企业生态环境守法智能服务微信小程序服务协议.docx',
    newUser: false, //是否为注册一个月以内的新用户
  },
  // 智能咨询结果类型文本转换
  cosultTypeName: typeId => {
    let name = '';
    switch (typeId) {
      case 1:
        name = '相关文件';
        break;
      case 2:
        name = '相关条目';
        break;
      case 3:
        name = '执法案例';
        break;
      case 4:
        name = '环保问题';
        break;
      default:
        break;
    }
    return name;
  },
});