app.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //app.js
  2. App({
  3. onLaunch: function (options) {
  4. // // 判断是否由分享进入小程序
  5. // if (options.scene == 1007 || options.scene == 1008) {
  6. // this.globalData.share = true
  7. // } else {
  8. // this.globalData.share = false
  9. // };
  10. // //获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度)
  11. // //这个最初我是在组件中获取,但是出现了一个问题,当第一次进入小程序时导航栏会把
  12. // //页面内容盖住一部分,当打开调试重新进入时就没有问题,这个问题弄得我是莫名其妙
  13. // //虽然最后解决了,但是花费了不少时间
  14. // wx.getSystemInfo({
  15. // success: (res) => {
  16. // this.globalData.height = res.statusBarHeight
  17. // }
  18. // })
  19. if (wx.cloud) {
  20. wx.cloud.init({
  21. traceUser: true
  22. })
  23. }
  24. wx.getSystemInfo({
  25. success: e => {
  26. this.globalData.StatusBar = e.statusBarHeight;
  27. let capsule = wx.getMenuButtonBoundingClientRect();
  28. if (capsule) {
  29. this.globalData.Custom = capsule;
  30. this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
  31. } else {
  32. this.globalData.CustomBar = e.statusBarHeight + 50;
  33. }
  34. }
  35. })
  36. },
  37. globalData: {
  38. ColorList: [{
  39. title: '嫣红',
  40. name: 'red',
  41. color: '#e54d42'
  42. },
  43. {
  44. title: '桔橙',
  45. name: 'orange',
  46. color: '#f37b1d'
  47. },
  48. {
  49. title: '明黄',
  50. name: 'yellow',
  51. color: '#fbbd08'
  52. },
  53. {
  54. title: '橄榄',
  55. name: 'olive',
  56. color: '#8dc63f'
  57. },
  58. {
  59. title: '森绿',
  60. name: 'green',
  61. color: '#39b54a'
  62. },
  63. {
  64. title: '天青',
  65. name: 'cyan',
  66. color: '#1cbbb4'
  67. },
  68. {
  69. title: '海蓝',
  70. name: 'blue',
  71. color: '#0081ff'
  72. },
  73. {
  74. title: '姹紫',
  75. name: 'purple',
  76. color: '#6739b6'
  77. },
  78. {
  79. title: '木槿',
  80. name: 'mauve',
  81. color: '#9c26b0'
  82. },
  83. {
  84. title: '桃粉',
  85. name: 'pink',
  86. color: '#e03997'
  87. },
  88. {
  89. title: '棕褐',
  90. name: 'brown',
  91. color: '#a5673f'
  92. },
  93. {
  94. title: '玄灰',
  95. name: 'grey',
  96. color: '#8799a3'
  97. },
  98. {
  99. title: '草灰',
  100. name: 'gray',
  101. color: '#aaaaaa'
  102. },
  103. {
  104. title: '墨黑',
  105. name: 'black',
  106. color: '#333333'
  107. },
  108. {
  109. title: '雅白',
  110. name: 'white',
  111. color: '#ffffff'
  112. },
  113. ]
  114. },
  115. globalData: {
  116. share: false, // 分享默认为false
  117. height: 0,
  118. publicUrl: 'https://jlxwjr.jljrkg.com/',
  119. imageUrl: 'https://jlxwjr.jljrkg.com',
  120. }
  121. })