Commit cc29dbbe authored by lvtz's avatar lvtz

fix

parents e399b42c ccbc4277
......@@ -361,7 +361,8 @@
"index",
"setting",
"chooseclass",
"subjecteditor"
"subjecteditor",
"lockthemelist"
]
},
{
......
/*
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
<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
......@@ -2041,7 +2041,7 @@ Page({
addSort = 1;
}
wx.navigateTo({
url: `/business/pages/themeeditor/subjecteditor?tid=${this.data.tid}&sid=${this.data.sid}&addSort=${addSort}&sort=${sort}&id=${item.id}&detail=${encodeURIComponent(JSON.stringify(item))}&index=${index}&currentSortIndex=${this.data.currentSortIndex}`,
url: `/business/pages/themeeditor/subjecteditor?tid=${this.data.tid}&sid=${this.data.sid}&addSort=${addSort}&sort=${sort}&id=${item.id}&index=${index}&currentSortIndex=${this.data.currentSortIndex}&from=edit`,
})
},
checknameIpt(e) {
......@@ -2333,7 +2333,6 @@ Page({
audio_require_num: 0,
})
}
console.log(lockSubjects, 'lockSubjects');
this.setData({
lockparams: {
......
/*
time: 2018-10-31
author: wxl
*/
import {
unlockSubjectShow
} from '../../../service/business/themeindex';
import {
unlockSubjectListGet,
} from '../../../service/business/common.js';
var app = getApp();
Page({
data: {
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
sid: 0,
tid: 0,
classes: [],
chooseClasses: [],
classList: [],
page: 1,
subjectCount: 1,
lockparams: {
title: '',
created_at: '',
teacher: {
name: '',
id: '',
}
},
lockSubjects: [],
settingModalShow: false
},
onLoad: function(options) { // Do some initialize when page load.
const { sid, tid } = options;
this.setData({
sid,
tid,
})
this.unlockSubjectShow();
},
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.
},
onPullDownRefresh() {
this.getUnlockSubject();
},
getUnlockSubject() {
unlockSubjectListGet({
page: 1,
perPage: 201,
id: this.data.tid,
school_id: this.data.sid
}).then((res) => {
const { code, data } = res;
if (code == 200) {
const lockSubjects = data.list;
const count = this.data.subjectCount - data.total;
for (let i = 0; i < count; i++) {
lockSubjects.push({
id: 0,
title: '',
content: [],
force_status: 2,
force_num: 0,
text_require_status: 2,
text_require_num: 0,
image_require_status: 2,
image_require_num: 0,
video_require_status: 2,
video_require_num: 0,
audio_require_status: 2,
audio_require_num: 0,
})
}
this.setData({
lockSubjects,
})
wx.stopPullDownRefresh();
} else {
}
}).catch((e) => {
})
},
unlockSubjectShow() {
wx.showLoading({
title: '数据加载中...'
});
unlockSubjectShow({
id: this.data.tid,
school_id: this.data.sid,
extra: 'teacher'
}).then((res) => {
const { code, data } = res;
if (code == 200) {
wx.hideLoading();
this.setData({
subjectCount: data.subject_count,
lockparams: {
title: data.title,
created_at: data.created_at,
teacher: {
name: data.teacher && data.teacher.nickname,
id: data.teacher && data.teacher.id,
}
}
})
this.getUnlockSubject();
}
}).catch(() => {
wx.showToast({
icon: 'none',
title: '内容加载失败'
})
})
},
goThemeDetail (e) {
const { index, item } = e.currentTarget.dataset;
if (item.id > 0) {
} else {
const { item, index, } = e.currentTarget.dataset;
wx.navigateTo({
url: `/business/pages/themeeditor/subjecteditor?tid=${this.data.tid}&sid=${this.data.sid}&addSort=0&sort=${index + 1}&id=${item.id}&index=${index}&currentSortIndex=0&from=index`,
})
}
},
setting () {
this.setData({
settingModalShow: true
})
},
closeSettingModal () {
this.setData({
settingModalShow: false
})
},
toEdit () {
const that = this;
wx.navigateTo({
url: `/business/pages/themeeditor/index?id=0&tid=${this.data.tid}&sid=tid=${this.data.sid}&classes=[]&editType=3`,
success() {
that.closeSettingModal()
}
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "新建作业打卡",
"enablePullDownRefresh": true,
"usingComponents": {
"sjd-media-editor": "../../../components/newsjdmediaeditor",
"sound-recording": "../../../components/soundrecording",
......
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="titlebox">
<view class="miantitle">{{lockparams.title}}</view>
<view class="teacherdesc">{{lockparams.teacher.name}} {{lockparams.created_at}}发布</view>
</view>
<view wx:for="{{lockSubjects}}" wx:key="index">
<view class="themesorttitle">第{{index + 1}}关</view>
<view class="themeitembox {{item.id == 0 ? 'empty' : ''}}" data-item="{{item}}" data-index="{{index}}" bindtap="goThemeDetail">
<block wx:if="{{item.id != 0}}">
<view class="themeitetitle">{{item.title}}</view>
<view class="staticbox">
<view class="staticitem">已打卡人数: {{item.clock_people}}人</view>
<view class="staticitem" wx:if="{{item.clock_people > 0}}">待点评: <text class="em">{{item.review_clock_record_count}}</text></view>
<view class="staticitem" wx:else="{{item.review_clock_record_count > 0}}">待点评: 无</view>
</view>
</block>
<block wx:else>
待完善
</block>
</view>
</view>
<view class="btnbox">
<view class="btn" bindtap="setting">高级设置</view>
<view class="btn share">分享</view>
</view>
<view class="modal modal-setup {{settingModalClass? 'hide': ''}}" hidden="{{!settingModalShow}}">
<view class="mask" bindtap="closeSettingModal"></view>
<view class="modal-content">
<view class="modal-title">
高级设置
<image class="icon-close" src="{{imageRoot}}2b/themeindex/close_icon.png" bindtap="closeSettingModal"></image>
</view>
<view class="setting-list">
<view class="setting-item" bindtap="goMembers">
<view class="left">
<view class="item-label">成员管理</view>
<view class="item-desc">已打卡学生管理、点评老师管理</view>
</view>
<view class="right">
<image class="icon-arr" src="{{imageRoot}}2b/themeindex/setting_right.png"></image>
</view>
</view>
<view class="setting-item" bindtap="toEdit">
<view class="left">
<view class="item-label">作业打卡设置</view>
<view class="item-desc">作业内容、作业要求、参与打卡方式等设置</view>
</view>
<view class="right">
<image class="icon-arr" src="{{imageRoot}}2b/themeindex/setting_right.png"></image>
</view>
</view>
<!-- <view class="setting-item">
<view class="left">
<view class="item-label">打卡营销页设置</view>
<view class="item-desc">配置此页面后可在学生加入打卡前展示,此功能可收集有意向学生的联系方式。 <text class="more-tip">了解更多</text></view>
</view>
<view class="right">
<image class="icon-arr" src="{{imageRoot}}2b/themeindex/setting_right.png"></image>
</view>
</view> -->
</view>
</view>
</view>
</view>
.container {
min-height: 100vh;
background-color: #F5F5F7;
padding-bottom: 150rpx;
}
.titlebox {
background-color: #fff;
padding: 18rpx 24rpx;
}
.miantitle {
color: #222222;
font-size: 30rpx;
word-break: break-all;
margin-bottom: 8px;
}
.teacherdesc {
color: #999999;
font-size: 22rpx;
}
.themesorttitle {
padding: 26rpx 24rpx 10rpx;
line-height: 1;
color: #999999;
font-size: 26rpx;
}
.themeitembox {
background-color: #fff;
padding: 26rpx 32rpx 26rpx 24rpx;
position: relative;
}
.themeitembox.empty {
display: flex;
align-items: center;
justify-content: center;
color: #16B0FD;
font-size: 30rpx;
height: 132rpx;
}
.themeitetitle {
font-size: 26rpx;
color: #222222;
word-break: break-all;
margin-bottom: 12rpx;
}
.staticbox {
color: #999999;
font-size: 22rpx;
display: flex;
}
.staticbox .staticitem {
color: #999999;
font-size: 22rpx;
padding-right: 30rpx;
}
.staticbox .staticitem .em {
color: #16B0FD;
font-size: 22rpx;
}
.btnbox {
position: fixed;
width: 100%;
left: 0;
bottom: 0;
z-index: 2;
display: flex;
}
.btnbox .btn {
height: 98rpx;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
background-color: #fff;
font-size: 30rpx;
letter-spacing: 2rpx;
color: #666666;
}
.btnbox .btn.share {
background-color: #16B0FD;
color: #FFFFFF;
box-shadow: 0px -2rpx 4rpx 0px rgba(214,205,189,0.5);
}
@import "../../style/themeindex.wxss";
\ No newline at end of file
......@@ -30,6 +30,7 @@ Page({
sid: 0,
addSort: 0,
sort: 0,
from: 'edit', // 新建页面进来 编辑关卡 index 主题页面进来新建关卡
id: 0,
index: 0,
currentSortIndex: 0,
......@@ -73,29 +74,6 @@ Page({
},
},
onLoad: function (options) { // Do some initialize when page load.
// const {
// id,
// tid,
// sid,
// sort,
// sub, // 课时id
// addSub
// } = options;
// this.setData({
// id,
// tid,
// sid: sid || '',
// sort,
// sub,
// addSub: addSub || 0 // 是否是添加課時
// });
// if (sub && sub > 0) {
// wx.setNavigationBarTitle({
// title: '编辑关卡内容',
// });
// }
// wx.hideShareMenu();
// this.unlockSubjectDetail();
const {
id,
index,
......@@ -105,6 +83,7 @@ Page({
sort,
sid,
tid,
from,
} = options;
this.setData({
tid,
......@@ -114,7 +93,8 @@ Page({
id,
index,
currentSortIndex,
params: JSON.parse(decodeURIComponent(detail)),
from,
// params: JSON.parse(decodeURIComponent(detail)),
})
if (this.data.id > 0) {
this.unlockSubjectDetail();
......@@ -255,7 +235,6 @@ Page({
})
_params.content = JSON.stringify(_content);
const paramsData = Object.assign(_params, {
// class_id: this.data.id,
school_id: this.data.sid,
id: this.data.id,
sort: this.data.sort,
......@@ -336,12 +315,16 @@ Page({
currPage = pages[pages.length - 1]; //当前页面
prevPage = pages[pages.length - 2]; //上一个页面
}
console.log(this.data.sort);
console.log(this.data.currentSortIndex);
prevPage.setData({
[`lockSubjects[${this.data.sort-1}]`]: {...paramsData, id: data.id},
[`lockSubjectLists[${this.data.index}]`]: {...paramsData, id: data.id},
});
if (this.data.from == 'edit') {
prevPage.setData({
[`lockSubjects[${this.data.sort-1}]`]: {...paramsData, id: data.id},
[`lockSubjectLists[${this.data.index}]`]: {...paramsData, id: data.id},
});
} else if (this.data.from == 'index') {
prevPage.setData({
[`lockSubjects[${this.data.sort-1}]`]: {...paramsData, id: data.id, clock_people: 0, review_clock_record_count: 0},
});
}
wx.navigateBack({
delta: 1, // 回退前 delta(默认为1) 页面
success () {
......
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