notice.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="notice clearfix" :style="{ paddingTop: CustomBar + 'px' }">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view v-else>
  11. <view class="navbar-wrap" :style="{ height: CustomBar + 'px', paddingTop: StatusBar + 'px' }">
  12. <view
  13. class="navbar-text"
  14. :style="{ lineHeight: CustomBar - StatusBar + 'px;', fontSize: fontSizeSetting + 'px;' }"
  15. >
  16. 消息 <image class="iconfont icon-qingli" @click="clearNews" src="@/static/tabBar/clean_notice.png"></image>
  17. </view>
  18. </view>
  19. <view class="container-notice">
  20. <view class="notice-cell" @click="navigateTo('/pages/notice/club/notice-order?messageType=1')">
  21. <view class="notice-cell-icon">
  22. <image class="icon-image" src="@/static/tabBar/play_notice.png" mode=""></image>
  23. </view>
  24. <view class="notice-cell-text"> 交易物流 <text class="cell-text">官方</text> </view>
  25. <view class="notice-cell-badge" v-if="tradeCount > 0">
  26. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num">
  27. {{ tradeCount | BadgeType }}
  28. </text>
  29. </view>
  30. </view>
  31. <view class="notice-cell" @click="navigateTo('/pages/notice/club/notice-users?messageType=2')">
  32. <view class="notice-cell-icon">
  33. <image class="icon-image" src="@/static/tabBar/user_notice.png" mode=""></image>
  34. </view>
  35. <view class="notice-cell-text"> 账户通知 <text class="cell-text">官方</text> </view>
  36. <view class="notice-cell-badge" v-if="accountCount > 0">
  37. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num">
  38. {{ accountCount | BadgeType }}
  39. </text>
  40. </view>
  41. </view>
  42. <view class="notice-cell" @click="navigateTo('/pages/notice/club/notice-server?messageType=3')">
  43. <view class="notice-cell-icon">
  44. <image class="icon-image" src="@/static/tabBar/server_notice.png" mode=""></image>
  45. </view>
  46. <view class="notice-cell-text"> 服务通知 <text class="cell-text">官方</text> </view>
  47. <view class="notice-cell-badge" v-if="notificationCount > 0">
  48. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num">
  49. {{ notificationCount | BadgeType }}
  50. </text>
  51. </view>
  52. </view>
  53. <view class="notice-cell" @click="navigateTo('/pages/notice/club/notice-coupon?messageType=4')">
  54. <view class="notice-cell-icon">
  55. <image class="icon-image" src="@/static/tabBar/preferential_notice.png" mode=""></image>
  56. </view>
  57. <view class="notice-cell-text"> 优惠促销 <text class="cell-text">官方</text> </view>
  58. <view class="notice-cell-badge" v-if="promotionCount > 0">
  59. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num">
  60. {{ promotionCount | BadgeType }}
  61. </text>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import { mapGetters, mapMutations } from 'vuex'
  70. export default {
  71. data() {
  72. return {
  73. skeletonShow: true,
  74. // CustomBar: this.CustomBar,
  75. // StatusBar: this.StatusBar,
  76. // fontSizeSetting: this.fontSizeSetting,
  77. CustomBar: '',
  78. StatusBar: '',
  79. fontSizeSetting: '',
  80. StaticUrl: '',
  81. clubId: 0,
  82. allCount:0,
  83. tradeCount: 0,
  84. accountCount: 0,
  85. notificationCount: 0,
  86. promotionCount: 0
  87. }
  88. },
  89. filters: {
  90. BadgeType: (val) => (val && val >= 99 ? '99+' : val), // 红点的提示信息
  91. },
  92. computed: {
  93. ...mapGetters(['hasLogin'])
  94. },
  95. watch: {},
  96. onPullDownRefresh() {
  97. uni.stopPullDownRefresh()
  98. },
  99. onShow() {
  100. console.log(this.hasLogin)
  101. if (this.hasLogin) {
  102. this.initData()
  103. } else {
  104. this.initLogin()
  105. }
  106. },
  107. methods: {
  108. initLogin() {
  109. console.log(111)
  110. uni.redirectTo({ url: '/pages/authorize/login-custom' })
  111. },
  112. initData() {
  113. this.skeletonShow = false
  114. this.getSystomInfo()
  115. },
  116. getSystomInfo() {
  117. uni.getSystemInfo({
  118. success: (e) => {
  119. if (e.platform == 'android') {
  120. this.CustomBar = e.statusBarHeight + 50
  121. } else {
  122. this.CustomBar = e.statusBarHeight + 45
  123. };
  124. this.StatusBar = e.statusBarHeight
  125. this.fontSizeSetting = e.fontSizeSetting
  126. }
  127. })
  128. },
  129. navigateTo(url) {
  130. uni.navigateTo({
  131. url: url,
  132. })
  133. },
  134. },
  135. }
  136. </script>
  137. <style lang="scss">
  138. .navbar-wrap {
  139. position: fixed;
  140. width: 100%;
  141. top: 0;
  142. z-index: 100000;
  143. box-sizing: border-box;
  144. background: #ffffff;
  145. .navbar-text {
  146. font-size: 30rpx;
  147. color: #000000;
  148. font-weight: 500;
  149. text-align: center;
  150. .iconfont {
  151. display: inline-block;
  152. width: 48rpx;
  153. height: 48rpx;
  154. border-radius: 50%;
  155. background-color: #f5f5f5;
  156. text-align: center;
  157. line-height: 48rpx;
  158. color: #666666;
  159. font-size: 30rpx;
  160. margin-left: 20rpx;
  161. }
  162. }
  163. }
  164. .container-notice {
  165. width: 100%;
  166. height: auto;
  167. box-sizing: border-box;
  168. padding: 0 24rpx;
  169. padding-top: 20rpx;
  170. .notice-cell {
  171. width: 100%;
  172. height: 130rpx;
  173. box-sizing: border-box;
  174. padding: 19rpx 0;
  175. border-bottom: 1px solid #e1e1e1;
  176. .notice-cell-icon {
  177. width: 92rpx;
  178. height: 92rpx;
  179. float: left;
  180. .icon-image {
  181. width: 92rpx;
  182. height: 92rpx;
  183. display: block;
  184. }
  185. }
  186. .notice-cell-text {
  187. width: 400rpx;
  188. height: 100%;
  189. line-height: 92rpx;
  190. font-size: 34rpx;
  191. text-align: left;
  192. margin-left: 24rpx;
  193. float: left;
  194. .cell-text {
  195. display: inline-block;
  196. height: 32rpx;
  197. padding: 0 11rpx;
  198. line-height: 32rpx;
  199. border-radius: 20rpx;
  200. text-align: center;
  201. border: 1px solid #e15616;
  202. font-size: 24rpx;
  203. color: #e15616;
  204. margin-left: 10rpx;
  205. }
  206. }
  207. .notice-cell-badge {
  208. width: 92rpx;
  209. height: 92rpx;
  210. float: right;
  211. box-sizing: border-box;
  212. padding: 25rpx 15rpx;
  213. text-align: right;
  214. }
  215. }
  216. }
  217. .uni-badge--small {
  218. -webkit-transform: scale(0.8);
  219. -ms-transform: scale(0.8);
  220. transform: scale(0.8);
  221. -webkit-transform-origin: center center;
  222. -ms-transform-origin: center center;
  223. transform-origin: center center;
  224. }
  225. .uni-badge {
  226. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  227. -webkit-box-sizing: border-box;
  228. box-sizing: border-box;
  229. font-size: 12px;
  230. line-height: 1;
  231. display: inline-block;
  232. padding: 3px 6px;
  233. color: #333;
  234. border-radius: 100px;
  235. background-color: #f1f1f1;
  236. }
  237. .uni-badge-error {
  238. color: #fff;
  239. background-color: #ff2a2a;
  240. }
  241. </style>