refactor(analysis): 优化分析组件和移除冗余日志输出
- 移除了 Analysis组件中的多余 console.log 语句 - 优化了MineTask组件中的轮播图高度计算逻辑- 删除了 useAnalysis hook 中的冗余日志输出
This commit is contained in:
@@ -23,14 +23,11 @@ const chartHeight = computed(() => {
|
||||
|
||||
// 做一些额外的检测, 如果 option 下面的title 字段超过 8 个,就把 addHeight 增加
|
||||
analysis.value?.option?.forEach((item: any) => {
|
||||
console.log(item);
|
||||
|
||||
if (item.title?.length > 8) {
|
||||
addHeight += 2;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`addHeight`, addHeight);
|
||||
// 每三个选项高度增加 20px, 默认 300px
|
||||
return dimension.value ? 280 : 280 + addHeight;
|
||||
});
|
||||
@@ -52,8 +49,6 @@ watch(
|
||||
// console.log(`series value`, series.value);
|
||||
|
||||
if (!series.value.data?.length) return;
|
||||
console.log(`series.value.data`, series.value.data);
|
||||
|
||||
// nextTick(() => {
|
||||
// setTimeout(() => {
|
||||
useSetPieChart(pieChart, series, { title: false, legend: false });
|
||||
@@ -101,10 +96,7 @@ const chartVisible = computed(() => {
|
||||
// });
|
||||
} else if (analysis.value.question_type === 106 || analysis.value.question_type === 5) {
|
||||
const data = series.value?.data as { name: any; value: any }[];
|
||||
console.log(`series.value on nps`, series.value?.data);
|
||||
|
||||
const filterData = data?.filter((item) => item.value && Number(item.value) > 0);
|
||||
console.log(`filterData`, filterData);
|
||||
|
||||
return filterData?.length;
|
||||
// console.log(`series.value on nps`, series.value?.data);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import QuestionList from './components/QuestionList.vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref, watch, nextTick } from 'vue';
|
||||
import { isDrag } from './hooks/useDragEvent';
|
||||
const active = ref(0);
|
||||
const total = ref(0);
|
||||
@@ -10,27 +10,42 @@ function setActive(act: number, tol: number) {
|
||||
total.value = tol;
|
||||
}
|
||||
const swiper = ref();
|
||||
const questionComat = ref();
|
||||
const questionComat = ref([]);
|
||||
function handleDragStart() {
|
||||
isDrag.value = true;
|
||||
}
|
||||
watch(
|
||||
() => active.value,
|
||||
(value) => {
|
||||
setTimeout(() => {
|
||||
// 获取高度
|
||||
swiper.value.$el.style.height = questionComat.value[value]?.$el.scrollHeight + 30 + 'px';
|
||||
swiper.value.resize();
|
||||
}, 500);
|
||||
updateSwiperHeight();
|
||||
}
|
||||
);
|
||||
function slideChange() {
|
||||
|
||||
nextTick(() => {
|
||||
if (questionComat.value && questionComat.value.length > 0) {
|
||||
console.log('questionComat 已经加载完成');
|
||||
updateSwiperHeight();
|
||||
}
|
||||
});
|
||||
|
||||
function updateSwiperHeight() {
|
||||
setTimeout(() => {
|
||||
// 获取高度
|
||||
swiper.value.$el.style.height = questionComat.value[active.value]?.$el.scrollHeight + 30 + 'px';
|
||||
swiper.value.resize();
|
||||
if (swiper.value && questionComat.value[active.value]) {
|
||||
console.log(questionComat.value[active.value]?.$el.scrollHeight, '123');
|
||||
if (questionComat.value[active.value]?.$el.scrollHeight === 0) {
|
||||
updateSwiperHeight();
|
||||
return false;
|
||||
}
|
||||
|
||||
swiper.value.$el.style.height =
|
||||
questionComat.value[active.value]?.$el.scrollHeight + 30 + 'px';
|
||||
swiper.value.resize();
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
function slideChange() {
|
||||
updateSwiperHeight();
|
||||
}
|
||||
function handleDragEnd() {
|
||||
isDrag.value = false;
|
||||
// setTimeout(() => {
|
||||
|
||||
@@ -52,9 +52,6 @@ export async function postAnalysis(sn: string) {
|
||||
clearInterval(aiInsightsConfig.value.timer);
|
||||
// 获取洞察结果
|
||||
const { data } = await getAnalysis(sn);
|
||||
console.log(data.other.overall_conclusion);
|
||||
|
||||
console.log(data);
|
||||
|
||||
aiAnalysisData.value = data;
|
||||
aiInsightsConfig.value.message = data.other.overall_conclusion;
|
||||
@@ -71,7 +68,5 @@ export async function checkAnalysis(sn: string) {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export {aiAnalysisData, currentSn };
|
||||
export { aiAnalysisData, currentSn };
|
||||
export { useFetchAnalysis } from '@/hooks/request/useSurvey';
|
||||
|
||||
Reference in New Issue
Block a user