index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. 消息 <text @click="clearNews" class="iconfont icon-qingli"></text>
  17. </view>
  18. </view>
  19. <view class="container-notice">
  20. <view class="notice-cell" @click="navigator('/pages/notice/club/notice-order')">
  21. <view class="notice-cell-icon">
  22. <image class="icon-image" :src="StaticUrl + 'icon/icon-notice-order@2x.png'" mode=""></image>
  23. </view>
  24. <view class="notice-cell-text"> 交易物流 <text class="cell-text">官方</text> </view>
  25. <view class="notice-cell-badge">
  26. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"> 99+ </text>
  27. </view>
  28. </view>
  29. <view class="notice-cell" @click="navigator('/pages/notice/club/notice-users')">
  30. <view class="notice-cell-icon">
  31. <image class="icon-image" :src="StaticUrl + 'icon/icon-notice-users@2x.png'" mode=""></image>
  32. </view>
  33. <view class="notice-cell-text"> 账户通知 <text class="cell-text">官方</text> </view>
  34. <view class="notice-cell-badge">
  35. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"> 99+ </text>
  36. </view>
  37. </view>
  38. <view class="notice-cell" @click="navigator('/pages/notice/club/notice-serve')">
  39. <view class="notice-cell-icon">
  40. <image class="icon-image" :src="StaticUrl + 'icon/icon-notice-serve@2x.png'" mode=""></image>
  41. </view>
  42. <view class="notice-cell-text"> 服务通知 <text class="cell-text">官方</text> </view>
  43. <view class="notice-cell-badge">
  44. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"> 5 </text>
  45. </view>
  46. </view>
  47. <view class="notice-cell" @click="navigator('/pages/notice/club/notice-coupon')">
  48. <view class="notice-cell-icon">
  49. <image class="icon-image" :src="StaticUrl + 'icon/icon-notice-coupon@2x.png'" mode=""></image>
  50. </view>
  51. <view class="notice-cell-text"> 优惠促销 <text class="cell-text">官方</text> </view>
  52. <view class="notice-cell-badge">
  53. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"> 10 </text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import { mapState, mapMutations } from 'vuex'
  62. export default {
  63. data() {
  64. return {
  65. CustomBar: this.CustomBar,
  66. StatusBar: this.StatusBar,
  67. StaticUrl: this.$Static,
  68. skeletonShow:true
  69. }
  70. },
  71. onLoad() {},
  72. computed: {
  73. ...mapState(['hasLogin', 'userInfo'])
  74. },
  75. methods: {
  76. async initData() {
  77. const userInfo = await this.$api.getStorage()
  78. this.skeletonShow = true //预加载圆圈
  79. this.userId = userInfo.userId ? userInfo.userId : 0
  80. this.initGetCartGoodsList()
  81. },
  82. clearNews() {
  83. this.$util.msg('已将所有消息标记为已读', 2000)
  84. },
  85. initGetCartGoodsList() {
  86. console.log('获取消息通知数据')
  87. this.skeletonShow = false
  88. },
  89. initLogin() {
  90. this.$api.redirectTo('/pages/login/login')
  91. },
  92. navigator(url) {
  93. this.$api.navigateTo(url)
  94. },
  95. },
  96. onPullDownRefresh() {
  97. //下拉刷新
  98. uni.stopPullDownRefresh()
  99. },
  100. onShow() {
  101. if (this.hasLogin) {
  102. this.initData()
  103. } else {
  104. this.initLogin()
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. .navbar-wrap {
  111. position: fixed;
  112. width: 100%;
  113. top: 0;
  114. z-index: 100000;
  115. box-sizing: border-box;
  116. background: #ffffff;
  117. .navbar-text {
  118. font-size: 30rpx;
  119. color: #000000;
  120. font-weight: 500;
  121. text-align: center;
  122. .iconfont {
  123. display: inline-block;
  124. width: 48rpx;
  125. height: 48rpx;
  126. border-radius: 50%;
  127. background-color: #f5f5f5;
  128. text-align: center;
  129. line-height: 48rpx;
  130. color: #666666;
  131. font-size: 30rpx;
  132. margin-left: 20rpx;
  133. }
  134. }
  135. }
  136. .container-notice {
  137. width: 100%;
  138. height: auto;
  139. box-sizing: border-box;
  140. padding: 0 24rpx;
  141. padding-top: 20rpx;
  142. .notice-cell {
  143. width: 100%;
  144. height: 130rpx;
  145. box-sizing: border-box;
  146. padding: 19rpx 0;
  147. border-bottom: 1px solid #e1e1e1;
  148. .notice-cell-icon {
  149. width: 92rpx;
  150. height: 92rpx;
  151. float: left;
  152. .icon-image {
  153. width: 92rpx;
  154. height: 92rpx;
  155. display: block;
  156. }
  157. }
  158. .notice-cell-text {
  159. width: 400rpx;
  160. height: 100%;
  161. line-height: 92rpx;
  162. font-size: 34rpx;
  163. text-align: left;
  164. margin-left: 24rpx;
  165. float: left;
  166. .cell-text {
  167. display: inline-block;
  168. height: 32rpx;
  169. padding: 0 11rpx;
  170. line-height: 32rpx;
  171. border-radius: 20rpx;
  172. text-align: center;
  173. border: 1px solid #e15616;
  174. font-size: 24rpx;
  175. color: #e15616;
  176. margin-left: 10rpx;
  177. }
  178. }
  179. .notice-cell-badge {
  180. width: 92rpx;
  181. height: 92rpx;
  182. float: right;
  183. box-sizing: border-box;
  184. padding: 25rpx 15rpx;
  185. text-align: right;
  186. }
  187. }
  188. }
  189. .uni-badge--small {
  190. -webkit-transform: scale(0.8);
  191. -ms-transform: scale(0.8);
  192. transform: scale(0.8);
  193. -webkit-transform-origin: center center;
  194. -ms-transform-origin: center center;
  195. transform-origin: center center;
  196. }
  197. .uni-badge {
  198. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  199. -webkit-box-sizing: border-box;
  200. box-sizing: border-box;
  201. font-size: 12px;
  202. line-height: 1;
  203. display: inline-block;
  204. padding: 3px 6px;
  205. color: #333;
  206. border-radius: 100px;
  207. background-color: #f1f1f1;
  208. }
  209. .uni-badge-error {
  210. color: #fff;
  211. background-color: #ff2a2a;
  212. }
  213. </style>