|
@@ -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;
|
|
|
}
|