合并之前缺少部分

This commit is contained in:
muzi
2025-06-17 11:18:39 +08:00
parent a72487fe56
commit 384be13f46
32 changed files with 2394 additions and 220 deletions

View File

@ -1,6 +1,6 @@
<template>
<view>
<topHeader ref="topHeaderRef"></topHeader>
<topHeader ref="topHeaderRef" @search="search"></topHeader>
<a-space direction="vertical" style="background-color: #fff; width: 100%; padding: 24px; margin: 24px 0">
<a-space align="center">
<span>行业词云</span>
@ -65,12 +65,29 @@ const topHeaderRef = ref();
const selectedIndustry = computed(() => topHeaderRef.value?.selectedIndustry);
const selectedSubCategory = computed(() => topHeaderRef.value?.selectedSubCategory);
const selectedTimePeriod = computed(() => topHeaderRef.value?.selectedTimePeriod);
// 监听筛选条件变化
watch([selectedTimePeriod, selectedSubCategory], () => {
getIndustryTerms();
});
const search = () => {
getIndustryTerms();
};
watch(selectedIndustry, () => {
selectedSubCategory.value = 0;
getIndustryTerms();
});
onMounted(() => {
getIndustryTerms();
});
const getIndustryTerms = async () => {
const params = {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
params['industry_id'] = selectedSubCategory.value;
}
const res = await fetchindustryTerms(params);
// 这里需要根据API返回的数据结构处理成tagRows需要的格式
tagRows.value = processTagData(res);
@ -107,7 +124,7 @@ const getPadding = (rowIndex, tagIndex) => {
// 处理API返回数据为tagRows格式
const processTagData = (apiData) => {
const totalGroups = 7; // 总组数
const totalGroups = 4; // 总组数
const middleIndex = Math.floor(totalGroups / 2); // 中间位置索引3
const chunkSize = Math.ceil(apiData.length / totalGroups); // 每组大小
const arr = [];
@ -133,15 +150,6 @@ const processTagData = (apiData) => {
return arr.filter(Boolean); // 移除可能的空项
};
// 监听筛选条件变化
watch([selectedIndustry, selectedTimePeriod], () => {
getIndustryTerms();
});
onMounted(() => {
getIndustryTerms();
});
</script>
<style scoped>

View File

@ -1,6 +1,6 @@
<template>
<view>
<topHeader ref="topHeaderRef"></topHeader>
<topHeader ref="topHeaderRef" @search="search"></topHeader>
<!-- tabel -->
<a-space direction="vertical" style="background-color: #fff; width: 100%; padding: 24px; margin-bottom: 24px">
<a-space align="center">
@ -112,7 +112,7 @@
<span style="margin-right: 16px; width: 60px; font-size: 12px">原始来源 </span>
<a-space direction="vertical" style="margin-left: 15px">
<a-space v-for="item in topicInfo.industry_topic_sources" :key="item">
<a-link style="background-color: initial" :href="item.link">{{ item.title }}</a-link>
<a-link style="background-color: initial" :href="item.link" target="_blank">{{ item.title }}</a-link>
<img src="@/assets/img/hottranslation/xhs.png" style="width: 16px; height: 16px" />
</a-space>
</a-space>
@ -151,11 +151,18 @@ const topHeaderRef = ref();
const selectedIndustry = computed(() => topHeaderRef.value?.selectedIndustry);
const selectedSubCategory = computed(() => topHeaderRef.value?.selectedSubCategory);
const selectedTimePeriod = computed(() => topHeaderRef.value?.selectedTimePeriod);
const search = () => {
getIndustryTopics();
};
// 监听筛选条件变化
watch([selectedIndustry, selectedTimePeriod], () => {
watch([selectedIndustry, selectedTimePeriod, selectedSubCategory], () => {
getIndustryTopics();
});
watch(selectedIndustry, () => {
selectedSubCategory.value = 0;
getIndustryTopics();
});
onMounted(() => {
getIndustriesTree();
});
@ -173,8 +180,10 @@ const getIndustryTopics = async () => {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
parms['industry_id'] = selectedSubCategory.value;
}
const res = await fetchIndustryTopics(parms);
console.log(res);
dataList.value = res;
};

View File

@ -0,0 +1,3 @@
<template>
<LayoutBasic> </LayoutBasic>
</template>

View File

@ -1,6 +1,6 @@
<template>
<view>
<topHeader ref="topHeaderRef"></topHeader>
<topHeader ref="topHeaderRef" @click="search"></topHeader>
<!-- 重点品牌列表 -->
<a-space direction="vertical" style="background-color: #fff; width: 100%; padding: 24px; margin: 24px 0">
<a-space align="center">
@ -107,11 +107,18 @@ const selectedTimePeriod = computed(() => topHeaderRef.value?.selectedTimePeriod
const dataList = ref([]);
const otherList = ref([]);
const search = () => {
getFocusBrandsList();
getEventDynamicsList();
};
const getFocusBrandsList = async () => {
const params = {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
params['industry_id'] = selectedSubCategory.value;
}
const res = await fetchFocusBrandsList(params);
// 这里需要根据API返回的数据结构处理成tagRows需要的格式
dataList.value = res;
@ -122,6 +129,9 @@ const getEventDynamicsList = async () => {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
params['industry_id'] = selectedSubCategory.value;
}
const res = await fetchEventDynamicsList(params);
// 这里需要根据API返回的数据结构处理成tagRows需要的格式
otherList.value = res;
@ -132,10 +142,15 @@ onMounted(() => {
getEventDynamicsList();
});
// 监听筛选条件变化
watch([selectedIndustry, selectedTimePeriod], () => {
watch([selectedTimePeriod, selectedSubCategory], () => {
getFocusBrandsList();
getEventDynamicsList();
});
watch(selectedIndustry, () => {
selectedSubCategory.value = 0;
getFocusBrandsList();
getEventDynamicsList;
});
</script>
<style scoped>

View File

@ -1,6 +1,6 @@
<template>
<view>
<topHeader ref="topHeaderRef"></topHeader>
<topHeader ref="topHeaderRef" @search="search"></topHeader>
<!-- 关键词热度榜 -->
<a-space direction="vertical" style="background-color: #fff; width: 100%; padding: 24px; margin: 24px 0">
<a-space align="center">
@ -51,7 +51,12 @@
style="font-size: 14px"
:value="record.trend * 100"
:value-style="{ color: '#25C883' }"
></a-statistic>
>
<template #prefix>
<icon-arrow-fall />
</template>
<template #suffix>%</template>
</a-statistic>
</template>
</a-table-column>
<a-table-column title="情感倾向" data-index="sentiment">
@ -170,9 +175,9 @@
<template #cell="{ record }">
<a-statistic
style="font-size: 14px"
v-if="record.trend > 0"
:value="record.trend * 100"
:value-style="{ color: '#F64B31' }"
v-if="record.trend > 0"
>
<template #prefix>
<icon-arrow-rise />
@ -184,18 +189,92 @@
style="font-size: 14px"
:value="record.trend * 100"
:value-style="{ color: '#25C883' }"
></a-statistic>
>
<template #prefix>
<icon-arrow-fall />
</template>
<template #suffix>%</template>
</a-statistic>
</template>
</a-table-column>
<a-table-column title="操作" data-index="optional">
<template #cell="{ record }">
<a-button type="outline" @click="gotoDetail(record)">详情</a-button>
</template>
</a-table-column>
</template>
</a-table>
</a-space>
<!-- modal -->
<a-modal :visible="visible" @ok="handleOk" @cancel="handleCancel" unmountOnClose>
<template #title>
<span style="text-align: left; width: 100%">新兴关键词</span>
</template>
<div>
<a-space direction="vertical">
<a-space>
<span style="margin-right: 16px">关键词</span>
<span>{{ topicInfo.name }}</span>
</a-space>
<a-space>
<span style="margin-right: 16px">最大规模出现</span>
<span>{{ formatTimestamp(topicInfo.first_appeared_at) }}</span>
</a-space>
<a-space>
<span style="margin-right: 16px">变化幅度</span>
<div>
<a-statistic
v-if="topicInfo?.trend > 0"
style="font-size: 14px"
:value="topicInfo.trend * 100"
:value-style="{ color: '#F64B31' }"
>
<template #prefix>
<IconArrowRise />
</template>
<template #suffix>%</template>
</a-statistic>
<a-statistic
v-else
style="font-size: 14px"
:value="topicInfo?.trend * 100 || 0"
:value-style="{ color: '#25C883' }"
>
<template #prefix>
<IconArrowFall />
</template>
<template #suffix>%</template>
</a-statistic>
</div>
</a-space>
<a-space>
<span style="margin-right: 16px">热度指数</span>
<img v-for="i in topicInfo.hot" :key="i" :src="starImages[i - 1]" style="width: 16px; height: 16px" />
</a-space>
<a-space direction="top">
<span style="margin-right: 16px; width: 60px; font-size: 12px">原始来源 </span>
<a-space direction="vertical" style="margin-left: 15px">
<a-space v-for="item in topicInfo.industry_new_keyword_sources" :key="item">
<a-link style="background-color: initial" :href="item.link" target="_blank">{{ item.title }}</a-link>
<img src="@/assets/img/hottranslation/xhs.png" style="width: 16px; height: 16px" />
</a-space>
</a-space>
</a-space>
</a-space>
</div>
</a-modal>
</view>
</template>
<script setup>
import topHeader from './topHeader.vue';
import { fetchKeywordTrendsList, fetchIndustryEmotions, fetchNewKeywordList } from '@/api/all/index';
import {
fetchKeywordTrendsList,
fetchIndustryEmotions,
fetchNewKeywordList,
fetchNewKeywordDetail,
} from '@/api/all/index';
import { ref, onMounted, onBeforeUnmount, watchEffect, computed } from 'vue';
import * as echarts from 'echarts';
import star1 from '@/assets/img/hottranslation/star-fill1.png';
@ -220,12 +299,18 @@ const dataList = ref([]);
const rowData = ref([]);
const keywordList = ref([]);
const fellingRate = ref([]);
const visible = ref(false);
const topicInfo = ref({});
const getIndustryEmotions = async () => {
const params = {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
params['industry_id'] = selectedSubCategory.value;
}
const res = await fetchIndustryEmotions(params);
fellingRate.value = [];
fellingRate.value.push(res['good_felling_rate']);
fellingRate.value.push(res['bad_felling_rate']);
@ -235,6 +320,14 @@ const getIndustryEmotions = async () => {
console.log('行业情绪', items);
};
// 详情
const gotoDetail = async (record) => {
console.log(record);
const res = await fetchNewKeywordDetail(record.id);
console.log(res);
visible.value = true;
topicInfo.value = res;
};
const groupedData = () => {
const groups = {
negative: { name: '负面', items: [], color: '#F64B31' },
@ -249,12 +342,23 @@ const groupedData = () => {
return groups;
};
// 弹窗的取消
const handleCancel = () => {
visible.value = false;
};
// 弹窗的确定
const handleOk = () => {
visible.value = false;
};
const getKeywordTrendsList = async () => {
const params = {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
params['industry_id'] = selectedSubCategory.value;
}
const res = await fetchKeywordTrendsList(params);
console.log('关键词热度榜', res);
// 这里需要根据API返回的数据结构处理成tagRows需要的格式
@ -276,6 +380,9 @@ const getNewKeywordList = async () => {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
params['industry_id'] = selectedSubCategory.value;
}
const res = await fetchNewKeywordList(params);
// 这里需要根据API返回的数据结构处理成tagRows需要的格式
keywordList.value = res;
@ -307,8 +414,21 @@ const drawChart = () => {
}
};
const search = () => {
getKeywordTrendsList();
getIndustryEmotions();
getNewKeywordList();
};
// 监听筛选条件变化
watch([selectedIndustry, selectedTimePeriod], () => {
watch([selectedTimePeriod, selectedSubCategory], () => {
getKeywordTrendsList();
getIndustryEmotions();
getNewKeywordList();
});
watch([selectedIndustry], () => {
selectedSubCategory.value = 0;
getKeywordTrendsList();
getIndustryEmotions();
getNewKeywordList();
@ -319,22 +439,6 @@ onMounted(() => {
getIndustryEmotions();
getNewKeywordList();
});
// const chartData = computed(() => {
// const result = [
// { name: '正面', value: 0, color: '#25C883' },
// { name: '中性', value: 0, color: '#FFAA16' },
// { name: '负面', value: 0, color: '#F64B31' },
// ];
// rawData.value.forEach((item) => {
// if (item.felling === 2) result[0].value++;
// else if (item.felling === 1) result[1].value++;
// else result[2].value++;
// });
// return result.filter((item) => item.value > 0); // 过滤空数据
// });
</script>
<style scoped>

View File

@ -33,17 +33,17 @@
<a-tag
size="Medium"
v-for="item in subCategories"
:key="item.value"
:key="item.id"
:checkable="true"
:checked="selectedSubCategory == item.value"
@check="handleSubCategoryCheck(item.value)"
:checked="selectedSubCategory == item.id"
@check="handleSubCategoryCheck(item.id)"
style="padding: 4px 16px; border-radius: 30px; height: 28px"
:style="
selectedSubCategory == item.value
selectedSubCategory == item.id
? 'color: #6d4cfe; background-color: #f0edff'
: 'color: #3C4043; background-color: #F7F8FA'
"
>{{ item.label }}</a-tag
>{{ item.name }}</a-tag
>
</a-space>
</a-space>
@ -77,32 +77,36 @@
<!-- Use the default slot to avoid extra spaces -->
<template #default>搜索</template>
</a-button>
<a-button type="primary" style="background-color: #fff; color: #000">
<template #icon>
<icon-refresh />
</template>
<!-- Use the default slot to avoid extra spaces -->
<template #default>重置</template>
</a-button>
<div
@click="handleReset"
style="
width: 92px;
height: 32px;
font-size: 14px;
color: #3c4043;
border: 1px solid #d7d7d9;
text-align: center;
line-height: 32px;
border-radius: 4px;
"
>
<icon-refresh></icon-refresh>
<span>重置</span>
</div>
</a-space>
</a-space>
</view>
</template>
<script setup>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { fetchIndustriesTree, fetchIndustryTopics, fetchIndustryTopicDetail } from '@/api/all/index';
import star1 from '@/assets/img/hottranslation/star-fill1.png';
import star2 from '@/assets/img/hottranslation/star-fill2.png';
import star3 from '@/assets/img/hottranslation/star-fill3.png';
import star4 from '@/assets/img/hottranslation/star-fill4.png';
import star5 from '@/assets/img/hottranslation/star-fill5.png';
const starImages = [star1, star2, star3, star4, star5];
import { fetchIndustriesTree } from '@/api/all/index';
// 行业大类
const industriesTree = ref([]);
// 数据状态
const selectedIndustry = ref();
const selectedSubCategory = ref('all');
const selectedSubCategory = ref(0);
const selectedTimePeriod = ref('7');
// 暴露这些状态给父组件
@ -111,20 +115,8 @@ defineExpose({
selectedSubCategory,
selectedTimePeriod,
});
// 行业热门话题洞察
const dataList = ref([]);
// 显示详情
const visible = ref(false);
const topicInfo = ref({});
// 二级类目选项
const subCategories = [
{ value: 'all', label: '全部' },
{ value: 'airline', label: '航司' },
{ value: 'hotel', label: '酒店' },
{ value: 'entertainment', label: '玩乐' },
{ value: 'cruise', label: '游轮' },
];
const subCategories = ref([]);
// 时间周期选项
const timePeriods = [
{
@ -141,6 +133,28 @@ const timePeriods = [
},
];
const handleIndustryCheck = (id) => {
selectedIndustry.value = id;
console.log(industriesTree.value);
for (let i = 0; i < industriesTree.value.length; i++) {
if (industriesTree.value[i].id == id) {
subCategories.value = [];
subCategories.value = [...industriesTree.value[i].children];
subCategories.value.unshift({ id: 0, name: '全部' });
selectedSubCategory.value = 0;
break;
}
}
};
const handleSubCategoryCheck = (id) => {
selectedSubCategory.value = id;
};
const handleTimePeriodCheck = (value) => {
selectedTimePeriod.value = value;
};
onMounted(() => {
getIndustriesTree();
});
@ -149,52 +163,21 @@ const getIndustriesTree = async () => {
const res = await fetchIndustriesTree();
industriesTree.value = res;
selectedIndustry.value = res[0].id;
getIndustryTopics();
selectedSubCategory.value = 0;
subCategories.value = [...industriesTree.value[0].children];
subCategories.value.unshift({ id: 0, name: '全部' });
};
// 行业热门话题
const getIndustryTopics = async () => {
let parms = {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
const res = await fetchIndustryTopics(parms);
dataList.value = res;
};
const handleIndustryCheck = (value) => {
selectedIndustry.value = value;
};
const handleSubCategoryCheck = (value) => {
selectedSubCategory.value = value;
};
const handleTimePeriodCheck = (value) => {
selectedTimePeriod.value = value;
};
// 详情
const gotoDetail = async (record) => {
console.log(record);
const res = await fetchIndustryTopicDetail(record.id);
console.log(res);
visible.value = true;
topicInfo.value = res;
};
const emit = defineEmits<{
(e: 'search'): void;
}>();
// 搜索
const handleSearch = () => {
getIndustryTopics();
emit('search');
};
// 弹窗的取消
const handleCancel = () => {
visible.value = false;
};
// 弹窗的确定
const handleBeforeOk = () => {
visible.value = false;
const handleReset = () => {
selectedIndustry.value = industriesTree.value[0].id;
selectedSubCategory.value = 0;
selectedTimePeriod.value = '7';
};
</script>

View File

@ -1,6 +1,6 @@
<template>
<view>
<topHeader ref="topHeaderRef"></topHeader>
<topHeader ref="topHeaderRef" @search="search"></topHeader>
<!-- 用户痛点观察 -->
<a-space direction="vertical" style="background-color: #fff; width: 100%; padding: 24px; margin: 24px 0">
@ -98,7 +98,7 @@
<span style="margin-right: 16px; width: 60px; font-size: 12px">原始来源 </span>
<a-space direction="vertical" style="margin-left: 15px">
<a-space v-for="item in topicInfo.user_pain_point_sources" :key="item">
<a-link style="background-color: initial" :href="item.link">{{ item.title }}</a-link>
<a-link style="background-color: initial" :href="item.link" target="_blank">{{ item.title }}</a-link>
<img src="@/assets/img/hottranslation/xhs.png" style="width: 16px; height: 16px" />
</a-space>
</a-space>
@ -140,6 +140,9 @@ const getUserPainPointsList = async () => {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
params['industry_id'] = selectedSubCategory.value;
}
const res = await fetchUserPainPointsList(params);
console.log('关键词热度榜', res);
// 这里需要根据API返回的数据结构处理成tagRows需要的格式
@ -155,13 +158,16 @@ const handleOk = () => {
visible.value = false;
};
// 监听筛选条件变化
watch([selectedIndustry, selectedTimePeriod], () => {
watch([selectedIndustry, selectedTimePeriod, selectedSubCategory], () => {
getUserPainPointsList();
});
onMounted(() => {
getUserPainPointsList();
});
const search = () => {
getUserPainPointsList();
};
</script>
<style scoped>

View File

@ -1,6 +1,6 @@
<template>
<view>
<topHeader ref="topHeaderRef"></topHeader>
<topHeader ref="topHeaderRef" @search="search"></topHeader>
<a-space style="width: 100%; display: flex">
<a-space direction="vertical" style="background-color: #fff; padding: 24px; flex: 1">
<a-space align="center">
@ -153,19 +153,29 @@ const genderValueData = ref([]);
const ageValueData = ref([]);
const geoList = ref([]);
// 监听筛选条件变化
watch([selectedIndustry, selectedTimePeriod], () => {
watch([selectedIndustry, selectedTimePeriod, selectedSubCategory], () => {
getAgeDistributionsList();
getGeoDistributionsList();
getGenderDistributionsList();
drawChinaMap();
});
const search = () => {
getAgeDistributionsList();
getGeoDistributionsList();
getGenderDistributionsList();
drawChinaMap();
};
// 获取年龄分布列表
const getAgeDistributionsList = async () => {
const params = {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
parms['industry_id'] = selectedSubCategory.value;
}
const res = await fetchAgeDistributionsList(params);
console.log('年龄分布:', res);
ageValueData.value = res;
@ -179,6 +189,9 @@ const getGeoDistributionsList = async () => {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
parms['industry_id'] = selectedSubCategory.value;
}
const res = await fetchGeoDistributionsList(params);
console.log('地理分布:', res);
geoList.value = res;
@ -189,6 +202,9 @@ const getGenderDistributionsList = async () => {
industry_id: selectedIndustry.value,
time_dimension: selectedTimePeriod.value,
};
if (selectedSubCategory.value != 0) {
parms['industry_id'] = selectedSubCategory.value;
}
const res = await fetchGenderDistributionsList(params);
genderData.value = [];
genderData.value = [...res];