Commit 2a29882f authored by zhengzy's avatar zhengzy

考核认证

parent 75f36528
<template> <template>
<view class="content"> <view class="content">
<view class=""> <view class="">
<view class="" style="padding-left: 94rpx;margin:36rpx 0"> <view class="" style="padding-left: 94rpx; margin: 36rpx 0">
<text class="dx">多选</text><text class="num">第1题</text><text class="all">/共30题</text> <text class="dx">多选</text
><text class="all">{{ ExaminationQuestions.progress }}</text>
</view> </view>
<view class="" style="text-align: center;"> <view class="" style="text-align: center">
一下对压缩机故障描述有误的是? {{ ExaminationQuestions.question.content }}
</view> </view>
<view class="" style="margin-top: 130rpx;"> <view class="" style="margin-top: 130rpx">
<view class="list-box"> <view class="list-box">
<view v-for="(item,index) in list" :key="index" @click="choice(index)" :class="[item.selected?'selde':'noselde']"> <view
{{item.selected?item.title:item.title}} v-for="(item, index) in list"
:key="index"
@click="choice(index)"
:class="[item.isRight ? 'selde' : 'noselde']"
>
{{ item.content }}
</view> </view>
</view> </view>
</view> </view>
<button class="btn">下一题</button> <button class="btn" @click="nextClick()">下一题</button>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
list: [{ list: [
selected: false, {
title: 'A' isRight: false,
title: "A",
}, },
{ {
selected: false, isRight: false,
title: 'B' title: "B",
}, },
{ {
selected: false, isRight: false,
title: 'C' title: "C",
}, },
{ {
selected: false, isRight: false,
title: 'D' title: "D",
}, },
{ {
selected: false, isRight: false,
title: 'E' title: "E",
} },
], ],
selectId:[], isSelect: false,
selectId: [],
userExamId: null,
ExaminationQuestions: null,
isQuestion: true,
}; };
}, },
onLoad() { onLoad(num) {
this.getUserExamInfo() console.log("标识符4", this.userExamId);
console.log("标识符3" + num);
this.userExamId = num;
this.getExaminationQuestions();
}, },
onUnload() {
wx.reLaunch({
url: "./index",
});
},
methods: { methods: {
abc() { abc() {
console.log("11111") console.log("11111");
var arr = document.querySelector(".btm"); var arr = document.querySelector(".btm");
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
arr[i].onclick = function() { arr[i].onclick = function () {
console.log(this.value) console.log(this.value);
} };
} }
}, },
//选择按钮 //选择按钮
choice(index) { choice(index) {
if (this.list[index].selected == true) { if (this.list[index].isRight == true) {
this.list[index].selected = false; this.list[index].isRight = false;
this.isSelect = false;
console.log(this.isSelect);
//取消选中时删除数组中的值 //取消选中时删除数组中的值
for (var i = 0; i < this.selectId.length; i++) { for (var i = 0; i < this.selectId.length; i++) {
if (this.selectId[i] === this.list[index].title) { if (this.selectId[i] === this.list[index].id) {
this.selectId.splice(i, 1); this.selectId.splice(i, 1);
} }
} }
console.log("选中的值", this.selectId) console.log("选中的值", this.selectId);
} else { } else {
this.list[index].selected = true; this.list[index].isRight = true;
this.selectId.push(this.list[index].title) this.isSelect = true;
console.log("选中的值", this.selectId) console.log(this.isSelect);
this.selectId.push(this.list[index].id);
console.log("选中的值", this.selectId);
} }
}, },
//申请考试题目
getExaminationQuestions: function () {
uni.request({
url:
"http://192.168.1.22" +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/next/" +
this.vuex_token +
"?userExamId=" +
this.userExamId.userExamId,
method: "POST",
header: {
"Content-Type": "application/x-www-form-urlencoded",
}, },
mounted() { success: (res) => {
console.log("111111") if (res.data.code == 200) {
this.ExaminationQuestions = res.data.data;
this.list = res.data.data.answerList;
console.log(this.ExaminationQuestions);
} }
},
});
console.log("answer的userExamId是", this.userExamId);
},
//下一题
nextClick: function () {
//判断
if (this.isQuestion == "第20题/共20题") {
this.isQuestion = "";
console.log("标识符6666", this.userExamId.userExamId);
wx.navigateTo({
url: "./result?userExamId=" + this.userExamId.userExamId,
});
}
//判断有没有选
if (this.selectId.length == 0) {
wx.showToast({
title: "请选择",
icon: "none", //当icon:'none'时,没有图标 只有文字
duration: 2000,
});
return;
}
uni.request({
url:
"http://192.168.1.22" +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/next/" +
this.vuex_token +
"?userExamId=" +
this.userExamId.userExamId +
"&questionId=" +
this.ExaminationQuestions.question.id +
"&userAnswerIds=" +
this.selectId,
method: "POST",
header: {
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
console.log("sssss", res);
if (res.data.code == 200) {
this.ExaminationQuestions = res.data.data;
this.list = res.data.data.answerList;
this.isQuestion = res.data.data.progress;
console.log("uuuuuuuu", this.ExaminationQuestions);
} }
this.selectId = [];
console.log("zzy", this.selectId);
},
});
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
.content { .content {
width: 600rpx; width: 600rpx;
height: 800rpx; height: 800rpx;
/* background: #8F8F94; */ /* background: #8F8F94; */
margin: 0 auto; margin: 0 auto;
} }
.dx { .dx {
padding: 0rpx; padding: 0rpx;
background: #2979FF; background: #2979ff;
color: #FFFFFF; color: #ffffff;
border-radius: 0px; border-radius: 0px;
} }
.num { .num {
color: #2B85E4; color: #2b85e4;
} }
.all { .all {
color: #8F8F94; color: #8f8f94;
} }
.btn { .btn {
margin-top: 98rpx; margin-top: 98rpx;
width: 476rpx; width: 476rpx;
height: 60rpx; height: 60rpx;
line-height: 30px; line-height: 30px;
background: #007AFF; background: #007aff;
color: #FFFFFF; color: #ffffff;
} }
.btm { .btm {
width: 476rpx; width: 476rpx;
height: 60rpx; height: 60rpx;
line-height: 30px; line-height: 30px;
margin: 34rpx auto; margin: 34rpx auto;
} }
.list-box { .list-box {
// display: flex; // display: flex;
// flex-wrap: wrap; // flex-wrap: wrap;
padding: 16upx; padding: 16upx;
...@@ -139,26 +232,24 @@ ...@@ -139,26 +232,24 @@
line-height: 60upx; line-height: 60upx;
text-align: center; text-align: center;
margin: 26rpx auto 0; margin: 26rpx auto 0;
} }
}
} /*已选择*/
.selde {
/*已选择*/ background: #007aff;
.selde { color: #ffffff;
background: #007AFF;
color: #FFFFFF;
border-radius: 20upx; border-radius: 20upx;
font-size: 26rpx; font-size: 26rpx;
padding: 0 10upx; padding: 0 10upx;
} }
/*未选择*/ /*未选择*/
.noselde { .noselde {
background: #E4E7ED; background: #e4e7ed;
color: #959595; color: #959595;
border-radius: 20upx; border-radius: 20upx;
font-size: 20upx; font-size: 20upx;
padding: 0 10upx; padding: 0 10upx;
} }
</style> </style>
...@@ -3,148 +3,106 @@ ...@@ -3,148 +3,106 @@
<view class="title">考试规则说明</view> <view class="title">考试规则说明</view>
<view class="test"> <view class="test">
<view class="text"> <view class="text">
<text class="left">考试科目:</text><text style="color: #007AFF;">{{exam.examName}}</text> <text class="left">考试科目:</text
><text style="color: #007aff">{{ exam.examName }}</text>
</view> </view>
<view class="text"> <view class="text">
<text class="left">合格条件:</text><text>{{exam.ruleDisc}}</text> <text class="left">合格条件:</text
><text>{{ exam.ruleDisc }}</text>
</view> </view>
<view class="text"> <view class="text">
<text class="left">考试时间:</text><text>30分钟</text> <text class="left">考试时间:</text><text>30分钟</text>
</view> </view>
<view class="text"> <view class="text">
<text class="left">题目规则:</text><text>题库100题,随机抽20题</text> <text class="left">题目规则:</text
><text>题库100题,随机抽20题</text>
</view> </view>
<view class="text"> <view class="text">
<text class="left">备注说明:</text><text>无</text> <text class="left">备注说明:</text><text>无</text>
</view> </view>
</view> </view>
<button @click="aaa">开始考试</button> <button @click="getUserExamId()">开始考试</button>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
examId:1, examId: 2,
exam:null exam: null,
} userExamId: null,
};
}, },
onLoad() { onLoad() {
this.getUserExamInfo() // this.getUserExamInfo();
}, },
methods: { methods: {
aaa(){ //申请考试获取userExamId
getUserExamId: function () {
wx.navigateTo({ var that = this;
console.log("这是一条消息");
url:'./answer'
})
},
//获取考试信息
getUserExamInfo: function() {
uni.showLoading({
title: '请稍候'
})
let that = this
uni.request({ uni.request({
url: 'https://system.banshouhui.com' + url:
'/wxh-worker-rest/rest/exam' + "http://192.168.1.22" +
'/serviceRule/userExamInfo/' + "/wxh-worker-rest/rest/exam/serviceRule/" +
'RTOKENf86a7c0606ef5ebf36f211ace3466b7f9de56e37' + that.vuex_token +
'?examId=' + this.examId, "?examId=" +
method: 'POST', this.examId,
data: { method: "POST",
//examId:this.examId,
},
header: { header: {
'Content-Type': 'application/x-www-form-urlencoded' "Content-Type": "application/x-www-from-urlencoded",
}, },
success: (res) => { success: (res) => {
console.log(res.data) console.log("标识符1", res.data);
uni.hideLoading() uni.hideLoading();
if (!res.data) {
return
}
if (res.data.code == 401 || res.data.code == 403) {
// uni.navigateTo({
// url: '/pages/login/wxlogin'
// })
// return
console.log('洪塘张学友')
}
if (res.data.code == 200) { if (res.data.code == 200) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 if (res.data.data.userExamId) {
that.exam = res.data.data that.userExamId = res.data.data.userExamId;
console.log(that.exam) console.log("这个是个标识符", that.userExamId);
if (res.data.data.examStatus == 2) {
that.applyExam()
return
}
if(res.data.data.examStatus == 1){
console.log('111111111111111111111111111')
that.isComplete = true
that.examScore = res.data.data.examScore
that.postResult()
return
} }
if (res.data.data.examStatus == 0 ) {
that.userExamId = res.data.data.id
that.getNext()
} }
} else {
uni.showToast({
icon: 'none',
title: res.data.message
})
}
}, },
fail: (e) => { });
uni.hideLoading() setTimeout(() => {
uni.showToast({ wx.navigateTo({
icon: 'none', url: "./answer?userExamId=" + that.userExamId,
title: '获取考试信息失败' });
}) }, 1000);
}
})
}, },
},
} };
}
</script> </script>
<style > <style>
.content{ .content {
margin: 187rpx 80rpx; margin: 187rpx 80rpx;
} }
.title{
.title {
font-size: 17px; font-size: 17px;
text-align: center; text-align: center;
} }
.test{
margin: 0 0 ; .test {
} margin: 0 0;
.left{ }
.left {
margin-right: 8rpx; margin-right: 8rpx;
margin-left: 68rpx; margin-left: 68rpx;
}
} .text {
.text{
margin: 50rpx 0; margin: 50rpx 0;
} }
button{
width:364rpx; button {
width: 364rpx;
height: 56rpx; height: 56rpx;
background: #007AFF; background: #007aff;
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #ffffff;
} }
</style> </style>
...@@ -164,11 +164,12 @@ ...@@ -164,11 +164,12 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
msg: "赣南吴彦祖", msg: "赣南吴彦祖",
tabs: [{ tabs: [
{
name: "交付规范", name: "交付规范",
}, },
{ {
...@@ -299,7 +300,7 @@ ...@@ -299,7 +300,7 @@
break; break;
case 2: case 2:
this.getCourseList(); this.getCourseList();
console.log('重新加载学习进度'); console.log("重新加载学习进度");
break; break;
case 3: case 3:
this.getUserExamInfo(); this.getUserExamInfo();
...@@ -319,9 +320,22 @@ ...@@ -319,9 +320,22 @@
}, },
//跳转到assessment页面 //跳转到assessment页面
aaa() { aaa() {
var id = this.exam.id;
if (this.exam.examStatus == 0) {
console.log("这是个标识符", this.exam.id);
wx.navigateTo({
url: "./answer?userExamId=" + id,
});
} else if (this.exam.examStatus == 1) {
wx.navigateTo({
url: "./result?userExamId=" + id,
});
} else if (this.exam.examStatus == 2) {
wx.navigateTo({ wx.navigateTo({
url: "./assessment", url: "./assessment",
}); });
}
}, },
//跳转到课程介绍 //跳转到课程介绍
ccc(id) { ccc(id) {
...@@ -382,10 +396,11 @@ ...@@ -382,10 +396,11 @@
let that = this; let that = this;
uni.request({ uni.request({
url: "http://192.168.1.22" + url:
"http://192.168.1.22" +
"/wxh-worker-rest/rest/exam" + "/wxh-worker-rest/rest/exam" +
"/serviceRule/userExamInfo/" + "/serviceRule/userExamInfo/" +
getApp().globalData.token + this.vuex_token +
"?examId=" + "?examId=" +
2, 2,
method: "POST", method: "POST",
...@@ -396,7 +411,6 @@ ...@@ -396,7 +411,6 @@
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
}, },
success: (res) => { success: (res) => {
console.log(res.data);
uni.hideLoading(); uni.hideLoading();
if (!res.data) { if (!res.data) {
return; return;
...@@ -412,26 +426,6 @@ ...@@ -412,26 +426,6 @@
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 //examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data.data; that.exam = res.data.data;
console.log(that.exam); console.log(that.exam);
if (res.data.data.examStatus == 2) {
that.applyExam();
return;
}
if (res.data.data.examStatus == 1) {
console.log("111111111111111111111111111");
that.isComplete = true;
that.examScore = res.data.data.examScore;
that.postResult();
return;
}
if (res.data.data.examStatus == 0) {
that.userExamId = res.data.data.id;
that.getNext();
}
} else {
uni.showToast({
icon: "none",
title: res.data.message,
});
} }
}, },
fail: (e) => { fail: (e) => {
...@@ -444,114 +438,115 @@ ...@@ -444,114 +438,115 @@
}); });
}, },
}, },
}; };
</script> </script>
<style> <style>
.study { .study {
height: 100vh; height: 100vh;
background-color: #f4f5f7; background-color: #f4f5f7;
padding: 0rpx 30rpx 0 30rpx; padding: 0rpx 30rpx 0 30rpx;
} }
.title-view { .title-view {
color: #333333; color: #333333;
font-weight: bold; font-weight: bold;
font-size: 40rpx; font-size: 40rpx;
} }
.banner { .banner {
width: 690rpx; width: 690rpx;
height: 240rpx; height: 240rpx;
/* margin-left: -15rpx; */ /* margin-left: -15rpx; */
} }
/* //交付规范 */ /* //交付规范 */
.standard { .standard {
width: 656rpx; width: 656rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
border-bottom: 1rpx solid #82848a; border-bottom: 1rpx solid #82848a;
padding: 0 34rpx; padding: 0 34rpx;
margin: 72rpx auto; margin: 72rpx auto;
} }
/* //培训通知 */ /* //培训通知 */
.notice { .notice {
border: #808080 solid 2rpx; border: #808080 solid 2rpx;
width: 100%; width: 100%;
height: 400rpx; height: 400rpx;
margin-top: 36rpx; margin-top: 36rpx;
overflow: hidden; overflow: hidden;
} }
.n-head { .n-head {
text-align: center; text-align: center;
margin: 32rpx 0; margin: 32rpx 0;
} }
.news {} .news {
}
/* //在线学习 */ /* //在线学习 */
.currency-class { .currency-class {
width: 100%; width: 100%;
background: #ffffff; background: #ffffff;
padding: 18rpx; padding: 18rpx;
margin-bottom: 11px; margin-bottom: 11px;
border-radius: 12rpx; border-radius: 12rpx;
} }
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
font-family: PingFang-SC-Bold, PingFang-SC; font-family: PingFang-SC-Bold, PingFang-SC;
} }
.class1 { .class1 {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-top: 22rpx; padding-top: 22rpx;
margin-top: 28rpx; margin-top: 28rpx;
border-top: 1rpx solid #808080; border-top: 1rpx solid #808080;
} }
.img { .img {
width: 201rpx; width: 201rpx;
height: 201rpx; height: 201rpx;
display: block; display: block;
margin-right: 0rpx; margin-right: 0rpx;
} }
.right { .right {
width: 428rpx; width: 428rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
} }
.intro { .intro {
color: #9999a6; color: #9999a6;
} }
.tab { .tab {
background: #fff; background: #fff;
height: 82rpx; height: 82rpx;
margin: 0 0; margin: 0 0;
} }
.text { .text {
margin: 0 40rpx; margin: 0 40rpx;
line-height: 82rpx; line-height: 82rpx;
color: #667eb5; color: #667eb5;
} }
.content { .content {
margin: 5px 0; margin: 5px 0;
height: 485rpx; height: 485rpx;
background: #fff; background: #fff;
} }
swiper { swiper {
height: 691rpx; height: 691rpx;
} }
</style> </style>
<template> <template>
<view class="test-result"> <view class="test-result">
<text class="title">考试结果</text> <text class="title">考试结果</text>
<view class="result"> <view class="result"> {{ text }} </view>
未通过
</view>
<view class="test-explain"> <view class="test-explain">
<view class="hang"> <view class="hang">
<text class="text1">合格条件:</text><text class="text2">答对20题</text> <text class="text1">合格条件:</text
><text class="text2">答对20题</text>
</view> </view>
<view class="hang"> <view class="hang">
<text class="text1">考试结果:</text><text class="text2">答对10题</text> <text class="text1">考试结果:</text
><text class="text2">答对10题</text>
</view> </view>
<view class="hang"> <view class="hang">
<text class="text1">考试用时:</text><text class="text2">16分29秒</text> <text class="text1">考试用时:</text
><text class="text2">16分29秒</text>
</view> </view>
</view> </view>
<view class="btn"> <view class="btn">
<button class="btn1">再答一次</button> <button class="btn1" @click="getAgain()">再答一次</button>
<button class="btn2">退出重考</button> <button class="btn2" @click="toIndex">下次再考</button>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
text: "",
} examId: 2,
result: null,
userExamId: null,
};
},
onLoad(a) {
this.userExamId = a.userExamId;
console.log("userExamId是", this.userExamId);
this.nextClick();
},
onUnload() {
wx.reLaunch({
url: "./index",
});
}, },
methods: { methods: {
//考试结果
nextClick: function () {
console.log("wwwwwwwwww");
uni.request({
url:
"http://192.168.1.22" +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/next/" +
this.vuex_token +
"?userExamId=" +
this.userExamId,
} method: "POST",
} header: {
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
this.result = res.data.data;
this.text = res.data.data.examLevelResult;
console.log("标识符55", this.result);
},
});
},
//再次考试
getAgain: function () {
wx.navigateTo({
url: "./assessment",
});
},
//下次再考跳转到学习主界面页面
toIndex: function () {
wx.reLaunch({
url: "./index",
});
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
.test-result{ .test-result {
width: 610rpx; width: 610rpx;
height: 965rpx; height: 965rpx;
margin: 70rpx auto 0; margin: 70rpx auto 0;
.title{ .title {
margin: 0 44rpx 0; margin: 0 44rpx 0;
} }
.result{ .result {
color: red; color: red;
font-size: 66rpx; font-size: 66rpx;
text-align: center; text-align: center;
...@@ -51,21 +99,21 @@ ...@@ -51,21 +99,21 @@
margin: 74rpx 0; margin: 74rpx 0;
padding: 66rpx; padding: 66rpx;
} }
.test-explain{ .test-explain {
.hang{ .hang {
margin: 26rpx 26rpx; margin: 26rpx 26rpx;
.text1{ .text1 {
color: #a69999; color: #a69999;
margin-right: 22rpx; margin-right: 22rpx;
} }
.text2{ .text2 {
color: #333333; color: #333333;
} }
} }
} }
.btn{ .btn {
margin-top: 236rpx; margin-top: 236rpx;
.btn1{ .btn1 {
width: 478rpx; width: 478rpx;
height: 60rpx; height: 60rpx;
background: #0079fe; background: #0079fe;
...@@ -74,16 +122,15 @@ ...@@ -74,16 +122,15 @@
line-height: 60rpx; line-height: 60rpx;
margin: 20rpx auto; margin: 20rpx auto;
} }
.btn2{ .btn2 {
width: 478rpx; width: 478rpx;
height: 60rpx; height: 60rpx;
background: #f2f2f2; background: #f2f2f2;
color: #333333; color: #333333;
font-size: 26rpx; font-size: 26rpx;
line-height: 60rpx; line-height: 60rpx;
margin:0 auto; margin: 0 auto;
}
} }
} }
}
</style> </style>
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