Commit f39bfc69 authored by wangxuelai's avatar wangxuelai

'三种打卡编辑提交'

parent 0ca43638
/*
time: 2018-10-31
author: wxl
*/
import {
themeEditor
} from '../../../service/business/themeeditor.js';
import {
themeDetail
} from '../../../service/business/themeindex.js';
import {
audioorigin,
formatDate,
getDateInfo,
LocalStorage,
deepCopy
} from '../../../utilities/index.js';
import {
erpClassListGet,
} from '../../../service/business/common.js';
var app = getApp();
Page({
data: {
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
sid: 0,
classes: [],
chooseClasses: [],
classList: [],
page: 1,
},
onLoad: function(options) { // Do some initialize when page load.
const that = this;
const {
sid,
class_ids,
} = options;
this.setData({
sid,
classes: !class_ids ? [] : JSON.parse(decodeURIComponent(class_ids)),
});
this.getClassList();
},
onReady: function() { // Do something when page ready.
},
onShow: function() { // Do something when page show.
},
onHide: function() { // Do something when page hide.
},
onUnload: function() { // Do something when page close.
},
// 切换选择班级 start
getClassList() {
let dakarole = LocalStorage.getItem('dakarole');
erpClassListGet({
page: this.data.page,
// perPage: this.data.circlePerpage,
perPage: 200,//重新选择问题,所以这里暂不分页了
school_id: this.data.sid,
// my: dakarole==2 ? 1: this.data.my
}).then((res) => {
const {
code,
data
} = res;
if (code != 200) { // 失败的处理
} else {
this.setData({
classList: data.list,
});
const { chooseClasses } = this.data;
this.data.classes.forEach((ele) => {
const item = data.list.find(e => e.id == ele);
if (item) {
chooseClasses.push({
title: item.title,
id: item.id
})
}
})
this.setData({
chooseClasses
})
}
}).catch((e) => {
})
},
chooseClass (e) {
const { item } = e.currentTarget.dataset;
const { classes, chooseClasses } = this.data;
const classesIndex = classes.indexOf(item.id);
const chooseClassesIndex = chooseClasses.findIndex(ele => ele.id == item.id);
if (classesIndex == -1) {
classes.push(item.id);
} else {
classes.splice(classesIndex, 1);
}
if (chooseClassesIndex == -1) {
chooseClasses.push({
title: item.title,
id: item.id,
});
} else {
chooseClasses.splice(classesIndex, 1);
}
this.setData({
classes,
chooseClasses,
});
},
saveClass () {
const curPages = getCurrentPages();
let currPage = null; //当前页面
let prevPage = null; //上一个页面
if (curPages.length >= 2) {
currPage = curPages[curPages.length - 1]; //当前页面
prevPage = curPages[curPages.length - 2]; //上一个页面
}
prevPage.setData({
classes: this.data.chooseClasses
});
wx.navigateBack({
delta: 1
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "新建作业打卡",
"usingComponents": {
"sjd-media-editor": "../../../components/newsjdmediaeditor",
"sound-recording": "../../../components/soundrecording",
"w-switch": "/dist/w-switch/index",
"w-button": "/dist/w-button/index",
"w-cell": "/dist/w-cell/index",
"w-cell-group": "/dist/w-cell-group/index",
"w-checkbox": "/dist/w-checkbox/index",
"w-pane": "/dist/w-pane/index",
"expiredTip": "../../components/expiredTip"
}
}
\ No newline at end of file
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="themetypebox">
<view class="themetab">
<view class="themetypeitem active">全部班级</view>
<view class="themetypeitem ">只看我的</view>
</view>
</view>
<view class="listbox">
<view class="listitem" hover-class="none" hover-stop-propagation="false" wx:for="{{classList}}" wx:key="id" data-item="{{item}}" bindtap="chooseClass">
<view class="classtitle">{{item.title}}</view>
<view class="rightbox">
<view class="teachername">
<text wx:for="{{item.school_teachers}}" wx:key="id" wx:for-item="teacher">{{teacher.nickname}}</text>
</view>
<image class="selectedicon" src="{{imageRoot}}2b/common/{{filter.indexOf(classes, item.id) == -1 ? 'notselect' : 'select'}}.png"></image>
</view>
</view>
</view>
<view class="savebtn" hover-class="none" hover-stop-propagation="false" bindtap="saveClass">保存</view>
</view>
.themetypebox {
/* margin-bottom: 20px; */
background-color: #fff;
padding: 20rpx 0;
}
.themetab {
display: flex;
align-items: center;
justify-content: center;
/* margin-bottom: 34rpx; */
/* border: 1px solid #16B0FD; */
}
.themetab .themetypeitem {
width: 210rpx;
height: 60rpx;
/* border-bottom: 1px solid #16B0FD;
border-top: 1px solid #16B0FD; */
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #16B0FD;
text-align: center;
border: 1px solid #16B0FD;
}
.themetab .themetypeitem.active {
background-color: #16B0FD;
color: #FFFFFF;
}
.selectedicon {
width: 38rpx;
height: 38rpx;
display: block;
}
.listitem {
display: flex;
align-items: center;
justify-content: space-between;
}
.classtitle {
max-width: 370rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.rightbox {
display: flex;
align-items: center;
justify-content: center;
}
.listbox {
padding: 0 20rpx;
}
.listitem {
padding: 28rpx 0;
border-top: 1px solid #F1F2F3;
}
.teachername {
max-width: 230rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 10rpx;
}
.savebtn {
width:630rpx;
height:90rpx;
background:rgba(22,176,253,1);
border-radius:49rpx;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
letter-spacing: 2rpx;
position: fixed;
bottom: 20rpx;
left: 60rpx;
}
\ No newline at end of file
......@@ -1769,6 +1769,10 @@ Page({
wx.setNavigationBarTitle({
title: '新建闯关打卡'
})
this.setData({
lockSubjectLists: this.data.lockSubjects.slice(this.data.currentSortIndex * 10, this.data.currentSortIndex * 10 + 10),
})
this.getSubjectSort();
}
this.setData({
editType: type,
......
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container" style="display: {{videostatus.videoShow ? 'none' : 'block'}}">
<view class="theme-editor-container clearfix {{showWarn ? 'opacitybody' : ''}}">
<view class="themetypebox">
<view class="themetypebox" wx:if="{{tid == 0}}">
<view class="themetab">
<view class="themetypeitem {{editType == 1 ? 'active' : ''}}" data-type="1" bindtap="editTypeChange">作业打卡</view>
<view class="themetypeitem {{editType == 1 ? 'active' : ''}}" data-type="1" bindtap="editTypeChange">作业打卡{{tid}}</view>
<view class="themetypeitem {{editType == 2 ? 'active' : ''}}" data-type="2" bindtap="editTypeChange">日历打卡</view>
<view class="themetypeitem {{editType == 3 ? 'active' : ''}}" data-type="3" bindtap="editTypeChange">闯关打卡</view>
</view>
......
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