1
0

app.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //app.js viptime
  2. // appid wx842cf17c56448e51
  3. // appid 装修宝 wxf33092e34e6ae8b1
  4. var d = new Date()
  5. App({
  6. globalData:{
  7. statusBarHeight:'',
  8. titleBarHeight:44,
  9. imgUrl:'https://o.nczyzs.com/',//imgzqxgtest
  10. wburl:'https://img.yunxiekeji.cn',
  11. simgUrl:'https://wzh-zqxg.oss-cn-hangzhou.aliyuncs.com/',
  12. webUrl:'https://wzh.nczyzs.com/',//测试环境 saastest https://saasdev.zhuangqixiaoguan.com/,正式环境https://wzh.nczyzs.com/
  13. token:'',
  14. userflag:false,//true是有个人信息,false没有个人信息
  15. phone:false,//true是有手机号,false是没有手机号
  16. shareuserid:'',//分享人的id
  17. currentUserId: '',
  18. brokeruserId: '',
  19. companyobj:{},
  20. shareperson:{},
  21. sharempid:'',
  22. personMsg:{},//org_type 2是设计师,其他的是销售
  23. unreadNum:0,
  24. official_openid: null,
  25. screenHeight:'100%',
  26. sharename:'',//分享人的昵称
  27. timearr:[],
  28. addstate:'',//add是添加客户页面,list是客户列表页面
  29. clientype:'',
  30. companyname:'',
  31. platform: '',
  32. vraddress: '',
  33. sharepersonobj:{},
  34. timeline:'',//1是从“单页模式”打开小程序”,2是朋友圈内打开“单页模式”
  35. },
  36. onLaunch: function (opts) {
  37. var that = this;
  38. // wx.loadFontFace({
  39. // family: 'digifaw',
  40. // global:true,
  41. // source: 'url("https://wzh.nczyzs.com/static/fonts/digifaw.ttf")',
  42. // success: console.log
  43. // })
  44. this.globalData.timearr = [];
  45. const updateManager = wx.getUpdateManager()
  46. updateManager.onCheckForUpdate(function (res) {
  47. // 请求完新版本信息的回调
  48. console.log(res.hasUpdate)
  49. })
  50. updateManager.onUpdateReady(function () {
  51. wx.showModal({
  52. title: '更新提示',
  53. content: '新版本已经准备好,是否重启应用?',
  54. success: function (res) {
  55. if (res.confirm) {
  56. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  57. updateManager.applyUpdate()
  58. }
  59. }
  60. })
  61. })
  62. updateManager.onUpdateFailed(function () {
  63. // 新的版本下载失败
  64. wx.showModal({
  65. title: '更新提示',
  66. content: '新版本下载失败',
  67. showCancel: false
  68. })
  69. })
  70. wx.getSystemInfo({
  71. success: (res) => {
  72. that.globalData.screenHeight = res.safeArea.height;
  73. that.globalData.platform = res.platform;
  74. that.globalData.statusBarHeight = res.statusBarHeight;
  75. if (!!that.globalData.statusBarHeight && res.platform != 'devtools') {
  76. wx.setStorage({
  77. key: "statusBarHeight",
  78. data: res.statusBarHeight
  79. })
  80. }
  81. },
  82. fail: (res) => {
  83. }
  84. })
  85. var that = this;
  86. var obj = wx.getLaunchOptionsSync();
  87. if(obj.scene==1155){
  88. that.globalData.timeline=1;
  89. if(obj.path=='index/pages/namecard/namecard'){
  90. wx.reLaunch({
  91. url:'/share/pages/shareCard/shareCard?uid=' + obj.query.uid + '&empid=' + obj.query.empid + '&ctp=' + obj.query.ctp,
  92. })
  93. }
  94. }else if(obj.scene==1154&&(obj.path=='index/pages/namecard/namecard'||obj.path=='share/pages/shareCard/shareCard'||obj.path=='pages/index/index')){
  95. that.globalData.timeline=2;
  96. }else{
  97. that.globalData.timeline='';
  98. }
  99. },
  100. onShow: function (options) {
  101. var that = this;
  102. var obj = wx.getLaunchOptionsSync();
  103. if(obj.scene==1155){
  104. that.globalData.timeline=1;
  105. if(obj.path=='index/pages/namecard/namecard'){
  106. wx.reLaunch({
  107. url:'/share/pages/shareCard/shareCard?uid=' + obj.query.uid + '&empid=' + obj.query.empid + '&ctp=' + obj.query.ctp,
  108. })
  109. }
  110. }else if(obj.scene==1154&&(obj.path=='index/pages/namecard/namecard'||obj.path=='share/pages/shareCard/shareCard'||obj.path=='pages/index/index')){
  111. that.globalData.timeline=2;
  112. }else{
  113. that.globalData.timeline='';
  114. }
  115. wx.getStorage({
  116. key: 'lastpath',
  117. success(res) {
  118. let arr = obj.path.split('/');
  119. if (res.data == obj.path && obj.path == 'mycustomer/pages/invite/invite') {
  120. wx.reLaunch({
  121. url: '/pages/index/index',
  122. })
  123. }
  124. }
  125. })
  126. if (obj.path == 'mycustomer/pages/invite/invite') {
  127. wx.removeStorage({
  128. key: "lastpath",
  129. })
  130. } else {
  131. wx.setStorage({
  132. key: "lastpath",
  133. data: obj.path
  134. })
  135. }
  136. },
  137. })