Blame view

pages-sub/msg/index.vue 2.08 KB
4f475013   刘淇   k线图
1
2
  <template>
    <view class="user-center-page">
4570c70a   刘淇   消息中心
3
4
5
6
7
8
9
10
11
12
      <z-paging
          ref="paging"
          v-model="dataList"
          @query="queryList"
          :auto-show-system-loading="true"
  
      >
        <template #empty>
          <empty-view/>
        </template>
4f475013   刘淇   k线图
13
14
15
      <up-card
          :border="false"
          :foot-border-top="false"
4570c70a   刘淇   消息中心
16
          v-for="(item,index) in dataList"
4f475013   刘淇   k线图
17
18
19
20
21
22
23
          :key="`${item.orderNo}_${index}`"
          :show-head="false"
      >
  
        <template #body>
          <view class="card-body">
            <view class="u-flex common-item-center common-justify-between" style="font-size: 14px;margin-top: 5px;">
4570c70a   刘淇   消息中心
24
              <view class="u-line-1" style="flex: 1;margin-right: 20px;color: #333"> {{ item.templateCode || '无' }}</view>
4f475013   刘淇   k线图
25
26
27
              <view style="color: #000">{{ timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
            </view>
            <view class="u-line-1 ">
4570c70a   刘淇   消息中心
28
              {{ item.templateContent || '无' }}
4f475013   刘淇   k线图
29
30
31
32
33
34
            </view>
  
  
          </view>
        </template>
      </up-card>
4570c70a   刘淇   消息中心
35
      </z-paging>
4f475013   刘淇   k线图
36
37
38
39
40
41
42
43
44
45
46
47
48
    </view>
  </template>
  
  <script setup lang="ts">
  import { computed,ref } from 'vue'
  import { useUserStore } from '@/pinia/user'
  import {  onShow } from '@dcloudio/uni-app'
  import { getMsg } from '@/api/user'
  // 初始化Pinia仓库
  const userStore = useUserStore()
  import { timeFormat } from '@/uni_modules/uview-plus';
  // 计算属性获取用户信息(响应式)
  const userInfo = computed(() => userStore.userInfo.user || {})
4570c70a   刘淇   消息中心
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  
  const paging = ref(null);
  const dataList = ref([]);
  // 分页查询列表
  const queryList = async (pageNo, pageSize) => {
    try {
      const apiParams = {
        readStatus: false,
        pageNo,
        pageSize,
      };
      const  res = await getMsg(apiParams)
      // 适配z-paging分页
      paging.value.complete(res.list, res.total);
    } catch (error) {
      console.error('加载工单失败:', error);
      paging.value?.complete(false);
      uni.showToast({title:  res.msg||'加载失败,请重试', icon: 'none'});
4f475013   刘淇   k线图
67
    }
4570c70a   刘淇   消息中心
68
  };
4f475013   刘淇   k线图
69
  
4570c70a   刘淇   消息中心
70
71
72
73
  // // 页面显示时检查登录状态
  // onShow( async () => {
  //   const  res = await getMsg()
  // })
4f475013   刘淇   k线图
74
75
76
77
78
79
80
  </script>
  
  
  
  <style lang="scss" scoped>
  
  </style>