feat(TaskAdd): 优化任务添加界面,调整模板浏览器和加载提示样式

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
kuaifan 2026-05-11 02:03:33 +00:00
parent 7dc641e69e
commit 0c1a913134
3 changed files with 32 additions and 26 deletions

View File

@ -23,9 +23,8 @@
</li>
<li
v-if="hasMoreTemplates"
class="more"
@click="openTemplateBrowser">
{{ $L('更多') }}
{{ $L('更多') }}...
</li>
</ul>
<div class="task-add-form">
@ -197,10 +196,7 @@
</div>
<TaskExistTips ref="taskExistTipsRef" @onContinue="onAdd(addContinue, true)"/>
<TaskTemplateBrowser
v-model="templateBrowserVisible"
:current-project-id="addData.project_id"
@pick="onPickFromBrowser" />
<TaskTemplateBrowser v-model="templateBrowserVisible" :current-project-id="addData.project_id" @pick="onPickFromBrowser" />
</div>
</template>
@ -326,7 +322,7 @@ export default {
const others = all.filter(t => t.project_id != currentId)
return [...others]
.sort((a, b) => (b.use_count || 0) - (a.use_count || 0))
.slice(0, 5)
.slice(0, 3)
},
/**
@ -340,7 +336,7 @@ export default {
if (ownCount > 0) {
return otherCount > 0
}
return otherCount > 5
return otherCount > 3
},
},

View File

@ -29,7 +29,10 @@
<span v-if="item.user_name" class="creator">· @{{ item.user_name }}</span>
</div>
</div>
<div v-if="loading" class="loading">{{ $L('加载中') }}</div>
<div v-if="loading" class="loading">
<Loading />
{{ $L('加载中') }}
</div>
<div v-if="!loading && items.length === 0" class="empty">{{ $L('暂无可用模板') }}</div>
</div>
</Modal>
@ -137,11 +140,16 @@ export default {
<style lang="scss" scoped>
.task-template-browser {
.search-wrap {
margin-bottom: 12px;
margin-bottom: 8px;
}
.list-wrap {
max-height: 420px;
overflow-y: auto;
> div {
&:last-child {
margin-bottom: 12px;
}
}
}
.item {
padding: 10px 12px;
@ -162,6 +170,17 @@ export default {
}
}
}
.loading {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
.common-loading {
width: 18px;
height: 18px;
margin: 0;
}
}
.loading, .empty {
text-align: center;
padding: 20px;

View File

@ -93,29 +93,20 @@
}
&.cross {
// 跨项目 chip左侧添加视觉 marker小圆点
position: relative;
padding-left: 20px;
padding-left: 24px;
&::before {
content: '';
content: "";
position: absolute;
left: 8px;
top: 50%;
transform: translateY(-50%);
width: 4px;
height: 4px;
border-radius: 50%;
background: $primary-desc-color;
}
}
&.more {
font-style: italic;
opacity: 0.7;
&:hover {
opacity: 1;
width: 12px;
height: 12px;
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXNoYXJlMi1pY29uIGx1Y2lkZS1zaGFyZS0yIj48Y2lyY2xlIGN4PSIxOCIgY3k9IjUiIHI9IjMiLz48Y2lyY2xlIGN4PSI2IiBjeT0iMTIiIHI9IjMiLz48Y2lyY2xlIGN4PSIxOCIgY3k9IjE5IiByPSIzIi8+PGxpbmUgeDE9IjguNTkiIHgyPSIxNS40MiIgeTE9IjEzLjUxIiB5Mj0iMTcuNDkiLz48bGluZSB4MT0iMTUuNDEiIHgyPSI4LjU5IiB5MT0iNi41MSIgeTI9IjEwLjQ5Ii8+PC9zdmc+);
background-size: cover;
background-repeat: no-repeat;
}
}
}