mineMessage.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div class="mineMessage">
  3. <div class="msgItem" v-for="item in msgList" @click="toDetail(item)">
  4. <div class="msgItemLeft">
  5. <img src="./image/msgIcon.png" class="msgIcon">
  6. <div class="redDoll" v-show="item.isNew"></div>
  7. </div>
  8. <div class="msgItemRight">
  9. <div class="msgItemName">{{ item.content }}!</div>
  10. <div class="msgItemTime">{{ item.createdAt }}</div>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import { getMyList,getUserLocalStorageInfo,updateInformation,parkSystemMsgReadAdd } from "@/js_sdk/http";
  17. export default {
  18. name: "mineMessage",
  19. data(){
  20. return{
  21. msgList:[
  22. // {name:'您有一条最新政策待查看',isNew:false},
  23. // {name:'您有一条最新政策待查看',isNew:true},
  24. // {name:'您有一条最新政策待查看',isNew:false},
  25. ],
  26. requestParam: {
  27. userId: getUserLocalStorageInfo().userId,
  28. userType: getUserLocalStorageInfo().userType,
  29. },
  30. total:0
  31. }
  32. },
  33. // mounted(){
  34. // this.getList()
  35. // },
  36. onShow(){
  37. this.getList()
  38. },
  39. methods:{
  40. getList(){
  41. this.msgList = []
  42. getMyList(this.requestParam).then(res=>{
  43. res.forEach(element => {
  44. const json = this.getItemJson(element)
  45. this.msgList.push(json)
  46. })
  47. })
  48. },
  49. getItemJson(item){
  50. item.isNew = item.readStatus == '0'
  51. return item
  52. },
  53. toDetail(item){
  54. // 1 反馈 2 资源预约 3 政策
  55. let url = ''
  56. if(item.type === '1'){
  57. this.readMsg(item)
  58. url = '/pages/subPackages/minePages/feedback_detail?id=' + item.businessId
  59. }
  60. if(item.type === '2'){
  61. this.readMsg(item)
  62. url = '/pages/subPackages/resourceReservation_manage/edit?id=' + item.businessId
  63. }
  64. if(item.type === '3'){
  65. this.readSysMsg(item)
  66. url = '/pages/subPackages/industrialPolicy/detail?id='+item.businessId
  67. }
  68. uni.navigateTo({
  69. url: url
  70. })
  71. },
  72. readMsg(item){
  73. const data = {
  74. id: item.id,
  75. status: '1'
  76. }
  77. updateInformation(data)
  78. },
  79. readSysMsg(item){
  80. const data = {
  81. msg_id: item.businessId,
  82. user_type: getUserLocalStorageInfo().userType,
  83. userId: getUserLocalStorageInfo().userId,
  84. }
  85. parkSystemMsgReadAdd(data)
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. .mineMessage{
  92. padding:32rpx;
  93. .msgItem{
  94. width: 686rpx;
  95. height: 162rpx;
  96. background: white;
  97. box-sizing: border-box;
  98. border-radius: 16rpx;
  99. display: flex;
  100. align-items: center;
  101. padding-left: 32rpx;
  102. margin-bottom: 24rpx;
  103. .msgItemLeft{
  104. position: relative;
  105. .msgIcon{
  106. width: 80rpx;
  107. height: 80rpx;
  108. }
  109. .redDoll {
  110. position: absolute;
  111. right: 0;
  112. top: 0;
  113. width: 16rpx;
  114. height: 16rpx;
  115. background: #f25551;
  116. border-radius: 50%;
  117. }
  118. }
  119. .msgItemRight{
  120. display: flex;
  121. flex-direction: column;
  122. justify-content: center;
  123. margin-left: 16rpx;
  124. .msgItemTime{
  125. color: #888888;
  126. font-size: 28rpx;
  127. margin-top: 8rpx;
  128. }
  129. .msgItemName{
  130. font-size: 32rpx;
  131. color: #222222;
  132. }
  133. }
  134. }
  135. }
  136. </style>