fix: 更新行业和概念页面的标签显示逻辑,修复标签删除功能

This commit is contained in:
傅光孟 2026-02-10 11:14:46 +08:00
parent a0ae694e84
commit 3b90800bc2
7 changed files with 21 additions and 19 deletions

View File

@ -39,9 +39,9 @@
</view>
</view>
<view class="my-industry-list" v-if="myTagList.length > 0">
<view class="industry-item" v-for="item in myTagList">
<view class="industry-name">{{ item.name }}</view>
<view class="industry-btn" @click="handleDeleteTag(item)"></view>
<view class="industry-item" v-for="(item, index) in myTagList">
<view class="industry-name">{{ item.name.split('-')[1] }}</view>
<view class="industry-btn" @click="handleDeleteTag(index)"></view>
</view>
</view>
<view class="my-industry-empty" v-else> 暂无自选请从下方添加 </view>
@ -61,7 +61,7 @@
:class="['industry-item', { active: isSelected(item.content) }]"
@click="handleAddTag(item.content)"
>
<view class="industry-name">{{ item.content }}</view>
<view class="industry-name">{{ item.content.split('-')[1] }}</view>
</view>
</view>
<view v-else class="no-data"> <u-empty /></view>
@ -152,8 +152,7 @@ function handleAddTag(tag) {
}
//
function handleDeleteTag(tag) {
const index = myTagList.value.findIndex((item) => item.name === tag);
function handleDeleteTag(index: number) {
myTagList.value.splice(index, 1);
}

View File

@ -28,6 +28,7 @@
fontFamily: 'PingFangSC, PingFang SC',
}"
itemStyle="padding-left: 15px; padding-right: 15px; height: 70rpx;"
keyName="content"
@change="handleChangeTag"
>
</u-tabs>
@ -36,7 +37,7 @@
<view class="page-main">
<view class="banner">
<view class="text-1">{{tagList[current]?.name}}</view>
<view class="text-1">{{ tagList[current]?.content }}</view>
<view class="text-2">风口概念近一个月排名Top5</view>
</view>
@ -146,8 +147,8 @@ watch(
}
},
{
immediate: true
}
immediate: true,
},
);
const handleShowCustom = () => {

View File

@ -67,6 +67,7 @@ const getTagList = async () => {
tagList.value = result.data.map((item: any) => {
return {
name: item.primaryName + "-" + item.secondaryName,
content: item.secondaryName,
};
});
} else {

View File

@ -39,9 +39,9 @@
</view>
</view>
<view class="my-industry-list" v-if="myTagList.length > 0">
<view class="industry-item" v-for="item in myTagList">
<view class="industry-name">{{ item.name }}</view>
<view class="industry-btn" @click="handleDeleteTag(item)"></view>
<view class="industry-item" v-for="(item, index) in myTagList">
<view class="industry-name">{{ item.name.split("-")[1] }}</view>
<view class="industry-btn" @click="handleDeleteTag(index)"></view>
</view>
</view>
<view class="my-industry-empty" v-else> 暂无自选请从下方添加 </view>
@ -61,7 +61,7 @@
:class="['industry-item', { active: isSelected(item.content) }]"
@click="handleAddTag(item.content)"
>
<view class="industry-name">{{ item.content }}</view>
<view class="industry-name">{{ item.content.split("-")[1] }}</view>
</view>
</view>
<view v-else class="no-data"> <u-empty /></view>
@ -152,8 +152,7 @@ function handleAddTag(tag) {
}
//
function handleDeleteTag(tag) {
const index = myTagList.value.findIndex((item) => item.name === tag);
function handleDeleteTag(index: number) {
myTagList.value.splice(index, 1);
}

View File

@ -28,6 +28,7 @@
fontFamily: 'PingFangSC, PingFang SC',
}"
itemStyle="padding-left: 15px; padding-right: 15px; height: 70rpx;"
keyName="content"
@change="handleChangeTag"
>
</u-tabs>
@ -36,7 +37,7 @@
<view class="page-main">
<view class="banner">
<view class="text-1">{{tagList[current]?.name}}</view>
<view class="text-1">{{ tagList[current]?.content }}</view>
<view class="text-2">热门行业近一个月排名Top5</view>
</view>
@ -146,8 +147,8 @@ watch(
}
},
{
immediate: true
}
immediate: true,
},
);
const handleShowCustom = () => {

View File

@ -67,6 +67,7 @@ const getTagList = async () => {
tagList.value = result.data.map((item: any) => {
return {
name: item.primaryName + "-" + item.secondaryName,
content: item.secondaryName,
};
});
} else {

View File

@ -77,7 +77,7 @@ function navigateTo() {
}
uni.navigateTo({
url: `/pages/industry/index`,
url: `/pages/concept/index`,
});
}