优化首页的待办工作添加与标记star的移动位置

This commit is contained in:
zhoumingfa 2024-08-04 11:46:47 +08:00
parent ecd671682e
commit 15cc4a9003
2 changed files with 23 additions and 16 deletions

View File

@ -1,5 +1,5 @@
<!--
* 已办/代办
* 待办工作
*
* @Author: 1024创新实验室-主任卓大
* @Date: 2022-09-12 22:34:00
@ -70,16 +70,21 @@
function handleCheckbox(e) {
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
useUserStore().toBeDoneCount = toDoList.value.length;
}
function itemStar(data) {
data.starFlag = !data.starFlag;
// star
const index = toBeDoneList.value.findIndex((item) => item.title === data.title);
toBeDoneList.value.splice(index, 1);
if (data.starFlag) {
// star
toBeDoneList.value.unshift(data);
} else {
toBeDoneList.value.push(data);
// star star
const lastStarIndex = toBeDoneList.value.findLastIndex((item) => item.starFlag);
toBeDoneList.value.splice(lastStarIndex + 1, 0, data);
}
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
}
@ -94,9 +99,9 @@
//
function addToBeDone(data) {
toBeDoneList.value.unshift(data);
useUserStore().toBeDoneCount = toBeDoneList.value.length;
toBeDoneList.value.push(data);
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
useUserStore().toBeDoneCount = toDoList.value.length;
}
function toDelete(data) {
@ -121,8 +126,8 @@
function deleteToBeDone(data) {
const index = toBeDoneList.value.findIndex((item) => item.title === data.title);
toBeDoneList.value.splice(index, 1);
useUserStore().toBeDoneCount = toBeDoneList.value.length;
localSave(localKey.TO_BE_DONE, JSON.stringify(toBeDoneList.value));
useUserStore().toBeDoneCount = toDoList.value.length;
}
</script>
<style lang="less" scoped>

View File

@ -1,4 +1,5 @@
<template>
<div>
<a-modal v-model:open="visible" title="新建待办" @close="onClose">
<a-form ref="formRef" :model="form" :rules="rules">
<a-form-item label="标题" name="title">
@ -10,6 +11,7 @@
<a-button type="primary" @click="onSubmit">确定</a-button>
</template>
</a-modal>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue';