Commit 659aab99 authored by 和慭琛's avatar 和慭琛

考试 接口请求代码

parent 7b240b93
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
export default { export default {
data() { data() {
return { return {
examId:1,
isStart:false, isStart:false,
currentNumber:1, currentNumber:1,
currentItem:null, currentItem:null,
...@@ -57,8 +58,122 @@ ...@@ -57,8 +58,122 @@
startClick: function () { startClick: function () {
this.isStart = true this.isStart = true
this.getData() this.getData()
this.applyExam()
this.getUserExamInfo()
}, },
//申请考试
applyExam: function () {
uni.showLoading({
title:'请稍候'
})
let that = this
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-support-rest/rest/exam/'
+getApp().globalData.token+'/serviceRule',
method: 'POST',
data: {
examId:this.examId,
},
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)
}
})
},
//获取考试信息
getUserExamInfo: function () {
uni.showLoading({
title:'请稍候'
})
let that = this
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-support-rest/rest/exam/'
+getApp().globalData.token+'/serviceRule/userExamInfo/',
method: 'GET',
data: {
examId:this.examId,
},
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)
}
})
},
getData: function () { getData: function () {
this.currentItem = { this.currentItem = {
'topic':'这是第一道题的题目这是第一道题的题目', 'topic':'这是第一道题的题目这是第一道题的题目',
...@@ -137,7 +252,67 @@ ...@@ -137,7 +252,67 @@
nextClick: function () { nextClick: function () {
this.currentNumber = this.currentNumber + 1 this.currentNumber = this.currentNumber + 1
this.getData() this.getData()
this.getNext()
},
//获取下一题
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: {
examId:this.examId,
},
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)
}
})
},
} }
......
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