fix: 修复主页数据展示问题
1. 优化 MineTask 组件的数据展示逻辑 2. 修复 TypeScript 类型错误 3. 移除冗余的 SurveyAnalysis 组件引用 4. 清理未使用的样式和代码
This commit is contained in:
@@ -10,6 +10,9 @@ import {
|
||||
// series 信息
|
||||
const tableData = ref([]);
|
||||
const analysis = defineModel('analysis');
|
||||
|
||||
console.log('analysis', analysis.value);
|
||||
|
||||
const series = ref([]);
|
||||
const dimension = defineModel('dimension');
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getSurveysDetail } from '@/api/design';
|
||||
import { getSurveysPage } from '@/api/home';
|
||||
import { surveyAnalysis } from '@/api/survey';
|
||||
import { ref, type Ref } from 'vue';
|
||||
|
||||
// 异步函数获取数据
|
||||
@@ -37,4 +38,16 @@ function fetchSingleSurvey(sn: string) {
|
||||
return { currentSurvey };
|
||||
}
|
||||
|
||||
export { fetchSurveys, fetchSingleSurvey };
|
||||
function useFetchAnalysis(sn: string) {
|
||||
const questionAnalysis = ref();
|
||||
|
||||
surveyAnalysis(sn).then(({ data }) => {
|
||||
questionAnalysis.value = data.data;
|
||||
});
|
||||
|
||||
return {
|
||||
questionAnalysis
|
||||
};
|
||||
}
|
||||
|
||||
export { fetchSurveys, fetchSingleSurvey, useFetchAnalysis };
|
||||
|
||||
@@ -66,7 +66,7 @@ useFetchAnalysis(sn.value);
|
||||
<!-- 图表分析部分 -->
|
||||
<van-cell class="analysis">
|
||||
<template #extra>
|
||||
<analysis-info />
|
||||
<analysis-info :sn="sn" />
|
||||
</template>
|
||||
</van-cell>
|
||||
</section>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { questionAnalysis } from '../../hooks/useAnalysis';
|
||||
import { useFetchAnalysis } from '../../hooks/useAnalysis';
|
||||
import { questionTypeMap } from '@/utils/question/typeMapping';
|
||||
import ChartMsg from '@/components/Analysis/Index.vue';
|
||||
import { getTableData } from './hooks/pieSeries';
|
||||
@@ -34,7 +34,8 @@ import YlTable from '@/components/YlTable/Index.vue';
|
||||
import { ref } from 'vue';
|
||||
// questionTypeMap 自己去对应
|
||||
const showChart = ref([1, 2, 5, 106, 9, 10]);
|
||||
|
||||
const sn = defineModel('sn');
|
||||
const { questionAnalysis } = useFetchAnalysis(sn.value as string);
|
||||
// const showTable = ref([1,2,4])
|
||||
|
||||
// 构建表头
|
||||
|
||||
@@ -10,6 +10,7 @@ type AiInsightType = {
|
||||
message: string;
|
||||
info: string;
|
||||
};
|
||||
|
||||
// ai 智能洞察
|
||||
export const aiInsightsConfig = ref<AiInsightType>({
|
||||
visible: false,
|
||||
@@ -18,7 +19,6 @@ export const aiInsightsConfig = ref<AiInsightType>({
|
||||
info: ''
|
||||
});
|
||||
|
||||
const questionAnalysis = ref();
|
||||
const params: AnalysisParam = {
|
||||
page: 1,
|
||||
per_page: 30,
|
||||
@@ -71,10 +71,7 @@ export async function checkAnalysis(sn: string) {
|
||||
return data;
|
||||
}
|
||||
|
||||
async function useFetchAnalysis(sn: string) {
|
||||
const res = await surveyAnalysis(sn);
|
||||
questionAnalysis.value = res.data.data;
|
||||
// console.log(`question analysis`, questionAnalysis.value);
|
||||
}
|
||||
|
||||
export { useFetchAnalysis, questionAnalysis, aiAnalysisData, currentSn };
|
||||
|
||||
export {aiAnalysisData, currentSn };
|
||||
export { useFetchAnalysis } from '@/hooks/request/useSurvey';
|
||||
|
||||
Reference in New Issue
Block a user