App.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <script>
  2. /**
  3. * vuex管理登陆状态,具体可以参考官方登陆模板示例
  4. */
  5. import Vue from 'vue'
  6. import { mapActions, mapMutations } from 'vuex'
  7. export default {
  8. onLaunch: function() {
  9. this.initSystemInfo()
  10. // 判断优惠券弹窗是否显示
  11. this.checkShowCouponPopup()
  12. },
  13. methods: {
  14. ...mapActions('app', ['setWindowHeight', 'setVariableFun']),
  15. ...mapMutations('coupon', ['setCouponPopupStatus']),
  16. ...mapMutations('app', ['setWindowHeight']),
  17. // 验证是否需要显示优惠券入口弹窗
  18. checkShowCouponPopup() {
  19. const couponPopupType = uni.getStorageSync('couponPopupType')
  20. const nowDay = new Date().getDay()
  21. // 新用户 当天不弹窗
  22. if (couponPopupType === nowDay) {
  23. this.setCouponPopupStatus(false)
  24. }
  25. },
  26. initSystemInfo() {
  27. let self = this
  28. uni.getSystemInfo({
  29. success: function(e) {
  30. let modelmes = e.model
  31. self.setWindowHeight(e.windowHeight)
  32. // iphone x以上的版本都要控制下巴高度
  33. if (/iphone [1|x]\s?/i.test(modelmes)) {
  34. self.setVariableFun(true)
  35. } else {
  36. self.setVariableFun(false)
  37. }
  38. // #ifndef MP
  39. Vue.prototype.StatusBar = e.statusBarHeight
  40. if (e.platform == 'android') {
  41. Vue.prototype.CustomBar = e.statusBarHeight + 50
  42. Vue.prototype.platformClass = true
  43. } else {
  44. Vue.prototype.CustomBar = e.statusBarHeight + 45
  45. Vue.prototype.platformClass = false
  46. }
  47. // #endif
  48. // #ifdef MP-WEIXIN || MP-QQ
  49. if (e.platform == 'android') {
  50. Vue.prototype.platformClass = 'left'
  51. self.setVariableFun(false)
  52. } else {
  53. Vue.prototype.platformClass = 'center'
  54. self.setVariableFun(true)
  55. }
  56. Vue.prototype.StatusBar = e.statusBarHeight
  57. Vue.prototype.fontSizeSetting = e.fontSizeSetting
  58. Vue.prototype.screenWidth = e.screenWidth
  59. let capsule = wx.getMenuButtonBoundingClientRect()
  60. Vue.prototype.capsule = capsule
  61. if (capsule) {
  62. Vue.prototype.Custom = capsule
  63. Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight
  64. } else {
  65. Vue.prototype.CustomBar = e.statusBarHeight + 50
  66. }
  67. // #endif
  68. // #ifdef MP-ALIPAY
  69. Vue.prototype.StatusBar = e.statusBarHeight
  70. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight
  71. // #endif
  72. }
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. /*每个页面公共css */
  80. @import '@/common/css/common.scss';
  81. @import '@/common/css/iconfont.scss';
  82. @import '@/common/css/style/thorui.css';
  83. @import '@/common/css/style/icon.css';
  84. view,
  85. scroll-view,
  86. swiper,
  87. swiper-item,
  88. cover-view,
  89. cover-image,
  90. icon,
  91. text,
  92. rich-text,
  93. progress,
  94. button,
  95. checkbox,
  96. form,
  97. input,
  98. label,
  99. radio,
  100. slider,
  101. switch,
  102. textarea,
  103. navigator,
  104. audio,
  105. camera,
  106. image,
  107. video {
  108. // box-sizing: border-box;
  109. }
  110. // page {
  111. // width: 100%;
  112. // height: 100%;
  113. // background: #fff;
  114. // filter: grayscale(100%);
  115. // filter: gray;
  116. // filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
  117. // --toast-default-width: 114px;
  118. // }
  119. page {
  120. height: 100%;
  121. background-color: #ffffff;
  122. }
  123. /* 骨架屏替代方案 */
  124. .Skeleton {
  125. background: #f3f3f3;
  126. padding: 20upx 0;
  127. border-radius: 8upx;
  128. }
  129. .clamp {
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. white-space: nowrap;
  133. display: block;
  134. }
  135. .common-hover {
  136. background: #f5f5f5;
  137. }
  138. /* input 样式 */
  139. .input-placeholder {
  140. color: #999999;
  141. }
  142. .placeholder {
  143. color: #999999;
  144. }
  145. .uni-swiper__dots-box {
  146. display: none !important;
  147. }
  148. </style>