messageDetail.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="msg-det">
  3. <view class="title">
  4. {{$t(msgData.title)}}
  5. </view>
  6. <view class="content">
  7. {{msgData.content}}
  8. </view>
  9. <view class="add-time">
  10. {{$t(`通知于`)}}{{msgData.add_time}}
  11. </view>
  12. <!-- #ifndef MP -->
  13. <home></home>
  14. <!-- #endif -->
  15. </view>
  16. </template>
  17. <script>
  18. import {
  19. getMsgDetails
  20. } from '@/api/user.js'
  21. import home from '@/components/home';
  22. export default {
  23. components: {
  24. home
  25. },
  26. data() {
  27. return {
  28. msgData: {}
  29. }
  30. },
  31. onLoad(option) {
  32. this.getMsgDetails(option.id)
  33. },
  34. methods: {
  35. getMsgDetails(id) {
  36. uni.showLoading({
  37. title: this.$t(`加载中`)
  38. });
  39. getMsgDetails(id).then(res => {
  40. uni.hideLoading();
  41. this.msgData = res.data
  42. console.log(res)
  43. }).catch(err => {
  44. uni.hideLoading();
  45. return this.$util.Tips({
  46. title: err
  47. });
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style scoped lang="scss">
  54. .msg-det {
  55. background-color: #fff;
  56. padding: 20rpx;
  57. .title {
  58. padding: 20rpx;
  59. font-size: 32rpx;
  60. font-weight: bold;
  61. padding-bottom: 20rpx;
  62. border-bottom: 1px solid #f2f2f2;
  63. }
  64. .add-time {
  65. color: #ababab;
  66. text-align: right;
  67. padding-right: 30rpx;
  68. margin-top: 30rpx;
  69. }
  70. .content {
  71. padding: 20rpx;
  72. color: #333;
  73. }
  74. }
  75. </style>