Commit e94cf462 authored by zhengzy's avatar zhengzy

倒计时与题数bug

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