小程序源码

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