Commit 30aa7fae authored by wangxuelai's avatar wangxuelai

'新增班级流程添加'

parent 90e1caa4
...@@ -336,6 +336,10 @@ Page({ ...@@ -336,6 +336,10 @@ Page({
wx.redirectTo({ wx.redirectTo({
url: `/business/pages/circleindex/index?id=${res.data.id}&sid=${this.data.sid}&from=2` url: `/business/pages/circleindex/index?id=${res.data.id}&sid=${this.data.sid}&from=2`
}) })
}else if(this.data.from == 4){
wx.navigateBack({
delta: 1, // 回退前 delta(默认为1) 页面
})
}else{ }else{
wx.redirectTo({ wx.redirectTo({
url: `/business/pages/classservice/classdetail?id=${res.data.id}&sid=${this.data.sid}` url: `/business/pages/classservice/classdetail?id=${res.data.id}&sid=${this.data.sid}`
......
...@@ -250,17 +250,17 @@ Page({ ...@@ -250,17 +250,17 @@ Page({
switch (thisSubject.subject_type) { switch (thisSubject.subject_type) {
case 1: case 1:
wx.navigateTo({ wx.navigateTo({
url: `/business/pages/themeindex/index?id=${this.data.id}&tid=${this.data.tid}&sid=${this.data.sid}` url: `/business/pages/themeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
}) })
break; break;
case 2: case 2:
wx.navigateTo({ wx.navigateTo({
url: `/business/pages/calendarthemeindex/index?id=${this.data.id}&tid=${this.data.tid}&sid=${this.data.sid}` url: `/business/pages/calendarthemeindex/index?tid=${this.data.tid}&sid=${this.data.sid}`
}) })
break; break;
case 3: case 3:
wx.navigateTo({ wx.navigateTo({
url: `/business/pages/morethemeindex/index?id=${this.data.id}&tid=${thisSubject.unlock_mode_id}&sid=${this.data.sid}` url: `/business/pages/morethemeindex/index?mid=${this.data.clock.unlock_mode_id}&tid=${thisSubject.id}&sid=${this.data.sid}`
}) })
break; break;
default: default:
......
...@@ -46,12 +46,12 @@ Page({ ...@@ -46,12 +46,12 @@ Page({
sid, sid,
classes: !class_ids ? [] : JSON.parse(decodeURIComponent(class_ids)), classes: !class_ids ? [] : JSON.parse(decodeURIComponent(class_ids)),
}); });
this.getMyRoleInfo()
}, },
onReady: function() { // Do something when page ready. onReady: function() { // Do something when page ready.
}, },
onShow: function() { // Do something when page show. onShow: function() { // Do something when page show.
this.getMyRoleInfo()
}, },
onHide: function() { // Do something when page hide. onHide: function() { // Do something when page hide.
...@@ -101,9 +101,22 @@ Page({ ...@@ -101,9 +101,22 @@ Page({
}).then((res) => { }).then((res) => {
const { code, data } = res; const { code, data } = res;
if (code == 200) { if (code == 200) {
const chooseClasses = [];
data.list.forEach((course) => {
course.classes && course.classes.forEach((classes) => {
if (this.data.classes.indexOf(classes.id) != -1) {
chooseClasses.push({
title: classes.title,
id: classes.id
});
}
})
})
this.setData({ this.setData({
courseList: data.list courseList: data.list,
chooseClasses,
}) })
console.log(chooseClasses, 'chooseClasses');
} else { } else {
} }
...@@ -114,6 +127,7 @@ Page({ ...@@ -114,6 +127,7 @@ Page({
const { classes, chooseClasses } = this.data; const { classes, chooseClasses } = this.data;
const classesIndex = classes.indexOf(item.id); const classesIndex = classes.indexOf(item.id);
const chooseClassesIndex = chooseClasses.findIndex(ele => ele.id == item.id); const chooseClassesIndex = chooseClasses.findIndex(ele => ele.id == item.id);
console.log(chooseClassesIndex, 'chooseClassesIndex');
if (classesIndex == -1) { if (classesIndex == -1) {
classes.push(item.id); classes.push(item.id);
} else { } else {
...@@ -125,8 +139,10 @@ Page({ ...@@ -125,8 +139,10 @@ Page({
id: item.id, id: item.id,
}); });
} else { } else {
chooseClasses.splice(classesIndex, 1); chooseClasses.splice(chooseClassesIndex, 1);
} }
console.log(classes, 'classes');
console.log(chooseClasses, 'chooseClasses');
this.setData({ this.setData({
classes, classes,
chooseClasses, chooseClasses,
...@@ -136,6 +152,15 @@ Page({ ...@@ -136,6 +152,15 @@ Page({
const curPages = getCurrentPages(); const curPages = getCurrentPages();
let currPage = null; //当前页面 let currPage = null; //当前页面
let prevPage = null; //上一个页面 let prevPage = null; //上一个页面
console.log(this.data.chooseClasses, 'this.data.chooseClasses');
// return;
if (this.data.chooseClasses.length == 0) {
wx.showToast({
title: '请选择班级',
icon: 'none',
})
return;
}
if (curPages.length >= 2) { if (curPages.length >= 2) {
currPage = curPages[curPages.length - 1]; //当前页面 currPage = curPages[curPages.length - 1]; //当前页面
prevPage = curPages[curPages.length - 2]; //上一个页面 prevPage = curPages[curPages.length - 2]; //上一个页面
...@@ -146,5 +171,10 @@ Page({ ...@@ -146,5 +171,10 @@ Page({
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}) })
},
toAddClass() {
wx.navigateTo({
url: `/business/pages/circleeditor/index?sid=${this.data.sid}&id=0&from=4`,
})
} }
}) })
\ No newline at end of file
...@@ -24,5 +24,6 @@ ...@@ -24,5 +24,6 @@
</view> </view>
</block> </block>
<empty-content text="暂无数据~" emptyimg="" wx:else></empty-content> <empty-content text="暂无数据~" emptyimg="" wx:else></empty-content>
<view class="savebtn" hover-class="none" hover-stop-propagation="false" bindtap="saveClass">保存</view> <view class="savebtn" hover-class="none" hover-stop-propagation="false" bindtap="saveClass" wx:if="{{courseList.length > 0}}">保存</view>
<view class="savebtn" hover-class="none" hover-stop-propagation="false" bindtap="toAddClass" wx:if="{{courseList.length == 0}}">新增班级</view>
</view> </view>
...@@ -155,11 +155,7 @@ Page({ ...@@ -155,11 +155,7 @@ Page({
}, },
goThemeDetail (e) { goThemeDetail (e) {
const { index, item } = e.currentTarget.dataset; const { index, item } = e.currentTarget.dataset;
if (item.id > 0) { if (index >= 1) {
wx.navigateTo({
url: `/business/pages/morethemeindex/index?mid=${this.data.tid}&tid=${item.id}&sid=${this.data.sid}`,
})
} else {
if (this.data.lockSubjects[index - 1].id == 0) { if (this.data.lockSubjects[index - 1].id == 0) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
...@@ -168,6 +164,12 @@ Page({ ...@@ -168,6 +164,12 @@ Page({
}) })
return; return;
} }
}
if (item.id > 0) {
wx.navigateTo({
url: `/business/pages/morethemeindex/index?mid=${this.data.tid}&tid=${item.id}&sid=${this.data.sid}`,
})
} else {
wx.navigateTo({ 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`, 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`,
}) })
......
...@@ -311,7 +311,23 @@ Page({ ...@@ -311,7 +311,23 @@ Page({
editType, editType,
max_clock_count, max_clock_count,
unlock_limit, unlock_limit,
} = this.data } = this.data;
if (join_rule_type == 3 && join_secret == '') {
wx.showToast({
title: '请输入密码',
icon: 'none'
})
return;
}
if ((join_rule_type == 2 || join_rule_type == 4) && classes.length == 0) {
wx.showModal({
title: '提示',
content: `当前选择的参与打卡模式为${join_rule_type == 2 ? '【任何人都可参与(指定班级学生收到通知)】' : ''}${join_rule_type == 4 ? '【指定班级学生参与】' : ''},请选择班级`,
showCancel: false,
})
return;
}
console.log()
let currPage = null; //当前页面 let currPage = null; //当前页面
let prevPage = null; //上一个页面 let prevPage = null; //上一个页面
if (pages.length >= 2) { if (pages.length >= 2) {
......
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