Commit e94cf462 authored by zhengzy's avatar zhengzy

倒计时与题数bug

parent 05fe970c
......@@ -75,7 +75,7 @@ export default {
timeDefine: {
"time-id-2": 1800,
"time-id-3": 900,
"time-id-4": 360,
"time-id-4": 450,
},
endTime: 0,
currentTime: 100,
......@@ -407,6 +407,11 @@ export default {
if (this.everyTime > 0) {
this.timer = setTimeout(this.startCounting, 1000);
console.log(
"endTime:" + this.endTime,
"everyTime:" + this.everyTime,
"currentTime:" + this.currentTime
);
} else {
clearTimeout(this.timer);
this.everyTime = 90;
......
<template>
<view class="content">
<u-navbar
back-icon-color="#FFFFFF"
:background="background"
title-color="#fff"
:border-bottom="false"
></u-navbar>
<u-navbar back-icon-color="#FFFFFF" :background="background" title-color="#fff" :border-bottom="false"></u-navbar>
<view class="title">考试规则</view>
<view class="test">
<view class="slogan">
这是一场严肃的考试,请认真查看 规则,预祝您顺利通过考试!
</view>
<view class="text">
<text class="left">考试科目:</text
><text style="color: #007aff">{{ desc.title }}</text>
<text class="left">考试科目:</text><text style="color: #007aff">{{ desc.title }}</text>
</view>
<view class="text">
<text class="left">合格条件:</text><text>{{ desc.score }}</text>
......@@ -22,7 +16,7 @@
<text class="left">考试时间:</text><text>{{ desc.time }}</text>
</view>
<view class="text">
<text class="left">题目来源:</text><text>系统随机{{ desc.number }}</text>
<text class="left">题目来源:</text><text>{{ ruleDisc }}</text>
</view>
<button @click="getUserExamId()">开始考试</button>
</view>
......@@ -31,66 +25,66 @@
<script>
let condition = {
"dev": {
dev: {
"id-2": {
"score": "60分",
"time": "30分钟",
"number": "20",
"title": "服务规范"
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
"score": "30分",
"time": "15分钟",
"number": "10",
"title": "服务规范"
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
"score": "15分",
"time": "6分钟",
"number": "4",
"title": "交付规范"
}
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
"test": {
test: {
"id-2": {
"score": "60分",
"time": "30分钟",
"number": "20",
"title": "服务规范"
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
"score": "30分",
"time": "15分钟",
"number": "10",
"title": "服务规范"
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
"score": "15分",
"time": "6分钟",
"number": "4",
"title": "交付规范"
}
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
"prod": {
prod: {
"id-2": {
"score": "60分",
"time": "30分钟",
"number": "20",
"title": "服务规范"
score: "60分",
time: "30分钟",
number: "20",
title: "服务规范",
},
"id-3": {
"score": "30分",
"time": "15分钟",
"number": "10",
"title": "服务规范"
score: "30分",
time: "15分钟",
number: "10",
title: "服务规范",
},
"id-4": {
"score": "15分",
"time": "6分钟",
"number": "4",
"title": "交付规范"
}
}
score: "15分",
time: "6分钟",
number: "4",
title: "交付规范",
},
},
};
let env = process.uniEnv.node_env;
let desc = condition[env];
......@@ -102,11 +96,13 @@ export default {
examId: null,
exam: null,
userExamId: null,
ruleDisc: "",
};
},
onLoad(param) {
this.examId = param.examId
this.desc = desc["id-" + this.examId]
this.examId = param.examId;
this.desc = desc["id-" + this.examId];
this.getExamResult();
// this.getUserExamInfo();
},
methods: {
......@@ -119,33 +115,58 @@ export default {
},
getUserExamInfo() {
uni.request({
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam/serviceRule/" +
this.vuex_token +
"?examId=" +
this.examId,
method: "POST",
header: {
"Content-Type": "application/x-www-from-urlencoded",
},
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam/serviceRule/" +
this.vuex_token +
"?examId=" +
this.examId,
method: "POST",
header: {
"Content-Type": "application/x-www-from-urlencoded",
},
success: (res) => {
console.log("标识符1", res.data);
uni.hideLoading();
if (res.data.code == 200) {
if (res.data.data.userExamId) {
this.userExamId = res.data.data.userExamId;
console.log("这个是个标识符", this.userExamId);
}
}
},
success: (res) => {
console.log("标识符1", res.data);
uni.hideLoading();
if (res.data.code == 200) {
if (res.data.data.userExamId) {
this.userExamId = res.data.data.userExamId;
console.log("这个是个标识符", this.userExamId);
}
}
},
});
setTimeout(() => {
wx.navigateTo({
url: "/pages/learn/answer?userExamId=" + this.userExamId,
});
}, 1000);
wx.navigateTo({
url: "/pages/learn/answer?userExamId=" + this.userExamId,
});
}, 1000);
},
getExamResult() {
uni.request({
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/" +
this.vuex_token +
"?examId=" +
this.examId,
method: "POST",
header: {
"Content-Type": "application/x-www-from-urlencoded",
},
success: (res) => {
uni.hideLoading();
if (res.data.code == 200) {
if (res.data.data.ruleDisc) {
console.log(res.data.data.ruleDisc);
var str = res.data.data.ruleDisc;
console.log(str.substring(0, 11));
this.ruleDisc = str.substring(0, 11);
}
}
},
});
},
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment