Commit c8c12230 authored by 李俊赕's avatar 李俊赕

small-css

parent 52c021f7
...@@ -20,13 +20,12 @@ ...@@ -20,13 +20,12 @@
<text class="topicText">{{currentItem.question.content}}</text> <text class="topicText">{{currentItem.question.content}}</text>
</view> </view>
<view class="itemBackView" v-for="(item,ikey) in currentItem.answerList":key="ikey"> <view class="itemBackView" v-for="(item,ikey) in currentItem.answerList" :key="ikey">
<view class="itemView"> <view class="itemView">
<view class="itemIndexView"> <view class="itemIndexView">
<text class="itemIndexText">A</text> <text class="itemIndexText">A</text>
</view> </view>
<text :class="item.isSelect ? 'itemText selectedColor' : 'itemText defaultColor' " <text :class="item.isSelect ? 'itemText selectedColor' : 'itemText defaultColor' " @click="itemClick(item,ikey)">哒哒所大所大所大所大所大所大所大所大所大所大所大所大所大所大所大所多撒大大所大撒多</text>
@click="itemClick(item,ikey)">哒哒所大所大所大所大所大所大所大所大所大所大所大所大所大所大所大所多撒大大所大撒多</text>
<!--view>{{item.content}}</view--> <!--view>{{item.content}}</view-->
</view> </view>
...@@ -39,8 +38,7 @@ ...@@ -39,8 +38,7 @@
<view class="answerBottomView"> <view class="answerBottomView">
<image class="timeIcon" src="" mode=""></image> <image class="timeIcon" src="" mode=""></image>
<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">{{bottomTitle}}</text> <text class="bottomTitle">{{bottomTitle}}</text>
</view> </view>
</view> </view>
...@@ -51,23 +49,22 @@ ...@@ -51,23 +49,22 @@
</template> </template>
<script> <script>
import globalData from '@/common/base_url.js' import globalData from '@/common/base_url.js'
const systemApiUrl = globalData.systemUrl.apiUrl const systemApiUrl = globalData.systemUrl.apiUrl
export default { export default {
data() { data() {
return { return {
examId:2, examId: 2,
userExamId:0, userExamId: 0,
userAnswerIds:'', userAnswerIds: '',
isStart:true, isStart: true,
currentNumber:1, currentNumber: 1,
currentItem:null, currentItem: null,
isSelect:false, isSelect: false,
currentTime:30, currentTime: 30,
progress:'', progress: '',
bottomTitle:'下一题', bottomTitle: '下一题',
isStop:false, isStop: false,
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -79,7 +76,7 @@ ...@@ -79,7 +76,7 @@
methods: { methods: {
//开始考试 点击 //开始考试 点击
startClick: function () { startClick: function() {
this.isStart = true this.isStart = true
//this.getData() //this.getData()
//this.applyExam() //this.applyExam()
...@@ -89,56 +86,56 @@ ...@@ -89,56 +86,56 @@
}, },
//获取考试信息 //获取考试信息
getUserExamInfo: function () { getUserExamInfo: function() {
uni.showLoading({ uni.showLoading({
title:'请稍候' title: '请稍候'
}) })
let that = this let that = this
uni.request({ uni.request({
url:systemApiUrl url: systemApiUrl +
+'/wxh-worker-rest/rest/exam' '/wxh-worker-rest/rest/exam' +
+'/serviceRule/userExamInfo/' '/serviceRule/userExamInfo/' +
+getApp().globalData.token getApp().globalData.token +
+'?examId='+this.examId, '?examId=' + this.examId,
method: 'POST', method: 'POST',
data: { data: {
//examId:this.examId, //examId:this.examId,
}, },
header:{ header: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: (res) => { success: (res) => {
uni.hideLoading() uni.hideLoading()
if(!res.data){ if (!res.data) {
return return
} }
if(res.data.code==401 || res.data.code==403 ){ if (res.data.code == 401 || res.data.code == 403) {
uni.navigateTo({ uni.navigateTo({
url:'/pages/login/wxlogin' url: '/pages/login/wxlogin'
}) })
return return
} }
if(res.data.code==200){ if (res.data.code == 200) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 //examStatus 用户考试状态 0考试中 1考试完成 2未参与
if(res.data.data.examStatus == 2){ if (res.data.data.examStatus == 2) {
that.applyExam() that.applyExam()
} }
if(res.data.data.examStatus == 0 if (res.data.data.examStatus == 0 ||
||res.data.data.examStatus == 1){ res.data.data.examStatus == 1) {
that.userExamId = res.data.data.id that.userExamId = res.data.data.id
that.getNext() that.getNext()
} }
// console.log('code=200') // console.log('code=200')
//this.handleList(res) //this.handleList(res)
}else{ } else {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:res.data.message title: res.data.message
}) })
...@@ -149,8 +146,8 @@ ...@@ -149,8 +146,8 @@
fail: (e) => { fail: (e) => {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'获取考试信息失败' title: '获取考试信息失败'
}) })
// console.log('获取下单列表 失败') // console.log('获取下单列表 失败')
// console.log(e) // console.log(e)
...@@ -160,23 +157,23 @@ ...@@ -160,23 +157,23 @@
}, },
//申请考试 //申请考试
applyExam: function () { applyExam: function() {
uni.showLoading({ uni.showLoading({
title:'请稍候' title: '请稍候'
}) })
let that = this let that = this
uni.request({ uni.request({
url: systemApiUrl url: systemApiUrl +
+'/wxh-worker-rest/rest/exam' '/wxh-worker-rest/rest/exam' +
+'/serviceRule/' '/serviceRule/' +
+getApp().globalData.token getApp().globalData.token +
+'?examId=' + this.examId, '?examId=' + this.examId,
method: 'POST', method: 'POST',
data: { data: {
//examId:this.examId, //examId:this.examId,
}, },
header:{ header: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: (res) => { success: (res) => {
...@@ -184,26 +181,26 @@ ...@@ -184,26 +181,26 @@
console.log('申请考试 成功') console.log('申请考试 成功')
console.log(res) console.log(res)
if(res.statusCode==401){ if (res.statusCode == 401) {
uni.navigateTo({ uni.navigateTo({
url:'/pages/login/wxlogin' url: '/pages/login/wxlogin'
}) })
return return
} }
if(res.data.code==200){ if (res.data.code == 200) {
if(res.data.data.userExamId){ if (res.data.data.userExamId) {
that.userExamId = res.data.data.userExamId that.userExamId = res.data.data.userExamId
that.getNext() that.getNext()
} }
// console.log('code=200') // console.log('code=200')
//this.handleList(res) //this.handleList(res)
}else{ } else {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:res.data.message title: res.data.message
}) })
...@@ -214,8 +211,8 @@ ...@@ -214,8 +211,8 @@
fail: (e) => { fail: (e) => {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'申请考试 失败' title: '申请考试 失败'
}) })
// console.log('获取下单列表 失败') // console.log('获取下单列表 失败')
// console.log(e) // console.log(e)
...@@ -224,35 +221,35 @@ ...@@ -224,35 +221,35 @@
}, },
//获取下一题 //获取下一题
getNext: function () { getNext: function() {
var questionId = '' var questionId = ''
if(this.currentItem if (this.currentItem &&
&&this.currentItem.question this.currentItem.question &&
&&this.currentItem.question.id){ this.currentItem.question.id) {
questionId = this.currentItem.question.id questionId = this.currentItem.question.id
} }
uni.showLoading({ uni.showLoading({
title:'请稍候' title: '请稍候'
}) })
let that = this let that = this
uni.request({ uni.request({
url: systemApiUrl url: systemApiUrl +
+'/wxh-worker-rest/rest/exam' '/wxh-worker-rest/rest/exam' +
+'/serviceRule/next/' '/serviceRule/next/' +
+getApp().globalData.token getApp().globalData.token +
+'?userExamId='+this.userExamId '?userExamId=' + this.userExamId +
+'&questionId='+questionId '&questionId=' + questionId +
+'&userAnswerIds='+this.userAnswerIds, '&userAnswerIds=' + this.userAnswerIds,
method: 'POST', method: 'POST',
data: { data: {
// userExamId:this.userExamId, // userExamId:this.userExamId,
// questionId:this.currentItem.question.id, // questionId:this.currentItem.question.id,
// userAnswerIds:this.userAnswerIds, // userAnswerIds:this.userAnswerIds,
}, },
header:{ header: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: (res) => { success: (res) => {
...@@ -260,22 +257,22 @@ ...@@ -260,22 +257,22 @@
console.log('获取下一题 成功') console.log('获取下一题 成功')
console.log(res) console.log(res)
if(res.statusCode==401){ if (res.statusCode == 401) {
uni.navigateTo({ uni.navigateTo({
url:'/pages/login/wxlogin' url: '/pages/login/wxlogin'
}) })
return return
} }
if(res.data.code==200){ if (res.data.code == 200) {
that.currentItem = res.data.data that.currentItem = res.data.data
that.progress = res.data.data.progress that.progress = res.data.data.progress
if(res.data.data.answerList){ if (res.data.data.answerList) {
that.handleData() that.handleData()
that.currentTime = 30 that.currentTime = 30
//that.startCounting() //that.startCounting()
}else{ } else {
that.isSelect = true that.isSelect = true
that.bottomTitle = '完成考试,现在签约' that.bottomTitle = '完成考试,现在签约'
} }
...@@ -284,10 +281,10 @@ ...@@ -284,10 +281,10 @@
// console.log('code=200') // console.log('code=200')
//this.handleList(res) //this.handleList(res)
}else{ } else {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:res.data.message title: res.data.message
}) })
...@@ -298,8 +295,8 @@ ...@@ -298,8 +295,8 @@
fail: (e) => { fail: (e) => {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'获取下一题 失败' title: '获取下一题 失败'
}) })
// console.log('获取下单列表 失败') // console.log('获取下单列表 失败')
// console.log(e) // console.log(e)
...@@ -310,7 +307,7 @@ ...@@ -310,7 +307,7 @@
handleData: function () { handleData: function() {
...@@ -321,17 +318,17 @@ ...@@ -321,17 +318,17 @@
console.log(this.currentItem) console.log(this.currentItem)
}, },
startCounting : function () { startCounting: function() {
if(this.isStop){ if (this.isStop) {
return return
} }
this.currentTime = this.currentTime - 1 this.currentTime = this.currentTime - 1
if(this.currentTime > 0){ if (this.currentTime > 0) {
setTimeout(this.startCounting, 1000); setTimeout(this.startCounting, 1000);
}else{ } else {
this.currentTime = 30 this.currentTime = 30
this.nextClick() this.nextClick()
} }
...@@ -340,7 +337,7 @@ ...@@ -340,7 +337,7 @@
itemClick: function (currentItem , ikey) { itemClick: function(currentItem, ikey) {
...@@ -351,14 +348,14 @@ ...@@ -351,14 +348,14 @@
for (let i = 0; i < this.currentItem.answerList.length; i++) { for (let i = 0; i < this.currentItem.answerList.length; i++) {
var item = this.currentItem.answerList[i] var item = this.currentItem.answerList[i]
if(this.currentItem.answerType == 2){//多选 if (this.currentItem.answerType == 2) { //多选
if(ikey == i){ if (ikey == i) {
item.isSelect = !item.isSelect item.isSelect = !item.isSelect
} }
}else{//单选/简答 } else { //单选/简答
if(ikey == i){ if (ikey == i) {
item.isSelect = !item.isSelect item.isSelect = !item.isSelect
}else{ } else {
item.isSelect = false item.isSelect = false
} }
} }
...@@ -367,7 +364,7 @@ ...@@ -367,7 +364,7 @@
var isSelect = false var isSelect = false
this.currentItem.answerList.forEach(item => { this.currentItem.answerList.forEach(item => {
if(item.isSelect){ if (item.isSelect) {
isSelect = true isSelect = true
} }
}) })
...@@ -379,13 +376,13 @@ ...@@ -379,13 +376,13 @@
}, },
//下一题 //下一题
nextClick: function () { nextClick: function() {
console.log(this.bottomTitle) console.log(this.bottomTitle)
if(this.bottomTitle == '完成考试,现在签约'){ if (this.bottomTitle == '完成考试,现在签约') {
uni.navigateTo({ uni.navigateTo({
url:'/pages/settle/prompt' url: '/pages/settle/prompt'
}) })
return return
} }
...@@ -397,7 +394,7 @@ ...@@ -397,7 +394,7 @@
}, },
//所选答案 //所选答案
handleAnswer: function () { handleAnswer: function() {
/* /*
userAnswerIds userAnswerIds
...@@ -414,14 +411,14 @@ ...@@ -414,14 +411,14 @@
// if(this.currentItem.answerType == 2){//多选} // if(this.currentItem.answerType == 2){//多选}
if(item.isSelect){ if (item.isSelect) {
//this.userAnswerIds = item.id + ',' + this.userAnswerIds //this.userAnswerIds = item.id + ',' + this.userAnswerIds
///* ///*
if(this.userAnswerIds.length == 0){ if (this.userAnswerIds.length == 0) {
this.userAnswerIds = item.id this.userAnswerIds = item.id
}else{ // if(this.userAnswerIds.length == 1) } else { // if(this.userAnswerIds.length == 1)
this.userAnswerIds = item.id + ',' + this.userAnswerIds this.userAnswerIds = item.id + ',' + this.userAnswerIds
} }
//*/ //*/
...@@ -448,8 +445,7 @@ ...@@ -448,8 +445,7 @@
</script> </script>
<style> <style>
.backView {
.backView{
background-color: #FFFFFF; background-color: #FFFFFF;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -459,20 +455,20 @@ ...@@ -459,20 +455,20 @@
flex-direction: column; flex-direction: column;
} }
.noticeView{ .noticeView {
margin-top: 100rpx; margin-top: 100rpx;
width: 100%; width: 100%;
display: flex; display: flex;
} }
.noticeText{ .noticeText {
font-size: 32rpx; font-size: 32rpx;
color: #555555; color: #555555;
padding-left: 40rpx; padding-left: 40rpx;
padding-right: 40rpx; padding-right: 40rpx;
} }
.numberView{ .numberView {
margin-top: 40rpx; margin-top: 40rpx;
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -480,20 +476,20 @@ ...@@ -480,20 +476,20 @@
align-items: center; align-items: center;
} }
.numberText{ .numberText {
color: #333333; color: #333333;
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; font-weight: bold;
} }
.topicView{ .topicView {
margin-top: 60rpx; margin-top: 60rpx;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.topicText{ .topicText {
color: #333333; color: #333333;
font-size: 36rpx; font-size: 36rpx;
padding-left: 28rpx; padding-left: 28rpx;
...@@ -503,7 +499,7 @@ ...@@ -503,7 +499,7 @@
font-weight: bold; font-weight: bold;
} }
.itemBackView{ .itemBackView {
background-color: #4CD964; background-color: #4CD964;
margin-top: 40rpx; margin-top: 40rpx;
width: 100%; width: 100%;
...@@ -512,7 +508,7 @@ ...@@ -512,7 +508,7 @@
align-items: center; align-items: center;
} }
.itemView{ .itemView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 690rpx; width: 690rpx;
display: flex; display: flex;
...@@ -521,7 +517,7 @@ ...@@ -521,7 +517,7 @@
border-radius: 12rpx; border-radius: 12rpx;
} }
.itemIndexView{ .itemIndexView {
background-color: #D02B2B; background-color: #D02B2B;
margin-left: 30rpx; margin-left: 30rpx;
width: 40rpx; width: 40rpx;
...@@ -532,11 +528,16 @@ ...@@ -532,11 +528,16 @@
justify-content: center; justify-content: center;
} }
.itemIndexText{ .itemIndexText {
width: 40rpx;
height: 40rpx;
display: block;
line-height: 40rpx;
text-align: center;
font-size: 28rpx; font-size: 28rpx;
} }
.itemText{ .itemText {
margin-left: 20rpx; margin-left: 20rpx;
font-size: 28rpx; font-size: 28rpx;
padding-top: 40rpx; padding-top: 40rpx;
...@@ -544,7 +545,7 @@ ...@@ -544,7 +545,7 @@
padding-right: 40rpx; padding-right: 40rpx;
} }
.bottomView{ .bottomView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 100%; width: 100%;
height: 140rpx; height: 140rpx;
...@@ -555,7 +556,7 @@ ...@@ -555,7 +556,7 @@
bottom: 0; bottom: 0;
} }
.bottomBtn{ .bottomBtn {
background-color: #007AFF; background-color: #007AFF;
width: 60%; width: 60%;
height: 80rpx; height: 80rpx;
...@@ -565,12 +566,12 @@ ...@@ -565,12 +566,12 @@
justify-content: center; justify-content: center;
} }
.bottomTitle{ .bottomTitle {
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #FFFFFF;
} }
.answerBottomView{ .answerBottomView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 100%; width: 100%;
height: 140rpx; height: 140rpx;
...@@ -581,7 +582,7 @@ ...@@ -581,7 +582,7 @@
bottom: 0; bottom: 0;
} }
.timeIcon{ .timeIcon {
background-color: #999999; background-color: #999999;
margin-left: 80rpx; margin-left: 80rpx;
width: 80rpx; width: 80rpx;
...@@ -589,13 +590,13 @@ ...@@ -589,13 +590,13 @@
border-radius: 40rpx; border-radius: 40rpx;
} }
.timeText{ .timeText {
margin-left: 20rpx; margin-left: 20rpx;
font-size: 32rpx; font-size: 32rpx;
color: #999999; color: #999999;
} }
.nextBtn{ .nextBtn {
width: 400rpx; width: 400rpx;
height: 80rpx; height: 80rpx;
border-radius: 40rpx; border-radius: 40rpx;
...@@ -605,16 +606,15 @@ ...@@ -605,16 +606,15 @@
justify-content: center; justify-content: center;
} }
.defaultColor{ .defaultColor {
background-color: #999999; background-color: #999999;
} }
.selectedColor{ .selectedColor {
background-color: #007AFF; background-color: #007AFF;
} }
.bottom-padding{ .bottom-padding {
padding-bottom: 180rpx; padding-bottom: 180rpx;
} }
</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