index.vue 1.7 KB

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