Commit e0f5e0ae by lijiabin

【需求 23684】ux: 优化体验

parent bba0cdba
...@@ -232,9 +232,15 @@ ...@@ -232,9 +232,15 @@
</div> </div>
<!-- 标签 --> <!-- 标签 -->
<div class="flex flex-wrap gap-2 mt-6"> <div class="flex flex-wrap gap-2 mt-6">
<button <el-tooltip
v-for="(item, index) in articleDetail?.tagNameList" v-for="(item, index) in articleDetail?.tagNameList"
:key="item" :key="item"
:content="canLoadRelatedColumns ? '点击查看相关推荐专栏' : ''"
:disabled="!canLoadRelatedColumns"
placement="top"
:show-after="200"
>
<button
type="button" type="button"
:disabled="!canLoadRelatedColumns" :disabled="!canLoadRelatedColumns"
:class="[ :class="[
...@@ -246,6 +252,7 @@ ...@@ -246,6 +252,7 @@
> >
#{{ item }} #{{ item }}
</button> </button>
</el-tooltip>
</div> </div>
<div <div
...@@ -253,7 +260,7 @@ ...@@ -253,7 +260,7 @@
v-loading="relatedColumnLoading" v-loading="relatedColumnLoading"
class="mt-4 min-h-24 border-t border-gray-100 pt-4" class="mt-4 min-h-24 border-t border-gray-100 pt-4"
> >
<h2 class="mb-3 text-sm font-semibold text-gray-700">相关推荐</h2> <h2 class="mb-3 text-sm font-semibold text-gray-700">相关推荐专栏</h2>
<ul v-if="relatedColumnList.length" class="space-y-2"> <ul v-if="relatedColumnList.length" class="space-y-2">
<li v-for="(item, index) in relatedColumnList" :key="item.id"> <li v-for="(item, index) in relatedColumnList" :key="item.id">
<button <button
...@@ -322,6 +329,7 @@ const loading = computed(() => !articleDetail.title) ...@@ -322,6 +329,7 @@ const loading = computed(() => !articleDetail.title)
const canLoadRelatedColumns = computed( const canLoadRelatedColumns = computed(
() => articleDetail.type === ArticleTypeEnum.COLUMN && !isAudit, () => articleDetail.type === ArticleTypeEnum.COLUMN && !isAudit,
) )
// 点击标签后只展示当前关键词下的相关推荐专栏,列表由后端按优先级排好后再截取前三条。
const activeKeyword = ref('') const activeKeyword = ref('')
const relatedColumnLoading = ref(false) const relatedColumnLoading = ref(false)
const relatedColumnList = ref<RelatedColumnItemDto[]>([]) const relatedColumnList = ref<RelatedColumnItemDto[]>([])
...@@ -337,7 +345,7 @@ const handleTagClick = async (keyword: string, tagId: number) => { ...@@ -337,7 +345,7 @@ const handleTagClick = async (keyword: string, tagId: number) => {
articleId: articleDetail.id, articleId: articleDetail.id,
tagId, tagId,
}) })
relatedColumnList.value = data relatedColumnList.value = data.slice(0, 3)
} catch { } catch {
relatedColumnList.value = [] relatedColumnList.value = []
} finally { } finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment