Commit b7288cfd authored by 吴颖's avatar 吴颖

'签到限制,课程瞬间限制'

parent 000a0252
...@@ -53,7 +53,7 @@ Page({ ...@@ -53,7 +53,7 @@ Page({
}, },
gocourseinstant: function () { gocourseinstant: function () {
wx.navigateTo({ wx.navigateTo({
url: '../../index/courseInstant/courseInstant', url: '../../index/courseInstant/courseInstant?type=check&lesson_id=' + this.data.lesson_id,
}) })
}, },
......
...@@ -8,6 +8,7 @@ var qiniuUploader = require("../../../utils/qiniuUploader"); ...@@ -8,6 +8,7 @@ var qiniuUploader = require("../../../utils/qiniuUploader");
Page({ Page({
data: { data: {
lesson_id: '', lesson_id: '',
type: '', // 查看还是修改
videoBox: [], videoBox: [],
videoShow: true, videoShow: true,
imgBox: [], imgBox: [],
...@@ -20,12 +21,12 @@ Page({ ...@@ -20,12 +21,12 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({ this.setData({
lesson_id: options.lesson_id ? options.lesson_id : '' lesson_id: options.lesson_id ? options.lesson_id : '',
type: options.type ? options.type : '',
}) })
if (this.data.lesson_id) { if (this.data.lesson_id) {
this.getDetail() this.getDetail()
} }
}, },
getDetail() { getDetail() {
let params = { let params = {
...@@ -34,6 +35,22 @@ Page({ ...@@ -34,6 +35,22 @@ Page({
lesson_id: this.data.lesson_id lesson_id: this.data.lesson_id
}, },
callback:(data)=>{ callback:(data)=>{
console.log(JSON.parse(data.class_moment))
let class_moment = JSON.parse(data.class_moment)
let arr1 = [], arr2 = []
for(var i=0; i< class_moment.length; i++) {
if (class_moment[i].type == 'video') {
arr1.push(class_moment[i])
} else {
arr2.push(class_moment[i])
}
}
this.setData({
videoBox: arr1,
imgBox: arr2
})
console.log(arr1)
console.log(arr2)
console.log(data) console.log(data)
} }
} }
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<view class="imgBox flex-h"> <view class="imgBox flex-h">
<view class="img videoBox" wx:for="{{videoBox}}" wx:for-item="item" wx:key="idx"> <view class="img videoBox" wx:for="{{videoBox}}" wx:for-item="item" wx:key="idx">
<video src="{{item.url}}" data-index="{{index}}"></video> <video src="{{item.url}}" data-index="{{index}}"></video>
<view class="delete-btn" data-index="{{index}}" catchtap="deleteVideo"> <view class="delete-btn" data-index="{{index}}" catchtap="deleteVideo" wx:if="{{type != 'check'}}">
<text class='iconfont iconguanbi'></text> <text class='iconfont iconguanbi'></text>
</view> </view>
</view> </view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseVideo" wx:if="{{videoShow}}"> <view class='addBox flex-h flex-vc flex-hc' bindtap="chooseVideo" wx:if="{{imgBox.length < 1}}">
<text class='iconfont iconshipin'></text> <text class='iconfont iconshipin'></text>
</view> </view>
</view> </view>
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
<view class="imgBox flex-h flex-hw"> <view class="imgBox flex-h flex-hw">
<view class="img" wx:for="{{imgBox}}" wx:for-item="item" wx:key="idx"> <view class="img" wx:for="{{imgBox}}" wx:for-item="item" wx:key="idx">
<image src="{{item.url}}" data-index="{{index}}" mode="aspectFill" bindtap="previewImg"></image> <image src="{{item.url}}" data-index="{{index}}" mode="aspectFill" bindtap="previewImg"></image>
<view class="delete-btn" data-index="{{index}}" catchtap="deleteImg"> <view class="delete-btn" data-index="{{index}}" catchtap="deleteImg" wx:if="{{type != 'check'}}">
<text class='iconfont iconguanbi'></text> <text class='iconfont iconguanbi'></text>
</view> </view>
</view> </view>
<view class='addBox flex-h flex-vc flex-hc' bindtap="chooseImg" wx:if="{{imgBox.length < 9}}"> <view class='addBox flex-h flex-vc flex-hc' bindtap="chooseImg" wx:if="{{imgBox.length < 9 && type != 'check' }}">
<text class='iconfont iconxiangji'></text> <text class='iconfont iconxiangji'></text>
</view> </view>
</view> </view>
</view> </view>
<view class="button"> <view class="button" wx:if="{{type != 'check'}}">
<view class="submit" catchtap="save">提交</view> <view class="submit" catchtap="save">提交</view>
</view> </view>
\ No newline at end of file
...@@ -27,7 +27,6 @@ page { ...@@ -27,7 +27,6 @@ page {
.img { .img {
width: 210rpx; width: 210rpx;
height: 210rpx; height: 210rpx;
border: 1px solid #EBEBEB;
border-radius: 5rpx; border-radius: 5rpx;
margin-right: 30rpx; margin-right: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment