index.vue
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
<view class="user-center-page">
<z-paging
ref="paging"
v-model="dataList"
@query="queryList"
:auto-show-system-loading="true"
>
<template #empty>
<empty-view/>
</template>
<up-card
:border="false"
:foot-border-top="false"
v-for="(item,index) in dataList"
:key="`${item.orderNo}_${index}`"
:show-head="false"
>
<template #body>
<view class="card-body">
<view class="u-flex common-item-center common-justify-between" style="margin-top: 5px;">
<view class="u-line-1" style="flex: 1;margin-right: 20px;color: #333;font-size: 14px;"> {{ item.templateCode || '无' }}</view>
<view style="color: #030303;font-size: 12px;" >{{ timeFormat(item.createTime, 'yyyy-mm-dd') }}</view>
</view>
<view class="u-line-1 " style="font-size: 13px;color: #848484">
{{ item.templateContent || '无' }}
</view>
</view>
</template>
</up-card>
</z-paging>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { getMsg } from '@/api/user'
import { timeFormat } from '@/uni_modules/uview-plus';
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'});
}
};
// // 页面显示时检查登录状态
onShow( async () => {
// 初始化分页数据
paging.value?.reload()
})
</script>
<style lang="scss" scoped>
</style>
<script setup lang="ts">
</script>