This commit is contained in:
2025-06-23 19:07:23 +08:00
parent 1ae5c75f5e
commit b98de4746d
5 changed files with 95 additions and 17 deletions

View File

@@ -390,6 +390,13 @@ const system = {
data: data data: data
}); });
}, },
setExchangeTop: async (data) => {
return request({
method: MethodsENUM.POST,
url: "/task/setExchangeTop",
data: data
});
},
} }
export default system; export default system;

View File

@@ -1,17 +1,14 @@
<script setup> <script setup>
import {computed} from 'vue'; import {computed, onMounted} from 'vue';
import messageIcon from "../static/icons/messageIcon.png"; import messageIcon from "../static/icons/messageIcon.png";
import XActionsheet from "./XActionsheet.vue"; import XActionsheet from "./XActionsheet.vue";
import OpenTypeFun from "./OpenTypeFun.js"; import OpenTypeFun from "./OpenTypeFun.js";
import {toPage} from "../utils/uils.js"; import {showToast, toPage} from "../utils/uils.js";
import {useSystemStore} from "../pinia/SystemStore/index.js";
import Api from "../api/index.js";
const itemList = computed(() => { const SystemStore = useSystemStore();
const item = []; const emits = defineEmits(['success']);
true ?
item.push({text: '标记未读', type: 0}) :
item.push({text: '标记已读', type: 1});
return item;
})
const {contextRow, type, data} = defineProps({ const {contextRow, type, data} = defineProps({
contextRow: { contextRow: {
type: String, type: String,
@@ -27,9 +24,46 @@ const {contextRow, type, data} = defineProps({
} }
}); });
const selectActionsheet = (e) => { const itemList = computed(() => {
console.log(e); const list = type === 0 ? [
{text: '置顶', type: 1, hide: data.is_top === 1},
{text: '取消置顶', type: 0, hide: data.is_top === 0},
{text: '标记已读', type: 0, hide: data.is_read === 0},
{text: '标记未读', type: 1, hide: data.is_read === 1},
] : [
{text: '标记已读', type: 0, hide: data.is_read === 0},
{text: '标记未读', type: 1, hide: data.is_read === 1},
]
return list.filter(v => !v.hide);
})
const selectActionsheet = async (e) => {
if (type === 0) {
const {msg} = await Api.system.setExchangeTop({
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 = true;
} }
}
const openOpenTypeFun = () => {
const index = SystemStore.message.findIndex(v => v.id === data.id);
SystemStore.message[index].is_read = true;
OpenTypeFun(data);
}
onMounted(() => {
if (type === 1) {
const now = SystemStore.message.find(v => v.id === data.id);
console.log(now);
if (!now) SystemStore.message.push({...data, is_read: false});
}
});
</script> </script>
<template> <template>
@@ -37,12 +71,17 @@ const selectActionsheet = (e) => {
@success="selectActionsheet" @success="selectActionsheet"
:itemList="itemList"> :itemList="itemList">
<view <view
@click.stop="type === 0 ? toPage(`/pages/taskDetails/index?id=${data.task_id}&task_children_id=${data.task_children_id}&tab=3`) : OpenTypeFun(data)" @click.stop="type === 0 ? toPage(`/pages/taskDetails/index?id=${data.task_id}&task_children_id=${data.task_children_id}&tab=3`) : openOpenTypeFun()"
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">
<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"
class="size-[20rpx] bg-[#f00] absolute right-0 top-0 rounded-[50%]"></view>
</view>
<view class="flex-grow !flex flex-col gap-[12rpx]"> <view class="flex-grow !flex flex-col gap-[12rpx]">
<view class="!flex justify-between items-center"> <view class="!flex justify-between items-center">
<view class="bh">{{ type === 0 ? '任务编号: DF12122' : data.title }}</view> <view class="bh">{{ data.title }}</view>
<view class="time">2024-01-26 14:00</view> <view class="time">2024-01-26 14:00</view>
</view> </view>
<view :class="['context', contextRow]"> <view :class="['context', contextRow]">

View File

@@ -18,6 +18,7 @@ const tabs = [
const po = reactive({ const po = reactive({
type: 1, type: 1,
is_read: 99,
keyword: null, keyword: null,
}); });
const vo = reactive({ const vo = reactive({
@@ -61,7 +62,11 @@ const changeTab = ({index}) => {
</view> </view>
<view class="!px-[20rpx] !py-[16rpx] box-border !h-[80rpx] !flex items-center"> <view class="!px-[20rpx] !py-[16rpx] box-border !h-[80rpx] !flex items-center">
<checkbox>只看未读</checkbox> <checkbox @click="() => {
po.is_read = po.is_read === 0 ? 99 : 0;
initFetchData();
}">只看未读
</checkbox>
</view> </view>
<scroll-view <scroll-view
@@ -74,6 +79,7 @@ const changeTab = ({index}) => {
scroll-y> scroll-y>
<view class="!flex flex-col !px-[20rpx]"> <view class="!flex flex-col !px-[20rpx]">
<MessageCard <MessageCard
@success="initFetchData"
:context-row="po.type === 0 ? 'ellipsis-1': 'ellipsis-2'" :context-row="po.type === 0 ? 'ellipsis-1': 'ellipsis-2'"
:type="po.type" :type="po.type"
:data="item" :data="item"

View File

@@ -26,6 +26,7 @@ const MyBackfill = defineAsyncComponent(() => import('./components/MyBackfill.vu
const ReviewCommunication = defineAsyncComponent(() => import('./components/ReviewCommunication.vue')); const ReviewCommunication = defineAsyncComponent(() => import('./components/ReviewCommunication.vue'));
// #endif // #endif
const showMenu = ref(false);
const ScrollViewRef = ref(); const ScrollViewRef = ref();
const details = ref(null); const details = ref(null);
const home = ref(false); const home = ref(false);
@@ -144,6 +145,16 @@ const setScroll = (value) => {
}); });
} }
const scroll = ({detail: {scrollTop}}) => { const scroll = ({detail: {scrollTop}}) => {
const systemInfo = uni.getSystemInfoSync();
const screenHeight = systemInfo.screenHeight;
console.log('屏幕高度:', screenHeight);
if (scrollTop > screenHeight) {
showMenu.value = true;
} else {
showMenu.value = false;
}
let last = menuTabs[0]; let last = menuTabs[0];
for (const k of menuTabs) { for (const k of menuTabs) {
if (scrollTop + 300 > k.value) { if (scrollTop + 300 > k.value) {
@@ -159,7 +170,7 @@ const scroll = ({detail: {scrollTop}}) => {
<!--任务详情--> <!--任务详情-->
<XNav :delta="delta"></XNav> <XNav :delta="delta"></XNav>
<x-notice-bar></x-notice-bar> <x-notice-bar></x-notice-bar>
<left-menu :tabs="menuTabs" @top="topTop" @setScroll="setScroll"></left-menu> <left-menu v-show="showMenu" :tabs="menuTabs" @top="topTop" @setScroll="setScroll"></left-menu>
<scroll-view <scroll-view
scroll-y scroll-y

View File

@@ -1,11 +1,26 @@
import {defineStore} from "pinia"; import {defineStore} from "pinia";
import {reactive} from "vue"; import {reactive, ref} from "vue";
export const useSystemStore = defineStore('SystemStore', () => { export const useSystemStore = defineStore('SystemStore', () => {
const accountManagementPo = reactive({ const accountManagementPo = reactive({
pid: null, pid: null,
}); });
const message = ref([]);
return { return {
accountManagementPo, accountManagementPo,
message,
}
}, {
persist: {
key: 'SystemStore',
pick: ['message'],
storage: {
getItem(key) {
return uni.getStorageSync(key);
},
setItem(key, value) {
uni.setStorageSync(key, value);
}
},
} }
}); });