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

考试 接口对接 100%

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