app.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. var util = require('./utils/util.js');
  2. var api = require('./config/api.js');
  3. var user = require('./utils/user.js');
  4. App({
  5. onLaunch: function () {
  6. const updateManager = wx.getUpdateManager();
  7. wx.getUpdateManager().onUpdateReady(function () {
  8. wx.showModal({
  9. title: '更新提示',
  10. content: '新版本已经准备好,是否重启应用?',
  11. success: function (res) {
  12. if (res.confirm) {
  13. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  14. updateManager.applyUpdate()
  15. }
  16. }
  17. })
  18. })
  19. /*网络状态
  20. wx.onNetworkStatusChange(function (res) {
  21. if (res.networkType === 'none') {
  22. wx.showToast({
  23. title: '网络已断开',
  24. icon: 'none'
  25. })
  26. } else if (res.networkType === "2g" || res.networkType === "3g")
  27. wx.showToast({
  28. title: '您的网络状态不佳,' + res.networkType + ',建议使用wifi',
  29. icon: 'none'
  30. });
  31. })*/
  32. //初始化小程序云开发
  33. //wx.cloud.init();
  34. },
  35. onShow: function (options) {
  36. /*是否授权登录*/
  37. user.checkLogin().then(res => {
  38. this.globalData.hasLogin = true;
  39. if (this.checkLoginReadyCallback) {
  40. this.checkLoginReadyCallback();
  41. }
  42. }).catch(() => {
  43. this.globalData.hasLogin = false;
  44. });
  45. //购物车数据显示
  46. //user.cartcount();
  47. },
  48. checkLoginReadyCallback: function () { //是否登录
  49. this.globalData.hasLogin = true;
  50. },
  51. globalData: {
  52. hasLogin: false, //是否授权登录
  53. isMember:false,//是否是会员
  54. userInfo: {},
  55. r_userid: 0, //推荐人id
  56. iscert: false, //是否注册过
  57. mapKey:'JA2BZ-XGOEU-UNZVD-46G64-S6MYJ-6BBF4',
  58. currentLocationName:"位置获取中",
  59. rId:'',//引荐人ID
  60. shareImage:'',
  61. recommend:{ //引荐人信息
  62. userName:'',
  63. avatarUrl:'',
  64. bCode:'',
  65. phone:'',
  66. unionId:'',
  67. openId:'',
  68. sessionKey:""
  69. },
  70. infoGoods:{
  71. picUrl:'',
  72. name:'',
  73. brief:"",
  74. type:'0'
  75. },//信息收集,
  76. infoAddress:{
  77. addressId:'',
  78. addressDetail:''
  79. },
  80. memberUserInfo:{
  81. nickName: '',
  82. avatarUrl: '/static/images/new/icon-user.png'
  83. }
  84. }
  85. })
  86. //购物车隐藏
  87. // {
  88. // "pagePath": "pages/tabBar/cart/cart",
  89. // "iconPath": "static/images/cart.png",
  90. // "selectedIconPath": "static/images/cart@selected.png",
  91. // "text": "购物车"
  92. // },