调整使得卡片体积减小
This commit is contained in:
parent
3574aa5bab
commit
34347a3f0d
|
|
@ -154,6 +154,8 @@ import { ref, onMounted } from 'vue';
|
||||||
import { getTaskStatusType, getTaskStatusStyle, getStatusText } from '@/utils/taskConfig.js';
|
import { getTaskStatusType, getTaskStatusStyle, getStatusText } from '@/utils/taskConfig.js';
|
||||||
import { getDashboardBrief, getTaskList } from '@/common/api';
|
import { getDashboardBrief, getTaskList } from '@/common/api';
|
||||||
import { useUserStore } from '@/store/user';
|
import { useUserStore } from '@/store/user';
|
||||||
|
import {truncateText} from "@/utils/textSolve/truncateText";
|
||||||
|
|
||||||
|
|
||||||
// 任务统计
|
// 任务统计
|
||||||
const taskStats = ref([
|
const taskStats = ref([
|
||||||
|
|
@ -192,15 +194,7 @@ const customerStatus = ref([
|
||||||
{ label: '即将跟进', count: 0 }
|
{ 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);
|
const loading = ref(false);
|
||||||
|
|
|
||||||
|
|
@ -13,24 +13,37 @@
|
||||||
>
|
>
|
||||||
<!-- 状态标签和日期 -->
|
<!-- 状态标签和日期 -->
|
||||||
<view class="task-header">
|
<view class="task-header">
|
||||||
<view class="task-badge-wrapper">
|
<view style="display: flex;align-items: center;gap: 12px">
|
||||||
<uv-tags
|
<view class="task-badge-wrapper">
|
||||||
:text="getStatusText(task.status)"
|
<uv-tags
|
||||||
:type="getTaskStatusType(task.status)"
|
:text="getStatusText(task.status)"
|
||||||
size="mini"
|
:type="getTaskStatusType(task.status)"
|
||||||
:plain="false"
|
size="mini"
|
||||||
:custom-style="getTagCustomStyle(task.status)"
|
:plain="false"
|
||||||
></uv-tags>
|
:custom-style="getTagCustomStyle(task.status)"
|
||||||
|
></uv-tags>
|
||||||
|
</view>
|
||||||
|
<view class="task-date-wrapper">
|
||||||
|
<text class="task-date">{{ task.date }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="task-date-wrapper">
|
|
||||||
<text class="task-date">{{ task.date }}</text>
|
<!-- 立即处理按钮 -->
|
||||||
|
<view class="task-action" v-if="task.status !== 'completed'">
|
||||||
|
<uv-button
|
||||||
|
:type="getButtonType(task.status)"
|
||||||
|
size="small"
|
||||||
|
@click.stop="handleTask(task)"
|
||||||
|
>
|
||||||
|
立即处理
|
||||||
|
</uv-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 任务内容 -->
|
<!-- 任务内容 -->
|
||||||
<view class="task-content">
|
<view class="task-content">
|
||||||
<text class="task-project">所属项目: {{ task.project }}</text>
|
<text class="task-project">所属项目: {{ task.project }}</text>
|
||||||
<text class="task-description">{{ task.description }}</text>
|
<text class="task-description">{{truncateText(task.description)}}</text>
|
||||||
<view class="task-meta">
|
<view class="task-meta">
|
||||||
<text class="task-owner">负责人: {{ task.owner }}</text>
|
<text class="task-owner">负责人: {{ task.owner }}</text>
|
||||||
<text class="task-owner">创建人: {{ task.createName }}</text>
|
<text class="task-owner">创建人: {{ task.createName }}</text>
|
||||||
|
|
@ -41,21 +54,13 @@
|
||||||
<text class="countdown-text" :class="getCountdownClass(task.status)">
|
<text class="countdown-text" :class="getCountdownClass(task.status)">
|
||||||
{{ task.remainingDays < 0 ? `已逾期${Math.abs(task.remainingDays)}天` : `剩余${task.remainingDays}天` }}
|
{{ task.remainingDays < 0 ? `已逾期${Math.abs(task.remainingDays)}天` : `剩余${task.remainingDays}天` }}
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 立即处理按钮 -->
|
|
||||||
<view class="task-action" v-if="task.status !== 'completed'">
|
|
||||||
<uv-button
|
|
||||||
:type="getButtonType(task.status)"
|
|
||||||
size="small"
|
|
||||||
@click.stop="handleTask(task)"
|
|
||||||
>
|
|
||||||
立即处理
|
|
||||||
</uv-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -79,6 +84,8 @@ import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { getStatusText, getTaskStatusType, getTaskStatusStyle } from '@/utils/taskConfig.js';
|
import { getStatusText, getTaskStatusType, getTaskStatusStyle } from '@/utils/taskConfig.js';
|
||||||
import { getTaskList } from '@/common/api';
|
import { getTaskList } from '@/common/api';
|
||||||
import { useTaskStore } from '@/store/task';
|
import { useTaskStore } from '@/store/task';
|
||||||
|
import {truncateText} from "@/utils/textSolve/truncateText";
|
||||||
|
|
||||||
|
|
||||||
// 获取页面参数
|
// 获取页面参数
|
||||||
const statusFilter = ref('');
|
const statusFilter = ref('');
|
||||||
|
|
@ -454,6 +461,7 @@ onLoad((options) => {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-badge-wrapper {
|
.task-badge-wrapper {
|
||||||
|
|
@ -543,7 +551,7 @@ onLoad((options) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-action {
|
.task-action {
|
||||||
margin-top: 12px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
utils/textSolve/truncateText.js
Normal file
9
utils/textSolve/truncateText.js
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user