Commit 24da1956 authored by 和慭琛's avatar 和慭琛

考试 接口对接 100%

parent 1a4811e1
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
//https://system.dev.banshouhui.com //https://system.dev.banshouhui.com
//正式环境 //正式环境
domain_Name: 'https://system.banshouhui.com', //domain_Name: 'https://system.banshouhui.com',
//测试环境 //测试环境
//domain_Name: 'https://system.dev.banshouhui.com', domain_Name: 'https://system.dev.banshouhui.com',
//http://192.168.0.208:8192 //http://192.168.0.208:8192
//小青本地环境 //小青本地环境
......
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
{ {
"path": "pages/exam/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "入驻考试" "navigationBarTitleText": "下单"
} }
}, },
{ {
"path": "pages/video/index", "path": "pages/sign/index",
"style": { "style": {
"navigationBarTitleText": "培训&考试" "navigationBarTitleText": "入驻签约"
} }
}, },
...@@ -26,13 +26,25 @@ ...@@ -26,13 +26,25 @@
{ {
"path": "pages/index/index", "path": "pages/exam/index",
"style": { "style": {
"navigationBarTitleText": "下单" "navigationBarTitleText": "入驻考试"
}
},
{
"path": "pages/video/index",
"style": {
"navigationBarTitleText": "培训&考试"
} }
}, },
{ {
"path": "pages/photo/product", "path": "pages/photo/product",
"style": { "style": {
......
...@@ -12,8 +12,9 @@ ...@@ -12,8 +12,9 @@
</view> </view>
</template> </template>
<template v-if="isStart==true"> <template v-if="isStart==true">
<view class="bottom-padding">
<view class="numberView"> <view class="numberView">
<text class="numberText">第{{currentNumber}}题,共20题</text> <text class="numberText">{{progress}}</text>
</view> </view>
<view class="topicView"> <view class="topicView">
<text class="topicText">{{currentItem.topic}}</text> <text class="topicText">{{currentItem.topic}}</text>
...@@ -27,9 +28,11 @@ ...@@ -27,9 +28,11 @@
<text class="timeText">{{currentTime}}</text> <text class="timeText">{{currentTime}}</text>
<view :class="isSelect ? 'nextBtn selectedColor' : 'nextBtn defaultColor' " <view :class="isSelect ? 'nextBtn selectedColor' : 'nextBtn defaultColor' "
@click="nextClick()"> @click="nextClick()">
<text class="bottomTitle">下一题</text> <text class="bottomTitle">{{bottomTitle}}</text>
</view> </view>
</view> </view>
</view>
</template> </template>
</view> </view>
</template> </template>
...@@ -39,13 +42,16 @@ ...@@ -39,13 +42,16 @@
data() { data() {
return { return {
examId:1, examId:1,
userExamId:1, userExamId:0,
userAnswerIds:'', userAnswerIds:'',
isStart:false, isStart:false,
currentNumber:1, currentNumber:1,
currentItem:null, currentItem:null,
isSelect:false, isSelect:false,
currentTime:30 currentTime:30,
progress:'',
bottomTitle:'下一题',
isStop:false,
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -59,13 +65,16 @@ ...@@ -59,13 +65,16 @@
//开始考试 点击 //开始考试 点击
startClick: function () { startClick: function () {
this.isStart = true this.isStart = true
this.getData() //this.getData()
this.applyExam() //this.applyExam()
this.getUserExamInfo() this.getUserExamInfo()
}, },
//申请考试 //获取考试信息
applyExam: function () { getUserExamInfo: function () {
uni.showLoading({ uni.showLoading({
title:'请稍候' title:'请稍候'
}) })
...@@ -73,15 +82,20 @@ ...@@ -73,15 +82,20 @@
let that = this let that = this
uni.request({ uni.request({
url: getApp().globalData.domain_Name url: getApp().globalData.domain_Name
+'/wxh-support-rest/rest/exam/' +'/wxh-worker-rest/rest/exam'
+getApp().globalData.token+'/serviceRule', +'/serviceRule/userExamInfo/'
+getApp().globalData.token
+'?examId='+this.examId,
method: 'POST', method: 'POST',
data: { data: {
examId:this.examId, //examId:this.examId,
},
header:{
'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: (res) => { success: (res) => {
uni.hideLoading() uni.hideLoading()
console.log('申请考试 成功') console.log('获取考试信息 成功')
console.log(res) console.log(res)
if(res.statusCode==401){ if(res.statusCode==401){
...@@ -92,6 +106,16 @@ ...@@ -92,6 +106,16 @@
} }
if(res.data.code==200){ if(res.data.code==200){
//examStatus 用户考试状态 0考试中 1考试完成 2未参与
if(res.data.data.examStatus == 2){
that.applyExam()
}
if(res.data.data.examStatus == 0
||res.data.data.examStatus == 1){
that.userExamId = res.data.data.id
that.getNext()
}
// console.log('code=200') // console.log('code=200')
//this.handleList(res) //this.handleList(res)
...@@ -110,17 +134,17 @@ ...@@ -110,17 +134,17 @@
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
icon:'none', icon:'none',
title:'申请考试 失败' title:'获取考试信息失败'
}) })
// console.log('获取下单列表 失败') // console.log('获取下单列表 失败')
// console.log(e) // console.log(e)
} }
}) })
},
//获取考试信息 },
getUserExamInfo: function () {
//申请考试
applyExam: function () {
uni.showLoading({ uni.showLoading({
title:'请稍候' title:'请稍候'
}) })
...@@ -128,15 +152,20 @@ ...@@ -128,15 +152,20 @@
let that = this let that = this
uni.request({ uni.request({
url: getApp().globalData.domain_Name url: getApp().globalData.domain_Name
+'/wxh-support-rest/rest/exam/' +'/wxh-worker-rest/rest/exam'
+getApp().globalData.token+'/serviceRule/userExamInfo/', +'/serviceRule/'
method: 'GET', +getApp().globalData.token
+'?examId=' + this.examId,
method: 'POST',
data: { data: {
examId:this.examId, //examId:this.examId,
},
header:{
'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: (res) => { success: (res) => {
uni.hideLoading() uni.hideLoading()
console.log('获取考试信息 成功') console.log('申请考试 成功')
console.log(res) console.log(res)
if(res.statusCode==401){ if(res.statusCode==401){
...@@ -147,6 +176,11 @@ ...@@ -147,6 +176,11 @@
} }
if(res.data.code==200){ if(res.data.code==200){
if(res.data.data.userExamId){
that.userExamId = res.data.data.userExamId
that.getNext()
}
// console.log('code=200') // console.log('code=200')
//this.handleList(res) //this.handleList(res)
...@@ -165,71 +199,101 @@ ...@@ -165,71 +199,101 @@
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
icon:'none', icon:'none',
title:'获取考试信息失败' title:'申请考试 失败'
}) })
// console.log('获取下单列表 失败') // console.log('获取下单列表 失败')
// console.log(e) // console.log(e)
} }
}) })
}, },
//获取下一题
getNext: function () {
var questionId = ''
if(this.currentItem
&&this.currentItem.question
&&this.currentItem.question.id){
questionId = this.currentItem.question.id
}
getData: function () { uni.showLoading({
title:'请稍候'
})
this.currentItem = { let that = this
"isQuestion":true, uni.request({
"answerResult":false, url: getApp().globalData.domain_Name
"examScore":0, +'/wxh-worker-rest/rest/exam'
"examLevelDisc":"", +'/serviceRule/next/'
"examLevelResult":"", +getApp().globalData.token
"progress":"1/3", +'?userExamId='+this.userExamId
"question": { +'&questionId='+questionId
"id":3, +'&userAnswerIds='+this.userAnswerIds,
"content":"题目3", method: 'POST',
"score":100, data: {
"orderNumber":3, // userExamId:this.userExamId,
"rightAnswerIds":"", // questionId:this.currentItem.question.id,
"answerType":1, // userAnswerIds:this.userAnswerIds,
"excamId":1
},
"answerList": [
{
"id":1,
"content":"答案A",
"type":1,
"orderNumber":1,
"questionId":3,
"isRight":false
}, },
{ header:{
"id":2, 'Content-Type': 'application/x-www-form-urlencoded'
"content":"答案B",
"type":1,
"orderNumber":1,
"questionId":3,
"isRight":false
}, },
{ success: (res) => {
"id":3, uni.hideLoading()
"content":"答案C", console.log('获取下一题 成功')
"type":1, console.log(res)
"orderNumber":1,
"questionId":3, if(res.statusCode==401){
"isRight":false uni.navigateTo({
url:'/pages/login/wxlogin'
})
return
}
if(res.data.code==200){
that.currentItem = res.data.data
that.progress = res.data.data.progress
if(res.data.data.answerList){
that.handleData()
that.currentTime = 30
that.startCounting()
}else{
that.isSelect = true
that.bottomTitle = '完成考试,现在签约'
} }
]
// console.log('code=200')
//this.handleList(res)
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
} }
this.handleData()
this.startCounting() },
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon:'none',
title:'获取下一题 失败'
})
// console.log('获取下单列表 失败')
// console.log(e)
}
})
}, },
handleData: function () { handleData: function () {
...@@ -242,6 +306,11 @@ ...@@ -242,6 +306,11 @@
}, },
startCounting : function () { startCounting : function () {
if(this.isStop){
return
}
this.currentTime = this.currentTime - 1 this.currentTime = this.currentTime - 1
if(this.currentTime > 0){ if(this.currentTime > 0){
...@@ -256,6 +325,9 @@ ...@@ -256,6 +325,9 @@
itemClick: function (currentItem , ikey) { itemClick: function (currentItem , ikey) {
this.isSelect = true this.isSelect = true
//answerType 题目类型,1单选,2多选,3简答, //answerType 题目类型,1单选,2多选,3简答,
...@@ -292,6 +364,16 @@ ...@@ -292,6 +364,16 @@
//下一题 //下一题
nextClick: function () { nextClick: function () {
console.log(this.bottomTitle)
if(this.bottomTitle == '完成考试,现在签约'){
uni.navigateTo({
url:'/pages/sign/index'
})
return
}
this.currentNumber = this.currentNumber + 1 this.currentNumber = this.currentNumber + 1
//this.getData() //this.getData()
this.handleAnswer() this.handleAnswer()
...@@ -339,63 +421,7 @@ ...@@ -339,63 +421,7 @@
}, },
//获取下一题
getNext: function () {
uni.showLoading({
title:'请稍候'
})
let that = this
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-support-rest/rest/exam/'
+getApp().globalData.token+'/serviceRule/next',
method: 'POST',
data: {
userExamId:this.userExamId,
questionId:this.currentItem.question.id,
userAnswerIds:this.userAnswerIds,
},
success: (res) => {
uni.hideLoading()
console.log('获取下一题 成功')
console.log(res)
if(res.statusCode==401){
uni.navigateTo({
url:'/pages/login/wxlogin'
})
return
}
if(res.data.code==200){
// console.log('code=200')
//this.handleList(res)
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
}
},
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon:'none',
title:'获取下一题 失败'
})
// console.log('获取下单列表 失败')
// console.log(e)
}
})
},
...@@ -542,4 +568,8 @@ ...@@ -542,4 +568,8 @@
background-color: #007AFF; background-color: #007AFF;
} }
.bottom-padding{
padding-bottom: 180rpx;
}
</style> </style>
...@@ -100,7 +100,6 @@ ...@@ -100,7 +100,6 @@
<text class="agreeTitle" @click="agreeClick(isAgree)">我已阅读并同意</text> <text class="agreeTitle" @click="agreeClick(isAgree)">我已阅读并同意</text>
<text class="agreeProtocol" @click="protocolClick()">《服务协议》</text> <text class="agreeProtocol" @click="protocolClick()">《服务协议》</text>
</view> </view>
</view> </view>
<view class="bottomView"> <view class="bottomView">
<view class="bottomLeftView" @click="mineClick()"> <view class="bottomLeftView" @click="mineClick()">
...@@ -123,6 +122,7 @@ ...@@ -123,6 +122,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
...@@ -229,6 +229,12 @@ ...@@ -229,6 +229,12 @@
methods: { methods: {
hideClick:function(){
uni.navigateTo({
url: '/pages/exam/index',
})
},
doNothing:function(){}, doNothing:function(){},
toWhere: function(e){ toWhere: function(e){
...@@ -445,8 +451,10 @@ ...@@ -445,8 +451,10 @@
return return
} }
// yuan /pages/take/index
uni.navigateTo({ uni.navigateTo({
url: '/pages/take/index' url: '/pages/exam/index'
}) })
...@@ -1249,4 +1257,10 @@ ...@@ -1249,4 +1257,10 @@
justify-content: center; justify-content: center;
} }
.hideBtn{
background-color: #007AFF;
width: 100%;
height: 80rpx;
}
</style> </style>
<template>
<view class="">
签约界面
</view>
</template>
<script>
export default {
data() {
return {
protocolContent:''
}
},
onLoad(e) {
},
methods: {
//拨打客服 点击
phoneCallClick: function (phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
}
}
</script>
<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