小程序看题模式

This commit is contained in:
caoqianming 2020-11-18 14:42:20 +08:00
parent e15ed90ae1
commit b075c6adad
7 changed files with 123 additions and 74 deletions

View File

@ -16,13 +16,27 @@ Page({
answerP: false,
page:1,
domain:getApp().globalData.mediahost,
moShi:'背题模式',
},
changeM: function () {
var that = this
if(that.data.moShi=='看题模式'){
that.setData({
moShi:'背题模式',
})
that.showOptions()
}else{
that.setData({
moShi: '看题模式',
})
}
},
radioChange: function(e) {
var that = this
that.data.tm_current['user_answer'] = e.detail.value
that.data.tms[that.data.tm_index] = that.data.tm_current
that.showAnswer()
if (that.data.ydtms.indexOf(that.data.tm_current.id) == -1) {
if (that.data.moShi=='背题模式' && that.data.ydtms.indexOf(that.data.tm_current.id) == -1) {
that.data.ydtms.push(that.data.tm_current.id)
}
},
@ -30,7 +44,7 @@ Page({
var that = this
that.data.tm_current['user_answer'] = e.detail.value
that.data.tms[that.data.tm_index] = that.data.tm_current
if (that.data.ydtms.indexOf(that.data.tm_current.id) == -1) {
if (that.data.moShi=='背题模式' && that.data.ydtms.indexOf(that.data.tm_current.id) == -1) {
that.data.ydtms.push(that.data.tm_current.id)
}
},
@ -156,6 +170,14 @@ Page({
if (tm_current.user_answer) {
that.showAnswer()
}
else{
that.setData({
isright:false
})
}
if (that.data.moShi=='看题模式' && that.data.ydtms.indexOf(that.data.tm_current.id) == -1) {
that.data.ydtms.push(that.data.tm_current.id)
}
}
},
@ -230,15 +252,19 @@ Page({
let option = {}
option.key = key
option.value = tm_current.options[key].toString()
option.checked = false
option.right = false
if(option.key == tm_current.right||tm_current.right.indexOf(option.key)!=-1){
option.right = true
}
if (tm_current.user_answer) {
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
option.checked = true
}
} else {
option.checked = false
}
options.push(option)
}
console.log(options)
this.setData({
options: options
})

View File

@ -1,5 +1,11 @@
<view class="head">
题量: {{tm_index+1}}/{{tmtotal}}
<view style="width:50%">
<span style="margin-left:10px">题量: {{tm_index+1}}/{{tmtotal}}</span>
</view>
<view style="width:50%;text-align:right" bindtap="changeM">
<span style="margin-right:10px"><span style="font-weight:bold;">{{moShi}}</span>
(点击切换)</span>
</view>
</view>
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
<view class="weui-article">
@ -14,9 +20,15 @@
<view class="weui-cells weui-cells_radio">
<radio-group class="radio-group" bindchange="radioChange" wx:if="{{(tm_current.type=='单选' ||tm_current.type=='判断')}}">
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
<view class="weui-cell__bd">
<view class="weui-cell__bd" >
<view style="font-weight:bold;color:green" wx:if="{{ moShi == '看题模式' && item.right}}">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
</view>
<view wx:else>
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
</view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -30,8 +42,14 @@
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
<view class="weui-cell__bd" >
<view style="font-weight:bold;color:green" wx:if="{{ moShi == '看题模式' && item.right}}">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
</view>
<view wx:else>
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
</view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>
@ -40,10 +58,10 @@
</label>
</checkbox-group>
</view>
<view class="weui-article" wx:if="{{answerP}}">
<view class="weui-article" wx:if="{{answerP||moShi=='看题模式'}}">
<view class="weui-article__h2" wx:if="{{isright}}" style="color:green;font-weight:bold">回答正确!</view>
<view class="weui-article__h2" wx:else style="color:red;font-weight:bold">回答有误!</view>
<view class="weui-article__h2">正确答案是{{tm_current.right}},你的答案是{{tm_current.user_answer}}</view>
<view class="weui-article__h2">正确答案是 {{tm_current.right}},你的答案是 {{tm_current.user_answer}}</view>
<view class="weui-article__title">
<span style="color:blue">解析: </span>
<span wx:if="{{tm_current.resolution}}">{{tm_current.resolution}}</span>

View File

@ -3,7 +3,9 @@
height:30px;
color:#fff;
background-color: cornflowerblue;
text-align: center;
text-align: left;
display:flex;
flex-direction: row;
}
.btns{
height:40px;

View File

@ -140,6 +140,7 @@ Page({
wx.openDocument({
filePath,
fileType: filetype,
showMenu: true,
success(res) {
wx.hideLoading()
console.log('打开文档成功')

View File

@ -72,6 +72,7 @@ Page({
wx.openDocument({
filePath,
fileType: filetype,
showMenu: true,
success(res) {
wx.hideLoading()
console.log('打开文档成功')
@ -88,7 +89,7 @@ Page({
api.request('/cms/material/','get', {name:'个人防护用品检测申请单'}).then(res=>{
var res1 = res.data
if(res1.count){
var fileurl = getApp().globalData.host + res1[0].path
var fileurl = getApp().globalData.host + res1.results[0].path
wx.showLoading({
title: '正在下载...',
})
@ -127,6 +128,7 @@ Page({
wx.openDocument({
filePath,
fileType: filetype,
showMenu: true,
success(res) {
wx.hideLoading()
console.log('打开文档成功')

View File

@ -1,7 +1,7 @@
<view >
<view class="weui-form__text-area" style="margin-top:20px;padding: 0 18px;">
<h2 class="weui-form__title">个人防护用品检测(铅当量)</h2>
<view class="weui-form__desc">中科辐射学堂和国家建材工业安防工程产品质量监督检验中心推出个人防护用品合格检测,限每个核技术利用单位在10月31日之前免费检测一套个人防护用品,如有需要请提交您的申请。</view>
<view class="weui-form__desc">中科辐射学堂和国家建材工业安防工程产品质量监督检验中心推出个人防护用品合格检测,免费检测一套个人防护用品,如有需要请提交您的申请。</view>
</view>
<view style="text-align:center">
<button class="mini-btn" type="default" size="mini" bindtap="tap1">介绍和案例</button>

View File

@ -1,65 +1,65 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": []
},
"compileType": "miniprogram",
"libVersion": "2.10.3",
"appid": "wxf1e9471c93f05ad6",
"projectname": "test_mini",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"useIsolateContext": true,
"packNpmManually": false,
"packNpmRelationList": []
},
"compileType": "miniprogram",
"libVersion": "2.10.3",
"appid": "wxf1e9471c93f05ad6",
"projectname": "test_mini",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}