update
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
<script setup>
|
||||
import {computed} from 'vue';
|
||||
import {computed, onMounted} from 'vue';
|
||||
import messageIcon from "../static/icons/messageIcon.png";
|
||||
import XActionsheet from "./XActionsheet.vue";
|
||||
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 item = [];
|
||||
true ?
|
||||
item.push({text: '标记未读', type: 0}) :
|
||||
item.push({text: '标记已读', type: 1});
|
||||
return item;
|
||||
})
|
||||
const SystemStore = useSystemStore();
|
||||
const emits = defineEmits(['success']);
|
||||
const {contextRow, type, data} = defineProps({
|
||||
contextRow: {
|
||||
type: String,
|
||||
@@ -27,9 +24,46 @@ const {contextRow, type, data} = defineProps({
|
||||
}
|
||||
});
|
||||
|
||||
const selectActionsheet = (e) => {
|
||||
console.log(e);
|
||||
const itemList = computed(() => {
|
||||
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>
|
||||
|
||||
<template>
|
||||
@@ -37,12 +71,17 @@ const selectActionsheet = (e) => {
|
||||
@success="selectActionsheet"
|
||||
:itemList="itemList">
|
||||
<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]">
|
||||
<image class="!size-[72rpx] flex-shrink-0" mode="aspectFill" :src="messageIcon"></image>
|
||||
<view class="relative">
|
||||
<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 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>
|
||||
<view :class="['context', contextRow]">
|
||||
|
||||
Reference in New Issue
Block a user