Merge branch 'feature/feature-20250430-h5' of https://e.coding.yili.com/yldc/ylst/ylst-survey-h5 into feature/feature-20250430-h5
This commit is contained in:
3
components.d.ts
vendored
3
components.d.ts
vendored
@@ -33,12 +33,10 @@ declare module 'vue' {
|
|||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
||||||
VanButton: typeof import('vant/es')['Button']
|
VanButton: typeof import('vant/es')['Button']
|
||||||
VanCard: typeof import('vant/es')['Card']
|
|
||||||
VanCell: typeof import('vant/es')['Cell']
|
VanCell: typeof import('vant/es')['Cell']
|
||||||
VanCellGroup: typeof import('vant/es')['CellGroup']
|
VanCellGroup: typeof import('vant/es')['CellGroup']
|
||||||
VanCheckbox: typeof import('vant/es')['Checkbox']
|
VanCheckbox: typeof import('vant/es')['Checkbox']
|
||||||
VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup']
|
VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup']
|
||||||
VanCol: typeof import('vant/es')['Col']
|
|
||||||
VanDivider: typeof import('vant/es')['Divider']
|
VanDivider: typeof import('vant/es')['Divider']
|
||||||
VanField: typeof import('vant/es')['Field']
|
VanField: typeof import('vant/es')['Field']
|
||||||
VanIcon: typeof import('vant/es')['Icon']
|
VanIcon: typeof import('vant/es')['Icon']
|
||||||
@@ -49,7 +47,6 @@ declare module 'vue' {
|
|||||||
VanPopup: typeof import('vant/es')['Popup']
|
VanPopup: typeof import('vant/es')['Popup']
|
||||||
VanRadio: typeof import('vant/es')['Radio']
|
VanRadio: typeof import('vant/es')['Radio']
|
||||||
VanRadioGroup: typeof import('vant/es')['RadioGroup']
|
VanRadioGroup: typeof import('vant/es')['RadioGroup']
|
||||||
VanRow: typeof import('vant/es')['Row']
|
|
||||||
VanSearch: typeof import('vant/es')['Search']
|
VanSearch: typeof import('vant/es')['Search']
|
||||||
VanStepper: typeof import('vant/es')['Stepper']
|
VanStepper: typeof import('vant/es')['Stepper']
|
||||||
VanSwipe: typeof import('vant/es')['Swipe']
|
VanSwipe: typeof import('vant/es')['Swipe']
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ useSetPieChart(pieChart, series, { title: false, legend: false });
|
|||||||
<template>
|
<template>
|
||||||
<section>
|
<section>
|
||||||
<!-- 图表部分 -->
|
<!-- 图表部分 -->
|
||||||
<div
|
<div style="display: flex; height: 300px; width: 100%; justify-content: center; margin: 16px 0">
|
||||||
style="display: flex; height: 300px; width: 300px; justify-content: center; margin: 16px 0"
|
|
||||||
>
|
|
||||||
<span ref="pieChart" style="width: 100%; height: 300px"></span>
|
<span ref="pieChart" style="width: 100%; height: 300px"></span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ function useSetPieChart(
|
|||||||
chartInstance = chart.init(dom.value);
|
chartInstance = chart.init(dom.value);
|
||||||
pieOption.series = JSON.parse(JSON.stringify(series.value));
|
pieOption.series = JSON.parse(JSON.stringify(series.value));
|
||||||
|
|
||||||
|
console.log(pieOption);
|
||||||
|
|
||||||
// 设置图表选项
|
// 设置图表选项
|
||||||
chartInstance.setOption(pieOption, opts);
|
chartInstance.setOption(pieOption, opts);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
const map = new Map<number, string>();
|
import { basicQuesTypeList } from '@/utils/common';
|
||||||
|
|
||||||
map.set(1, '单选题');
|
const map = new Map<number, string>();
|
||||||
map.set(2, "多选题")
|
basicQuesTypeList.map((item) => {
|
||||||
map.set(3, "图片上传题")
|
map.set(item.question_type, item.name);
|
||||||
map.set(5, '数值打分题');
|
});
|
||||||
map.set(9, '矩阵单选');
|
export { map as questionTypeMap };
|
||||||
|
|
||||||
export { map as questionTypeMap };
|
|
||||||
|
|||||||
@@ -1,23 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<section
|
<section v-for="analysis in questionAnalysis" :key="analysis.stem" class="mt10">
|
||||||
v-for="analysis in questionAnalysis"
|
<el-tag>{{ questionTypeMap.get(analysis.question_type as number) }}</el-tag>
|
||||||
:key="analysis.stem"
|
{{ analysis.stem }}
|
||||||
v-if="analysis?.option.length"
|
|
||||||
>
|
<chart-msg :series="formatData(analysis)" v-if="showChart.includes(analysis.question_type)" />
|
||||||
<el-tag>{{ questionTypeMap.get(analysis.question_type as number) }}</el-tag>
|
|
||||||
{{ analysis.stem }}
|
<yl-table
|
||||||
|
:props="getTableHeadProps(analysis.head)"
|
||||||
<chart-msg :series="formatData(analysis)" />
|
:data="analysis.option"
|
||||||
|
v-if="analysis.head"
|
||||||
{{ analysis }}
|
></yl-table>
|
||||||
</section>
|
|
||||||
</div>
|
<!-- {{ analysis }}-->
|
||||||
</template>
|
</section>
|
||||||
|
</div>
|
||||||
<script setup lang="ts">
|
</template>
|
||||||
import { questionAnalysis } from '../../hooks/useAnalysis';
|
|
||||||
import { questionTypeMap } from '@/utils/question/typeMapping';
|
<script setup lang="ts">
|
||||||
import ChartMsg from '@/components/Analysis/Index.vue';
|
import { questionAnalysis } from '../../hooks/useAnalysis';
|
||||||
import { formatData } from './hooks/pieSeries';
|
import { questionTypeMap } from '@/utils/question/typeMapping';
|
||||||
</script>
|
import ChartMsg from '@/components/Analysis/Index.vue';
|
||||||
|
import { formatData } from './hooks/pieSeries';
|
||||||
|
import YlTable from '@/components/YlTable/Index.vue';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
// questionTypeMap 自己去对应
|
||||||
|
const showChart = ref([1, 2, 5, 106, 8, 9, 10]);
|
||||||
|
|
||||||
|
// const showTable = ref([1,2,4])
|
||||||
|
const getTableHeadProps = (values: any[]) => {
|
||||||
|
return values.map((item: Object) => {
|
||||||
|
return {
|
||||||
|
label: item.title,
|
||||||
|
prop: item.key
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.mt10 {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -3,22 +3,21 @@ import { ref } from 'vue';
|
|||||||
export const series = ref({
|
export const series = ref({
|
||||||
name: 'Access From',
|
name: 'Access From',
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: ['40%', '70%'],
|
radius: '70%',
|
||||||
avoidLabelOverlap: false,
|
data: [
|
||||||
label: {
|
{ value: 1048, name: 'Search Engine' },
|
||||||
show: false,
|
{ value: 735, name: 'Direct' },
|
||||||
position: 'center'
|
{ value: 580, name: 'Email' },
|
||||||
},
|
{ value: 484, name: 'Union Ads' },
|
||||||
|
{ value: 300, name: 'Video Ads' }
|
||||||
|
],
|
||||||
emphasis: {
|
emphasis: {
|
||||||
label: {
|
itemStyle: {
|
||||||
show: true,
|
// shadowBlur: 10,
|
||||||
fontSize: 40,
|
shadowOffsetX: 0,
|
||||||
fontWeight: 'bold'
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
labelLine: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
data: []
|
data: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { surveyAnalysis } from '@/api/survey';
|
|||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { analysisInsights, checkAnalysisStatus, getAnalysis } from '@/api/anslysis/aiInsight';
|
import { analysisInsights, checkAnalysisStatus, getAnalysis } from '@/api/anslysis/aiInsight';
|
||||||
|
|
||||||
|
const aiAnalysisData = ref();
|
||||||
type AiInsightType = {
|
type AiInsightType = {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
timer: NodeJS.Timeout | undefined;
|
timer: NodeJS.Timeout | undefined;
|
||||||
@@ -51,6 +52,10 @@ export async function postAnalysis(sn: string) {
|
|||||||
// 获取洞察结果
|
// 获取洞察结果
|
||||||
const { data } = await getAnalysis(sn);
|
const { data } = await getAnalysis(sn);
|
||||||
console.log(data.other.overall_conclusion);
|
console.log(data.other.overall_conclusion);
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
aiAnalysisData.value = data;
|
||||||
aiInsightsConfig.value.message = data.other.overall_conclusion;
|
aiInsightsConfig.value.message = data.other.overall_conclusion;
|
||||||
aiInsightsConfig.value.visible = false;
|
aiInsightsConfig.value.visible = false;
|
||||||
} else if (data.status === 2) {
|
} else if (data.status === 2) {
|
||||||
@@ -71,4 +76,4 @@ async function useFetchAnalysis(sn: string) {
|
|||||||
// console.log(`question analysis`, questionAnalysis.value);
|
// console.log(`question analysis`, questionAnalysis.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { useFetchAnalysis, questionAnalysis };
|
export { useFetchAnalysis, questionAnalysis, aiAnalysisData };
|
||||||
|
|||||||
Reference in New Issue
Block a user