index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view>
  3. <Nav title="消息详情" isBack @goBack="handelBack" />
  4. <view class="content">
  5. <view class="section" v-if="msg">
  6. <view>
  7. <view class="title">{{msg.noticeTitle}}</view>
  8. </view>
  9. <view>
  10. <view class="time">发布日期:{{msg.createTime}}</view>
  11. </view>
  12. <view class="cont">
  13. <text>{{msg.noticeContent}}</text>
  14. </view>
  15. <view class="empty" v-if="!this.msg">
  16. <u-empty mode="data" icon="../../static/data.png">
  17. </u-empty>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. getToken
  26. } from "@/utils/auth.js"
  27. export default {
  28. data() {
  29. return {
  30. id: null,
  31. state: null,
  32. msg: null,
  33. }
  34. },
  35. onLoad(options) {
  36. this.id = options.id
  37. this.state = options.state
  38. if (this.id) {
  39. this.getMsg()
  40. }
  41. if (this.id && this.state === '0') {
  42. this.msgStatus()
  43. }
  44. },
  45. methods: {
  46. //返回按钮
  47. handelBack() {
  48. uni.switchTab({
  49. url: '/pages/message/index'
  50. });
  51. },
  52. //消息详情接口
  53. getMsg() {
  54. uni.$http.get('/messageNotice/getMessageNoticeById', {
  55. id: this.id
  56. }).then(res => {
  57. const data = res.data
  58. if (data.code === 200) {
  59. this.msg = data.data
  60. }
  61. })
  62. },
  63. //改变消息已读状态
  64. msgStatus() {
  65. uni.$http.post('/messageNotice/readMessageNoticeById?id=' + this.id)
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .content {
  72. padding: 25rpx;
  73. .section {
  74. position: relative;
  75. text-align: center;
  76. .title {
  77. font-size: 40rpx;
  78. margin-bottom: 40rpx;
  79. word-wrap: break-word
  80. }
  81. .time {
  82. font-size: 32rpx;
  83. color: #9fa297;
  84. }
  85. .cont {
  86. font-size:32rpx;
  87. margin-top: 60rpx;
  88. text-align: left;
  89. word-wrap: break-word
  90. }
  91. .empty {
  92. position: absolute;
  93. top: 0;
  94. right: 0;
  95. left: 0;
  96. bottom: 0;
  97. }
  98. }
  99. }
  100. </style>