Browse Source

调用量表和认知任务接口--调试

plg 7 months ago
parent
commit
41b8dddb87

+ 25 - 0
package-lock.json

@@ -8,9 +8,11 @@
       "name": "cpdm_pc",
       "name": "cpdm_pc",
       "version": "0.0.0",
       "version": "0.0.0",
       "dependencies": {
       "dependencies": {
+        "@types/date-fns": "^2.6.0",
         "axios": "^1.7.2",
         "axios": "^1.7.2",
         "echarts": "^5.5.1",
         "echarts": "^5.5.1",
         "element-plus": "^2.7.7",
         "element-plus": "^2.7.7",
+        "js-md5": "^0.8.3",
         "pinia": "^2.1.7",
         "pinia": "^2.1.7",
         "pinia-plugin-persistedstate": "^3.2.1",
         "pinia-plugin-persistedstate": "^3.2.1",
         "vue": "^3.4.29",
         "vue": "^3.4.29",
@@ -1356,6 +1358,15 @@
       "integrity": "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==",
       "integrity": "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==",
       "dev": true
       "dev": true
     },
     },
+    "node_modules/@types/date-fns": {
+      "version": "2.6.0",
+      "resolved": "https://registry.npmmirror.com/@types/date-fns/-/date-fns-2.6.0.tgz",
+      "integrity": "sha512-9DSw2ZRzV0Tmpa6PHHJbMcZn79HHus+BBBohcOaDzkK/G3zMjDUDYjJIWBFLbkh+1+/IOS0A59BpQfdr37hASg==",
+      "deprecated": "This is a stub types definition for date-fns (https://github.com/date-fns/date-fns). date-fns provides its own type definitions, so you don't need @types/date-fns installed!",
+      "dependencies": {
+        "date-fns": "*"
+      }
+    },
     "node_modules/@types/estree": {
     "node_modules/@types/estree": {
       "version": "1.0.5",
       "version": "1.0.5",
       "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.5.tgz",
       "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.5.tgz",
@@ -2318,6 +2329,15 @@
       "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.3.tgz",
       "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.3.tgz",
       "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
       "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
     },
     },
+    "node_modules/date-fns": {
+      "version": "3.6.0",
+      "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-3.6.0.tgz",
+      "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==",
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/kossnocorp"
+      }
+    },
     "node_modules/dayjs": {
     "node_modules/dayjs": {
       "version": "1.11.12",
       "version": "1.11.12",
       "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.12.tgz",
       "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.12.tgz",
@@ -3274,6 +3294,11 @@
       "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
       "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
       "dev": true
       "dev": true
     },
     },
+    "node_modules/js-md5": {
+      "version": "0.8.3",
+      "resolved": "https://registry.npmmirror.com/js-md5/-/js-md5-0.8.3.tgz",
+      "integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ=="
+    },
     "node_modules/js-tokens": {
     "node_modules/js-tokens": {
       "version": "4.0.0",
       "version": "4.0.0",
       "resolved": "https://registry.npmmirror.com/js-tokens/-/js-tokens-4.0.0.tgz",
       "resolved": "https://registry.npmmirror.com/js-tokens/-/js-tokens-4.0.0.tgz",

+ 2 - 0
package.json

@@ -13,9 +13,11 @@
     "format": "prettier --write src/"
     "format": "prettier --write src/"
   },
   },
   "dependencies": {
   "dependencies": {
+    "@types/date-fns": "^2.6.0",
     "axios": "^1.7.2",
     "axios": "^1.7.2",
     "echarts": "^5.5.1",
     "echarts": "^5.5.1",
     "element-plus": "^2.7.7",
     "element-plus": "^2.7.7",
+    "js-md5": "^0.8.3",
     "pinia": "^2.1.7",
     "pinia": "^2.1.7",
     "pinia-plugin-persistedstate": "^3.2.1",
     "pinia-plugin-persistedstate": "^3.2.1",
     "vue": "^3.4.29",
     "vue": "^3.4.29",

+ 22 - 0
src/api/home.ts

@@ -1,6 +1,10 @@
 import { http } from '@/utils/http'
 import { http } from '@/utils/http'
 const homeUrl = ''
 const homeUrl = ''
 
 
+//测试计划
+const userPlanUrl = '/plan/findRunningPlanByUserNo'
+//测试计划详细信息
+const userPlanDetailUrl = '/planContent/findAllByPlanId'
 //首页API
 //首页API
 export const homeApi = (val: any) => {
 export const homeApi = (val: any) => {
     return http<any>(
     return http<any>(
@@ -18,4 +22,22 @@ export const userApi = (val: any) => {
             method: 'get',
             method: 'get',
             url: homeUrl
             url: homeUrl
         })
         })
+}
+
+//获取用户正在进行的计划条数
+export const userPlanApi = (val: string) => {
+    return http<any>(
+        {
+            method: 'get',
+            url: `${userPlanUrl}?userNo=${val}`
+        })
+}
+
+//获取用户正在进行的计划里边的详细信息
+export const userPlanDetailApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'get',
+            url: `${userPlanDetailUrl}?planId=${val.planId}&userNo=${val.userNo}`
+        })
 }
 }

+ 49 - 0
src/api/login.ts

@@ -0,0 +1,49 @@
+import { http } from '@/utils/http'
+const userGroupUrl = '/org/findAllOrgByPOrgNo'
+
+//注册方法
+const userRegisterUrl = '/system/registerUser'
+
+//登录方法
+const userLoginUrl = '/system/login'
+
+const homeUrl = ''
+
+//首页API
+export const homeApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'post',
+            url: homeUrl,
+            data: { val }
+        })
+}
+
+//getAPI
+export const userGroupApi = () => {
+    return http<any>(
+        {
+            method: 'get',
+            url: userGroupUrl
+        })
+}
+
+//注册API
+export const userRegisterApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'post',
+            url: userRegisterUrl,
+            data: { ...val }
+        })
+}
+
+//登录API
+export const userLoginApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'get',
+            url: `${userLoginUrl}?userNo=${val.userNo}&password=${val.password}`,
+
+        })
+}

+ 61 - 0
src/api/plan.ts

@@ -0,0 +1,61 @@
+import { http } from '@/utils/http'
+const homeUrl = ''
+
+
+const getSacleUrl = '/scale/findScaleByFlag'
+
+const saveSacleUrl = '/record/saveScaleRecord'
+//保存gonogo路径
+const saveGoNoGoUrl = '/record/saveSuppressionRecord'
+
+const saveFaceDotUrl = '/record/saveEmotionRecord'
+//首页API
+export const homeApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'post',
+            url: homeUrl,
+            data: { val }
+        })
+}
+
+
+
+//获取量表信息
+export const getScaleApi = (val: string) => {
+    return http<any>(
+        {
+            method: 'get',
+            url: `${getSacleUrl}?flag=${val}`
+        })
+}
+
+//保存量表信息
+//获取量表信息
+export const saveScaleApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'post',
+            url: saveSacleUrl,
+            data: { ...val }
+        })
+}
+//使用gonogoApi
+export const saveGoNoGoApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'post',
+            url: saveGoNoGoUrl,
+            data: { ...val }
+        })
+}
+
+//使用点探测Api
+export const saveFaceDotApi = (val: any) => {
+    return http<any>(
+        {
+            method: 'post',
+            url: saveFaceDotUrl,
+            data: { ...val }
+        })
+}

BIN
src/assets/cognize/c2.png


BIN
src/assets/cognize/dtc.mp4


File diff suppressed because it is too large
+ 35 - 0
src/assets/cognize/dtc.pdf


BIN
src/assets/cognize/goNogo.mp4


File diff suppressed because it is too large
+ 35 - 0
src/assets/cognize/goNogo.pdf


BIN
src/assets/planNo.png


+ 5 - 4
src/components/CpmdHeader.vue

@@ -4,10 +4,10 @@ import { ref } from 'vue'
 import { useRouter } from 'vue-router'
 import { useRouter } from 'vue-router'
 const router = useRouter()
 const router = useRouter()
 
 
-import { menuStatusStore } from '@/stores';
+import { menuStatusStore, userInfoStore } from '@/stores';
 // import url from '../assets/home/trademark.png';
 // import url from '../assets/home/trademark.png';
 //选中的索引
 //选中的索引
-
+const userInfo = userInfoStore()
 
 
 const menuStatus = menuStatusStore()
 const menuStatus = menuStatusStore()
 
 
@@ -55,7 +55,7 @@ const login = () => {
             </el-badge> -->
             </el-badge> -->
             <el-menu-item index="4">
             <el-menu-item index="4">
                 <div class="badge_custom">
                 <div class="badge_custom">
-                    122
+                    {{ userInfo.planCurrentNum }}
                 </div>
                 </div>
                 <span>测试计划</span>
                 <span>测试计划</span>
             </el-menu-item>
             </el-menu-item>
@@ -65,7 +65,8 @@ const login = () => {
         <div class="login_button_bg" @click="login">
         <div class="login_button_bg" @click="login">
             <img width="20px" src="../assets/home/button_login.png" />
             <img width="20px" src="../assets/home/button_login.png" />
             &nbsp;&nbsp;&nbsp;&nbsp;
             &nbsp;&nbsp;&nbsp;&nbsp;
-            <span>登录账号</span>
+            <span>{{ userInfo.userInfo.userName }}</span>
+            <span v-if="!userInfo.userInfo?.userName">登录账号</span>
         </div>
         </div>
         <!-- <div class="menu_gen">首页</div>
         <!-- <div class="menu_gen">首页</div>
         <div class="menu_gen">科普乐园</div>
         <div class="menu_gen">科普乐园</div>

BIN
src/planNo.png


+ 14 - 3
src/router/index.ts

@@ -71,14 +71,20 @@ const routes = [
 
 
     },
     },
     {
     {
-      path: 'scale',
+      path: 'scale/:planId/:planName/:flag/:flagName/:num',
       name: 'scale',
       name: 'scale',
       component: () => import('@/views/Scale.vue')
       component: () => import('@/views/Scale.vue')
 
 
+    },
+    {
+      path: 'scaleMid',
+      name: 'scaleMid',
+      component: () => import('@/views/ScaleMid.vue')//量表中间件
+
     },
     },
     //认知任务
     //认知任务
     {
     {
-      path: 'cognize',
+      path: 'cognize/:planId/:planName/:flag/:flagName/:num',
       name: 'cognize',
       name: 'cognize',
       component: () => import('@/views/Cognize.vue')
       component: () => import('@/views/Cognize.vue')
 
 
@@ -87,10 +93,15 @@ const routes = [
     // component: HomeView
     // component: HomeView
   },
   },
   {
   {
-    path: '/cognizeGoNoGo',
+    path: '/cognizeGoNoGo/:currentType/:planId/:planName/:flag/:flagName/:num',
     name: 'cognizeGoNoGo',
     name: 'cognizeGoNoGo',
     component: () => import('@/views/CognizeGoNoGo.vue')
     component: () => import('@/views/CognizeGoNoGo.vue')
 
 
+  }, {
+    path: '/cognizeFaceDot/:currentType/:planId/:planName/:flag/:flagName/:num',
+    name: 'cognizeFaceDot',
+    component: () => import('@/views/CognizeFaceDot.vue')
+
   }
   }
 
 
 ]
 ]

+ 8 - 2
src/stores/modules/userInfo.ts

@@ -5,7 +5,8 @@ const userInfoStore = defineStore(
   'userInfo',
   'userInfo',
   () => {
   () => {
 
 
-
+    //定义正在进行中的计划
+    const planCurrentNum = ref<number>(0)
 
 
     //定义token
     //定义token
     const token = ref<string>('')
     const token = ref<string>('')
@@ -13,6 +14,11 @@ const userInfoStore = defineStore(
     const userInfo = ref<any>({
     const userInfo = ref<any>({
       account: ''
       account: ''
     })
     })
+
+    //保存正在进行中的计划的文本
+    const savePlanCurrentNum = (val: number) => {
+      planCurrentNum.value = val
+    }
     //保存token信息
     //保存token信息
     const saveToken = (val: string) => {
     const saveToken = (val: string) => {
       token.value = val
       token.value = val
@@ -24,7 +30,7 @@ const userInfoStore = defineStore(
       userInfo.value = val
       userInfo.value = val
     }
     }
 
 
-    return { token, saveToken, userInfo, saveUserInfo }
+    return { planCurrentNum, savePlanCurrentNum, token, saveToken, userInfo, saveUserInfo }
   },
   },
   { persist: true }
   { persist: true }
 )
 )

+ 2 - 1
src/utils/http.ts

@@ -4,13 +4,14 @@ import axios from 'axios'
 //引入用户信息组件
 //引入用户信息组件
 import { userInfoStore } from '@/stores'
 import { userInfoStore } from '@/stores'
 import router from "@/router";
 import router from "@/router";
+import { ElMessage } from 'element-plus';
 
 
 
 
 const userInfo = userInfoStore()
 const userInfo = userInfoStore()
 //创建axios实例
 //创建axios实例
 
 
 //创建基础访问路径
 //创建基础访问路径
-const base_url = 'http://10.113.248.3:8086'
+const base_url = 'http://10.113.248.4:8090/'
 
 
 //设置axios 默认访问路径
 //设置axios 默认访问路径
 axios.defaults.baseURL = base_url
 axios.defaults.baseURL = base_url

+ 2 - 0
src/utils/test.ts

@@ -0,0 +1,2 @@
+
+export const isHaveManage = false

+ 46 - 9
src/views/Cognize.vue

@@ -3,15 +3,32 @@ import CpmdHeader from '@/components/CpmdHeader.vue';
 
 
 import { onMounted, onUnmounted, ref } from 'vue'
 import { onMounted, onUnmounted, ref } from 'vue'
 
 
-import { useRouter } from 'vue-router';
+import { useRoute, useRouter } from 'vue-router';
 const router = useRouter()
 const router = useRouter()
-//持久化设置 菜单状态
+const route = useRoute()
 
 
 
 
+
+const flag = ref<string>('')
+const flagName = ref<string>('')
+const planId = ref<string>('')
+const planName = ref<string>('')
+const num = ref<string>('')
+
 // 查看PDF
 // 查看PDF
 //刚进入页面就将高度设置为页面需要的
 //刚进入页面就将高度设置为页面需要的
 onMounted(() => {
 onMounted(() => {
 
 
+    //获取参数传过来的ID
+
+    //获取参数传过来的planId
+
+    flag.value = route.params.flag as string;
+    planId.value = route.params.planId as string
+    planName.value = route.params.planName as string
+    flagName.value = route.params.flagName as string
+    num.value = route.params.num as string
+
     //进到界面开始轮询
     //进到界面开始轮询
 })
 })
 
 
@@ -25,7 +42,12 @@ const requireImg = (path: string) => {
 }
 }
 
 
 const startCog = (val: number) => {
 const startCog = (val: number) => {
-    router.push({ name: 'cognizeStart' })
+    if (num.value == '3') {
+        router.push({ name: 'cognizeGoNoGo', params: { currentType: val } })
+    } else if (num.value == '4') {
+        router.push({ name: 'cognizeFaceDot', params: { currentType: val } })
+    }
+
 }
 }
 
 
 //界面销毁函数
 //界面销毁函数
@@ -57,10 +79,13 @@ onUnmounted(() => {
             <div class="kply_inner">
             <div class="kply_inner">
                 <div style="padding :20px 40px">
                 <div style="padding :20px 40px">
                     <div class="cognize_title">
                     <div class="cognize_title">
-                        冲动掌控大师
+                        {{ flagName }}
                     </div>
                     </div>
                     <div class="cognize_img_out">
                     <div class="cognize_img_out">
-                        <img src="../assets/cognize/c1.png" width="100px" style="margin-right: 40px;" />
+                        <img src="../assets/cognize/c1.png" v-show="num == '3'" width=" 100px"
+                            style="margin-right: 40px;" />
+                        <img src="../assets/cognize/c2.png" v-show="num == '4'" width="100px"
+                            style="margin-right: 40px;" />
                         <div class="cognize_des">
                         <div class="cognize_des">
                             测评介绍:对于患有抑郁症的人群并不在少数,
                             测评介绍:对于患有抑郁症的人群并不在少数,
                             每一个人或多或少都会有纠结的时候,
                             每一个人或多或少都会有纠结的时候,
@@ -70,11 +95,19 @@ onUnmounted(() => {
                         </div>
                         </div>
 
 
                     </div>
                     </div>
-                    <div class="cognize_title2">冲动掌控大师演示视频:</div>
-                    <div class="cognize_video">
+                    <div class="cognize_title2"> {{ flagName }}演示视频:</div>
+                    <div class="cognize_video" v-show="num == '3'">
+                        <!-- poster="../assets/cognize/bg_ty.png" -->
+                        <video width="100%" height="100%" controls style="border-radius: 40px;">
+                            <source src="../assets/cognize/goNogo.mp4" type="video/mp4">
+                            <!-- <source src="movie.ogg" type="video/ogg"> -->
+                            您的浏览器不支持 video 标签。
+                        </video>
+                    </div>
+                    <div class="cognize_video" v-show="num == '4'">
                         <!-- poster="../assets/cognize/bg_ty.png" -->
                         <!-- poster="../assets/cognize/bg_ty.png" -->
                         <video width="100%" height="100%" controls style="border-radius: 40px;">
                         <video width="100%" height="100%" controls style="border-radius: 40px;">
-                            <source src="../assets/cognize/1.mp4" type="video/mp4">
+                            <source src="../assets/cognize/dtc.mp4" type="video/mp4">
                             <!-- <source src="movie.ogg" type="video/ogg"> -->
                             <!-- <source src="movie.ogg" type="video/ogg"> -->
                             您的浏览器不支持 video 标签。
                             您的浏览器不支持 video 标签。
                         </video>
                         </video>
@@ -93,6 +126,7 @@ onUnmounted(() => {
                             <div @click="viewPDF" class="view">预览</div>
                             <div @click="viewPDF" class="view">预览</div>
                         </div>
                         </div>
                     </div>
                     </div>
+
                     <div class="scale_button">
                     <div class="scale_button">
                         <el-row>
                         <el-row>
                             <el-col :span="12" class="scale_button_inner">
                             <el-col :span="12" class="scale_button_inner">
@@ -117,7 +151,10 @@ onUnmounted(() => {
         </div>
         </div>
         <el-dialog v-model="centerDialogVisible" title="预览" width="70%" center>
         <el-dialog v-model="centerDialogVisible" title="预览" width="70%" center>
             <span>
             <span>
-                <embed width="100%" height=500px :src="requireImg('../assets/cognize/cs.pdf')">
+                <embed width="100%" height=500px v-show="num == '3'" :src="requireImg('../assets/cognize/goNogo.pdf')">
+
+                </embed>
+                <embed width="100%" height=500px v-show="num == '4'" :src="requireImg('../assets/cognize/dtc.pdf')">
 
 
                 </embed>
                 </embed>
             </span>
             </span>

+ 288 - 27
src/views/CognizeFaceDot.vue

@@ -1,12 +1,26 @@
 <script setup lang="ts">
 <script setup lang="ts">
 
 
+
 import { ElMessage, ElLoading } from 'element-plus';
 import { ElMessage, ElLoading } from 'element-plus';
 import { onMounted, onUnmounted, ref } from 'vue'
 import { onMounted, onUnmounted, ref } from 'vue'
+import { useRoute, useRouter } from 'vue-router';
+import { userInfoStore } from '@/stores'
+import { format } from 'date-fns/format';
+import { saveFaceDotApi } from '@/api/plan';
+const userInfo = userInfoStore()
+const route = useRoute()
+const router = useRouter()
+const flag1 = ref<string>('')
+const flagName = ref<string>('')
+const planId = ref<string>('')
+const planName = ref<string>('')
+const startTime1 = ref<string>('')
+const num = ref<string>('')
 
 
 const taskId = ref<string>('')
 const taskId = ref<string>('')
 const subjectInfo = ref()
 const subjectInfo = ref()
 const userId = ref<string>()// 用户id
 const userId = ref<string>()// 用户id
-const countDownStr = ref<string>("马上开始!")
+const countDownStr = ref<string>("")
 const countDownTime = ref<number>(6)
 const countDownTime = ref<number>(6)
 const countDownShow = ref<boolean>(true)
 const countDownShow = ref<boolean>(true)
 const isDisabled = ref<boolean>(false)//开始测试按钮禁用,防止重复点击
 const isDisabled = ref<boolean>(false)//开始测试按钮禁用,防止重复点击
@@ -38,6 +52,11 @@ const topImg = ref()
 const bottomImg = ref()
 const bottomImg = ref()
 const isLoading = ref<boolean>(false)
 const isLoading = ref<boolean>(false)
 
 
+//判断进来是练习测试还是正式测试
+const currentType = ref(0)
+//当前测试的轮数
+const turnsNumber = ref<number>(0)
+
 //引入静态资源的方法
 //引入静态资源的方法
 // vue3+vite   实现动态加载图片
 // vue3+vite   实现动态加载图片
 const requireImg = (path: string) => {
 const requireImg = (path: string) => {
@@ -45,10 +64,51 @@ const requireImg = (path: string) => {
 }
 }
 
 
 onMounted(() => {
 onMounted(() => {
+    countDownStr.value = '马上开始'
+    currentType.value = parseInt(route.params.currentType as string)
+
+    flag1.value = route.params.flag as string;
+    planId.value = route.params.planId as string
+    planName.value = route.params.planName as string
+    flagName.value = route.params.flagName as string
+    num.value = route.params.num as string
+    getStartTime()
+    // init()
+    // //传输1是练习测试
+    // //传输2是正式测试
+    // if (currentType.value) {
+    //     startTest(2)
+    // } else {
+    //     startTest(1)
+    // }
+    if (currentType.value) {
+        turnsNumber.value = 95
+
+    } else {
+        turnsNumber.value = 10
+    }
+    //接收到传过来的参数后
+    //判断是练习还是测试
+    // if(currentType.value=='0'){
+
+    // }
+
     init();
     init();
+
+
+    //判断是否是练习测试
+    //判断是否是正式测试
+
     clickVoice.value = new Audio(requireImg("../../assets/notify.wav"));
     clickVoice.value = new Audio(requireImg("../../assets/notify.wav"));
     banClickVoice.value = new Audio(requireImg("../../assets/ban.mp3"));
     banClickVoice.value = new Audio(requireImg("../../assets/ban.mp3"));
+
+
 })
 })
+const getStartTime = () => {
+    let date = new Date()
+    startTime1.value = format(date, "yyyy-MM-dd hh:mm:ss");
+    console.log(startTime1.value)
+}
 onUnmounted(() => {
 onUnmounted(() => {
     clearInterval(myInterval.value);
     clearInterval(myInterval.value);
     clearInterval(myInterval1.value);
     clearInterval(myInterval1.value);
@@ -58,6 +118,8 @@ onUnmounted(() => {
     clearTimeout(timingThree.value);
     clearTimeout(timingThree.value);
     clearTimeout(timingFour.value);
     clearTimeout(timingFour.value);
 })
 })
+//格式化页面
+
 const init = () => {
 const init = () => {
     taskId.value = '';
     taskId.value = '';
     userId.value = '';
     userId.value = '';
@@ -219,7 +281,9 @@ const recordUserResponse = () => {
             blockList2.value[cumulation.value].responseTime = "NULL"; //反应时(ms)
             blockList2.value[cumulation.value].responseTime = "NULL"; //反应时(ms)
             blockList2.value[cumulation.value].correct = 0; //反应是否正确
             blockList2.value[cumulation.value].correct = 0; //反应是否正确
 
 
-            if (cumulation.value >= 95) {
+
+
+            if (cumulation.value >= turnsNumber.value) {
                 //调用接口,跳转页面
                 //调用接口,跳转页面
                 submitData();
                 submitData();
             } else {
             } else {
@@ -262,7 +326,7 @@ const startTime = () => {
         commonTime.value++;
         commonTime.value++;
     }, 10);
     }, 10);
 }
 }
-const submitData = () => {
+const submitData = async () => {
     if (isLoading.value) {
     if (isLoading.value) {
         return;
         return;
     }
     }
@@ -428,6 +492,84 @@ const submitData = () => {
     neutralResponse2.map((item) => {
     neutralResponse2.map((item) => {
         neutralAllTime2 += item.responseTime;
         neutralAllTime2 += item.responseTime;
     });
     });
+    ElMessage({
+        message: `正确率为${((blockRight1.length / turnsNumber.value) * 100).toFixed(2)}%`,
+        type: "info"
+    })
+    if (currentType.value) {
+        setTimeout(() => {
+            router.go(-1)
+        }, 1500)
+    } else {
+        let result = {
+            block1: {
+                totalCorrectRate:
+                    ((blockRight1.length / 96) * 100).toFixed(2),
+                posCorrectRate:
+                    ((happyRight1.length / happy1.length) * 100).toFixed(2),
+                posAverageTime: (happyAllTime1 / happyResponse1.length).toFixed(
+                    2
+                ),
+                negCorrectRate:
+                    ((fearRight1.length / fear1.length) * 100).toFixed(2),
+                negAverageTime: (fearAllTime1 / fearResponse1.length).toFixed(2),
+                neuCorrectRate:
+                    ((neutralRight1.length / neutral1.length) * 100).toFixed(2)
+                ,
+                neuAverageTime: (
+                    neutralAllTime1 / neutralResponse1.length
+                ).toFixed(2),
+            },
+            block2: {
+                totalCorrectRate:
+                    ((blockRight2.length / 96) * 100).toFixed(2),
+                posCorrectRate:
+                    ((happyRight2.length / happy2.length) * 100).toFixed(2),
+                posAverageTime: (happyAllTime2 / happyResponse2.length).toFixed(
+                    2
+                ),
+                negCorrectRate:
+                    ((fearRight2.length / fear2.length) * 100).toFixed(2),
+                negAverageTime: (fearAllTime2 / fearResponse2.length).toFixed(2),
+                neuCorrectRate:
+                    ((neutralRight2.length / neutral2.length) * 100).toFixed(2),
+                neuAverageTime: (
+                    neutralAllTime1 / neutralResponse1.length
+                ).toFixed(2),
+            },
+        }
+        let params = {
+            beginTime: startTime1.value,
+            orgName: userInfo.userInfo.orgName,
+            orgNo: userInfo.userInfo.orgNo,
+            planId: planId.value,
+            planName: planName.value,
+            taskFlag: flag.value,
+            taskName: flagName.value,
+            // testRecord: JSON.stringify(productData()),
+            data: JSON.stringify(resultData),
+            result: JSON.stringify({ result }),
+            type: '1',
+            userName: userInfo.userInfo.userName,
+            // userNo: isHaveManage ? userInfo.userInfo.userNo : '20240726001',
+            userNo: userInfo.userInfo.userNo,
+        }
+        let res: any = await saveFaceDotApi(params)
+        if (res.code == 200) {
+            router.push({
+                name: 'scaleMid', params: {
+                    planId: planId.value,
+                    planName: planName.value,
+                    flag: flag.value,
+                    flagName: flagName.value,
+                    num: num.value
+                }
+            })
+        }
+
+    }
+
+
     /**
     /**
     $http.post(
     $http.post(
         `/cognize/FDOT`,
         `/cognize/FDOT`,
@@ -486,10 +628,10 @@ const submitData = () => {
     );
     );
  */
  */
 
 
-    ElMessage({
-        message: '测试结果生成中',
-        type: 'success'
-    })
+    // ElMessage({
+    //     message: '测试结果生成中',
+    //     type: 'success'
+    // })
 }
 }
 const imgListSerialize = async () => {
 const imgListSerialize = async () => {
     // 按情绪等级图片数组序列化
     // 按情绪等级图片数组序列化
@@ -523,8 +665,10 @@ const imgsPreloader = (imgArr: any) => {
     let count = 0;
     let count = 0;
     let loadingInstance = ElLoading.service({ fullscreen: true, text: "0%" });
     let loadingInstance = ElLoading.service({ fullscreen: true, text: "0%" });
     imgArr.forEach((item: any) => {
     imgArr.forEach((item: any) => {
-        promiseArr.push(imgPreloader(item.topImg));
-        promiseArr.push(imgPreloader(item.bottomImg));
+        // promiseArr.push(imgPreloader(item.topImg));
+        // promiseArr.push(imgPreloader(item.bottomImg));
+        promiseArr.push(item.topImg);
+        promiseArr.push(item.bottomImg);
         count++;
         count++;
         let point = count / imgArr.length;
         let point = count / imgArr.length;
         loadingInstance.text.value = point + "%";
         loadingInstance.text.value = point + "%";
@@ -573,15 +717,15 @@ const initImgList = async (rank: any) => {
             dotPos: index >= 6 ? "0" : "1", //0-上,1-下
             dotPos: index >= 6 ? "0" : "1", //0-上,1-下
             topImg:
             topImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-happy-0${rank + 1}.jpg`)
                         }-happy-0${rank + 1}.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`), //图片地址
                         }-neutral.jpg`), //图片地址
             bottomImg:
             bottomImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`)
                         }-neutral.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-happy-0${rank + 1}.jpg`), //图片地址
                         }-happy-0${rank + 1}.jpg`), //图片地址
         });
         });
         //害怕-1
         //害怕-1
@@ -596,15 +740,15 @@ const initImgList = async (rank: any) => {
             dotPos: index >= 6 ? "0" : "1", //0-上,1-下
             dotPos: index >= 6 ? "0" : "1", //0-上,1-下
             topImg:
             topImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-fear-0${rank + 1}.jpg`)
                         }-fear-0${rank + 1}.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`), //图片地址
                         }-neutral.jpg`), //图片地址
             bottomImg:
             bottomImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`)
                         }-neutral.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-fear-0${rank + 1}.jpg`), //图片地址
                         }-fear-0${rank + 1}.jpg`), //图片地址
         });
         });
         //开心-2
         //开心-2
@@ -619,15 +763,15 @@ const initImgList = async (rank: any) => {
             dotPos: index >= 6 ? "0" : "1", //0-上,1-下
             dotPos: index >= 6 ? "0" : "1", //0-上,1-下
             topImg:
             topImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-happy-0${rank + 1}-jumble.jpg`)
                         }-happy-0${rank + 1}-jumble.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`), //图片地址
                         }-neutral.jpg`), //图片地址
             bottomImg:
             bottomImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`)
                         }-neutral.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-happy-0${rank + 1}-jumble.jpg`), //图片地址
                         }-happy-0${rank + 1}-jumble.jpg`), //图片地址
         });
         });
         //害怕-2
         //害怕-2
@@ -642,15 +786,15 @@ const initImgList = async (rank: any) => {
             dotPos: index >= 6 ? "0" : "1", //点位置0-上,1-下
             dotPos: index >= 6 ? "0" : "1", //点位置0-上,1-下
             topImg:
             topImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-fear-0${rank + 1}-jumble.jpg`)
                         }-fear-0${rank + 1}-jumble.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`), //图片地址
                         }-neutral.jpg`), //图片地址
             bottomImg:
             bottomImg:
                 index % 2 == 0
                 index % 2 == 0
-                    ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-neutral.jpg`)
                         }-neutral.jpg`)
-                    : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
+                    : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
                         }-fear-0${rank + 1}-jumble.jpg`), //图片地址
                         }-fear-0${rank + 1}-jumble.jpg`), //图片地址
         });
         });
     });
     });
@@ -706,7 +850,7 @@ const userClick = (param: any) => {
         blockList2.value[cumulation.value].correct =
         blockList2.value[cumulation.value].correct =
             param == activeBlock.value.dotType ? 1 : 0; //反应是否正确
             param == activeBlock.value.dotType ? 1 : 0; //反应是否正确
 
 
-        if (cumulation.value >= 95) {
+        if (cumulation.value >= turnsNumber.value) {
             //调用接口,跳转页面
             //调用接口,跳转页面
             submitData();
             submitData();
         } else {
         } else {
@@ -738,8 +882,125 @@ const userClick = (param: any) => {
         }
         }
     }
     }
 }
 }
+// ${cumulation.value}/${turnsNumber.value}
 </script>
 </script>
 <template>
 <template>
+    <div class="cognize_plu" @contextmenu.prevent="" @click.left="userClick(0)" @click.right="userClick(1)">
+        <el-progress class="main_progress" color="linear-gradient(to right,#48D68E,#ffffff)" :text-inside="true"
+            :stroke-width="48" :percentage="(cumulation / turnsNumber) * 100" style="width: 50%">
+            <span style="color: #000;font-size: 20px;"> {{ cumulation }}/{{ turnsNumber }}</span>
+        </el-progress>
+        <Transition name="fade">
+            <p :key="countDownStr" v-show="countDownShow" class="imgBox1">{{ countDownStr }}</p>
+        </Transition>
 
 
+        <div style="text-align: center">
+            <img v-show="crossShow" src="../assets/cognize/whiteFlag-new.png" alt=""
+                style="width: 50px; height: 50px; margin-top: 20%" />
+        </div>
+        <div class="imgBox" v-show="expressionShow">
+            <img class="faceImg" :src="topImg" alt="" />
+            <img class="faceImg mt100" :src="bottomImg" alt="" />
+        </div>
+        <div class="imgBox" v-show="dotShow">
+            <div class="target">
+                {{ activeBlock?.dotPos == "0" ? activeBlock?.dot : "" }}
+            </div>
+            <div class="target mt100">
+                {{ activeBlock?.dotPos == "1" ? activeBlock?.dot : "" }}
+            </div>
+        </div>
+    </div>
 </template>
 </template>
-<style lang="scss"></style>
+<style lang="scss">
+.cognize_plu {
+    width: 100%;
+    height: 100vh;
+    background: url(../assets/cognize/goNoGoBg.png) no-repeat center;
+    background-size: cover;
+    background-color: rgb(37, 37, 37);
+}
+
+.imgBox {
+    width: 150px;
+    height: 400px;
+    position: absolute;
+    top: 25%;
+    left: 50%;
+    margin-left: -75px;
+}
+
+.target {
+    width: 150px;
+    height: 150px;
+    font-size: 48px;
+    font-weight: 700;
+    color: #000000;
+    text-align: center;
+    line-height: 150px;
+}
+
+.faceImg {
+    display: block;
+    width: 150px;
+    height: 150px;
+}
+
+.imgBox1 {
+    // text-align: center;
+    // position: absolute;
+    // top: 50%;
+    // left: 50%;
+    // transform: translate(-50%, -50%);
+    // color: black;
+    // font-size: 40px;
+    // text-align: center;
+    // line-height: 100px;
+    // margin: 0 auto;
+    width: 200px;
+    font-size: 50px;
+    font-weight: 700;
+    position: absolute;
+    // background-color: antiquewhite;
+    ;
+    height: 40px;
+    // background-color: aliceblue;
+    text-align: center;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    margin: auto;
+}
+
+.main_progress {
+    padding-top: 40px;
+    padding-left: 40px
+}
+
+//数字动画效果
+
+.fade-enter-active {
+    animation: fade-in 1s;
+}
+
+.fade-leave-active {
+    animation: fade-in 1s reverse;
+}
+
+@keyframes fade-in {
+    0% {
+        transform: scale(1.5);
+    }
+
+    50% {
+        // transform: scale(1.25);
+        transform: scale(1.5);
+    }
+
+    100% {
+        // transform: scale(1);
+        transform: scale(0.2);
+    }
+}
+</style>

+ 101 - 11
src/views/CognizeGoNoGo.vue

@@ -1,6 +1,20 @@
 <script lang="ts" setup>
 <script lang="ts" setup>
 import { ElMessage } from 'element-plus';
 import { ElMessage } from 'element-plus';
 import { onMounted, onUnmounted, ref } from 'vue'
 import { onMounted, onUnmounted, ref } from 'vue'
+import { useRoute, useRouter } from 'vue-router';
+import { format } from 'date-fns/format';
+import { saveGoNoGoApi } from '@/api/plan';
+import { userInfoStore } from '@/stores'
+const userInfo = userInfoStore()
+const route = useRoute()
+const router = useRouter()
+
+const flag = ref<string>('')
+const flagName = ref<string>('')
+const planId = ref<string>('')
+const planName = ref<string>('')
+const startTime = ref<string>('')
+const num = ref<string>('')
 
 
 const isok = ref<boolean>(false)
 const isok = ref<boolean>(false)
 const testTypeCode = ref<number>()
 const testTypeCode = ref<number>()
@@ -31,13 +45,39 @@ const showCountDown = ref<boolean>(true)
 const countDownStr = ref<string>('练习马上开始!')
 const countDownStr = ref<string>('练习马上开始!')
 const redayTime = ref(6)
 const redayTime = ref(6)
 
 
+//判断进来是练习测试还是正式测试
+const currentType = ref<number>(0)
+
+//当前测试的轮数
+const turnsNumber = ref<number>(0)
 //页面初始化
 //页面初始化
 onMounted(() => {
 onMounted(() => {
+    currentType.value = parseInt(route.params.currentType as string)
+    flag.value = route.params.flag as string;
+    planId.value = route.params.planId as string
+    planName.value = route.params.planName as string
+    flagName.value = route.params.flagName as string
+    num.value = route.params.num as string
+    getStartTime()
     init()
     init()
     //传输1是练习测试
     //传输1是练习测试
     //传输2是正式测试
     //传输2是正式测试
-    startTest(1)
+    if (currentType.value) {
+        //这是正式测试
+        turnsNumber.value = 64
+        startTest(2)
+    } else {
+        turnsNumber.value = 10
+        //这是练习测试
+        startTest(1)
+    }
+
 })
 })
+const getStartTime = () => {
+    let date = new Date()
+    startTime.value = format(date, "yyyy-MM-dd hh:mm:ss");
+    console.log(startTime.value)
+}
 const init = () => {
 const init = () => {
     taskId.value = ''
     taskId.value = ''
     userId.value = ''
     userId.value = ''
@@ -50,9 +90,7 @@ const clearTimer = () => {
     clearTimeout(timingThree.value) //延时器3
     clearTimeout(timingThree.value) //延时器3
     clearTimeout(timingFour.value) //延时器4
     clearTimeout(timingFour.value) //延时器4
 }
 }
-const format = (percentage: number) => {
-    return percentage === 100 ? "测试已完成" : "任务进度";
-}
+
 //随机生成测试
 //随机生成测试
 const createTestList = () => {
 const createTestList = () => {
     testList.value = [];
     testList.value = [];
@@ -75,7 +113,7 @@ const startTest = (i: number) => {
     if (i == 2) {
     if (i == 2) {
         isok.value = true;
         isok.value = true;
     }
     }
-    countLevel.value = i == 1 ? 10 : 64;
+    countLevel.value = turnsNumber.value;
     createTestList();
     createTestList();
     showCatain.value = true;
     showCatain.value = true;
     showCountDown.value = true;
     showCountDown.value = true;
@@ -154,12 +192,13 @@ const showWhite2 = () => {
         // 1000ms后判断是否继续
         // 1000ms后判断是否继续
         disableClick.value = true;
         disableClick.value = true;
         currentIndex.value++;
         currentIndex.value++;
+        // count.value++;
         if (testMode.value == 2) {
         if (testMode.value == 2) {
             count.value++;
             count.value++;
         }
         }
         if (currentIndex.value >= countLevel.value) {
         if (currentIndex.value >= countLevel.value) {
             // 测试结束
             // 测试结束
-            currentIndex.value = 0;
+            // currentIndex.value = 0;
             showCatain.value = false;
             showCatain.value = false;
             clearTimer();
             clearTimer();
             // if (this.testMode == 1) {
             // if (this.testMode == 1) {
@@ -184,7 +223,7 @@ const showWhite2 = () => {
     }, 1000);
     }, 1000);
 }
 }
 // 计算并保存测试成绩
 // 计算并保存测试成绩
-const getScore = (i: number) => {
+const getScore = async (i: number) => {
     let clickCount = 0;
     let clickCount = 0;
     let timeCount = 0;
     let timeCount = 0;
     responseTrueCount.value = 0;
     responseTrueCount.value = 0;
@@ -218,19 +257,62 @@ const getScore = (i: number) => {
             showFormal.value = true;
             showFormal.value = true;
         } else {
         } else {
             ElMessage({
             ElMessage({
-                message: `您的正确率是${correctPercent.value}%,很遗憾,请继续练习`,
+                message: `您的正确率是${correctPercent.value}%`,
                 type: 'success',
                 type: 'success',
 
 
             })
             })
 
 
         }
         }
         showCatain.value = false;
         showCatain.value = false;
+
+        //测试练习的话//返回到上一个练习测试的页面
+        setTimeout(() => {
+            router.go(-1)
+        }, 1500)
+
     } else {
     } else {
         ElMessage({
         ElMessage({
-            message: `正在调用保存哦`,
+            message: `正在调用保存`,
             type: 'success',
             type: 'success',
 
 
         })
         })
+        // setTimeout(() => {
+        //     router.push({ name: 'scaleMid' })
+        // }, 1500)
+        //调用保存goNogo测试计划
+        let params = {
+            beginTime: startTime.value,
+            orgName: userInfo.userInfo.orgName,
+            orgNo: userInfo.userInfo.orgNo,
+            planId: planId.value,
+            planName: planName.value,
+            taskFlag: flag.value,
+            taskName: flagName.value,
+            // testRecord: JSON.stringify(productData()),
+            testRecord: JSON.stringify(testList.value),
+            testResult: JSON.stringify({
+                correctPercent: correctPercent.value,
+                averageTime: averageTime.value.toFixed(2)
+            }),
+            type: '1',
+            userName: userInfo.userInfo.userName,
+            // userNo: isHaveManage ? userInfo.userInfo.userNo : '20240726001',
+            userNo: userInfo.userInfo.userNo,
+        }
+        let res: any = await saveGoNoGoApi(params)
+        console.log(res)
+        if (res.code = 200) {
+            router.push({
+                name: 'scaleMid', params: {
+                    planId: planId.value,
+                    planName: planName.value,
+                    flag: flag.value,
+                    flagName: flagName.value,
+                    num: num.value
+                }
+            })
+        }
+
         //调用接口开始保存数据表v
         //调用接口开始保存数据表v
         //    $http.post(
         //    $http.post(
         //       "cognize/GO_NO-GO2",
         //       "cognize/GO_NO-GO2",
@@ -265,6 +347,10 @@ onUnmounted(() => {
 </script>
 </script>
 <template>
 <template>
     <div class="cognize_plu">
     <div class="cognize_plu">
+        <el-progress class="main_progress" :text-inside="true" color="linear-gradient(to right,#48D68E,#ffffff)"
+            :stroke-width="48" :percentage="(currentIndex / turnsNumber) * 100" style="width: 50%">
+            <span style="color: #000;font-size: 20px;"> {{ currentIndex }}/{{ turnsNumber }}</span>
+        </el-progress>
         <div v-show="showTestResult">
         <div v-show="showTestResult">
             <p class="resultTxt">
             <p class="resultTxt">
                 GO信号平均时间(毫秒):{{ averageTime.toFixed(2) }}
                 GO信号平均时间(毫秒):{{ averageTime.toFixed(2) }}
@@ -275,8 +361,7 @@ onUnmounted(() => {
             @click.right="userClick(1)">
             @click.right="userClick(1)">
             <div class="taskHead">
             <div class="taskHead">
 
 
-                <el-progress class="main_progress" v-if="isok == true" :text-inside="true" :format="format"
-                    :stroke-width="48" :percentage="(count / 64) * 100" style="width: 50%"></el-progress>
+
             </div>
             </div>
             <div class="glass">
             <div class="glass">
                 <div v-show="showArrow" class="arrowModule">
                 <div v-show="showArrow" class="arrowModule">
@@ -417,4 +502,9 @@ onUnmounted(() => {
         transform: scale(0.2);
         transform: scale(0.2);
     }
     }
 }
 }
+
+.main_progress {
+    padding-top: 40px;
+    padding-left: 40px;
+}
 </style>
 </style>

+ 35 - 2
src/views/HomeView.vue

@@ -1,8 +1,11 @@
 <script setup lang="ts">
 <script setup lang="ts">
 import CpmdHeader from '@/components/CpmdHeader.vue';
 import CpmdHeader from '@/components/CpmdHeader.vue';
 import { onMounted, onUnmounted, ref } from 'vue'
 import { onMounted, onUnmounted, ref } from 'vue'
-import { menuStatusStore } from '@/stores'
+import { menuStatusStore, userInfoStore } from '@/stores'
 import { useRouter } from 'vue-router'
 import { useRouter } from 'vue-router'
+import { isHaveManage } from '../utils/test'
+import { userPlanApi } from '@/api/home';
+const userInfo = userInfoStore()
 const router = useRouter()
 const router = useRouter()
 const menuStatus = menuStatusStore();
 const menuStatus = menuStatusStore();
 menuStatus.saveActiveIndex('1')
 menuStatus.saveActiveIndex('1')
@@ -51,8 +54,11 @@ onMounted(() => {
   setHeight()
   setHeight()
   window.addEventListener('resize', setHeight);
   window.addEventListener('resize', setHeight);
   forStatus()
   forStatus()
+  planNumGet()
   //进到界面开始轮询
   //进到界面开始轮询
 })
 })
+
+
 //界面销毁函数
 //界面销毁函数
 
 
 
 
@@ -101,6 +107,33 @@ const brightStatusLevel = () => {
 }
 }
 
 
 
 
+
+//获取计划剩余多少个正在进行的
+//isHaveManage//
+//先判断是否登录
+const planNumGet = async () => {
+  //如果在就是登录了
+  if (userInfo.token) {
+    let userNo = ''
+    //登录的话
+    //判断当前是否有后台管理
+    if (isHaveManage) {
+      userNo = userInfo.userInfo.userNo
+    } else {
+      userNo = '20240726001'
+    }
+    //调用根据用户查询计划的API
+    let res: any = await userPlanApi(userNo)
+    console.log(res)
+    if (res.data.length > 0) {
+      taskCircleFlag.value = true
+    } else {
+      taskCircleFlag.value = false
+    }
+    userInfo.savePlanCurrentNum(res.data.length)
+
+  }
+}
 </script>
 </script>
 
 
 <template>
 <template>
@@ -166,7 +199,7 @@ const brightStatusLevel = () => {
     <div class="home_mid_plan" v-show="taskCircleFlag" @click="openSquare" ref="plan_jihua"
     <div class="home_mid_plan" v-show="taskCircleFlag" @click="openSquare" ref="plan_jihua"
       :style="{ top: plan_jihua + 'px' }">
       :style="{ top: plan_jihua + 'px' }">
       <div class="badge_custom">
       <div class="badge_custom">
-        122
+        {{ userInfo.planCurrentNum }}
       </div>
       </div>
       <img src="../assets/home/jihua_img.png" />
       <img src="../assets/home/jihua_img.png" />
     </div>
     </div>

+ 46 - 3
src/views/Login.vue

@@ -1,13 +1,17 @@
 <script setup lang="ts">
 <script setup lang="ts">
 
 
 
 
-
+import { md5 } from 'js-md5'
 import CpmdHeader from '@/components/CpmdHeader.vue';
 import CpmdHeader from '@/components/CpmdHeader.vue';
+import { ElMessage } from 'element-plus';
 
 
 import { onMounted, onUnmounted, reactive, ref } from 'vue'
 import { onMounted, onUnmounted, reactive, ref } from 'vue'
 
 
 import { useRoute, useRouter } from 'vue-router'
 import { useRoute, useRouter } from 'vue-router'
+import { userLoginApi } from '@/api/login';
 
 
+import { userInfoStore } from '@/stores'
+const userInfo = userInfoStore()
 
 
 //定义账号
 //定义账号
 const account = ref<string>('')
 const account = ref<string>('')
@@ -27,12 +31,14 @@ onMounted(() => {
 })
 })
 //跳转到注册页面的方法
 //跳转到注册页面的方法
 const router = useRouter()
 const router = useRouter()
+
 const registerFun = () => {
 const registerFun = () => {
     router.push({ name: 'register' })
     router.push({ name: 'register' })
-
 }
 }
 
 
 
 
+
+
 //轮旋切换页面的方法
 //轮旋切换页面的方法
 
 
 //退出页面销毁 方法
 //退出页面销毁 方法
@@ -42,7 +48,44 @@ onUnmounted(() => {
 
 
 
 
 
 
+//登录方法
+const loginFun = async () => {
+    //先判断是否是字段都填写了
+    if (account.value == '') {
+        ElMessage({
+            message: '账号不能为空',
+            type: 'warning'
+        })
+        return
+    }
+    if (password.value == '') {
+        ElMessage({
+            message: '密码不能为空',
+            type: 'warning'
+        })
+        return
+    } else if (password.value.length < 6) {
+        ElMessage({
+            message: '密码最少6位',
+            type: 'warning'
+        })
+        return
+    }
+    let params = {
+        userNo: account.value,
+        password: md5(password.value)
+    }
+    const res: any = await userLoginApi(params)
+    if (res.code == 200) {
+        //登录成功后将信息存入缓存  
+        userInfo.saveToken(res.data.token)
+        userInfo.saveUserInfo(res.data.user)
+        ElMessage({ message: `${res.msg}`, type: 'success' })
+    } else {
+        ElMessage({ message: `${res.msg}`, type: 'error' })
+    }
 
 
+}
 </script>
 </script>
 
 
 <template>
 <template>
@@ -78,7 +121,7 @@ onUnmounted(() => {
                         </span>
                         </span>
                     </div>
                     </div>
                     <div class="start_button_out">
                     <div class="start_button_out">
-                        <div class="start_button_self">登录</div>
+                        <div @click="loginFun" class="start_button_self">登录</div>
                     </div>
                     </div>
 
 
 
 

+ 120 - 15
src/views/Plan.vue

@@ -5,27 +5,131 @@ import { useRouter } from 'vue-router'
 const router = useRouter()
 const router = useRouter()
 
 
 //持久化设置 菜单状态
 //持久化设置 菜单状态
-import { menuStatusStore } from '@/stores'
+import { menuStatusStore, userInfoStore } from '@/stores'
+import { isHaveManage } from '@/utils/test';
+import { userPlanApi, userPlanDetailApi } from '@/api/home';
+const userInfo = userInfoStore();
 const menuStatus = menuStatusStore();
 const menuStatus = menuStatusStore();
 menuStatus.saveActiveIndex('4')
 menuStatus.saveActiveIndex('4')
 
 
-const homeHeaderOut = ref<any>()
+
+//定义计划列表数据
+const planList = ref<any>([
+
+])
+
 
 
 //点击了开始测试--跳转到测试页面
 //点击了开始测试--跳转到测试页面
-const startPlan = (val: number) => {
-    //点击了开始跳转到量表测试页面
-    if (val == 1) {
-        router.push({ name: 'scale' })
+const startPlan = (val: any) => {
+    let flag = ''
+    let num = 1
+    let flagName = ''
+    for (let i = 0; i < val.list.length; i++) {
+        //判断是该做第一个了
+        if (val.list[i].isCompleted == '0') {
+            flag = val.list[i].flag
+            flagName = val.list[i].name
+            num = i + 1
+            break
+        }
+    }
+    if (flag == '') {
+        //该测试计划已做完
+        return
     } else {
     } else {
-        router.push({ name: 'cognizeGoNoGo' })
+        if (num == 2 || num == 1) {
+            router.push({
+                name: 'scale', params: {
+                    planId: val.id,
+                    planName: val.planName,
+                    flag: flag,
+                    flagName: flagName,
+                    num: num
+
+                }
+            })
+        }
+        //当标志是3时应该跳转到认知任务gonogo页面
+        if (num == 3) {
+            router.push({
+                name: 'cognize', params: {
+                    planId: val.id,
+                    planName: val.planName,
+                    flag: flag,
+                    flagName: flagName,
+
+                    num: num
+
+                }
+            })
+        }
+        if (num == 4) {
+            router.push({
+                name: 'cognize', params: {
+                    planId: val.id,
+                    planName: val.planName,
+                    flag: flag,
+                    flagName: flagName,
+
+                    num: num
+                }
+            })
+        }
+
+        //开始跳转页面
+        //带上计划编号--计划名称
+        //以及flag  
     }
     }
+    //取到当前计划的下变的字段
+    //然后循环查看是该做第几个了
+
+    //点击了开始跳转到量表测试页面
+    // if (val == 1) {
+    //     router.push({ name: 'scale' })
+    // } else if (val == 2) {
+    //     router.push({ name: 'cognize', params: { id: 2 } })
+    // } else {
+    //     router.push({ name: 'cognize', params: { id: 3 } })
+    // }
 
 
 }
 }
 
 
+const planNumGet = async () => {
+    //如果在就是登录了
+    if (userInfo.token) {
+        let userNo = ''
+        //登录的话
+        //判断当前是否有后台管理
+        if (isHaveManage) {
+            userNo = userInfo.userInfo.userNo
+        } else {
+            userNo = '20240726001'
+        }
+        //调用根据用户查询计划的API
+        let res: any = await userPlanApi(userNo)
+
+
+        userInfo.savePlanCurrentNum(res.data.length)
+        planList.value = res.data
+
+        //循环list 给她赋值
+        for (let i = 0; i < planList.value.length; i++) {
+            let params = {
+                planId: planList.value[i].id,
+                userNo: isHaveManage ? userInfo.userInfo.userNo : '20240726001'
+            }
+            let temp: any = await userPlanDetailApi(params)
+            planList.value[i].list = temp.data
+        }
+        console.log(planList.value)
+
 
 
+    }
+}
 //刚进入页面就将高度设置为页面需要的
 //刚进入页面就将高度设置为页面需要的
 onMounted(() => {
 onMounted(() => {
-
+    //查询计划内容
+    planNumGet()
     //进到界面开始轮询
     //进到界面开始轮询
 })
 })
 //界面销毁函数
 //界面销毁函数
@@ -42,7 +146,7 @@ onUnmounted(() => {
 </script>
 </script>
 
 
 <template>
 <template>
-    <div class="home_header_out" ref="homeHeaderOut">
+    <div class="home_header_out">
         <div class=" home_header_inner">
         <div class=" home_header_inner">
             <CpmdHeader />
             <CpmdHeader />
             <div style="text-align: center;">
             <div style="text-align: center;">
@@ -52,16 +156,17 @@ onUnmounted(() => {
         <div class="kply">
         <div class="kply">
             <div class="kply_inner">
             <div class="kply_inner">
                 <div>
                 <div>
-
+                    <img v-show="planList.length == 0" src="../assets/planNo.png">
                     <!-- 测试记录列表 -->
                     <!-- 测试记录列表 -->
-                    <div class="test_record_out" v-for="item in 3">
+                    <div class="test_record_out" v-for="item in planList">
                         <div class="record_tip">
                         <div class="record_tip">
-                            <span class="record_tip_out"><span class="record_tip_inner">创建时间:</span>2023/07/20</span>
-                            <span><span class="record_tip_inner">结束时间:</span>2023/07/26</span>
+                            <span class="record_tip_out"><span class="record_tip_inner">创建时间:</span>{{ item.createDate
+                                }}</span>
+                            <span><span class="record_tip_inner">结束时间:</span>{{ item.planEndTime }}</span>
                         </div>
                         </div>
                         <div class="test_record">
                         <div class="test_record">
                             <img src="../assets/kepu/task_1.png" />
                             <img src="../assets/kepu/task_1.png" />
-                            <span>科技学院普查计划</span>
+                            <span>{{ item.planName }}</span>
                         </div>
                         </div>
                         <div class="test_time">
                         <div class="test_time">
                             <span>请根据您最近一个月的实际情况,选择最符合自己的选项。所有陈述都无正确和错误之分。所以请您不要再三思考,要根据第一反应诚实作答。</span>
                             <span>请根据您最近一个月的实际情况,选择最符合自己的选项。所有陈述都无正确和错误之分。所以请您不要再三思考,要根据第一反应诚实作答。</span>
@@ -155,7 +260,7 @@ onUnmounted(() => {
             right: 0;
             right: 0;
             margin: auto;
             margin: auto;
             width: 1200px;
             width: 1200px;
-
+            min-height: 500px;
             background-color: #FAFAFA;
             background-color: #FAFAFA;
             border-radius: 40px;
             border-radius: 40px;
             // height: 1000px;
             // height: 1000px;

+ 165 - 76
src/views/Register.vue

@@ -1,8 +1,11 @@
 <script setup lang="ts">
 <script setup lang="ts">
 
 
+//引入MD5
+import { md5 } from 'js-md5'
 
 
-
+import { userGroupApi, userRegisterApi } from '@/api/login';
 import CpmdHeader from '@/components/CpmdHeader.vue';
 import CpmdHeader from '@/components/CpmdHeader.vue';
+import { ElMessage } from 'element-plus';
 
 
 import { onMounted, onUnmounted, reactive, ref } from 'vue'
 import { onMounted, onUnmounted, reactive, ref } from 'vue'
 
 
@@ -13,86 +16,23 @@ import { useRoute, useRouter } from 'vue-router'
 const account = ref<string>('')
 const account = ref<string>('')
 //定义密码
 //定义密码
 const password = ref<string>('')
 const password = ref<string>('')
-//定义所选组织架构
+//定义所选组织架构ID
 const group = ref<string>('')
 const group = ref<string>('')
-//定义所选组织架构的数据
-const groupData = ref([
-    {
-        value: '1',
-        label: 'Level one 1',
-        children: [
-            {
-                value: '1-1',
-                label: 'Level two 1-1',
-                children: [
-                    {
-                        value: '1-1-1',
-                        label: 'Level three 1-1-1',
-                    },
-                ],
-            },
-        ],
-    },
-    {
-        value: '2',
-        label: 'Level one 2',
-        children: [
-            {
-                value: '2-1',
-                label: 'Level two 2-1',
-                children: [
-                    {
-                        value: '2-1-1',
-                        label: 'Level three 2-1-1',
-                    },
-                ],
-            },
-            {
-                value: '2-2',
-                label: 'Level two 2-2',
-                children: [
-                    {
-                        value: '2-2-1',
-                        label: 'Level three 2-2-1',
-                    },
-                ],
-            },
-        ],
-    },
-    {
-        value: '3',
-        label: 'Level one 3',
-        children: [
-            {
-                value: '3-1',
-                label: 'Level two 3-1',
-                children: [
-                    {
-                        value: '3-1-1',
-                        label: 'Level three 3-1-1',
-                    },
-                ],
-            },
-            {
-                value: '3-2',
-                label: 'Level two 3-2',
-                children: [
-                    {
-                        value: '3-2-1',
-                        label: 'Level three 3-2-1',
-                    },
-                ],
-            },
-        ],
-    },
-])
-
+//定义组织架构的名字
+const groupName = ref<string>('')
 //定义用户姓名
 //定义用户姓名
 const name = ref('')
 const name = ref('')
 
 
 //选择性别
 //选择性别
 const sex = ref('')
 const sex = ref('')
 
 
+//定义所选组织架构的数据
+const groupData = ref([])
+
+//定义临时变量保存平铺的数据
+const ppData = ref<any>([])
+
+
 
 
 
 
 
 
@@ -102,7 +42,7 @@ const id = ref<string>('')
 //持久化设置 菜单状态
 //持久化设置 菜单状态
 //刚进入页面就将高度设置为页面需要的
 //刚进入页面就将高度设置为页面需要的
 onMounted(() => {
 onMounted(() => {
-
+    userGroupFun()
 })
 })
 //跳转到注册页面的方法
 //跳转到注册页面的方法
 const router = useRouter()
 const router = useRouter()
@@ -110,7 +50,156 @@ const loginFun = () => {
     router.push({ name: 'login' })
     router.push({ name: 'login' })
 
 
 }
 }
+//注册方法
+const registerFun = async () => {
+    console.log(group.value)
+    //点击注册的方法
+    //判断各个字段是否都在---或是否都为空
+    if (group.value == '') {
+        ElMessage({
+            message: '请选择组织架构',
+            type: 'warning'
+        })
+        return
+    }
+    if (account.value == '') {
+        ElMessage({
+            message: '请填写账号',
+            type: 'warning'
+        })
+        return
+    }
+    if (name.value == '') {
+        ElMessage({
+            message: '请填写姓名',
+            type: 'warning'
+        })
+        return
+    }
+    if (sex.value == '') {
+        ElMessage({
+            message: '请选择性别',
+            type: 'warning'
+        })
+        return
+    }
+    if (password.value == '') {
+        ElMessage({
+            message: '请填写密码',
+            type: 'warning'
+        })
+        return
+    }
+
+    queryOrgName()
+    //开始组织参数
+    let prams = {
+        orgNo: group.value,
+        orgName: groupName.value,
+        userNo: account.value,
+        userName: name.value,
+        gender: sex.value,
+        password: md5(password.value)
+
+    }
+    console.log(prams)
+
+    //如果都通过开始调用方法注册的方法
+    const res: any = await userRegisterApi(prams)
+    console.log('注册返回细信息')
+    console.log(res)
+    if (res.code == 200) {
+        ElMessage({
+            message: res.msg,
+            type: 'success'
+
+        })
+
+        //如果注册成功过得话
+    } else {
+        ElMessage({
+            message: res.msg,
+            type: 'error'
+
+        })
+    }
+
+}
+
+//根据id查询组织架构名字的方法
+const queryOrgName = () => {
+    for (let i = 0; i < ppData.value.length; i++) {
+        if (group.value == ppData.value[i].orgNo) {
+            groupName.value = ppData.value[i].orgName
+        }
+    }
+}
+
+//-----------------组织架构处理方法start---------------------
+//获取组织架构list
+const userGroupFun = async () => {
+    let res: any = await userGroupApi()
+    console.log(res)
+    //数据的得到后新增数据格式的value字段 和id一样    新增数据格式的label  与name一致
+
+    //增加字段的方法
+    //先判断返回的是否有数据
+    if (res.data.length > 0) {
+        let resAdd = addPro(res.data)
+        ppData.value = JSON.parse(JSON.stringify(resAdd))
+        let forRes = arrToTree(resAdd)
+        // console.log('格式化的结构')
+        // console.log(forRes)
+        let resultRes = deleteChildren(forRes)
+        console.log('格式化的结构且去掉children')
+        console.log(resultRes)
+        groupData.value = resultRes
+    } else {
+        groupData.value = []
+    }
+
+    //修改数据的字段
+    //只取当前的id字段
+    //得到值后开始组装数据
+
+}
+//给数据增加两个字段的方法
+const addPro = (val: any) => {
+    let data = JSON.parse(JSON.stringify(val))
+    for (let i = 0; i < val.length; i++) {
+        data[i].value = val[i].orgNo
+        data[i].label = val[i].orgName
+    }
+    return data
+}
+//非递归方式:将平铺数据转换为树形结构数据
+const arrToTree = (arr: any) => {
+    let data = arr.filter((item: any) => {
+        item.children = arr.filter((e: any) => {
+            return item.orgNo === e.parentOrgNo
+        })
+        return !item.parentOrgNo
+    })
+    return data;
+}
+
+
+//去除转换树形结构数据后存在的空children
+const deleteChildren = (arr: any) => {
+    let childs = arr;
+    for (let i = childs.length; i--; i > 0) {
+        if (childs[i].children) {
+            if (childs[i].children.length) {
+                deleteChildren(childs[i].children);
+            } else {
+                delete childs[i].children;
+            }
+        }
+    }
+    return arr;
+}
 
 
+//-----------------组织架构处理方法结束---------------------
 
 
 //轮旋切换页面的方法
 //轮旋切换页面的方法
 
 
@@ -179,7 +268,7 @@ onUnmounted(() => {
                         </span>
                         </span>
                     </div>
                     </div>
                     <div class="start_button_out">
                     <div class="start_button_out">
-                        <div class="start_button_self">注册</div>
+                        <div @click="registerFun" class="start_button_self">注册</div>
                     </div>
                     </div>
 
 
 
 

+ 116 - 54
src/views/Scale.vue

@@ -1,11 +1,19 @@
 <script setup lang="ts">
 <script setup lang="ts">
+import { format } from 'date-fns/format';
+
 import CpmdHeader from '@/components/CpmdHeader.vue';
 import CpmdHeader from '@/components/CpmdHeader.vue';
 import { onMounted, onUnmounted, ref } from 'vue'
 import { onMounted, onUnmounted, ref } from 'vue'
 import { Check } from '@element-plus/icons-vue'
 import { Check } from '@element-plus/icons-vue'
 import { number } from 'echarts';
 import { number } from 'echarts';
 import { ElMessage } from 'element-plus';
 import { ElMessage } from 'element-plus';
-import { useRouter } from 'vue-router';
+import { useRouter, useRoute } from 'vue-router';
+import { getScaleApi, saveScaleApi } from '@/api/plan';
+import { userInfoStore } from '@/stores'
+
+import { isHaveManage } from '@/utils/test'
+const userInfo = userInfoStore()
 const router = useRouter()
 const router = useRouter()
+const route = useRoute()
 //持久化设置 菜单状态
 //持久化设置 菜单状态
 // import { menuStatusStore } from '@/stores'
 // import { menuStatusStore } from '@/stores'
 // const menuStatus = menuStatusStore();
 // const menuStatus = menuStatusStore();
@@ -14,27 +22,33 @@ const router = useRouter()
 //当前量表是否已经提交
 //当前量表是否已经提交
 const isCompleted = ref<boolean>(false)
 const isCompleted = ref<boolean>(false)
 
 
+const flag = ref<string>('')
+const flagName = ref<string>('')
+const planId = ref<string>('')
+const planName = ref<string>('')
+const startTime = ref<string>('')
+const num = ref<string>('')
+
 
 
 //获取到的题目数组
 //获取到的题目数组
-const scaleList = ref([
-    {
-        ti: '1.在学校做作业或者其他活动时,无法专注于细节的 部分或出现粗心的错误',
-        radio: '没有;一点;常是;总是',
-        isCheck: ''
-
-    }, {
-        ti: '2.在学校做作业或者其他活动时,无法专注于细节的 部分或出现粗心的错误',
-        radio: '没有;一点;常是;总是',
-        isCheck: ''
-    }, {
-        ti: '3.在学校做作业或者其他活动时,无法专注于细节的 部分或出现粗心的错误',
-        radio: '没有;一点;常是;总是',
-        isCheck: ''
-    }, {
-        ti: '4.在学校做作业或者其他活动时,无法专注于细节的 部分或出现粗心的错误',
-        radio: '没有;一点;常是;总是',
-        isCheck: ''
-    }
+const scaleList = ref<any>([
+    // {
+    //     id: '',
+    //     questionNo: '1',
+    //     serialNo: '',
+    //     content: '我发现我自己被一些琐碎的事情弄得很不开心',
+    //     checkItems: '非常符合;大部分符合;小部分符合;完全不符合',
+    //     questionType: '0',
+    //     questionParam: '',
+    //     weight: '',
+    //     score: '',
+    //     scoreDirection: '',
+
+    //     flag: '',
+    //     isCheck: '',
+    //     answerList: [{ name: '' }]
+
+    // }
 ])
 ])
 //当前题的对象
 //当前题的对象
 
 
@@ -69,7 +83,7 @@ const nextTopic = () => {
     topicIndex.value++
     topicIndex.value++
 
 
 }
 }
-const subScaleData = () => {
+const subScaleData = async () => {
     if (scaleList.value[topicIndex.value - 1].isCheck == '') {
     if (scaleList.value[topicIndex.value - 1].isCheck == '') {
         ElMessage({
         ElMessage({
             message: '请选择当前题目',
             message: '请选择当前题目',
@@ -79,11 +93,59 @@ const subScaleData = () => {
     }
     }
     //开始调用提交数据的方法
     //开始调用提交数据的方法
 
 
+    //开始处理数据
+    // productData()
+    let params = {
+        beginTime: startTime.value,
+        orgName: userInfo.userInfo.orgName,
+        orgNo: userInfo.userInfo.orgNo,
+        planId: planId.value,
+        planName: planName.value,
+        taskFlag: flag.value,
+        taskName: flagName.value,
+        testRecord: JSON.stringify(productData()),
+        type: '0',
+        userName: userInfo.userInfo.userName,
+        // userNo: isHaveManage ? userInfo.userInfo.userNo : '20240726001',
+        userNo: userInfo.userInfo.userNo,
+    }
+    const res = await saveScaleApi(params)
     ElMessage({
     ElMessage({
         message: '提交完成',
         message: '提交完成',
         type: "success",
         type: "success",
     })
     })
-    isCompleted.value = true
+    // isCompleted.value = true
+    //跳转到缓冲中间件
+    setTimeout(() => {
+        router.push({
+            name: 'scaleMid', params: {
+                planId: planId.value,
+                planName: planName.value,
+                flag: flag.value,
+                flagName: flagName.value,
+                num: num.value
+            }
+        })
+    }, 1500)
+
+}
+const productData = () => {
+    //循环列表
+    //查看isCheck字段
+    //根据字段拿出答案
+    //将答案放入数组
+    let testRecord = []
+    for (let i = 0; i < scaleList.value.length; i++) {
+        for (let k = 0; k < scaleList.value[i].answerList.length; k++) {
+            if (scaleList.value[i].isCheck === scaleList.value[i].answerList[k].name) {
+                //r
+                testRecord.push(scaleList.value[i].answerList[k])
+            }
+        }
+    }
+
+    return testRecord
+
 }
 }
 //上一题的方法
 //上一题的方法
 const lastTopic = () => {
 const lastTopic = () => {
@@ -101,18 +163,40 @@ const radioFun = () => {
     nextTopic()
     nextTopic()
 }
 }
 
 
-//返回计划列表
-const goBackList = () => {
-    router.push({ name: 'plan' })
-}
 
 
-//跳转到下一个任务
+
 
 
 //刚进入页面就将高度设置为页面需要的
 //刚进入页面就将高度设置为页面需要的
 onMounted(() => {
 onMounted(() => {
 
 
+
+    flag.value = route.params.flag as string;
+    planId.value = route.params.planId as string
+    planName.value = route.params.planName as string
+    flagName.value = route.params.flagName as string
+    num.value = route.params.num as string
     //进到界面开始轮询
     //进到界面开始轮询
+    getStartTime()
+    getScaleFun(flag.value)
 })
 })
+//获取当前时间
+const getStartTime = () => {
+    let date = new Date()
+    startTime.value = format(date, "yyyy-MM-dd hh:mm:ss");
+    console.log(startTime.value)
+}
+
+//根据flag 获取当前的题目
+const getScaleFun = async (val: string) => {
+    scaleList.value = []
+    let res: any = await getScaleApi(val)
+    console.log(res.data)
+    scaleList.value = res.data
+    for (let i = 0; i < scaleList.value.length; i++) {
+        scaleList.value[i].isCheck = ''
+    }
+
+}
 //界面销毁函数
 //界面销毁函数
 
 
 
 
@@ -136,7 +220,7 @@ onUnmounted(() => {
             <CpmdHeader />
             <CpmdHeader />
             <div class="report_top">
             <div class="report_top">
                 <div class="report_jt">
                 <div class="report_jt">
-                    <span v-show="!isCompleted">心灵万花筒</span>
+                    <span v-show="!isCompleted">{{ flagName }}</span>
                     <span v-show="isCompleted">心灵万花筒测试完成</span>
                     <span v-show="isCompleted">心灵万花筒测试完成</span>
                     <span v-show="!isCompleted" class="des">请根据您的表现回答下列问题,每道题请选择最符合您的情况的选项。</span>
                     <span v-show="!isCompleted" class="des">请根据您的表现回答下列问题,每道题请选择最符合您的情况的选项。</span>
                     <span v-show="isCompleted" class="des">以上测试已完成,请选择进行下一个测试或返回任务。</span>
                     <span v-show="isCompleted" class="des">以上测试已完成,请选择进行下一个测试或返回任务。</span>
@@ -146,17 +230,17 @@ onUnmounted(() => {
             <el-progress v-show="!isCompleted" :text-inside="true" :stroke-width="20"
             <el-progress v-show="!isCompleted" :text-inside="true" :stroke-width="20"
                 :percentage="(topicIndex / scaleList.length) * 100" color="#48D68E">
                 :percentage="(topicIndex / scaleList.length) * 100" color="#48D68E">
                 <!-- <el-button type="success" :icon="Check" circle style='z-index: 10;' /> -->
                 <!-- <el-button type="success" :icon="Check" circle style='z-index: 10;' /> -->
-                {{ topicIndex }}/{{ scaleList.length }}
+                <span style="color:#000000">{{ topicIndex }}/{{ scaleList.length }}</span>
             </el-progress>
             </el-progress>
         </div>
         </div>
         <div class="kply">
         <div class="kply">
             <div class="kply_inner" :style="{ border: isCompleted ? '8px solid #ffffff' : '8px solid #B2F2D2' }">
             <div class="kply_inner" :style="{ border: isCompleted ? '8px solid #ffffff' : '8px solid #B2F2D2' }">
                 <div style="padding :20px 40px">
                 <div style="padding :20px 40px">
-                    <div v-show="!isCompleted">
-                        <div class="scale_title">{{ scaleList[topicIndex - 1].ti }}</div>
+                    <div v-if="scaleList.length > 0">
+                        <div class="scale_title">{{ topicIndex }}:{{ scaleList[topicIndex - 1].content }}</div>
 
 
                         <el-radio-group v-model="scaleList[topicIndex - 1].isCheck" class="scale_radio_group">
                         <el-radio-group v-model="scaleList[topicIndex - 1].isCheck" class="scale_radio_group">
-                            <el-radio-button v-for="item in scaleList[topicIndex - 1].radio.split(';')  "
+                            <el-radio-button v-for="item in scaleList[topicIndex - 1].checkItems.split(';')  "
                                 @change="radioFun" :label="item" :value="item" />
                                 @change="radioFun" :label="item" :value="item" />
                         </el-radio-group>
                         </el-radio-group>
                         <div class="scale_button">
                         <div class="scale_button">
@@ -176,28 +260,6 @@ onUnmounted(() => {
 
 
                         </div>
                         </div>
                     </div>
                     </div>
-                    <div v-show="isCompleted" class="finish_calss">
-                        <div class="finish_img">
-                            <img width="30%" src="../assets/scale/complete.png" />
-                            <div class="finish_font">测试已完成</div>
-                        </div>
-                        <div class="scale_button">
-                            <el-row>
-                                <el-col :span="12" class="scale_button_inner">
-                                    <div class="scale_button_self" @click="goBackList">返回计划列表
-                                    </div>
-                                </el-col>
-                                <el-col :span="12" class="scale_button_inner">
-
-                                    <div class="scale_button_self" @click="subScaleData">&nbsp;下一个任务&nbsp;</div>
-                                </el-col>
-                            </el-row>
-
-
-                        </div>
-
-                    </div>
-
 
 
                 </div>
                 </div>
 
 

+ 499 - 0
src/views/ScaleMid.vue

@@ -0,0 +1,499 @@
+<script setup lang="ts">
+import CpmdHeader from '@/components/CpmdHeader.vue';
+import { onMounted, onUnmounted, ref } from 'vue'
+import { Check } from '@element-plus/icons-vue'
+import { number } from 'echarts';
+import { ElMessage } from 'element-plus';
+import { useRouter, useRoute } from 'vue-router';
+const router = useRouter()
+const route = useRoute()
+//持久化设置 菜单状态
+// import { menuStatusStore } from '@/stores'
+// const menuStatus = menuStatusStore();
+// menuStatus.saveActiveIndex('3')
+
+//当前量表是否已经提交
+const isCompleted = ref<boolean>(true)
+
+const flag = ref<string>('')
+const flagName = ref<string>('')
+const planId = ref<string>('')
+const planName = ref<string>('')
+const num = ref<string>('')
+
+
+//当前题的对象
+
+
+
+
+//点击跳转到下一列表
+const subScaleData = () => {
+
+}
+
+
+//返回计划列表
+const goBackList = () => {
+    router.push({ name: 'plan' })
+}
+
+//跳转到下一个任务
+const nextTask = () => {
+    if (num.value == '1') {
+        router.push({
+            name: 'scale', params: {
+                planId: planId.value,
+                planName: planName.value,
+                flag: flag.value,
+                flagName: flagName.value,
+                num: '2'
+
+            }
+        })
+    }
+    if (num.value == '2') {
+        router.push({
+            name: 'cognize', params: {
+                planId: planId.value,
+                planName: planName.value,
+                flag: flag.value,
+                flagName: flagName.value,
+                num: '3'
+
+            }
+        })
+    }
+    if (num.value == '3') {
+        router.push({
+            name: 'cognize', params: {
+                planId: planId.value,
+                planName: planName.value,
+                flag: flag.value,
+                flagName: flagName.value,
+                num: '4'
+
+            }
+        })
+    }
+    if (num.value == '4') {
+        //跳转到测试记录页面
+        router.push({
+            name: 'testRecord'
+        })
+    }
+
+}
+//跳转到下一个任务
+
+//刚进入页面就将高度设置为页面需要的
+onMounted(() => {
+    flag.value = route.params.flag as string;
+    planId.value = route.params.planId as string
+    planName.value = route.params.planName as string
+    flagName.value = route.params.flagName as string
+    num.value = route.params.num as string
+    //进到界面开始轮询
+})
+//界面销毁函数
+
+
+//轮旋切换页面的方法
+
+
+
+//退出页面销毁 方法
+onUnmounted(() => {
+
+})
+
+
+
+
+</script>
+
+<template>
+    <div class="home_header_out">
+        <div class=" home_header_inner">
+            <CpmdHeader />
+            <div class="report_top">
+                <div class="report_jt">
+
+                    <span v-show="isCompleted">心灵万花筒测试完成</span>
+
+                    <span v-show="isCompleted" class="des">以上测试已完成,请选择进行下一个测试或返回任务。</span>
+                </div>
+
+            </div>
+
+        </div>
+        <div class="kply">
+            <div class="kply_inner" :style="{ border: isCompleted ? '8px solid #ffffff' : '8px solid #B2F2D2' }">
+                <div style="padding :20px 40px">
+
+                    <div v-show="isCompleted" class="finish_calss">
+                        <div class="finish_img">
+                            <img width="30%" src="../assets/scale/complete.png" />
+                            <div class="finish_font">测试已完成</div>
+                        </div>
+                        <div class="scale_button">
+                            <el-row>
+                                <el-col :span="12" class="scale_button_inner">
+                                    <div class="scale_button_self" @click="goBackList">返回计划列表
+                                    </div>
+                                </el-col>
+                                <el-col :span="12" class="scale_button_inner">
+
+                                    <div class="scale_button_self" v-show="num != '4'" @click="nextTask">
+                                        &nbsp;下一个任务&nbsp;
+                                    </div>
+                                    <div class="scale_button_self" v-show="num == '4'" @click="nextTask">
+                                        &nbsp;下一个任务&nbsp;
+                                    </div>
+                                </el-col>
+                            </el-row>
+
+
+                        </div>
+                    </div>
+
+
+                </div>
+
+            </div>
+
+        </div>
+
+    </div>
+
+
+</template>
+<style lang="scss" scoped>
+:deep(.el-progress-bar__outer) {
+    background-color: #ffffff;
+    border-radius: 100px;
+    height: 6px;
+    overflow: hidden;
+    position: relative;
+    vertical-align: middle;
+}
+
+:deep(.el-radio-group) {
+    align-items: center;
+    display: flex;
+    flex-wrap: wrap;
+    font-size: 0;
+    flex-direction: column;
+}
+
+:deep(.el-radio-button) {
+    display: inline-block;
+    outline: none;
+    position: relative;
+    width: 80% !important;
+}
+
+:deep(.el-radio-button__inner) {
+    width: 100%;
+    border-radius: 40px !important;
+    margin-top: 30px;
+    border: 10px solid #B2F2D2;
+    border-left: 10px solid #B2F2D2 !important;
+    padding: 20px 20px;
+    font-size: 20px;
+    font-weight: 700;
+    text-align: left;
+
+}
+
+:deep(.el-radio-button__inner:hover) {
+    width: 100%;
+    border-radius: 40px !important;
+    margin-top: 30px;
+    border: 10px solid #B2F2D2;
+    border-left: 10px solid #B2F2D2 !important;
+    padding: 20px 20px;
+    font-size: 20px;
+    font-weight: 700;
+    text-align: left;
+    color: #000000;
+    background-color: #48D68E;
+    color: #ffffff;
+
+}
+
+:deep().el-radio-button__original-radio:checked+.el-radio-button__inner {
+    background-color: #48D68E;
+    border-color: #B2F2D2;
+    box-shadow: 0 0 0 0 var(--el-radio-button-checked-border-color, var(--el-color-primary));
+    color: var(--el-radio-button-checked-text-color, var(--el-color-white));
+}
+
+.home_header_out {
+    // position: relative;
+    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: #FAFAFA; //估计是需要动态
+
+    //获取屏幕宽度home_header_out 这个div的宽度--然后宽度*1000再除1920即为当前div的宽度
+    .home_header_inner {
+        min-height: 1;
+        left: 0;
+        right: 0;
+        margin: auto;
+        // height: 100px;
+        width: 1200px;
+
+
+
+        .report_top {
+            margin-top: 50px;
+            display: flex;
+            flex-direction: row;
+            justify-content: space-between;
+            align-items: center;
+            margin-bottom: 40px;
+
+            .xlts_img {
+                margin-right: 100px;
+                width: 200px;
+            }
+
+            .report_jt {
+                display: flex;
+                flex-direction: column;
+                font-size: 50px;
+                font-weight: 700;
+                letter-spacing: 3px;
+
+                .des {
+                    color: #888888;
+                    // opacity: 0.4;
+                    font-size: 20px;
+                    letter-spacing: 0px;
+                    margin-top: 10px;
+                }
+            }
+        }
+    }
+
+    .kply {
+        width: 100%;
+        margin-top: 40px;
+        // background-color: #FAFAFA;
+
+        .kply_inner {
+            // border: 8px solid #B2F2D2;
+            min-height: 500px;
+            left: 0;
+            right: 0;
+            margin: auto;
+            width: 1200px;
+            // padding: 20px 20px;
+            background-color: #ffffff;
+            border-radius: 40px;
+
+            .scale_title {
+                margin-top: 20px;
+                font-size: 35px;
+                letter-spacing: 4px;
+                line-height: 60px;
+
+                .scale_radio_group {
+                    display: flex;
+                    flex-direction: column;
+                }
+            }
+
+            .scale_button {
+                margin-top: 60px;
+                margin-bottom: 20px;
+
+                .scale_button_inner {
+                    text-align: center;
+                    display: flex;
+                    justify-content: center;
+
+                    .scale_button_self {
+
+                        border-radius: 12px;
+                        border: 3px solid #48D68E;
+                        color: #ffffff;
+                        background-color: #000000;
+                        margin-right: 20px;
+                        padding: 10px 90px;
+                        cursor: pointer;
+                        display: flex;
+                        align-items: center;
+                        font-size: 24px;
+                    }
+                }
+            }
+
+            .finish_calss {
+                display: flex;
+                flex-direction: column;
+
+                .finish_img {
+                    margin-top: 60px;
+                    display: flex;
+                    flex-direction: column;
+                    align-items: center;
+
+                    .finish_font {
+                        margin-top: 40px;
+                        font-size: 30px;
+                        margin-bottom: 100px;
+                    }
+                }
+            }
+        }
+    }
+
+
+}
+
+
+
+.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>

Some files were not shown because too many files changed in this diff