123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732 |
- <script setup lang="ts">
- //引入echarts
- import * as echarts from 'echarts'
- import CpmdHeader from '@/components/CpmdHeader.vue';
- import CpmdFooter from '@/components/CpmdFooter.vue'
- import { onMounted, onUnmounted, reactive, ref } from 'vue'
- import { userInfoStore } from '@/stores'
- const userInfo = userInfoStore()
- import { useRoute, useRouter } from 'vue-router'
- import { queryReportApi } from '@/api/plan';
- import { ElMessage } from 'element-plus';
- import { getUnread } from '@/utils/test';
- //雷达图
- const echarts_ld = ref<any>()
- //设置
- const route = useRoute()
- //此处应该是唯一的报告ID
- const planId = ref<string>('')
- const planName = ref<string>('')
- //定义一个参数判断测试报告需要跳转到哪
- const goFlag = ref('0')
- //获取到报告的总数据
- const reportData = ref<any>([])
- const echarts_des_list = ref<string[]>(['', '', '', '', '', ''])
- const echarts_data_list = ref<number[]>([10, 20, 30, 40, 0, 0])
- const echarts_name_list = ref<any>([
- // { name: '阳光指数', max: 100, color: '#000000' },
- // { name: '情绪稳定指数', max: 100, color: '#000000' },
- // { name: '社交能力', max: 100, color: '#000000' },
- // { name: '自律能力', max: 100, color: '#000000' },
- // { name: '爱情观', max: 100, color: '#000000' },
- // { name: '人生观', max: 100, color: '#000000' }
- ])
- const option = reactive({
- title: {
- // text: 'Basic Radar Chart'
- },
- legend: {
- // data: ['Allocated Budget', 'Actual Spending']
- },
- radar: {
- center: ['50%', "60%"],
- shape: 'square', //设置雷达图形状,值有circle、square,默认为方形
- splitNumber: 3, // 雷达图圈数设置
- radius: 90,
- // shape: 'circle',
- indicator: echarts_name_list.value,
- name: { //修改indicator文字的颜色
- textStyle: {
- color: "#999999"
- }
- },
- // 设置雷达图中间射线的颜色
- // axisLine: {
- // lineStyle: {
- // color: '#FFBA92',
- // },
- // },
- // splitArea: { //设置图表颜色,show的值为true
- // show: true,
- // areaStyle: {
- // // color:"#c1ddf8", //一般设置方式
- // //设置渐变背景色 new echarts.graphic.LinearGradient(a,b,c,d,arr)
- // //a ,b,c,d值可为0,1 a:1表示arr中的颜色右到左;c:1 arr中的颜色左到右
- // //b:1表示arr中的颜色下到上;d:1表示arr中的颜色上到下
- // color: new echarts.graphic.LinearGradient(0, 0, 0, 0, [
- // { offset: 1, color: '#F7E1DE' }, // 0% 处的颜色
- // { offset: 0, color: '#FF1E00' }// 100% 处的颜色
- // ], false)
- // }
- // },
- // splitArea: {
- // areaStyle: {
- // color: {
- // type: 'radial', // linear 线性渐变 radial径向渐变
- // x: 0.4, // 0.5为正中心,如果小于渐变中心靠左
- // y: 0.5, // 0.5为正中心,如果小于渐变中心靠上
- // r: 1,
- // colorStops: [{
- // offset: 0, color: '#f16e6e' // 0% 处的颜色rgba(247, 215, 211, 1)
- // }, {
- // offset: 1, color: 'rgba(247, 225, 222, 1)' // 100% 处的颜色rgba(247, 225, 222, 1)
- // }],
- // }
- // }
- // },
- //网格颜色设置
- // splitLine: {
- // show: true,
- // lineStyle: {
- // width: 1,
- // color: '#FFBA92',
- // },
- // },
- },
- // name: {
- // //修改indicator文字的颜色
- // textStyle: {
- // color: "#000000",
- // },
- // },
- series: [
- {
- name: 'Budget vs spending',
- type: 'radar',
- symbolSize: 6,
- data: [
- {
- value: echarts_data_list.value,
- itemStyle: { //该数值区域样式设置
- normal: {
- color: 'rgba(77, 106, 213, 1)', //背景颜色,还需设置areaStyle //修改线条颜色
- lineStyle: {
- color: 'rgba(77, 106, 213, 1)', //边框颜色rgba(77, 106, 213, 1)rgba(77, 106, 213, 1)
- },
- },
- },
- // name: 'Actual Spending'
- areaStyle: {
- //阴影区域背景
- // color: 'rgba(255, 228, 52, 0.6)'
- color: 'rgba(77, 106, 213, 0.6)'
- }
- }
- ]
- }
- ]
- })
- //持久化设置 菜单状态
- //刚进入页面就将高度设置为页面需要的
- onMounted(async () => {
- const params = route.params
- //当等于0时则跳转到测试计划页面
- //当等于1时则跳转到上一页
- goFlag.value = params.flag as string
- //获取用户编号
- planId.value = params.planId as string
- //获取用户编号
- planName.value = params.name as string
- let pa = {
- planId: planId.value,
- flag: goFlag.value
- }
- await queryReport(pa)
- //调用方法
- //进行量表信息查询
- //进到界面开始轮询
- await getUnread()
- })
- const queryReport = async (pa: any) => {
- let res: any = await queryReportApi(pa)
- //得到返回的数据
- if (res.code == 200) {
- reportData.value = res.data
- // let a =[res.data[0].]
- let a = []
- let des = []
- let name = []
- for (let i = 0; i < res.data.length; i++) {
- if (res.data[i].dimensionName != '总分') {
- a.push(parseInt(res.data[i].dimensionScore))
- des.push(res.data[i].dimensionAnalysis)
- let obj = { name: res.data[i].dimensionName, max: 100, color: '#000000' }
- name.push(obj)
- }
- }
- // const echarts_name_list = ref<any>([
- // { name: '阳光指数', max: 100, color: '#000000' },
- // { name: '情绪稳定指数', max: 100, color: '#000000' },
- // { name: '社交能力', max: 100, color: '#000000' },
- // { name: '自律能力', max: 100, color: '#000000' },
- // { name: '爱情观', max: 100, color: '#000000' },
- // { name: '人生观', max: 100, color: '#000000' }
- // ])
- echarts_name_list.value = name
- echarts_des_list.value = des
- echarts_data_list.value = a
- const myChart = echarts.init(echarts_ld.value)
- option.series[0].data[0].value = a
- option.radar.indicator = echarts_name_list.value
- myChart.setOption(option);
- } else {
- ElMessage({
- message: res.msg,
- type: 'error'
- })
- }
- }
- //界面销毁函数
- const router = useRouter()
- const backFun = () => {
- router.go(-1)
- // if (goFlag.value == '1') {
- // router.go(-1)
- // }
- // if (goFlag.value == '0') {
- // router.push({ name: 'plan' })
- // }
- }
- //轮旋切换页面的方法
- //退出页面销毁 方法
- onUnmounted(() => {
- })
- </script>
- <template>
- <div class="home_header_out">
- <div class=" home_header_inner">
- <CpmdHeader />
- <!-- <div class="report_top">
- <div class="report_jt">
- <span>你真棒!测评已完成</span>
- <span>下面是结果解析:</span>
- </div>
- <img class="xlts_img" src="../assets/report/report_top.png" />
- </div> -->
- </div>
- <div class="leave_message">
- <!-- <img class="img" src="../assets/zs/community.png" alt=""> -->
- <div class="font_blue"> 测试结果 </div>
- <img width="80px" style="position: absolute;left: 100px;bottom: 0;z-index: 11;"
- src="../assets/scale/guo.png" alt="">
- </div>
- <div class="kply">
- <div class="kply_inner">
- <div>
- <div>
- <div class="report_result_top">
- <div style="font-size: 20px;font-weight: 700;margin-bottom: 4px;"> {{ planName }}-测评结果</div>
- <div class="report_totol_score">
- <div class="totol_result_des" v-if="reportData.length > 0">
- 结论:{{ reportData[0].dimensionAnalysis }}
- </div>
- </div>
- <div class="report_echarts_out">
- <div style="display: flex;flex-direction: column;justify-content: center;"
- :style="{ height: (!(goFlag == 'SHAPE_RANDOM' || goFlag == 'ETB01' || goFlag == 'FDOT' || goFlag == 'EMOTION_STROOP')) ? '300px' : '100px' }">
- <div ref="echarts_ld"
- style="width:300px;display: flex; height: 300px; background:#F6F6F6;margin-right: 10px;"
- v-show="!(goFlag == 'SHAPE_RANDOM' || goFlag == 'ETB01' || goFlag == 'FDOT' || goFlag == 'EMOTION_STROOP')">
- </div>
- </div>
- <div
- style="display: flex;flex-direction: column;align-items: center;flex: 1; box-sizing: border-box;padding: 10px; justify-content: center;background:#F6F6F6;">
- <div class="progress_out" v-for="item, index in echarts_name_list">
- <span class="progress_out_name" style="width:150px">
- {{ item.name }}
- </span>
- <el-progress :percentage="echarts_data_list[index]" style="width:100%"
- :stroke-width="18" :show-text='false'
- color="linear-gradient(to right,#798EDE ,#1F2761)" />
- <span class="progress_out_score">{{ echarts_data_list[index] }}<span
- style="color:#000000;font-size: 12px;opacity: 0.4;">/100</span></span>
- </div>
- </div>
- </div>
- </div>
- <div v-show="!(goFlag == 'SHAPE_RANDOM' || goFlag == 'ETB01' || goFlag == 'FDOT' || goFlag == 'EMOTION_STROOP')"
- v-for="item, index in echarts_name_list" style="padding-top:20px">
- <div class="report_des_out">
- <div class="des_zhishu">{{ item.name }}</div>
- <div class="score" style="display: flex;align-items: center;margin-bottom: 10px;">
- <!-- <img style="width: 20px;margin-right:20px" src="../assets/report/score.png" /> -->
- <span style="font-weight: 700;color: #222222;margin-left: 10px;">分数:</span>
- <span style="color: #222222;"> {{ echarts_data_list[index] }}</span>
- <span style="color:#999999;letter-spacing: 0px;">(满分100.00)
- </span>
- </div>
- <div
- style=" background-color: #F6F6F6;box-sizing: border-box;padding:10px;border-radius: 5px;">
- <div class="score"
- style="font-weight: 700;color: #222222;display: flex; align-items: center;">
- <!-- <img style="width:20px;margin-right:20px" src="../assets/report/fenxi.png" /> -->
- <div style="color: #818996;font-weight: 400;text-align: left;">分析报告</div>
- </div>
- <div class="des">{{ echarts_des_list[index] }}</div>
- </div>
- </div>
- </div>
- <div class="start_button_out">
- <div @click="backFun" class="start_button_self">返回</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="home_footer_out">
- <CpmdFooter />
- </div>
- </template>
- <style lang="scss" scoped>
- .home_footer_out {
- width: 100%;
- background-color: rgba(31, 39, 97, 1);
- }
- .home_header_out {
- // position: relative;
- // scroll-snap-align: center;
- padding-bottom: 60px;
- width: 100%;
- min-width: 1200px;
- // background-image: url('../assets/home/bg_ty.png');
- background-repeat: no-repeat;
- background-size: contain;
- // background-color: #B3F1DA; //估计是需要动态
- display: flex;
- flex-direction: column;
- flex: 1;
- //获取屏幕宽度home_header_out 这个div的宽度--然后宽度*1000再除1920即为当前div的宽度
- .home_header_inner {
- min-height: 1;
- left: 0;
- right: 0;
- margin: auto;
- // height: 100px;
- width: 100%;
- .report_top {
- margin-left: 170px;
- width: 860px;
- margin-top: 20px;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- .xlts_img {
- width: 50px;
- }
- .report_jt {
- display: flex;
- flex-direction: column;
- font-size: 20px;
- font-weight: 700;
- letter-spacing: 3px;
- }
- }
- }
- .leave_message {
- position: relative;
- left: 0;
- right: 0;
- margin: auto;
- width: 860px;
- margin-bottom: 20px;
- margin-top: 20px;
- .font_blue {
- position: relative;
- color: #D31E1B;
- font-weight: 700;
- font-size: 22px;
- font-family: 'Rammetto One-Regular';
- padding-top: 30px;
- z-index: 10;
- background: url(../assets/zs/result1.png) no-repeat;
- background-size: auto 50px;
- }
- }
- .kply {
- width: 100%;
- // background-color: #FAFAFA;
- flex: 1;
- .kply_inner {
- // padding: 20px 20px;
- left: 0;
- right: 0;
- margin: auto;
- width: 860px;
- // min-height: 500px;
- background-color: #ffffff;
- border-radius: 40px;
- .report_result_top {
- box-sizing: border-box;
- padding: 36px 30px;
- box-shadow: 0px 4px 32px 0px rgba(0, 0, 0, 0.17);
- .report_totol_score {
- // margin-top: 20px;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- .report_bei {
- position: relative;
- // background-color: #111111;
- .score {
- width: 100%;
- height: 40px;
- text-align: center;
- // height: 120px;
- // background-color: #ffffff;
- // width: 10px;
- position: absolute;
- left: 0;
- right: 0;
- top: -15px;
- bottom: 0;
- margin: auto;
- color: #ffffff;
- font-size: 30px;
- }
- }
- .totol_result_des {
- color: #818996;
- font-size: 18px;
- // margin-left: 50px;
- letter-spacing: 1px;
- line-height: 30px;
- }
- }
- }
- .report_echarts_out {
- margin-top: 20px;
- border-radius: 40px;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- // background-color: #000000;
- // align-items: center;
- // height: 200px;
- .progress_out {
- margin-top: 10px;
- margin-bottom: 10px;
- width: 100%;
- display: flex;
- justify-content: start;
- flex-direction: row;
- align-items: center;
- // margin-right: 40px;
- // padding-right: 40px;
- .progress_out_name {
- color: #000000;
- font-size: 14px;
- margin-left: 10px;
- }
- .progress_out_score {
- color: #333333;
- font-weight: 600;
- margin-right: 25px;
- margin-left: 15px;
- }
- }
- }
- .des_zhishu {
- // background-color: #00BF78;
- // padding: 4px 16px;
- padding-left: 10px;
- border-radius: 20px;
- display: inline-flex;
- color: #333333;
- font-size: 18px;
- letter-spacing: 3px;
- font-weight: 700;
- margin-bottom: 10px;
- }
- .report_des_out {
- margin-top: 5px;
- // background-color: #F7F7F7;
- // border: 4px solid #F7F7F7;
- padding: 20px 40px;
- border-radius: 5px;
- box-shadow: 0px 4px 32px 0px rgba(0, 0, 0, 0.17);
- .score {
- color: #48D68E;
- font-size: 16px;
- line-height: 24px;
- letter-spacing: 3px;
- }
- .des {
- color: #818996;
- font-size: 16px;
- line-height: 24px;
- letter-spacing: 3px;
- }
- }
- .start_button_out {
- margin-top: 40px;
- margin-bottom: 40px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- .start_button_self {
- cursor: pointer;
- // width: 100px;
- border-radius: 12px;
- color: #ffffff;
- background-color: #1F2761;
- margin-right: 20px;
- padding: 8px 60px;
- cursor: pointer;
- display: flex;
- align-items: center;
- }
- }
- }
- }
- }
- .home_mid {
- // background-color: blanchedalmond;
- width: 1200px;
- left: 0;
- right: 0;
- margin: auto;
- margin-top: 40px;
- // position: relative;
- .kepu_title {
- text-align: center;
- font-size: 50px;
- color: #111111;
- line-height: 95px;
- // width: 100%;
- // left: 0;
- // right: 0;
- // margin: auto
- }
- .kepu_title_sub {
- margin-top: 30px;
- text-align: center;
- font-size: 28px;
- color: #48D68E;
- line-height: 26px;
- }
- .man1_group {
- margin-top: 60px;
- height: 100%;
- display: flex;
- .man1 {
- position: relative;
- width: 327px;
- // height: 100%;
- // height: 100%
- .man1_img {
- position: absolute;
- bottom: 0;
- /* bottom: 0px; */
- /* height: auto; */
- width: 100%;
- left: 100px
- }
- }
- .des {
- border: #48D68E solid 5px;
- border-radius: 40px;
- padding: 20px;
- letter-spacing: 6px;
- flex: 1;
- .des_inner {
- border: 1px dashed #48D68E;
- border-radius: 40px;
- padding-bottom: 40px;
- padding-top: 30px;
- padding-left: 100px;
- padding-right: 20px;
- letter-spacing: 6px;
- font-weight: normal;
- font-size: 24px;
- color: #333333;
- line-height: 40px;
- }
- }
- }
- .man2_group {
- margin-top: 60px;
- height: 100%;
- display: flex;
- .man2 {
- position: relative;
- width: 327px;
- // height: 100%;
- // height: 100%
- .man2_img {
- position: absolute;
- bottom: 0;
- /* bottom: 0px; */
- /* height: auto; */
- width: 100%;
- left: -100px
- }
- }
- .des2 {
- border: #48D68E solid 5px;
- border-radius: 40px;
- padding: 20px;
- letter-spacing: 6px;
- flex: 1;
- .des2_inner {
- border: 1px dashed #48D68E;
- border-radius: 40px;
- padding-bottom: 40px;
- padding-top: 30px;
- padding-left: 20px;
- padding-right: 100px;
- letter-spacing: 6px;
- font-weight: normal;
- font-size: 24px;
- color: #333333;
- line-height: 40px;
- }
- }
- }
- .get_more {
- text-align: center;
- img {
- width: 300px;
- margin-top: 60px;
- margin-bottom: 60px;
- }
- }
- }
- // .home_footer_out {
- // width: 100%;
- // background-color: #000000;
- // }</style>
|