yangan
2024-01-31 adc14180ebdc6b3a5251034a0693289dfa015161
pages/public-page/messageDetails/messageDetails.vue
@@ -1,55 +1,67 @@
<template>
   <view>
      <combined-title title="消息详情"></combined-title>
      <view class="compDetails" v-for="(item, index) in detail" :key="index">
         <uni-table border stripe emptyText="暂无更多数据">
            <uni-tr>
               <uni-th align="left">消息标题</uni-th>
               <uni-td align="left">{{ item.title || '' }}</uni-td>
            </uni-tr>
            <uni-tr>
               <uni-th align="left">消息内容</uni-th>
               <uni-td align="left">{{ item.content || '' }}</uni-td>
            </uni-tr>
            <uni-tr>
               <uni-th align="left">创建时间</uni-th>
               <uni-td align="left">{{ item.createTime || '' }}</uni-td>
            </uni-tr>
         </uni-table>
   <view class="main">
      <view class="main-title">
         {{title}}
      </view>
      <u-divider text="这是一条分割线"
         textColor="#2979ff"
         lineColor="#2979ff"
         textSize='20'></u-divider>
      <view class="main-content">
         <u-parse :content="content"
            :lazyLoad="true"
            :selectable="true"></u-parse>
      </view>
   </view>
</template>
<script>
export default {
   data() {
      return {
         index: '',
         detail: []
      };
   },
   onLoad(v) {
      this.index = v.index;
   },
   onShow() {
      this.messageReq();
   },
   methods: {
      messageReq() {
         uni.showLoading({
            title: '加载中'
         });
         this.$reqGet('getMessageByUser', { current: 1, size: 10 }).then(res => {
            if (res.code == 0) {
               uni.hideLoading();
               this.detail = res.data.records.filter((v, i) => i == this.index);
            } else {
               this.$u.toast('加载失败');
            }
         });
   export default {
      data() {
         return {
            index: '',
            detail: {},
            messageId: '',
            id: '',
            content: '',
            title: ''
         };
      },
      onLoad(v) {
         this.messageId = v.messageId;
         this.id = v.id;
      },
      onShow() {
         this.getDetail();
      },
      methods: {
         getDetail() {
            this.$reqGet('getMsgDetail', { messageId: this.messageId, id: this.id }).then(res => {
               this.detail = res.data;
               this.content = this.detail.content;
               this.title = this.detail.title;
            });
         }
      }
   }
};
   };
</script>
<style></style>
<style lang="scss"
   scoped>
   @mixin flex {
      display: flex;
      justify-content: center;
      align-items: center;
   }
   .main {
      width: 100%;
      height: 100%;
      .main-title,
      .main-content {
         width: 94%;
         margin: vww(10) auto;
      }
   }
</style>