|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
<template> |
|
|
|
|
<view> |
|
|
|
|
<view class="uni-padding-wrap uni-common-mt" v-if="isLoad"> |
|
|
|
|
<view class="uni-padding-wrap" v-if="isLoad"> |
|
|
|
|
|
|
|
|
|
<view v-for="(question,q_index) in questions" :key="q_index" class="question uni-flex uni-column"> |
|
|
|
|
<text class="title uni-center">{{question.question_title}}</text> |
|
|
|
@ -14,7 +14,7 @@ |
|
|
|
|
</radio-group> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="uni-flex uni-row button-group question"> |
|
|
|
|
<view class="uni-flex uni-row button-group question" v-if="questions.length>0"> |
|
|
|
|
<view class="flex-item"> |
|
|
|
|
<button type="primary" @click="submit">提交答卷</button> |
|
|
|
|
</view> |
|
|
|
@ -22,6 +22,11 @@ |
|
|
|
|
<button type="primary" class="reset" @click="reset">重置答卷</button> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="uni-flex vertical-center" :style="{height: height+'px'}" v-else> |
|
|
|
|
<view class="weui-btn-area" :style="{width:width+'px'}"> |
|
|
|
|
<button class="weui-btn" type="default" @click="openConfirm">错误提示</button> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
@ -36,10 +41,20 @@ |
|
|
|
|
title: "垃圾百科测验", |
|
|
|
|
questions:[], |
|
|
|
|
isLoad:false, |
|
|
|
|
show_answer:false |
|
|
|
|
show_answer:false, |
|
|
|
|
height:0, |
|
|
|
|
width:0 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods:{ |
|
|
|
|
openConfirm:function(){ |
|
|
|
|
let that=this |
|
|
|
|
uni.showModal({ |
|
|
|
|
title:"错误提示", |
|
|
|
|
content:that.err_msg, |
|
|
|
|
showCancel:false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
reset:function () { |
|
|
|
|
this.show_answer=false |
|
|
|
|
uni.reLaunch({ |
|
|
|
@ -105,8 +120,16 @@ |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title:"加载试题中" |
|
|
|
|
}) |
|
|
|
|
let url=getInterface(config.interface.create_question) |
|
|
|
|
let that=this |
|
|
|
|
uni.getSystemInfo({ |
|
|
|
|
success:function (res) { |
|
|
|
|
console.info(res) |
|
|
|
|
that.height=res.windowHeight |
|
|
|
|
that.width=res.windowWidth |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
let url=getInterface(config.interface.create_question) |
|
|
|
|
|
|
|
|
|
console.info("创建试题接口:"+url); |
|
|
|
|
uni.request({ |
|
|
|
|
url:url, |
|
|
|
@ -114,6 +137,13 @@ |
|
|
|
|
console.info(res.data) |
|
|
|
|
if(res.data.status) { |
|
|
|
|
that.questions = res.data.result; |
|
|
|
|
}else{ |
|
|
|
|
that.err_msg=res.data.msg |
|
|
|
|
uni.showModal({ |
|
|
|
|
title:"错误提示", |
|
|
|
|
content:that.err_msg, |
|
|
|
|
showCancel:false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fail:function (err) { |
|
|
|
@ -146,7 +176,6 @@ |
|
|
|
|
justify-content: center; |
|
|
|
|
} |
|
|
|
|
.true{ |
|
|
|
|
/*background-color: #75807f;*/ |
|
|
|
|
background-color: lightgrey; |
|
|
|
|
} |
|
|
|
|
.true_font{ |
|
|
|
@ -156,4 +185,9 @@ |
|
|
|
|
.false{ |
|
|
|
|
color: red; |
|
|
|
|
} |
|
|
|
|
/* 水平垂直居中*/ |
|
|
|
|
.vertical-center{ |
|
|
|
|
align-items: center; |
|
|
|
|
justify-content:center; |
|
|
|
|
} |
|
|
|
|
</style> |