notify-system.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view class="notify-system">
  3. <custom-nav ref="ltm" :title="title"></custom-nav>
  4. <view class="content">
  5. <scroll-view scroll-y :style="{ height: scrollviewHeight + 'px' }">
  6. <view class="item" v-for="(item, index) in systemList" :key="index">
  7. <view class="top"><text></text>{{ item.title }}</view>
  8. <view class="mid" @tap="toDetail(item.url)">{{ item.message }}&nbsp;&nbsp;<text v-if="item.url">点击查看详情 >>> </text></view>
  9. <view class="bot">{{ item.time | formatTime }}</view>
  10. </view>
  11. <view class="nomore" :class="{ empty: !systemList.length }">--暂无更多--</view>
  12. </scroll-view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { _API_AppMessage_Read } from '@/apis/app.js'
  18. export default {
  19. data() {
  20. return {
  21. title: '系统通知',
  22. scrollviewHeight: 0
  23. }
  24. },
  25. computed: {
  26. systemList() { return [...this.$store.state.message.system, ...this.$store.state.message.systemLocal] }
  27. },
  28. mounted() { // 设置scrollview 高
  29. this.$offset('.content').then(res => this.scrollviewHeight = res.height) // 设置scrollview 高
  30. if (this.$store.state.message.system.length) { // 当系统通知有未读消息时
  31. this.$refs.ltm.loading()
  32. _API_AppMessage_Read({ type: 1 }).then(res => { // 将我的订单未读消息设置位已读
  33. this.$store.commit('message/setStorage', 1)
  34. })
  35. }
  36. },
  37. methods: {
  38. toDetail(url) {
  39. if (url) {
  40. uni.navigateTo({ url: `../app-webview/app-webview?url=${url}` })
  41. }
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. .notify-system {
  48. @include page();
  49. .content {
  50. .nomore {
  51. margin: 39rpx auto;
  52. text-align: center;
  53. &.empty {
  54. margin-top: 567rpx;
  55. }
  56. }
  57. .item {
  58. width: 690rpx;
  59. font-size: 26rpx;
  60. margin: 30rpx auto 0;
  61. background: #FFFFFF;
  62. border-radius: 10rpx;
  63. .top {
  64. @include flex();
  65. height: 58rpx;
  66. padding: 0 30rpx;
  67. box-sizing: border-box;
  68. justify-content: flex-start;
  69. border-bottom: 1rpx solid $app-base-bg;
  70. >text {
  71. width: 6rpx;
  72. height: 24rpx;
  73. margin-right: 10rpx;
  74. background: $app-base-color;
  75. }
  76. }
  77. .mid {
  78. padding: 0 30rpx;
  79. line-height: 56rpx;
  80. box-sizing: border-box;
  81. color: $app-sec-text-color;
  82. text {
  83. margin-left: 10rpx;
  84. color: $app-base-color;
  85. }
  86. }
  87. .bot {
  88. height: 40rpx;
  89. font-size: 24rpx;
  90. padding: 0 30rpx;
  91. text-align: right;
  92. line-height: 40rpx;
  93. box-sizing: border-box;
  94. border-top: 1rpx solid $app-base-bg;
  95. }
  96. }
  97. }
  98. }
  99. </style>