JutarryWu 3 bulan lalu
induk
melakukan
1b2be90ea6

+ 33 - 10
src/views/CognitiveAbilityTask/coginitiveTask.vue

@@ -143,13 +143,18 @@ export default {
       userCanClick: false,
       tryStartTime: 0, // 试次开始时间
 
-      randomSeconds: [3, 3, 3, 3]
+      randomSeconds: [],
+      tryCount: 5 // 每种时间间隔的试次数量
     };
   },
   // 页面初始化函数
   created() {
-    this.taskId = this.$route.query.taskId;
-    this.init(this.taskId);
+    this.taskId = this.$route.query.taskId
+    this.init(this.taskId)
+
+    // 初始化动态参数
+    this.getParam()
+
     window.addEventListener(
       "popstate",
       function (e) {
@@ -160,7 +165,7 @@ export default {
         clearInterval(this.countDownInterval);
       },
       false
-    );
+    )
   },
   mounted() {
     document.onkeydown = function (e) {
@@ -176,16 +181,29 @@ export default {
     clearInterval(this.myInterval);
   },
   methods: {
-    init(taskId) {
-      // this.subjectInfo = cognitiveAbilityTaskList[taskId];
-      this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"));
-      this.imgUrl = this.subjectInfo.imageUrl;
+    init() {
+      this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"))
+      this.imgUrl = this.subjectInfo.imageUrl
+    },
+
+    getParam() {
+      this.$http.get(
+          `/taskParam/getByTaskId?taskId=${this.taskId}`,
+          {},
+          (msg) => {
+            msg.data.forEach((item) => {
+              if (item.code === 'CT_Try_Count') {
+                this.tryCount = Number(item.value)
+              }
+            })
+          }
+      )
     },
 
     initData() {
       this.randomSeconds = []
       this.userTestAnswer = []
-      for (let i = 0; i < 5; i++) {
+      for (let i = 0; i < this.tryCount; i++) {
         for (let j = 2; j <= 10; j++) {
           this.randomSeconds.push(j * 1000)
         }
@@ -205,7 +223,9 @@ export default {
       screenfull.toggle();
     },
     userClick() {
+      console.log('------ 999999')
       this.hasResponse = 1 // 标记用户做出了反应
+      console.log('------ 10100110')
       //用户点击动作
       if (this.userCanClick) {
         this.userResponseMilliSeconds = (performance.now() - this.tryStartTime).toFixed(2);
@@ -250,6 +270,8 @@ export default {
         this.taskStartTime = Date.now()
         this.initData()
         //重新赋值正式测试数量
+        this.hasResponse = 0 // 重置用户点击操作标识
+        this.isValidResponse = 0
         this.testCount = this.randomSeconds.length;
       }
       // 测试准备倒计时
@@ -294,6 +316,7 @@ export default {
       }, 1000);
     },
     testTrail() {
+      console.log('this.userTestAnswer: ', this.userTestAnswer)
       this.divRandomShow()
       if (this.testCount  > 0) {
         this.divShowInteval = setTimeout(() => {
@@ -316,7 +339,7 @@ export default {
             })
 
             // 清空数据,为下一次试次做准备
-            this.hasResponse = 0
+            this.hasResponse = 0 // 重置用户点击操作标识
             this.isValidResponse = 0
             this.userResponseMilliSeconds = 0;
           }

+ 6 - 4
src/views/CognitiveAbilityTask/goNogoTask.vue

@@ -59,13 +59,14 @@
       </p>
     </div>
     <div v-if="testFlag" :class="{ testMainDiv: !testState, activeTask: testState }" @click="userClick()">
+      <MainProgress v-if="testTypeCode == 1" :cur-percentage="percentage" />
+
       <div class="taskHead">
         <div class="scale" @click.stop="screen">
           <img src="../../assets/small-big.png" alt="" />
         </div>
-        <el-progress class="main_progress" v-if="testTypeCode == 1" :text-inside="true" :format="format"
-          :stroke-width="24" :percentage="percentage" style="width: 50%"></el-progress>
       </div>
+
       <div class="glass">
         <span class="countdownStr" v-if="countDownSpanShow">{{
           countDownStr
@@ -84,9 +85,10 @@
 import screenfull from "screenfull";
 import { oSessionStorage } from "../../utils/utils";
 import GoBack from "@/components/goBack/index.vue";
+import MainProgress from "@/components/MainProgress/index.vue";
 
 export default {
-  components: {GoBack},
+  components: {MainProgress, GoBack},
   data() {
     return {
       userId: "",
@@ -156,7 +158,7 @@ export default {
   },
   computed: {
     percentage() {
-      return (this.userResponseRecords.length / 144) * 100
+      return this.userResponseRecords.length / 144
     }
   },
   methods: {

+ 23 - 3
src/views/CognitiveAbilityTask/riskPolicy/formal.vue

@@ -156,12 +156,17 @@ export default {
       onceStartTime: 0,
 
       tryStartTime: 0, // 每次测试开始时间
+
+      tryCount: 3 // 每种充气次数的试次数量
     }
   },
   created() {
-    this.taskId = this.$route.query.taskId;
-    this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"));
+    this.taskId = this.$route.query.taskId
+    this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"))
     this.userId = sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f")
+
+    // 初始化动态参数
+    this.getParam()
   },
   computed: {
     // 当前收益
@@ -169,8 +174,23 @@ export default {
       return this.aeratedCount * 1
     }
   },
+
   methods: {
 
+    getParam() {
+      this.$http.get(
+          `/taskParam/getByTaskId?taskId=${this.taskId}`,
+          {},
+          (msg) => {
+            msg.data.forEach((item) => {
+              if (item.code === 'RP_Try_Count') {
+                this.tryCount = Number(item.value)
+              }
+            })
+          }
+      )
+    },
+
     startTest() {
       if(this.isPracticeEnd) {
         this.testFlag = true
@@ -192,7 +212,7 @@ export default {
 
     // 随机生成充气次数,2-10次;
     createAeratedArr() {
-      for (let i = 0; i < 3; i++) {
+      for (let i = 0; i < this.tryCount; i++) {
         for (let j = 2; j <= 10; j++) {
           this.aeratedArr.push(j)
         }

+ 20 - 0
src/views/CognitiveAbilityTask/spatialOrientationAbilityNew/index.vue

@@ -246,6 +246,10 @@ export default {
     // this.initImgData();
     // 生成指针圆环初始化
     // this.initCircleData();
+
+    // 初始化动态参数
+    this.getParam()
+
     let clientWidth = document.body.clientWidth
     this.roundSliderRadius = clientWidth * 0.0778
   },
@@ -254,6 +258,22 @@ export default {
       screenfull.toggle()
     },
 
+    getParam() {
+      this.$http.get(
+          `/taskParam/getByTaskId?taskId=${this.taskId}`,
+          {},
+          (msg) => {
+            msg.data.forEach((item) => {
+              if (item.code === 'SOA_Target_Count') {
+                this.levelNum = item.value.split(',').filter((item) => item && item >= 3)
+              } else if (item.code === 'SOA_Try_Count') {
+                this.tryCount = Number(item.value)
+              }
+            })
+          }
+      )
+    },
+
     startTest(flag) {
       if (!this.userId) {
         this.$message.error("请先登录!")

+ 23 - 7
src/views/CognitiveAbilityTask/speedCognitive/formal.vue

@@ -175,12 +175,7 @@ export default  {
       maxLevel: 9,
 
       // 游戏等级权重
-      gradeList: [
-        1, 2, 3, 4, 5, 6, 7, 8, 9,
-        1, 2, 3, 4, 5, 6, 7, 8, 9,
-        1, 2, 3, 4, 5, 6, 7, 8, 9,
-        1, 2, 3, 4, 5, 6, 7, 8, 9
-      ]
+      gradeList: []
     }
   },
   computed: {
@@ -284,7 +279,7 @@ export default  {
       if (this.practiceFlag) {
         return 6
       } else {
-        return 36
+        return this.gradeList.length
       }
     }
   },
@@ -292,11 +287,32 @@ export default  {
     this.taskId = this.$route.query.taskId
     this.gradeList = this.gradeList.sort(() => Math.random() - 0.5)
     this.init(this.taskId)
+
+    // 初始化动态参数
+    this.getParam()
   },
   mounted() {
     document.addEventListener('keydown', this.onKeydown)
   },
   methods: {
+
+    getParam() {
+      this.$http.get(
+          `/taskParam/getByTaskId?taskId=${this.taskId}`,
+          {},
+          (msg) => {
+            msg.data.forEach((item) => {
+              if (item.code === 'SC_Try_Count') {
+                let tryCount = Number(item.value)
+                for (let i = 0; i < tryCount; i++) {
+                  this.gradeList = this.gradeList.concat([1, 2, 3, 4, 5, 6, 7, 8, 9])
+                }
+              }
+            })
+          }
+      )
+    },
+
     initRecord() {
       return {
         imgIndex: "",

+ 30 - 15
src/views/CognitiveAbilityTask/targetTrackingChildren/formal.vue

@@ -100,11 +100,11 @@
 import ecStat from "echarts-stat";
 import * as echarts from "echarts";
 import screenfull from "screenfull";
-import {dateFormat, oSessionStorage} from "@/utils/utils";
+import { dateFormat, oSessionStorage } from "@/utils/utils"
 import GoBack from "@/components/goBack/index.vue"
 import MainProgress from "@/components/MainProgress/index.vue"
 import Practice from './practice.vue'
-import { shuffle } from "../../../utils/utils";
+import { shuffle } from "@/utils/utils"
 
 export default {
   components: { GoBack, MainProgress, Practice },
@@ -120,7 +120,6 @@ export default {
       isPracticeEnd: false, // 是否完成练习
 
       sum: 0,
-      tnumber: 4, //设置每个等级做几次
       endFlag: false,
       tableData: [],
       layer: 1,
@@ -145,14 +144,8 @@ export default {
       number: "",
       userId: "",
       onsave: false,
-      pam: [
-        [1, 0.0001, 3],
-        // [2, 0.001, 3],
-        [1, 0.0001, 4],
-        // [2, 0.001, 4],
-        [1, 0.0001, 5]
-        // [2, 0.001, 5],
-      ],
+      tryNumber: 4, //设置每个等级做几次
+      pam: [],
       parameters: [],
       grade: [],
       RandomArray: [
@@ -170,18 +163,40 @@ export default {
     };
   },
   created() {
-    this.taskId = this.$route.query.taskId;
-    this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"));
+    this.taskId = this.$route.query.taskId
+    this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"))
+
+    // 初始化动态参数
+    this.getParam()
   },
   mounted() {
-    this.userId = sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f");
+    this.userId = sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f")
   },
   methods: {
 
+    getParam() {
+      this.$http.get(
+          `/taskParam/getByTaskId?taskId=${this.taskId}`,
+          {},
+          (msg) => {
+            msg.data.forEach((item) => {
+              if (item.code === 'TTC_Target_Count') {
+                let tempArr = item.value.split(',').filter((item) => item && item > 0)
+                tempArr.forEach((item) => {
+                  this.pam.push([1, 0.0001, item])
+                })
+              } else if (item.code === 'TTC_Try_Count') {
+                this.tryNumber = Number(item.value)
+              }
+            })
+          }
+      )
+    },
+
     startTest() {
       if(this.isPracticeEnd) {
         for (let i = 0; i < this.pam.length; i++) {
-          for (let j = 1; j <= this.tnumber; j++) {
+          for (let j = 1; j <= this.tryNumber; j++) {
             this.parameters.push(this.pam[i]);
           }
         }