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