小程序源码

This commit is contained in:
mindskip
2020-09-02 08:44:41 +08:00
parent 30b54a23ff
commit 593017f562
277 changed files with 5497 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
import {
formatSeconds
} from '../../../utils/util.js'
let app = getApp()
Page({
data: {
spinShow: false,
paperId: null,
form: {},
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/select/' + paperId, null)
.then(res => {
_this.setData({
spinShow: false
});
if (res.code === 1) {
_this.setData({
form: res.response,
paperId: paperId,
remainTime: res.response.suggestTime * 60
});
_this.timeReduce()
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
},
timeReduce() {
let _this = this
let timer = setInterval(function() {
let remainTime = _this.data.remainTime
if (remainTime <= 0) {
_this.timeOut()
} else {
_this.setData({
remainTime: remainTime - 1,
remainTimeStr: formatSeconds(remainTime),
doTime: _this.data.doTime + 1
});
}
}, 1000)
_this.setData({
timer: timer
});
},
onUnload() {
clearInterval(this.data.timer)
},
returnRecord() {
wx.reLaunch({
url: '/pages/record/index',
});
},
timeOut() {
clearInterval(this.data.timer)
this.setData({
timeOutShow: true
});
},
formSubmit: function(e) {
let _this = this
if (this.data.timer) {
clearInterval(this.data.timer)
}
wx.showLoading({
title: '提交中',
mask: true
})
e.detail.value.id = this.data.paperId
e.detail.value.doTime = this.data.doTime
app.formPost('/api/wx/student/exampaper/answer/answerSubmit', e.detail.value)
.then(res => {
if (res.code === 1) {
_this.setData({
modalShow: true,
result: res.response
});
} else {
app.message(res.response, 'error')
}
wx.hideLoading()
}).catch(e => {
wx.hideLoading()
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,16 @@
{
"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"
}
}

View File

@@ -0,0 +1,80 @@
<view class="exam-page">
<view class="view-wrap">
<view class="exam-count-down">{{remainTimeStr}}</view>
</view>
<view class="view-wrap-hidden">
</view>
<view>
<view class="exam-name-title">
<h1>{{form.name}}</h1>
</view>
<form bindsubmit='formSubmit'>
<i-panel title="{{titleItem.name}}" wx:for="{{form.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" name="{{questionItem.itemOrder}}_{{questionItem.id}}_{{questionItem.questionType}}">
<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.checked}}" class="exam-item-left" />
<rich-text nodes="{{radioItem.prefix}}. {{radioItem.content}}" class="exam-item-left" />
</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" name="{{questionItem.itemOrder}}_{{questionItem.id}}_{{questionItem.questionType}}">
<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="{{radioItem.checked}}" class="exam-item-left" />
<rich-text nodes="{{radioItem.prefix}}. {{radioItem.content}}" class="exam-item-left" />
</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" name="{{questionItem.itemOrder}}_{{questionItem.id}}_{{questionItem.questionType}}">
<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.checked}}" 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" name="{{questionItem.itemOrder}}_{{questionItem.id}}_{{questionItem.questionType}}_{{idx}}" />
</view>
</view>
<view wx:else>
<rich-text nodes="{{questionItem.itemOrder}}. {{questionItem.title}}" />
<view class="exam-textarea-contain">
<textarea placeholder="答案" maxlength="-1" name="{{questionItem.itemOrder}}_{{questionItem.id}}_{{questionItem.questionType}}"></textarea>
</view>
</view>
</i-cell>
</i-cell-group>
</i-panel>
<view>
<button class="i-btn i-btn-primary i-btn-square" form-type='submit'>提交</button>
</view>
<i-action-sheet visible="true" visible="{{timeOutShow}}" mask-closable="{{ false }}">
<view slot="header" style="padding: 16px">
<view class="exam-timeout-title">考试试卷结束,请提交试卷!</view>
<button class="i-btn i-btn-primary i-btn-square" form-type='submit'>提交</button>
</view>
</i-action-sheet>
</form>
<i-modal title="考试结果" visible="{{modalShow}}" bind:ok="returnRecord" bind:cancel="returnRecord">
<view>得分:{{result}}</view>
</i-modal>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />
</view>
</view>

View File

@@ -0,0 +1,76 @@
.exam-page {
background: white;
}
.exam-count-down {
font-size: 15px;
line-height: 35px;
}
.view-wrap {
position: fixed;
width: 100%;
background: #fff6f6;
text-align: center;
height: 35px;
z-index: 999;
}
.view-wrap-hidden {
height: 35px;
}
.exam-name-title {
text-align: center;
margin-top: 10px;
font-size: 17px;
}
.exam-panel-title {
margin-top: 30px;
}
.exam-radio-item-label {
float: left;
margin-left: 10px;
line-height: 35px;
}
.exam-item-left {
float: left;
}
.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;
}

View File

@@ -0,0 +1,66 @@
// pages/exam/edit/index.js
Page({
/**
* Page initial data
*/
data: {
},
/**
* Lifecycle function--Called when page load
*/
onLoad: function (options) {
},
/**
* Lifecycle function--Called when page is initially rendered
*/
onReady: function () {
},
/**
* Lifecycle function--Called when page show
*/
onShow: function () {
},
/**
* Lifecycle function--Called when page hide
*/
onHide: function () {
},
/**
* Lifecycle function--Called when page unload
*/
onUnload: function () {
},
/**
* Page event handler function--Called when user drop down
*/
onPullDownRefresh: function () {
},
/**
* Called when page reach bottom
*/
onReachBottom: function () {
},
/**
* Called when user click on the top right corner to share
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,2 @@
<!--pages/exam/edit/index.wxml-->
<text>pages/exam/edit/index.wxml</text>

View File

@@ -0,0 +1 @@
/* pages/exam/edit/index.wxss */

View File

@@ -0,0 +1,91 @@
// pages/exam/index/index.js
let app = getApp()
Page({
data: {
paperType: 1,
spinShow: false,
loadMoreLoad: false,
loadMoreTip: '暂无数据',
queryParam: {
paperType: 1,
pageIndex: 1,
pageSize: app.globalData.pageSize
},
tableData: [],
total: 1
},
onLoad: function(options) {
this.setData({
spinShow: true
});
this.search(true)
},
tabChange({
detail
}) {
this.setData({
spinShow: true
});
let size = app.globalData.pageSize
this.setData({
paperType: detail.key,
queryParam: {
paperType: detail.key,
pageIndex: 1,
pageSize: app.globalData.pageSize
}
});
this.search(true)
},
onPullDownRefresh() {
this.setData({
spinShow: true
});
if (!this.loading) {
this.setData({
['queryParam.pageIndex']: 1
});
this.search(true)
}
},
onReachBottom() {
if (!this.loading && this.data.queryParam.pageIndex < this.data.total) {
this.setData({
loadMoreLoad: true,
loadMoreTip: '正在加载'
});
this.setData({
['queryParam.pageIndex']: this.data.queryParam.pageIndex + 1
});
this.search(false)
}
},
search: function(override) {
let _this = this
app.formPost('/api/wx/student/exampaper/pageList', this.data.queryParam).then(res => {
_this.setData({
spinShow: false
});
wx.stopPullDownRefresh()
if (res.code === 1) {
const re = res.response
_this.setData({
['queryParam.pageIndex']: re.pageNum,
tableData: override ? re.list : this.data.tableData.concat(re.list),
total: re.pages
});
if (re.pageNum >= re.pages) {
this.setData({
loadMoreLoad: false,
loadMoreTip: '暂无数据'
});
}
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,13 @@
{
"usingComponents": {
"i-tabs": "/component/iView/tabs/index",
"i-tab": "/component/iView/tab/index",
"i-cell-group": "/component/iView/cell-group/index",
"i-cell": "/component/iView/cell/index",
"i-load-more": "/component/iView/load-more/index",
"i-button": "/component/iView/button/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
},
"enablePullDownRefresh": true
}

View File

@@ -0,0 +1,15 @@
<!--pages/exam/index/index.wxml-->
<view>
<i-tabs current="{{ paperType }}" bindchange="tabChange" fixed="true">
<i-tab key="1" title="固定试卷" />
<i-tab key="4" title="时段试卷" />
</i-tabs>
<view class="exam-tab-view">
<i-cell-group>
<i-cell wx:for="{{tableData}}" data-item="item" wx:key="{{item.id}}" title="{{item.name}}" is-link url="/pages/exam/do/index?id={{item.id}}" value="{{item.subjectName}}"></i-cell>
</i-cell-group>
</view>
<i-load-more tip="{{loadMoreTip}}" loading="{{loadMoreLoad}}" i-class="xzs-load-more" />
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />
</view>

View File

@@ -0,0 +1,7 @@
.exam-tab-view {
margin-top: 42px;
}
.xzs-load-more {
margin-top: 60px !important;
}

View 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
});
}
})

View 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"
}
}

View 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>

View 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;
}

View File

@@ -0,0 +1,65 @@
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
spinShow: false,
fixedPaper: [],
pushPaper: [],
timeLimitPaper: [],
taskList: []
},
onLoad: function() {
this.setData({
spinShow: true
});
this.indexLoad()
},
onPullDownRefresh() {
this.setData({
spinShow: true
});
if (!this.loading) {
this.indexLoad()
}
},
indexLoad: function() {
let _this = this
app.formPost('/api/wx/student/dashboard/index', null).then(res => {
_this.setData({
spinShow: false
});
wx.stopPullDownRefresh()
if (res.code === 1) {
_this.setData({
fixedPaper: res.response.fixedPaper,
timeLimitPaper: res.response.timeLimitPaper,
pushPaper: res.response.pushPaper
});
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
app.formPost('/api/wx/student/dashboard/task', null).then(res => {
_this.setData({
spinShow: false
});
wx.stopPullDownRefresh()
if (res.code === 1) {
_this.setData({
taskList: res.response,
});
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,12 @@
{
"usingComponents": {
"i-panel": "/component/iView/panel/index",
"i-cell-group": "/component/iView/cell-group/index",
"i-cell": "/component/iView/cell/index",
"i-collapse": "/component/iView/collapse/index",
"i-collapse-item": "/component/iView/collapse-item/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
},
"enablePullDownRefresh": true
}

View File

@@ -0,0 +1,43 @@
<wxs module="enumItem" src="../../wxs/enumItem.wxs"></wxs>
<view>
<view>
<swiper indicator-dots="false" autoplay="true" interval="5000" duration="1000">
<swiper-item>
<image src="/assets/carousel/1.png" class="slide-image" />
</swiper-item>
<swiper-item>
<image src="/assets/carousel/2.png" class="slide-image" />
</swiper-item>
<swiper-item>
<image src="/assets/carousel/3.png" class="slide-image" />
</swiper-item>
<swiper-item>
<image src="/assets/carousel/4.png" class="slide-image" />
</swiper-item>
</swiper>
</view>
<i-panel title="任务中心">
<i-collapse accordion i-class="index-collapse">
<i-collapse-item i-class="index-collapse-item" title="{{item.title}}" name="{{item.id}}" wx:for="{{taskList}}" data-item="item" wx:key="{{item.id}}">
<i-cell-group slot="content">
<i-cell i-class="index-cell" wx:for="{{item.paperItems}}" data-item="item" wx:key="{{item.examPaperId}}" title="{{item.examPaperName}}" value="{{enumItem.format(enumItem.state.exam.examPaperAnswer.statusEnum,item.status)}}" is-link url="{{item.examPaperAnswerId == null?'/pages/exam/do/index?id='+item.examPaperId:'/pages/exam/read/index?id='+item.examPaperAnswerId}}">
</i-cell>
</i-cell-group>
</i-collapse-item>
</i-collapse>
</i-panel>
<i-panel title="固定试卷">
<i-cell-group>
<i-cell wx:for="{{fixedPaper}}" data-item="item" wx:key="{{item.id}}" title="{{item.name}}" is-link url="/pages/exam/do/index?id={{item.id}}"></i-cell>
</i-cell-group>
</i-panel>
<i-panel title="时段试卷">
<i-cell-group>
<i-cell wx:for="{{timeLimitPaper}}" data-item="item" wx:key="{{item.id}}" title="{{item.name}}" is-link url="/pages/exam/do/index?id={{item.id}}" label="{{item.startTime}} 至 {{item.endTime}}"></i-cell>
</i-cell-group>
</i-panel>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />
</view>

View File

@@ -0,0 +1,35 @@
/**index.wxss**/
.caption-wrap {
background-color: white;
margin-top: 15px;
}
.caption-title {
background-color: #f7f7f7;
display: block;
margin-left: 5px;
}
.index-collapse {
font-size: 14px;
line-height: 24px;
}
.index-collapse-item {
padding: 8px 15px !important;
border: 0px !important;
}
.slide-image {
width: 100%;
height: 150px;
}
.index-cell {
padding: 5px 15px !important;
}
p{
display: none;
}

View File

@@ -0,0 +1,54 @@
const app = getApp()
Page({
data: {
spinShow: false,
info: {}
},
onLoad: function(options) {
this.loadUserInfo()
},
loadUserInfo() {
let _this = this
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/user/current', null).then(res => {
if (res.code == 1) {
_this.setData({
info: res.response
});
}
_this.setData({
spinShow: false
});
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
},
logOut() {
let _this = this
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/auth/unBind', null).then(res => {
if (res.code == 1) {
wx.setStorageSync('token', '')
wx.reLaunch({
url: '/pages/user/bind/index',
});
}
_this.setData({
spinShow: false
});
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"i-cell-group": "/component/iView/cell-group/index",
"i-cell": "/component/iView/cell/index",
"i-icon": "/component/iView/icon/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
}
}

View File

@@ -0,0 +1,46 @@
<view class="userinfo">
<block>
<image class="userinfo-avatar" src="{{info.imagePath}}"></image>
<text class="userinfo-nickname">{{info.userName}}</text>
</block>
</view>
<view>
<i-cell-group i-class="my-group-margin">
<i-cell title="个人资料" is-link url="/pages/my/info/index">
<i-icon type="mine_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="个人动态" is-link url="/pages/my/log/index">
<i-icon type="collection_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="消息" is-link url="/pages/my/message/list/index">
<i-icon type="message_fill" slot="icon" size="20" />
</i-cell>
</i-cell-group>
</view>
<view>
<i-cell-group i-class="my-group-margin">
<i-cell title="设置" is-link url="/pages/dashboard/index">
<i-icon type="setup_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="反馈" is-link url="/pages/dashboard/index">
<i-icon type="praise_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="关于" is-link url="/pages/dashboard/index">
<i-icon type="prompt_fill" slot="icon" size="20" />
</i-cell>
</i-cell-group>
</view>
<view>
<i-cell-group i-class="my-group-margin">
<i-cell title="退出账号" bind:click="logOut">
<i-icon type="flashlight_fill" slot="icon" size="20" />
</i-cell>
</i-cell-group>
</view>
<view class="copyright">武汉思维跳跃科技有限公司 提供技术支持</view>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />

View File

@@ -0,0 +1,32 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: row;
align-items: center;
background: #598ce4;
height: 100px;
}
.userinfo-avatar {
width: 48px;
height: 48px;
margin-left: 30px;
}
.userinfo-nickname {
color: white;
margin-left: 20px;
}
.my-group-margin{
margin-top: 10px;
}
.copyright{
color: #8c8c8c;
text-align: center;
margin-top: 20px;
font-size: 14px;
}

View File

@@ -0,0 +1,68 @@
// pages/user/info/index.js
const app = getApp()
Page({
data: {
userInfo: null,
spinShow: false,
levelIndex: 0
},
onLoad: function(options) {
this.loadUserInfo()
},
loadUserInfo() {
let _this = this
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/user/current', null).then(res => {
if (res.code == 1) {
_this.setData({
userInfo: res.response,
levelIndex: res.response.userLevel-1
});
}
_this.setData({
spinShow: false
});
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
},
bindLevelChange: function(e) {
this.setData({
levelIndex: e.detail.value
})
},
bindDateChange(e) {
let {
value
} = e.detail;
this.setData({
"userInfo.birthDay": value
})
},
formSubmit: function(e) {
let _this = this
wx.showLoading({
title: '提交中',
mask: true
})
app.formPost('/api/wx/student/user/update', e.detail.value)
.then(res => {
if (res.code == 1) {
wx.reLaunch({
url: '/pages/my/index/index',
});
} else {
app.message(res.message, 'error')
}
wx.hideLoading()
}).catch(e => {
app.message(e, 'error')
wx.hideLoading()
})
}
})

View File

@@ -0,0 +1,11 @@
{
"usingComponents": {
"i-button": "/component/iView/button/index",
"i-panel": "/component/iView/panel/index",
"i-input": "/component/iView/input/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index",
"i-radio-group": "/component/iView/radio-group/index",
"i-radio": "/component/iView/radio/index"
}
}

View File

@@ -0,0 +1,40 @@
<wxs module="enumItem" src="../../../wxs/enumItem.wxs"></wxs>
<form bindsubmit='formSubmit'>
<i-panel title="真实姓名">
<i-input value="{{ userInfo.realName }}" name="realName" maxlength="-1" />
</i-panel>
<i-panel title="年龄">
<i-input value="{{ userInfo.age }}" name="age" maxlength="-1" />
</i-panel>
<i-panel title="性别">
<radio-group class="radio-group my-info-sex" name="sex">
<label class="radio my-info-sex-item" wx:for="{{ enumItem.state.user.sexEnum }}" wx:key="{{item.key}}" wx:for-item="radioItem">
<radio color="#2d8cf0" value="{{radioItem.key}}" checked="{{radioItem.key===userInfo.sex}}" />
<text>{{radioItem.value}}</text>
</label>
</radio-group>
</i-panel>
<i-panel title="出生日期">
<picker class="weui-btn" mode="date" value="{{userInfo.birthDay}}" bindchange="bindDateChange">
<view class="i-cell i-input exam-pick-input">{{ userInfo.birthDay }}</view>
<i-input value="{{ userInfo.birthDay }}" class="exam-hidden" name="birthDay" maxlength="-1" />
</picker>
</i-panel>
<i-panel title="手机">
<i-input value="{{ userInfo.phone }}" name="phone" maxlength="-1" />
</i-panel>
<i-panel title="年级">
<picker mode="selector" range="{{ enumItem.state.user.levelEnum }}" range-key="{{'value'}}" value="{{levelIndex}}" bindchange="bindLevelChange">
<view class="i-cell i-input exam-pick-input">{{ enumItem.state.user.levelEnum[levelIndex].value }}</view>
<i-input value="{{enumItem.state.user.levelEnum[levelIndex].key}}" maxlength="-1" name="userLevel" class="exam-hidden" />
</picker>
</i-panel>
<view>
<button class="i-btn i-btn- i-btn-primary i-btn-square" form-type='submit'>保存</button>
</view>
</form>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />

View File

@@ -0,0 +1,18 @@
.my-info-sex {
height: 45px;
font-size: 13px;
}
.my-info-sex-item {
line-height: 45px;
margin-left: 20px;
}
.my-info-level {
font-size: 13px;
}
.my-info-level-item {
line-height: 45px;
margin-left: 25px;
}

View File

@@ -0,0 +1,32 @@
const app = getApp()
Page({
data: {
logList: null,
len: 0
},
onLoad: function(options) {
this.search();
},
search: function() {
let _this = this
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/user/log', null).then(res => {
_this.setData({
spinShow: false
});
if (res.code === 1) {
_this.setData({
logList: res.response,
len: res.response.length
});
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"i-steps": "/component/iView/steps/index",
"i-step": "/component/iView/step/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index",
"i-panel": "/component/iView/panel/index"
}
}

View File

@@ -0,0 +1,18 @@
<view class="user-log-page">
<view wx:for="{{logList}}" data-item="item" wx:key="{{item.id}}" class="i-step-item i-step-process i-step-vertical" style="width : 100%;">
<view class="i-step-item-ico">
<view class="i-step-ico"></view>
<view class="i-step-line" wx:if="{{ index !== len - 1 }}"></view>
</view>
<view class="i-step-item-main">
<view class="i-step-item-title">
{{item.createTime}}
</view>
<view class="i-step-item-content">
{{item.content}}
</view>
</view>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />
</view>
</view>

View File

@@ -0,0 +1,24 @@
/* pages/user/log/index.wxss */
@import '/component/iView/steps/index.wxss';
@import '/component/iView/step/index.wxss';
.i-step-ico {
background: #fff !important;
box-sizing: border-box !important;
}
.i-step-item-title {
font-size: 12px;
font-weight: 400 !important;
}
.i-step-item-content {
font-size: 12px;
font-weight: 400 !important;
}
.user-log-page {
background: #fff;
padding: 5px;
padding-top: 10px;
}

View File

@@ -0,0 +1,79 @@
const app = getApp()
Page({
data: {
message: null
},
onLoad: function(options) {
let msgId = options.id;
let _this = this
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/user/message/detail/' + msgId, null).then(res => {
_this.setData({
spinShow: false
});
if (res.code === 1) {
_this.setData({
message: res.response,
});
app.formPost('/api/wx/student/user/message/read/' + msgId, null);
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})

View File

@@ -0,0 +1,7 @@
{
"usingComponents": {
"i-panel": "/component/iView/panel/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
}
}

View File

@@ -0,0 +1,19 @@
<view class="msg-page">
<view class="msg-title">
<h1>{{message.title}}</h1>
</view>
<view>
<view class="msg-content">
<h1>发送人:{{message.sendUserName}}</h1>
</view>
<view class="msg-content">
<h1>发送时间:{{message.createTime}}</h1>
</view>
<view class="msg-content">
<h1>发送内容:{{message.content}}</h1>
</view>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />
</view>
</view>

View File

@@ -0,0 +1,16 @@
.msg-page {
background: white;
width: 100%;
height: 100%;
padding: 10px 0px;
}
.msg-title {
text-align: center;
font-size: 14px;
}
.msg-content {
padding: 8px 15px;
font-size: 14px;
}

View File

@@ -0,0 +1,72 @@
const app = getApp()
Page({
data: {
spinShow: false,
loadMoreLoad: false,
loadMoreTip: '暂无数据',
queryParam: {
pageIndex: 1,
pageSize: app.globalData.pageSize
},
tableData: [],
total: 1
},
onLoad: function(options) {
this.setData({
spinShow: true
});
this.search(true);
},
onPullDownRefresh() {
this.setData({
spinShow: true
});
if (!this.loading) {
this.setData({
['queryParam.pageIndex']: 1
});
this.search(true)
}
},
onReachBottom() {
if (!this.loading && this.data.queryParam.pageIndex < this.data.total) {
this.setData({
loadMoreLoad: true,
loadMoreTip: '正在加载'
});
this.setData({
['queryParam.pageIndex']: this.data.queryParam.pageIndex + 1
});
this.search(false)
}
},
search: function(override) {
let _this = this
app.formPost('/api/wx/student/user/message/page', this.data.queryParam).then(res => {
_this.setData({
spinShow: false
});
wx.stopPullDownRefresh()
if (res.code === 1) {
const re = res.response
_this.setData({
['queryParam.pageIndex']: re.pageNum,
tableData: override ? re.list : this.data.tableData.concat(re.list),
total: re.pages
});
if (re.pageNum >= re.pages) {
this.setData({
loadMoreLoad: false,
loadMoreTip: '暂无数据'
});
}
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,10 @@
{
"usingComponents": {
"i-cell-group": "/component/iView/cell-group/index",
"i-cell": "/component/iView/cell/index",
"i-load-more": "/component/iView/load-more/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
},
"enablePullDownRefresh": true
}

View File

@@ -0,0 +1,10 @@
<wxs module="enumItem" src="../../../../wxs/enumItem.wxs"></wxs>
<view>
<i-cell-group>
<i-cell wx:for="{{tableData}}" data-item="item" label="{{item.content}}" wx:key="{{item.id}}" url="/pages/my/message/info/index?id={{item.id}}" title="{{item.title}}" lable="{{item.content}}" is-link value="{{enumItem.format(enumItem.state.user.message.readText,item.readed)}}"></i-cell>
</i-cell-group>
</view>
<i-load-more tip="{{loadMoreTip}}" loading="{{loadMoreLoad}}" />
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />

View File

@@ -0,0 +1 @@
/* pages/user/message/index.wxss */

View File

@@ -0,0 +1,73 @@
// pages/exam/index/index.js
let app = getApp()
Page({
data: {
spinShow: false,
loadMoreLoad: false,
loadMoreTip: '暂无数据',
queryParam: {
pageIndex: 1,
pageSize: app.globalData.pageSize
},
tableData: [],
total: 1
},
onLoad: function(options) {
this.setData({
spinShow: true
});
this.search(true)
},
onPullDownRefresh() {
this.setData({
spinShow: true
});
if (!this.loading) {
this.setData({
['queryParam.pageIndex']: 1
});
this.search(true)
}
},
onReachBottom() {
if (!this.loading && this.data.queryParam.pageIndex < this.data.total) {
this.setData({
loadMoreLoad: true,
loadMoreTip: '正在加载'
});
this.setData({
['queryParam.pageIndex']: this.data.queryParam.pageIndex + 1
});
this.search(false)
}
},
search: function(override) {
let _this = this
app.formPost('/api/wx/student/exampaper/answer/pageList', this.data.queryParam)
.then(res => {
_this.setData({
spinShow: false
});
wx.stopPullDownRefresh()
if (res.code === 1) {
const re = res.response
_this.setData({
['queryParam.pageIndex']: re.pageNum,
tableData: override ? re.list : this.data.tableData.concat(re.list),
total: re.pages
});
if (re.pageNum >= re.pages) {
this.setData({
loadMoreLoad: false,
loadMoreTip: '暂无数据'
});
}
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,13 @@
{
"usingComponents": {
"i-tabs": "/component/iView/tabs/index",
"i-tab": "/component/iView/tab/index",
"i-cell-group": "/component/iView/cell-group/index",
"i-cell": "/component/iView/cell/index",
"i-load-more": "/component/iView/load-more/index",
"i-button": "/component/iView/button/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
},
"enablePullDownRefresh": true
}

View File

@@ -0,0 +1,12 @@
<wxs module="enumItem" src="../../wxs/enumItem.wxs"></wxs>
<view>
<view>
<i-cell-group>
<i-cell wx:for="{{tableData}}" data-item="item" wx:key="{{item.id}}" title="{{item.paperName}}" is-link url="/pages/exam/read/index?id={{item.id}}" value="{{enumItem.format(enumItem.state.exam.examPaperAnswer.statusEnum,item.status)}}" label="{{item.subjectName}} 对错:{{item.questionCorrect}}/{{item.questionCount}} 时间:{{item.createTime}} "
/>
</i-cell-group>
</view>
<i-load-more tip="{{loadMoreTip}}" loading="{{loadMoreLoad}}" />
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />
</view>

View File

@@ -0,0 +1 @@
/* pages/exam/index/index.wxss */

View File

@@ -0,0 +1,47 @@
const app = getApp()
Page({
data: {
spinShow: false,
userName: '',
password: '',
},
formSubmit: function(e) {
let _this = this
_this.setData({
spinShow: true
});
wx.login({
success(wxres) {
if (wxres.code) {
e.detail.value.code = wxres.code
app.formPost('/api/wx/student/auth/bind', e.detail.value)
.then(res => {
_this.setData({
spinShow: false
});
if (res.code == 1) {
wx.setStorageSync('token', res.response)
wx.reLaunch({
url: '/pages/index/index',
});
} else {
app.message(res.message, 'error')
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
} else {
app.message(res.errMsg, 'error')
}
}
})
},
register: function(e) {
wx.navigateTo({
url: "../register/index"
})
}
})

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"i-button": "/component/iView/button/index",
"i-panel": "/component/iView/panel/index",
"i-input": "/component/iView/input/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
}
}

View File

@@ -0,0 +1,25 @@
<!--pages/user/bind/index.wxml-->
<view class="card-image-container">
<image src="/assets/logo2.png" style="width:175px;height:147px"></image>
</view>
<form bindsubmit='formSubmit'>
<i-panel title="用户名">
<i-input value="{{ userName }}" name="userName" maxlength="-1" />
</i-panel>
<i-panel title="密码">
<i-input value="{{ password }}" name="password" maxlength="-1" />
</i-panel>
<view>
<button class="i-btn i-btn- i-btn-primary i-btn-square" form-type='submit'>登录</button>
</view>
<view style="padding:font-size: 26rpx;color: #606266;padding: 20rpx 50rpx;">
学之思是一款学校考试系统,仅供学校内部学生使用,需要提供账号密码。没有账号?
<text bindtap="register" style="color:#4399fc">马上注册</text>
</view>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
</form>
<i-message id="message" />

View File

@@ -0,0 +1,7 @@
/* pages/user/bind/index.wxss */
.card-image-container {
align-items: center;
display: flex;
justify-content: center;
}

View File

@@ -0,0 +1,48 @@
const app = getApp()
Page({
data: {
levelIndex: 0
},
bindLevelChange: function (e) {
this.setData({
levelIndex: e.detail.value
})
},
formSubmit: function(e) {
let _this = this;
let form = e.detail.value
if (form.userName == null || form.userName == '') {
app.message('用户名不能为空', 'error');
return;
}
if (form.password == null || form.password == '') {
app.message('密码不能为空', 'error');
return;
}
if (form.userLevel == null || form.userLevel == '') {
app.message('年级不能为空', 'error');
return;
}
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/user/register', form)
.then(res => {
_this.setData({
spinShow: false
});
if (res.code == 1) {
wx.reLaunch({
url: '/pages/user/bind/index',
});
} else {
app.message(res.message, 'error')
}
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"i-button": "/component/iView/button/index",
"i-panel": "/component/iView/panel/index",
"i-input": "/component/iView/input/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
}
}

View File

@@ -0,0 +1,26 @@
<wxs module="enumItem" src="../../../wxs/enumItem.wxs"></wxs>
<view class="card-image-container">
<image src="/assets/logo2.png" style="width:175px;height:147px"></image>
</view>
<form bindsubmit='formSubmit'>
<i-panel title="用户名">
<i-input value="{{ userName }}" name="userName" maxlength="-1" />
</i-panel>
<i-panel title="密码">
<i-input value="{{ password }}" name="password" maxlength="-1" />
</i-panel>
<i-panel title="年级">
<picker mode="selector" range="{{ enumItem.state.user.levelEnum }}" range-key="{{'value'}}" value="{{levelIndex}}" bindchange="bindLevelChange">
<view class="i-cell i-input exam-pick-input">{{ enumItem.state.user.levelEnum[levelIndex].value }}</view>
<i-input value="{{enumItem.state.user.levelEnum[levelIndex].key}}" maxlength="-1" name="userLevel" class="exam-hidden" />
</picker>
</i-panel>
<view>
<button class="i-btn i-btn- i-btn-primary i-btn-square" form-type='submit'>注册</button>
</view>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
</form>
<i-message id="message" />

View File

@@ -0,0 +1,17 @@
/* pages/user/register/index.wxss */
.card-image-container {
align-items: center;
display: flex;
justify-content: center;
}
.register-level {
font-size: 13px;
}
.register-level-item {
line-height: 45px;
margin-left: 25px;
}