From 34347a3f0d70aafefc8039509c9ed41131027195 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Wed, 12 Nov 2025 15:15:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BD=BF=E5=BE=97=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E4=BD=93=E7=A7=AF=E5=87=8F=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ContentDashboard.vue | 10 ++----- pages/task/list/index.vue | 52 +++++++++++++++++++-------------- utils/textSolve/truncateText.js | 9 ++++++ 3 files changed, 41 insertions(+), 30 deletions(-) create mode 100644 utils/textSolve/truncateText.js diff --git a/components/ContentDashboard.vue b/components/ContentDashboard.vue index b666490..daf0200 100644 --- a/components/ContentDashboard.vue +++ b/components/ContentDashboard.vue @@ -154,6 +154,8 @@ import { ref, onMounted } from 'vue'; import { getTaskStatusType, getTaskStatusStyle, getStatusText } from '@/utils/taskConfig.js'; import { getDashboardBrief, getTaskList } from '@/common/api'; import { useUserStore } from '@/store/user'; +import {truncateText} from "@/utils/textSolve/truncateText"; + // 任务统计 const taskStats = ref([ @@ -192,15 +194,7 @@ const customerStatus = ref([ { label: '即将跟进', count: 0 } ]); -const truncateText = (text, maxLength = 30, suffix = '...')=> { - if (!text || typeof text !== 'string') return '' - if (text.length <= maxLength) { - return text - } - - return text.substring(0, maxLength) + suffix -} // 加载状态 const loading = ref(false); diff --git a/pages/task/list/index.vue b/pages/task/list/index.vue index d6c12d9..e785f37 100644 --- a/pages/task/list/index.vue +++ b/pages/task/list/index.vue @@ -13,24 +13,37 @@ > - - + + + + + + {{ task.date }} + - - {{ task.date }} + + + + + 立即处理 + 所属项目: {{ task.project }} - {{ task.description }} + {{truncateText(task.description)}} 负责人: {{ task.owner }} 创建人: {{ task.createName }} @@ -41,21 +54,13 @@ {{ task.remainingDays < 0 ? `已逾期${Math.abs(task.remainingDays)}天` : `剩余${task.remainingDays}天` }} + - - - - 立即处理 - - + @@ -79,6 +84,8 @@ import { onLoad } from '@dcloudio/uni-app'; import { getStatusText, getTaskStatusType, getTaskStatusStyle } from '@/utils/taskConfig.js'; import { getTaskList } from '@/common/api'; import { useTaskStore } from '@/store/task'; +import {truncateText} from "@/utils/textSolve/truncateText"; + // 获取页面参数 const statusFilter = ref(''); @@ -454,6 +461,7 @@ onLoad((options) => { align-items: center; gap: 12px; margin-bottom: 12px; + justify-content: space-between; } .task-badge-wrapper { @@ -543,7 +551,7 @@ onLoad((options) => { } .task-action { - margin-top: 12px; + display: flex; justify-content: flex-end; } diff --git a/utils/textSolve/truncateText.js b/utils/textSolve/truncateText.js new file mode 100644 index 0000000..6354216 --- /dev/null +++ b/utils/textSolve/truncateText.js @@ -0,0 +1,9 @@ +export const truncateText = (text, maxLength = 30, suffix = '...')=> { + if (!text || typeof text !== 'string') return '' + + if (text.length <= maxLength) { + return text + } + + return text.substring(0, maxLength) + suffix +} \ No newline at end of file