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

96 lines
2.5 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-05-12 19:45:27 +08:00
import {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-03-25 16:35:39 +08:00
2025-03-28 10:48:50 +08:00
const tabs = [
{
name: '任务消息',
},
{
name: '平台消息',
},
];
2025-05-12 19:45:27 +08:00
const po = reactive({
type: 1,
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,
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-05-12 19:45:27 +08:00
<x-input v-model:model-value="po.keyword" height="72rpx" placeholder="请输入要查询的内容">
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="() => {
console.log('进来了???')
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>