diff --git a/pages/classes/classes.wxml b/pages/classes/classes.wxml index 6179a52..8bf3225 100644 --- a/pages/classes/classes.wxml +++ b/pages/classes/classes.wxml @@ -31,6 +31,8 @@ classes: 课程列表 type: Array ## 在课堂界面右下角进入“更多”可以查看本课堂的课程文件资源 + ## 教员可以在课程的设置界面中更新课程的名称,还可以将学员移除本课程的学习 + ## 其他 ### 用户可以在设置中更改姓名、用户名 diff --git a/pages/classroom/classroom.js b/pages/classroom/classroom.js index 15e3117..89cd933 100644 --- a/pages/classroom/classroom.js +++ b/pages/classroom/classroom.js @@ -32,7 +32,7 @@ Page({ }, enter_setting: function(event){ wx.navigateTo({ - url: '../classsetting/classsetting?class_id='+this.data.class_id+"&teacher_id="+this.data.teacher.objectId, + url: '../classsetting/classsetting?class_id='+this.data.class_id+"&teacher_id="+this.data.teacher.objectId+"&classname="+this.data.class_name, }) }, @@ -130,7 +130,7 @@ Page({ return presences; }, - fetch_class: function(class_id){ + pull_class: function(class_id){ query = new AV.Query("Class_"); query.equalTo("objectId", class_id); query.include("teacher"); @@ -138,7 +138,7 @@ Page({ //console.log(this.class); this.class = classes[0]; teacher = this.class.get("teacher"); - console.log("fetch_class"); + console.log("pull_class"); console.log(teacher); teacher = teacher.toJSON(); // if(typeof teacher.toJson == "function"){ @@ -164,7 +164,7 @@ Page({ }) this.setData({current_user: AV.User.current().toJSON()}); this.class_id = options.class_id; - this.fetch_class.bind(this)(this.class_id) + this.pull_class.bind(this)(this.class_id) .then(()=>{ wx.setNavigationBarTitle({ title: this.data.class_name, @@ -219,6 +219,13 @@ Page({ */ onPullDownRefresh: function () { this.pull_presence.bind(this)(); + this.pull_class.bind(this)(this.class_id) + .then(() => { + wx.setNavigationBarTitle({ + title: this.data.class_name, + }) + } + ); }, /** diff --git a/pages/classsetting/classsetting.js b/pages/classsetting/classsetting.js index 8be3c27..5eb9eee 100644 --- a/pages/classsetting/classsetting.js +++ b/pages/classsetting/classsetting.js @@ -10,9 +10,28 @@ Page({ */ class: null, data: { + classname:"", + new_classname:"", presences:[], teacher_id: "" }, + update_classname: function({detail: {value}}){ + this.setData({new_classname:value}) + }, + change_name:function(event){ + let {new_classname} =this.data + this.class.set("name", new_classname).save().then(()=>{ + wx.showToast({ + title:"更新成功" + }); + this.setData({classname: new_classname}); + },()=>{ + wx.showToast({ + title:"操作失败", + icon:"none" + }) + }); + }, del_class:function(event){ class_ = this.class; wx.showModal({ @@ -95,12 +114,17 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + classname = options.classname; class_id = options.class_id; teacher_id = options.teacher_id; console.log(teacher_id); this.class = AV.Object.createWithoutData("Class_", class_id); - this.setData({teacher_id: teacher_id}); + this.setData({ + teacher_id: teacher_id, + classname:classname + }); this.pull_presences(); + console.log(this.data); }, /** diff --git a/pages/classsetting/classsetting.wxml b/pages/classsetting/classsetting.wxml index fd6ec72..be0b548 100644 --- a/pages/classsetting/classsetting.wxml +++ b/pages/classsetting/classsetting.wxml @@ -1,7 +1,18 @@ + + + 更改课程名 + - 学员列表 + + 学员列表长按移除 +