调整样式

This commit is contained in:
砂糖
2025-07-12 11:21:09 +08:00
parent 86f3a4bd93
commit ad58cb208e
2 changed files with 20 additions and 5 deletions

View File

@@ -290,7 +290,7 @@
"path" : "pages/workbench/task/reportTaskDetail",
"style" :
{
"navigationBarTitleText" : "报工任务详情",
"navigationBarTitleText" : "任务详情",
"navigationStyle": "default"
}
}

View File

@@ -43,7 +43,7 @@
<!-- 任务内容 -->
<view class="task-content">
<view class="task-title">{{ task.taskTitle || '未命名任务' }}</view>
<view class="task-title" :class="{ 'single-line': isSingleLine(task.taskTitle) }">{{ task.taskTitle || '未命名任务' }}</view>
<view class="task-status" :class="getStatusClass(task.state)">
{{ getStatusText(task.state) }}
</view>
@@ -111,11 +111,9 @@ export default {
},
methods: {
// 获取左划操作选项
getSwipeOptions(task) {
const options = []
// 置顶功能
if (this.config.canTop) {
if (task.ownRank === 1) {
@@ -242,6 +240,15 @@ export default {
2: 'status-completed'
}
return classMap[state] || 'status-unknown'
},
// 判断是否为单行文字
isSingleLine(text) {
if (!text) return true
// 估算文字长度假设每个中文字符约等于2个英文字符
const estimatedLength = text.replace(/[\u4e00-\u9fa5]/g, 'aa').length
// 如果估算长度小于等于20个字符认为是单行
return estimatedLength <= 20
}
}
}
@@ -317,12 +324,20 @@ export default {
flex: 1;
margin-right: 20rpx;
line-height: 1.4;
height: 88rpx;
height: 88rpx; /* 固定高度 */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
/* 单行文字时垂直居中 */
&.single-line {
display: flex;
flex-direction: column;
justify-content: center;
-webkit-line-clamp: 1;
}
}
.task-status {