app.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // app.js
  2. import storage from "./utils/storage";
  3. import basePage from "./utils/baseListPage";
  4. import UpdateManager from './model/update-manager.js';
  5. import Config from "./model/config";
  6. console.log = Config.LOG_ENABLE ? console.log : () => {
  7. };
  8. App({
  9. globalData: {
  10. userInfo: null,
  11. token: "",
  12. isPC: false,
  13. isPCDeviceUnkonw: false,
  14. systemInfo: null,
  15. },
  16. onLaunch(options) {
  17. // UpdateManager.update();
  18. this.globalData.token = storage.getItem("token")
  19. const res = wx.getSystemInfoSync()
  20. this.globalData.isPC = (res.platform == "windows" || res.platform == 'mac')
  21. this.globalData.isPCDeviceUnkonw = (this.globalData.isPC && res.devicePixelRatio == res.pixelRatio && res.pixelRatio != 1);
  22. wx.getSystemInfo({
  23. success: (result) => {
  24. this.globalData.systemInfo = result;
  25. },
  26. })
  27. },
  28. onShow(){
  29. UpdateManager.update();
  30. },
  31. Base: basePage,
  32. // 备注:为实现dayjs插件功能 需要在node_modules/dayjs/package.json,最外层添加代码
  33. // "miniprogram": "esm",
  34. // import localeData from "dayjs/plugin/localeData"
  35. // dayjs.extend(localeData)
  36. // dayjs.locale('zh-cn')
  37. // dayjs.months()[dayjs().month()]//获取中文月份
  38. // dayjs.locale('en')
  39. })