This commit is contained in:
王一嘉
2025-07-22 18:38:39 +08:00
parent d4b90b09f8
commit 8d4c585e53
7 changed files with 55 additions and 14 deletions

View File

@@ -407,7 +407,14 @@ const system = {
setExchangeTop: async (data) => { setExchangeTop: async (data) => {
return request({ return request({
method: MethodsENUM.POST, method: MethodsENUM.POST,
url: "/task/setExchangeTop", url: "/task/setChildrenTop",
data: data
});
},
setChildrenRead: async (data) => {
return request({
method: MethodsENUM.POST,
url: "/task/setChildrenRead",
data: data data: data
}); });
}, },

View File

@@ -25,20 +25,21 @@ const {contextRow, type, data} = defineProps({
}); });
const itemList = computed(() => { const itemList = computed(() => {
const tp = SystemStore.message.find(v => v.id === data.id);
const list = type === 0 ? [ const list = type === 0 ? [
{text: '置顶', type: 1, hide: data.is_top === 1}, {text: '置顶', type: 1, hide: data.is_top === 1},
{text: '取消置顶', type: 0, hide: data.is_top === 0}, {text: '取消置顶', type: 0, hide: data.is_top === 0},
{text: '标记已读', type: 0, hide: data.is_read === 0}, {text: '标记已读', type: 1, hide: data.is_read === 0},
{text: '标记未读', type: 1, hide: data.is_read === 1}, {text: '标记未读', type: 0, hide: data.is_read > 0},
] : [ ] : [
{text: '标记已读', type: 0, hide: data.is_read === 0}, {text: '标记已读', type: 0, hide: tp.is_read},
{text: '标记未读', type: 1, hide: data.is_read === 1}, {text: '标记未读', type: 1, hide: !tp.is_read},
] ]
return list.filter(v => !v.hide); return list.filter(v => !v.hide);
}) })
const selectActionsheet = async (e) => { const selectActionsheet = async (e) => {
if (type === 0) { if (e.text === '置顶' || e.text === '取消置顶') {
const {msg} = await Api.system.setExchangeTop({ const {msg} = await Api.system.setExchangeTop({
id: data.id, id: data.id,
type: e.type, type: e.type,
@@ -46,8 +47,17 @@ const selectActionsheet = async (e) => {
showToast(msg); showToast(msg);
emits('success'); emits('success');
} else { } else {
const index = SystemStore.message.findIndex(v => v.id === data.id); if (type === 0) {
SystemStore.message[index].is_read = true; const {msg} = await Api.system.setChildrenRead({
id: data.id,
type: e.type,
});
showToast(msg);
emits('success');
} else {
const index = SystemStore.message.findIndex(v => v.id === data.id);
SystemStore.message[index].is_read = !SystemStore.message[index].is_read;
}
} }
} }
@@ -75,7 +85,7 @@ onMounted(() => {
class="!py-[30rpx] !px-[24rpx] bg-[#fff] rounded-[8rpx] !flex items-center gap-[20rpx] overflow-hidden relative !mb-[20rpx]"> class="!py-[30rpx] !px-[24rpx] bg-[#fff] rounded-[8rpx] !flex items-center gap-[20rpx] overflow-hidden relative !mb-[20rpx]">
<view class="relative"> <view class="relative">
<image class="!size-[72rpx] flex-shrink-0" mode="aspectFill" :src="messageIcon"></image> <image class="!size-[72rpx] flex-shrink-0" mode="aspectFill" :src="messageIcon"></image>
<view v-if="type === 0 ? data.is_read===0 : !SystemStore.message.find(v => v.id===data.id).is_read" <view v-if="type === 0 ? data.is_read>0 : !SystemStore.message.find(v => v.id===data.id).is_read"
class="size-[20rpx] bg-[#f00] absolute right-0 top-0 rounded-[50%]"></view> class="size-[20rpx] bg-[#f00] absolute right-0 top-0 rounded-[50%]"></view>
</view> </view>

View File

@@ -5,6 +5,7 @@ const emits = defineEmits(['success']);
const show = ref(false); const show = ref(false);
const success = (e) => { const success = (e) => {
show.value = false;
emits('success', e); emits('success', e);
} }
</script> </script>
@@ -19,7 +20,6 @@ const success = (e) => {
:show="show" :show="show"
@click="success" @click="success"
@cancel="show=false"> @cancel="show=false">
</tui-actionsheet> </tui-actionsheet>
</template> </template>

View File

@@ -1,23 +1,40 @@
<script setup> <script setup>
const visible = defineModel('visible'); const visible = defineModel('visible');
const model = defineModel('model'); const model = defineModel('model');
const emits = defineEmits(['success']); const emits = defineEmits(['success', 'init']);
import {watch, ref} from "vue";
const XFilterRef = ref();
const init = () => { const init = () => {
Object.keys(model.value).forEach(key => { Object.keys(model.value).forEach(key => {
model.value[key] = null; model.value[key] = null;
}); });
success(); success();
emits('init');
} }
const success = () => { const success = () => {
visible.value = false; visible.value = false;
emits('success'); emits('success');
} }
watch(
() => visible.value,
(val) => {
const node = XFilterRef.value.$el.nextElementSibling.childNodes[2];
if (val) {
node.style.transform = 'none';
} else {
node.style.transform = 'translate3d(0, -100%, 0)';
}
},
{deep: true}
)
</script> </script>
<template> <template>
<tui-drawer <tui-drawer
ref="XFilterRef"
mode="top" mode="top"
maskZIndex="999" maskZIndex="999"
zIndex="999" zIndex="999"

View File

@@ -29,6 +29,7 @@ const vo = reactive({
const {loading, pagination, initFetchData} = useTableQuery({ const {loading, pagination, initFetchData} = useTableQuery({
api: Api.system.getMessageCenter, api: Api.system.getMessageCenter,
uuid: true,
parameter: po, parameter: po,
callback: (data) => { callback: (data) => {
Object.assign(vo, data); Object.assign(vo, data);

View File

@@ -55,14 +55,14 @@ const {loading, pagination, initFetchData, fetchData} = useTableQuery({
<view class="px-[24rpx] py-[16rpx] bg-[#fff] rounded-[8rpx]" v-if="v.pattern===1"> <view class="px-[24rpx] py-[16rpx] bg-[#fff] rounded-[8rpx]" v-if="v.pattern===1">
<view v-html="v.content"></view> <view v-html="v.content"></view>
<view v-if="v.image_arr.length > 0" class="!flex flex-wrap gap-2"> <view v-if="v.image_arr.length > 0" class="!flex flex-wrap gap-2">
<x-image v-for="v in v.image_arr" :src="v" <x-image v-for="(v, index) in v.image_arr" :cur="index" :src="v"
style="width: 80rpx;height: 80rpx"></x-image> style="width: 80rpx;height: 80rpx"></x-image>
</view> </view>
</view> </view>
<view class="px-[24rpx] py-[16rpx] bg-[#fff] rounded-[8rpx] test-24r text-[#4E5969]" v-else> <view class="px-[24rpx] py-[16rpx] bg-[#fff] rounded-[8rpx] test-24r text-[#4E5969]" v-else>
<view v-html="v.content"></view> <view v-html="v.content"></view>
<view v-if="v.image_arr.length > 0" class="!flex flex-wrap gap-2 justify-end"> <view v-if="v.image_arr.length > 0" class="!flex flex-wrap gap-2 justify-end">
<x-image v-for="k in v.image_arr" :src="k" :list="v.image_arr" <x-image v-for="(k, index) in v.image_arr" :cur="index" :src="k" :list="v.image_arr"
style="width: 70rpx;height: 70rpx"></x-image> style="width: 70rpx;height: 70rpx"></x-image>
</view> </view>
</view> </view>

View File

@@ -29,6 +29,11 @@ const {loading, pagination, initFetchData} = useTableQuery({
Object.assign(vo, data); Object.assign(vo, data);
} }
}); });
const init = () => {
sumPo.type = 0;
sumPo.datetime = dayjs().format('YYYY-MM');
}
</script> </script>
<template> <template>
@@ -36,6 +41,7 @@ const {loading, pagination, initFetchData} = useTableQuery({
<x-nav></x-nav> <x-nav></x-nav>
<x-filter <x-filter
@init="init"
@success="initFetchData" @success="initFetchData"
v-model:model="sumPo" v-model:model="sumPo"
v-model:visible="showFilter"> v-model:visible="showFilter">
@@ -73,7 +79,7 @@ const {loading, pagination, initFetchData} = useTableQuery({
<scroll-view <scroll-view
@refresherpulling="initFetchData()" @refresherpulling="initFetchData()"
@scrolltolower="pagination.current++" @scrolltolower="pagination.page++"
scroll-y scroll-y
class="h-[calc(100vh-200rpx)]"> class="h-[calc(100vh-200rpx)]">
<view class="p-[20rpx]" v-for="item in vo.rows" :key="item.id"> <view class="p-[20rpx]" v-for="item in vo.rows" :key="item.id">