小程序源码
This commit is contained in:
0
source/wx/xzs-student/pages/exam/read/exam-fun.wxs
Normal file
0
source/wx/xzs-student/pages/exam/read/exam-fun.wxs
Normal file
59
source/wx/xzs-student/pages/exam/read/index.js
Normal file
59
source/wx/xzs-student/pages/exam/read/index.js
Normal file
@@ -0,0 +1,59 @@
|
||||
import {
|
||||
formatSeconds,
|
||||
} from '../../../utils/util.js'
|
||||
|
||||
let app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
spinShow: false,
|
||||
paperId: null,
|
||||
paper: {},
|
||||
answer: {},
|
||||
timer: null,
|
||||
doTime: 0,
|
||||
remainTime: 0,
|
||||
remainTimeStr: '',
|
||||
modalShow: false,
|
||||
result: 0,
|
||||
timeOutShow: false
|
||||
},
|
||||
onLoad: function(options) {
|
||||
let paperId = options.id
|
||||
let _this = this
|
||||
_this.setData({
|
||||
spinShow: true
|
||||
});
|
||||
app.formPost('/api/wx/student/exampaper/answer/read/' + paperId, null)
|
||||
.then(res => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
if (res.code === 1) {
|
||||
_this.setData({
|
||||
paper: res.response.paper,
|
||||
answer: res.response.answer,
|
||||
paperId: paperId,
|
||||
});
|
||||
}
|
||||
}).catch(e => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
app.message(e, 'error')
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
clearInterval(this.data.timer)
|
||||
},
|
||||
returnRecord() {
|
||||
wx.reLaunch({
|
||||
url: '/pages/record/index',
|
||||
});
|
||||
},
|
||||
timeOut() {
|
||||
clearInterval(this.data.timer)
|
||||
this.setData({
|
||||
timeOutShow: true
|
||||
});
|
||||
}
|
||||
})
|
||||
17
source/wx/xzs-student/pages/exam/read/index.json
Normal file
17
source/wx/xzs-student/pages/exam/read/index.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"i-panel": "/component/iView/panel/index",
|
||||
"i-cell-group": "/component/iView/cell-group/index",
|
||||
"i-cell": "/component/iView/cell/index",
|
||||
"i-radio-group": "/component/iView/radio-group/index",
|
||||
"i-radio": "/component/iView/radio/index",
|
||||
"i-row": "/component/iView/row/index",
|
||||
"i-col": "/component/iView/col/index",
|
||||
"i-input": "/component/iView/input/index",
|
||||
"i-action-sheet": "/component/iView/action-sheet/index",
|
||||
"i-modal": "/component/iView/modal/index",
|
||||
"i-message": "/component/iView/message/index",
|
||||
"i-spin": "/component/iView/spin/index",
|
||||
"i-rate": "/component/iView/rate/index"
|
||||
}
|
||||
}
|
||||
86
source/wx/xzs-student/pages/exam/read/index.wxml
Normal file
86
source/wx/xzs-student/pages/exam/read/index.wxml
Normal file
@@ -0,0 +1,86 @@
|
||||
<wxs module="filter" src="../../../wxs/exam-fun.wxs"></wxs>
|
||||
<view class="exam-page">
|
||||
<view class="view-wrap-hidden">
|
||||
</view>
|
||||
<view>
|
||||
<view class="exam-name-title">
|
||||
<h1>{{paper.name}}</h1>
|
||||
</view>
|
||||
<view class="exam-result">
|
||||
<h1 class="">试卷得分: {{answer.score}}</h1>
|
||||
<h1 class="exam-result-detail">试卷耗时: {{answer.doTime}}秒</h1>
|
||||
</view>
|
||||
|
||||
<i-panel title="{{titleItem.name}}" wx:for="{{paper.titleItems}}" wx:for-item="titleItem" wx:key="{{titleItem.name}}" i-class="exam-panel-title">
|
||||
<i-cell-group i-class="exam-cell">
|
||||
<i-cell wx:for="{{titleItem.questionItems}}" wx:key="{{titleItem.id}}" wx:for-item="questionItem">
|
||||
<view wx:if="{{questionItem.questionType === 1}}">
|
||||
<rich-text nodes="{{questionItem.itemOrder}}. {{questionItem.title}}" />
|
||||
<radio-group class="radio-group">
|
||||
<label class="radio" wx:for="{{questionItem.items}}" wx:key="{{questionItem.prefix}}" wx:for-item="radioItem" class="exam-radio-item-label">
|
||||
<radio color="#2d8cf0" value="{{radioItem.prefix}}" checked="{{radioItem.prefix == answer.answerItems[questionItem.itemOrder-1].content}}" class="exam-item-left" />
|
||||
<rich-text nodes="{{radioItem.prefix}}. {{radioItem.content}}" class="exam-item-left {{radioItem.prefix == answer.answerItems[questionItem.itemOrder-1].content ? 'item-content-selected' : ''}}" />
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
<view wx:elif="{{questionItem.questionType === 2}}">
|
||||
<rich-text nodes="{{questionItem.itemOrder}}. {{questionItem.title}}" class="exam-item-left" style="line-height:35px" />
|
||||
<checkbox-group class="exam-item-left" style="margin-left:10px">
|
||||
<label wx:for="{{questionItem.items}}" wx:key="{{questionItem.prefix}}" wx:for-item="radioItem" class="exam-radio-item-label">
|
||||
<checkbox color="#2d8cf0" value="{{radioItem.prefix}}" checked="{{filter.indexOf(answer.answerItems[questionItem.itemOrder-1].content,radioItem.prefix)}}" class="exam-item-left" />
|
||||
<rich-text nodes="{{radioItem.prefix}}. {{radioItem.content}}" class="exam-item-left {{filter.indexOf(answer.answerItems[questionItem.itemOrder-1].content,radioItem.prefix) ? 'item-content-selected' : ''}}" />
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<view wx:elif="{{questionItem.questionType === 3}}">
|
||||
<rich-text nodes="{{questionItem.itemOrder}}. {{questionItem.title}}" class="exam-item-left" style="line-height:35px" />
|
||||
<radio-group class="radio-group" class="exam-item-left" style="margin-left:10px">
|
||||
<label class="radio" wx:for="{{questionItem.items}}" wx:key="{{questionItem.prefix}}" wx:for-item="radioItem" class="exam-radio-item-label">
|
||||
<radio color="#2d8cf0" value="{{radioItem.prefix}}" checked="{{radioItem.prefix == answer.answerItems[questionItem.itemOrder-1].content}}" class="exam-item-left" />
|
||||
<rich-text nodes="{{radioItem.content}}" class="exam-item-left" />
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
<view wx:elif="{{questionItem.questionType === 4}}">
|
||||
<rich-text nodes="{{questionItem.itemOrder}}. {{questionItem.title}}" />
|
||||
<view class="exam-input-contain" wx:for="{{questionItem.items}}" wx:key="{{questionItem.prefix}}" wx:for-item="inputItem" wx:for-index="idx">
|
||||
<view class="exam-input-contain-label">{{inputItem.prefix}}</view>
|
||||
<input class="exam-input-contain-content" maxlength="-1" value="{{answer.contentArray[inputItem.prefix-1]}}" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<rich-text nodes="{{questionItem.itemOrder}}. {{questionItem.title}}" />
|
||||
<view class="exam-textarea-contain">
|
||||
<textarea placeholder="" maxlength="-1">{{answer.answerItems[questionItem.itemOrder-1].content}}</textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="exam-clear">
|
||||
<view class="exam-extend-item" style="padding-left:0px">
|
||||
结果:
|
||||
<text class="question-answer-right question-answer-result" wx:if="{{answer.answerItems[questionItem.itemOrder-1].doRight==true}}">正确</text>
|
||||
<text class="question-answer-error question-answer-result" wx:elif="{{answer.answerItems[questionItem.itemOrder-1].doRight==false}}">错误</text>
|
||||
<text class="question-answer-judge question-answer-result" wx:elif="{{answer.answerItems[questionItem.itemOrder-1].doRight===null}}">待批改</text>
|
||||
</view>
|
||||
<view class="exam-extend-item">得分: {{answer.answerItems[questionItem.itemOrder-1].score}}</view>
|
||||
<view class="exam-extend-item">分数: {{questionItem.score}}</view>
|
||||
<view class="exam-extend-item" style="padding-left:0px">
|
||||
难度:
|
||||
<i-rate value="{{questionItem.difficult}}" i-class="exam-item-rate" />
|
||||
</view>
|
||||
<view class="exam-extend-item">
|
||||
<rich-text nodes="解析: {{questionItem.analyze}}" />
|
||||
</view>
|
||||
<view class="exam-extend-item">
|
||||
<rich-text nodes="正确答案: {{questionItem.correct}}" wx:if="{{questionItem.questionType==1||questionItem.questionType==2 ||questionItem.questionType==5}}" />
|
||||
<rich-text nodes="正确答案: {{filter.trueFalseFormatter(questionItem)}}" wx:elif="{{questionItem.questionType==3}}" />
|
||||
<rich-text nodes="正确答案: {{questionItem.correctArray}}" wx:elif="{{questionItem.questionType==4}}" />
|
||||
</view>
|
||||
</view>
|
||||
</i-cell>
|
||||
</i-cell-group>
|
||||
</i-panel>
|
||||
|
||||
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
|
||||
<i-message id="message" />
|
||||
</view>
|
||||
</view>
|
||||
134
source/wx/xzs-student/pages/exam/read/index.wxss
Normal file
134
source/wx/xzs-student/pages/exam/read/index.wxss
Normal file
@@ -0,0 +1,134 @@
|
||||
.exam-page {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.view-wrap {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
background: #fff6f6;
|
||||
text-align: center;
|
||||
height: 35px;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.view-wrap-hidden {
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.exam-name-title {
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.exam-result {
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.exam-result-detail {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.exam-panel-title {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.exam-radio-item-label {
|
||||
float: left;
|
||||
margin-left: 10px;
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
.exam-item-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.item-content-selected {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.exam-input-contain {
|
||||
margin: 10px 2px !important;
|
||||
border-width: 1px;
|
||||
border-color: #dddee1;
|
||||
border-style: solid;
|
||||
width: 95%;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.exam-input-contain-label {
|
||||
float: left;
|
||||
padding: 0px 15px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.exam-input-contain-content {
|
||||
float: left;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.exam-textarea-contain {
|
||||
margin: 10px 2px !important;
|
||||
border-width: 1px;
|
||||
border-color: #dddee1;
|
||||
border-style: solid;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.exam-timeout-title {
|
||||
font-size: 16px;
|
||||
color: red;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.gapfilling-span {
|
||||
color: red;
|
||||
padding: 0px 30px;
|
||||
margin: 0px 5px;
|
||||
border-bottom: 3px double red;
|
||||
}
|
||||
|
||||
.ueditor-p {
|
||||
display: inline !important;
|
||||
}
|
||||
|
||||
.question-answer-result {
|
||||
text-align: center;
|
||||
height: 28px;
|
||||
width: 60px;
|
||||
line-height: 26px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.question-answer-error {
|
||||
background-color: #fef0f0;
|
||||
border-color: #fde2e2;
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.question-answer-right {
|
||||
background-color: #f0f9eb;
|
||||
border-color: #e1f3d8;
|
||||
color: #67c23a;
|
||||
}
|
||||
|
||||
.question-answer-judge {
|
||||
background-color: #fdf6ec;
|
||||
border-color: #faecd8;
|
||||
color: #e6a23c;
|
||||
}
|
||||
|
||||
.exam-clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.exam-extend-item {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.exam-item-rate {
|
||||
line-height: 0px;
|
||||
}
|
||||
Reference in New Issue
Block a user