Files
xl-mobile/src/pages/messageCenter/index.vue

101 lines
2.7 KiB
Vue
Raw Normal View History

2025-03-25 16:35:39 +08:00
<script setup>
2025-03-28 10:48:50 +08:00
import XNav from "../../components/XNav.vue";
2025-07-24 16:03:29 +08:00
import {computed, reactive} from "vue";
2025-03-28 10:48:50 +08:00
import XInput from "../../components/XInput.vue";
import XLink from "../../components/XLink.vue";
import MessageCard from "../../components/MessageCard.vue";
2025-05-12 19:45:27 +08:00
import useTableQuery from "../../hooks/useTableQuery.js";
import Api from "../../api/index.js";
2025-07-24 11:00:48 +08:00
import {useSystemStore} from "../../pinia/SystemStore/index.js";
2025-03-25 16:35:39 +08:00
2025-07-24 11:00:48 +08:00
const SystemStore = useSystemStore();
2025-07-24 16:03:29 +08:00
const tabs = computed(() => [
2025-03-28 10:48:50 +08:00
{
name: '任务消息',
2025-07-24 11:00:48 +08:00
num: SystemStore.messageCount.one,
2025-03-28 10:48:50 +08:00
},
{
name: '平台消息',
2025-07-24 11:00:48 +08:00
num: SystemStore.messageCount.two,
2025-03-28 10:48:50 +08:00
},
2025-07-24 16:03:29 +08:00
]);
2025-05-12 19:45:27 +08:00
const po = reactive({
2025-07-23 19:06:07 +08:00
type: 0,
2025-06-23 19:07:23 +08:00
is_read: 99,
2025-05-12 19:45:27 +08:00
keyword: null,
});
const vo = reactive({
rows: [],
page: 0,
total: 0,
});
const {loading, pagination, initFetchData} = useTableQuery({
api: Api.system.getMessageCenter,
2025-07-22 18:38:39 +08:00
uuid: true,
2025-05-12 19:45:27 +08:00
parameter: po,
callback: (data) => {
Object.assign(vo, data);
}
});
const changeTab = ({index}) => {
po.type = index;
initFetchData();
}
2025-03-25 16:35:39 +08:00
</script>
<template>
<!--消息中心-->
2025-03-28 10:48:50 +08:00
<XNav :show-back="false"></XNav>
<view class="w-full bg-[#fff]">
2025-05-12 19:45:27 +08:00
<tui-tabs :tabs="tabs" :currentTab="po.type" @change="changeTab" height="90"></tui-tabs>
2025-03-28 10:48:50 +08:00
<view class="!pt-[24rpx] !pb-[28rpx] !px-[32rpx] !flex gap-[32rpx] items-center">
<view class="flex-grow">
2025-07-21 08:54:13 +08:00
<x-input v-model:model-value="po.keyword" height="72rpx"
:placeholder="`请输入要查询的${po.type===0?'任务编号':'标题'}`">
2025-03-28 10:48:50 +08:00
<template #prefix>
<tui-icon name="search" size="18" class="!mr-[12rpx]"></tui-icon>
</template>
</x-input>
</view>
2025-05-12 19:45:27 +08:00
<x-link @click="initFetchData">搜索</x-link>
2025-03-28 10:48:50 +08:00
</view>
</view>
2025-05-12 19:45:27 +08:00
<view class="!px-[20rpx] !py-[16rpx] box-border !h-[80rpx] !flex items-center">
2025-06-23 19:07:23 +08:00
<checkbox @click="() => {
po.is_read = po.is_read === 0 ? 99 : 0;
initFetchData();
}">只看未读
</checkbox>
2025-03-28 10:48:50 +08:00
</view>
2025-05-12 19:45:27 +08:00
<scroll-view
@refresherpulling="initFetchData()"
@scrolltolower="() => {
pagination.page++;
}"
class="h-[calc(100vh-500rpx)]"
scroll-y>
<view class="!flex flex-col !px-[20rpx]">
<MessageCard
2025-06-23 19:07:23 +08:00
@success="initFetchData"
2025-05-12 19:45:27 +08:00
:context-row="po.type === 0 ? 'ellipsis-1': 'ellipsis-2'"
:type="po.type"
:data="item"
:key="item.id"
v-for="item in vo.rows">
</MessageCard>
</view>
</scroll-view>
2025-03-25 16:35:39 +08:00
</template>
<style scoped>
</style>