66b7ad5e6db51786b5aa46f95868927676c1469d.svn-base 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div style="height:100vh">
  3. <yd-navbar title="我的消息" color="#fff">
  4. <router-link :to="{path: '/PersonalCenter' }" slot="left">
  5. <yd-navbar-back-icon style="color: #fff"></yd-navbar-back-icon>
  6. </router-link>
  7. </yd-navbar>
  8. <section>
  9. <yd-pullrefresh id="messageCenter" :callback="loadList" ref="pullrefreshDemo">
  10. <yd-list theme="4">
  11. <yd-list-item v-for="(item,index) in list" :key="index" @click.native="goDetail(item)">
  12. <img slot="img" :src="item.read_status == -1 ? email_off : email_on" alt="">
  13. <span slot="title">{{item.title}}</span>
  14. <span slot="title" style="color: #999999; font-weight: normal; float: right;">{{item.write_time}}</span>
  15. <yd-list-other slot="other">
  16. <div class="content">{{item.content}}</div>
  17. </yd-list-other>
  18. </yd-list-item>
  19. </yd-list>
  20. </yd-pullrefresh>
  21. <ul style="text-align: center; margin-top: 50%; font-size: 16px" v-if="list.length < 1">
  22. 暂无数据
  23. </ul>
  24. </section>
  25. </div>
  26. </template>
  27. <script>
  28. import email_on from '../../../assets/st-imges/email_icon.png'
  29. import email_off from '../../../assets/st-imges/email_off.png'
  30. export default {
  31. name: "messageCenter.vue",
  32. data() {
  33. return {
  34. email: "",
  35. email_on: email_on,
  36. email_off: email_off,
  37. page: 1,
  38. list: []
  39. }
  40. },
  41. mounted() {
  42. this.loadList()
  43. },
  44. methods: {
  45. // 获取列表
  46. loadList() {
  47. // console.log('ok')
  48. this.$http.post(this.$ports.login.mesaageList, {
  49. type: 'pulldown',
  50. page: this.page,
  51. currentPage: this.page,
  52. pageSize: 8,
  53. token: localStorage.getItem("token")
  54. }).then((res) => {
  55. console.log(res.data.data, '获取消息列表')
  56. const _list = res.data.data.list;
  57. this.list = [..._list, ...this.list]
  58. this.$dialog.toast({
  59. mes: _list.length > 0 ? '为您更新了' + _list.length + '条内容' : '已是最新内容'
  60. });
  61. this.$refs.pullrefreshDemo.$emit('ydui.pullrefresh.finishLoad');
  62. this.page++;
  63. });
  64. },
  65. // 跳转详情
  66. goDetail(item) {
  67. // console.log(item)
  68. // // return false;
  69. this.$http.get(this.$ports.login.upStatus, {
  70. identity: item.identity,
  71. token: localStorage.getItem("token")
  72. }).then((res) => {
  73. console.log(res.data.data, '更新消息')
  74. });
  75. this.$router.push({
  76. name: 'MessageDetail',
  77. params: {
  78. id: item.identity
  79. }
  80. });
  81. this.$store.dispatch('SET_MESSAGEDETAIl', item)
  82. // sessionStorage.setItem('messageDetail', item);
  83. }
  84. }
  85. }
  86. </script>
  87. <style>
  88. #messageCenter .yd-list-theme4 .yd-list-item .yd-list-img {
  89. width: 0.52rem !important;
  90. padding: 0.5rem 0;
  91. }
  92. #messageCenter .yd-list-img img {
  93. width: 0.52rem;
  94. }
  95. #messageCenter .yd-list-theme4 {
  96. background: #E4E4E4;
  97. }
  98. #messageCenter .yd-list-img img,
  99. #messageCenter .yd-list-mes {
  100. background: #EFEFEF !important;
  101. }
  102. #messageCenter .yd-list-mes {
  103. padding-left: 0.5rem;
  104. }
  105. #messageCenter .content {
  106. width: 5.15rem;
  107. overflow: hidden;
  108. white-space: nowrap;
  109. text-overflow: ellipsis;
  110. background: #EFEFEF;
  111. }
  112. #messageCenter .yd-list-item {
  113. background: #EFEFEF;
  114. border-radius: 10px;
  115. padding: 0.25rem 0.29rem;
  116. overflow: hidden;
  117. margin: 0.25rem 0;
  118. }
  119. </style>
  120. <style scoped>
  121. .yd-btn-block {
  122. margin-top: 0.6rem;
  123. }
  124. .yd-navbar {
  125. background-image: linear-gradient(0deg, #565656 0%, #999999 100%);
  126. }
  127. .switch img {
  128. width: 0.3rem;
  129. height: 0.3rem;
  130. margin-left: 0.4rem;
  131. margin-top: 0.1rem;
  132. }
  133. .messageList {
  134. padding: 10px;
  135. }
  136. .messageList li {
  137. display: flex;
  138. justify-content: flex-start;
  139. background: #EFEFEF;
  140. border-radius: 10px;
  141. padding: 0.29rem;
  142. overflow: hidden;
  143. margin-bottom: 0.25rem;
  144. }
  145. .messageList img {
  146. width: 0.52rem;
  147. height: 0.38rem;
  148. margin-top: 0.10rem;
  149. margin-right: 0.15rem;
  150. }
  151. .item_text {
  152. width: 6.15rem;
  153. overflow: hidden;
  154. white-space: nowrap;
  155. text-overflow: ellipsis;
  156. }
  157. .item_title {
  158. display: flex;
  159. justify-content: space-between;
  160. }
  161. .item_title .name {
  162. color: #333333;
  163. font-size: 14px;
  164. white-space: nowrap;
  165. overflow: hidden;
  166. text-overflow: ellipsis;
  167. }
  168. .item_title .time {
  169. color: #999999;
  170. padding-top: 0.05rem;
  171. padding-right: 0.2rem;
  172. }
  173. .yd-scrollview {
  174. touch-action: none;
  175. }
  176. </style>