diff --git a/src/pages-evaluation-sub/aiAutoFill/index.vue b/src/pages-evaluation-sub/aiAutoFill/index.vue index 557c9b5..e23f65a 100644 --- a/src/pages-evaluation-sub/aiAutoFill/index.vue +++ b/src/pages-evaluation-sub/aiAutoFill/index.vue @@ -62,7 +62,7 @@ diff --git a/src/pages-evaluation-sub/evaluate/academicReport/CharacterReport.vue b/src/pages-evaluation-sub/evaluate/academicReport/CharacterReport.vue new file mode 100644 index 0000000..b607214 --- /dev/null +++ b/src/pages-evaluation-sub/evaluate/academicReport/CharacterReport.vue @@ -0,0 +1,126 @@ + +{ + style: { + navigationStyle: 'custom', + }, +} + + + + + + diff --git a/src/pages-evaluation-sub/evaluate/academicReport/InterestReport.vue b/src/pages-evaluation-sub/evaluate/academicReport/InterestReport.vue new file mode 100644 index 0000000..282afc8 --- /dev/null +++ b/src/pages-evaluation-sub/evaluate/academicReport/InterestReport.vue @@ -0,0 +1,123 @@ + +{ + style: { + navigationStyle: 'custom', + }, +} + + + + + + diff --git a/src/pages-evaluation-sub/evaluate/academicReport/index.vue b/src/pages-evaluation-sub/evaluate/academicReport/index.vue deleted file mode 100644 index 5aa96c4..0000000 --- a/src/pages-evaluation-sub/evaluate/academicReport/index.vue +++ /dev/null @@ -1,249 +0,0 @@ - -{ - style: { - navigationStyle: 'custom', - }, -} - - - - - - diff --git a/src/pages-evaluation-sub/evaluate/components/InterestingThings.vue b/src/pages-evaluation-sub/evaluate/components/InterestingThings.vue index d856937..902421f 100644 --- a/src/pages-evaluation-sub/evaluate/components/InterestingThings.vue +++ b/src/pages-evaluation-sub/evaluate/components/InterestingThings.vue @@ -1,40 +1,70 @@ - + diff --git a/src/pages-evaluation-sub/evaluate/components/IntroMajor.vue b/src/pages-evaluation-sub/evaluate/components/IntroMajor.vue new file mode 100644 index 0000000..7014e97 --- /dev/null +++ b/src/pages-evaluation-sub/evaluate/components/IntroMajor.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/src/pages-evaluation-sub/evaluate/components/interestChart/CharacterChart.vue b/src/pages-evaluation-sub/evaluate/components/interestChart/CharacterChart.vue new file mode 100644 index 0000000..19f44a7 --- /dev/null +++ b/src/pages-evaluation-sub/evaluate/components/interestChart/CharacterChart.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/src/pages-evaluation-sub/evaluate/components/interestChart/DependenciesChart.vue b/src/pages-evaluation-sub/evaluate/components/interestChart/DependenciesChart.vue index 632c4b3..10ac3aa 100644 --- a/src/pages-evaluation-sub/evaluate/components/interestChart/DependenciesChart.vue +++ b/src/pages-evaluation-sub/evaluate/components/interestChart/DependenciesChart.vue @@ -1,17 +1,37 @@ @@ -19,111 +39,153 @@ import LEchart from '@/pages-evaluation-sub/uni_modules/lime-echart/components/l-echart/l-echart.vue' const echarts = require('../../../uni_modules/lime-echart/static/echarts.min') const echart = ref(null) + const props = defineProps({ - chartData: { - type: Array, - default: () => ['社会型', '研究型', '企业型', '艺术型', '常规型', '现实型'], + mainDomain: { + type: String, + default: '', + }, + major: { + type: String, + default: '', + }, + occupation: { + type: String, + default: '', }, }) -onMounted(() => { - echart.value.init(echarts, (chart) => { - let option = { - tooltip: {}, - animationDurationUpdate: 1500, - animationEasingUpdate: 'quinticInOut', - series: [ - { - type: 'graph', - layout: 'none', - symbolSize: 50, - roam: true, + +// 定义固定的样式配置 +const styleConfig = [ + { bg: '#FDF0F0', text: '#F58C8C', size: 45, x: 2, y: 38 }, + { bg: '#ECF5FF', text: '#3B9DFF', size: 77, x: 52, y: 64 }, + { bg: '#F6F4FD', text: '#7E5EFF', size: 63, x: 136, y: 48 }, + { bg: '#FFF8E5', text: '#FFC832', size: 62, x: 116, y: 104 }, + { bg: '#E6FBF0', text: '#37D480', size: 45, x: 0, y: 110 }, + { bg: '#FDF0F0', text: '#F58C8C', size: 45, x: 166, y: 118 }, +] + +const chartData = ref([]) + +// 根据文字长度选择合适的样式 +const selectStylesByLength = (items: string[]) => { + const usedIndices = new Set() + const result: Array<{ style: any; text: string }> = [] + + // 优先处理大尺寸的元素 + const processItems = (items: string[], targetSize: number) => { + items.forEach((item) => { + // 查找匹配大小且未使用的样式 + const availableIndices = styleConfig + .map((style, index) => ({ index, style })) + .filter(({ style, index }) => style.size === targetSize && !usedIndices.has(index)) + + if (availableIndices.length > 0) { + const { index, style } = availableIndices[0] + usedIndices.add(index) + result.push({ style, text: item }) + } + }) + } + + // 按不同尺寸进行分类 + const bigItems = items.filter((item) => item.length >= 4) + const mediumItems = items.filter((item) => item.length === 3) + const smallItems = items.filter((item) => item.length <= 2) + + // 依次处理不同尺寸的元素 + processItems(bigItems, 77) + processItems(mediumItems, 63) + processItems(smallItems, 45) + + // 处理剩余的未分配元素(使用任何可用样式) + const remainingItems = items.filter((item) => !result.some((r) => r.text === item)) + + remainingItems.forEach((item) => { + // 尝试找到任何未使用的样式 + for (let i = 0; i < styleConfig.length; i++) { + if (!usedIndices.has(i)) { + usedIndices.add(i) + result.push({ style: styleConfig[i], text: item }) + break + } + } + }) + + return result +} + +watch( + () => props.mainDomain, + (newV) => { + if (!newV) return + + chartData.value = newV.split('、') + echart.value.init(echarts, (chart) => { + // 根据文字长度选择合适的样式 + const selectedStyles = selectStylesByLength(chartData.value) + + // 生成图表数据 + const data = selectedStyles.map(({ style, text }) => { + return { + name: text, + x: style.x, + y: style.y, + symbolSize: style.size, + itemStyle: { + color: style.bg, + }, label: { show: true, + color: style.text, + fontSize: 14, + formatter: (params: any) => { + const text = params.name + if (text.length >= 5) { + const lines = [] + for (let i = 0; i < text.length; i += 3) { + lines.push(text.slice(i, i + 3)) + } + return lines.join('\n\n') + } + return text + }, + rich: { + lineHeight: 20, + }, + align: 'center', + verticalAlign: 'middle', + position: 'inside', }, - edgeSymbol: ['circle', 'arrow'], - edgeSymbolSize: [4, 10], - edgeLabel: { - fontSize: 20, - }, - data: [ - { - name: '节点1', - x: 300, - y: 300, - }, - { - name: '节点2', - x: 800, - y: 300, - }, - { - name: '节点3', - x: 550, - y: 100, - }, - { - name: '节点4', - x: 550, - y: 500, - }, - ], - // links: [], - links: [ - { - source: 0, - target: 1, - symbolSize: [5, 20], - label: { - show: true, - }, - lineStyle: { - width: 5, - curveness: 0.2, - }, - }, - { - source: '节点2', - target: '节点1', - label: { - show: true, - }, - lineStyle: { - curveness: 0.2, - }, - }, - { - source: '节点1', - target: '节点3', - }, - { - source: '节点2', - target: '节点3', - }, - { - source: '节点2', - target: '节点4', - }, - { - source: '节点1', - target: '节点4', - }, - ], - lineStyle: { - opacity: 0.9, - width: 2, - curveness: 0, - }, - }, - ], - } + } + }) - chart.setOption(option) - }) -}) + let option = { + tooltip: {}, + animationDurationUpdate: 1500, + animationEasingUpdate: 'quinticInOut', + series: [ + { + type: 'graph', + layout: 'none', + roam: true, + data, + links: [], + lineStyle: { + opacity: 0.9, + width: 2, + curveness: 0, + }, + }, + ], + } + + chart.setOption(option) + }) + }, +) diff --git a/src/pages-evaluation-sub/evaluate/components/interestChart/InterestRadar.vue b/src/pages-evaluation-sub/evaluate/components/interestChart/InterestRadar.vue index 106e517..060f75a 100644 --- a/src/pages-evaluation-sub/evaluate/components/interestChart/InterestRadar.vue +++ b/src/pages-evaluation-sub/evaluate/components/interestChart/InterestRadar.vue @@ -2,7 +2,9 @@ - + + + @@ -91,6 +93,12 @@ watch( } }, ) + +onBeforeMount(() => { + if (echart.value) { + echart.value.dispose() + } +}) diff --git a/src/pages-evaluation-sub/rank/index.vue b/src/pages-evaluation-sub/rank/index.vue index 8dc9ed8..998d615 100644 --- a/src/pages-evaluation-sub/rank/index.vue +++ b/src/pages-evaluation-sub/rank/index.vue @@ -233,9 +233,15 @@ const getScoreSectionData = () => { const echart = ref(null) -onMounted(() => { +onLoad(() => { getScoreSectionData() }) + +onBeforeMount(() => { + if (echart.value) { + echart.value.dispose() + } +}) diff --git a/src/pages-sub/evaluation/assessmentPage.vue b/src/pages-sub/evaluation/assessmentPage.vue index e3f7e65..7768c00 100644 --- a/src/pages-sub/evaluation/assessmentPage.vue +++ b/src/pages-sub/evaluation/assessmentPage.vue @@ -119,21 +119,32 @@ const handleCheckChange = (value: any[]) => { } else { disableBtn.value = false } - let _type = questions.value[currentIndex.value].type - let _name = questions.value[currentIndex.value].answer[0].tag - if (answerMap.has(_type)) { - let val = answerMap.get(_type) - val.value += value.length - answerMap.set(_type, val) - } else { - answerMap.set(_type, { name: _name, value: value.length }) - } if (questionType.value === 0) { // 单选题就点完跳下一题 handleNextQuestion() } } + +const calcScore = () => { + let _type = questions.value[currentIndex.value].type + let _name = questions.value[currentIndex.value].answer[0].tag + let _options = questions.value[currentIndex.value].answer.filter((answer) => { + return checkedList.value.includes(answer.key) + }) + + if (answerMap.has(_type)) { + let val = answerMap.get(_type) + val.value += _options.reduce((count, cur) => (count = count + Number(cur.value)), 0) + answerMap.set(_type, val) + } else { + answerMap.set(_type, { + name: _name, + value: _options.reduce((count, cur) => (count = count + Number(cur.value)), 0), + }) + } +} + // 当前显示的卡片索引 const currentIndex = ref(0) const questions = ref([]) @@ -177,6 +188,7 @@ onLoad((options) => { const handleNextQuestion = () => { if (disableBtn.value) return disableBtn.value = true + calcScore() checkedList.value = [] if (currentIndex.value === questions.value.length - 1) { handleSubmit() diff --git a/src/pages-sub/ucenter/evaluate/evaluateList.vue b/src/pages-sub/ucenter/evaluate/evaluateList.vue index 7e86372..5d4b783 100644 --- a/src/pages-sub/ucenter/evaluate/evaluateList.vue +++ b/src/pages-sub/ucenter/evaluate/evaluateList.vue @@ -47,8 +47,17 @@ const toDetail = (item: any) => { // =9 MHT /// =-1 价值观 /// =-2 留学咨询 + let url = '' + + if (item.type === 0) { + url = `/pages-evaluation-sub/evaluate/academicReport/InterestReport?id=${item.reportsId}&type=${item.type}` + } else if (item.type === 1) { + url = `/pages-evaluation-sub/evaluate/academicReport/CharacterReport?id=${item.reportsId}&type=${item.type}` + } else if (item.type === 2) { + url = `/pages-evaluation-sub/evaluate/academicReport/CapabilityReport?id=${item.reportsId}&type=${item.type}` + } uni.navigateTo({ - url: `/pages-evaluation-sub/evaluate/academicReport/index?id=${item.reportsId}&type=${item.type}`, + url, }) } diff --git a/src/pages.json b/src/pages.json index 9950701..e4cd407 100644 --- a/src/pages.json +++ b/src/pages.json @@ -348,7 +348,21 @@ } }, { - "path": "evaluate/academicReport/index", + "path": "evaluate/academicReport/CapabilityReport", + "type": "page", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "evaluate/academicReport/CharacterReport", + "type": "page", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "evaluate/academicReport/InterestReport", "type": "page", "style": { "navigationStyle": "custom" diff --git a/src/service/index/api.ts b/src/service/index/api.ts index f0e2193..bede426 100644 --- a/src/service/index/api.ts +++ b/src/service/index/api.ts @@ -413,3 +413,19 @@ export const deleteMyAppointment = (params: { id: number }) => { export const getHollandDimensionInfo = (params: { ScaleId: string }) => { return http.get('/api/busScale/GetHollandDimension', params) } + +export const getTagMapPro = (params: { tag: string }) => { + return http.get('/api/busScale/getTagMapPro', params) +} + +export const getTagMapPerson = (params: { tag: string }) => { + return http.get('/api/busScale/getTagMapPerson', params) +} + +export const getMBTIDimension = (params: { ScaleId: number }) => { + return http.get('/api/busScale/GetMBTIDimension', params) +} + +export const getAbilityDimension = (params: { ScaleId: number }) => { + return http.get('/api/busscale/GetAbilityDimension', params) +} diff --git a/src/types/uni-pages.d.ts b/src/types/uni-pages.d.ts index 9529471..1c84383 100644 --- a/src/types/uni-pages.d.ts +++ b/src/types/uni-pages.d.ts @@ -40,7 +40,9 @@ interface NavigateToOptions { "/login-sub/index" | "/pages-evaluation-sub/aiAutoFill/index" | "/pages-evaluation-sub/rank/index" | - "/pages-evaluation-sub/evaluate/academicReport/index" | + "/pages-evaluation-sub/evaluate/academicReport/CapabilityReport" | + "/pages-evaluation-sub/evaluate/academicReport/CharacterReport" | + "/pages-evaluation-sub/evaluate/academicReport/InterestReport" | "/aiService-sub/index/index"; } interface RedirectToOptions extends NavigateToOptions {}