index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. console.log(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. getMsg() {
  48. uni.$http.get('/messageNotice/getMessageNoticeById', {
  49. id: this.id
  50. }).then(res => {
  51. const data = res.data
  52. if (data.code === 200) {
  53. this.msg = data.data
  54. }
  55. })
  56. },
  57. //改变消息已读状态
  58. msgStatus() {
  59. uni.$http.post('/messageNotice/readMessageNoticeById?id=' + this.id)
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .content {
  66. padding: 25rpx;
  67. .section {
  68. position: relative;
  69. text-align: center;
  70. .title {
  71. font-size: 36rpx;
  72. margin-bottom: 40rpx;
  73. word-wrap: break-word
  74. }
  75. .time {
  76. font-size: 32rpx;
  77. color: #9fa297;
  78. }
  79. .cont {
  80. font-size:32rpx;
  81. margin-top: 60rpx;
  82. text-align: left;
  83. word-wrap: break-word
  84. }
  85. .empty {
  86. position: absolute;
  87. top: 0;
  88. right: 0;
  89. left: 0;
  90. bottom: 0;
  91. }
  92. }
  93. }
  94. </style>