教师可以更改课程名称

smart_class
educoder_weapp 5 years ago
parent c8664c2f01
commit 3eeb0195b2

@ -31,6 +31,8 @@ classes: 课程列表 type: Array
## 在课堂界面右下角进入“更多”可以查看本课堂的课程文件资源
## 教员可以在课程的设置界面中更新课程的名称,还可以将学员移除本课程的学习
## 其他
### 用户可以在设置中更改姓名、用户名

@ -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,
})
}
);
},
/**

@ -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);
},
/**

@ -1,7 +1,18 @@
<!--pages/classsetting/classsetting.wxml-->
<view class="container">
<view class="flex-wrap header">
<input
placeholder="课程名:{{classname}}"
bindinput="update_classname"
bindconfirm="change"
value="{{new_classname}}"
class="change_name"/>
<text style="display: {{new_classname ? 'inline': 'none'}}" class="change tappable" ontap="change_name">更改课程名</text>
</view>
<view class="student-list">
<text>学员列表</text>
<view class="flex-wrap title">
<text>学员列表</text><text class="hint">长按移除</text>
</view>
<block wx:for="{{presences}}" wx:for-item="presence" wx:key="objectId">
<view hidden="{{presence.student_id==teacher_id}}" class="student flex-wrap" data-id="{{presence.objectId}}" bindlongtap="del_student">
<text>{{presence.student_name}}</text>

@ -1,4 +1,29 @@
/* pages/classsetting/classsetting.wxss */
.header {
height: 54px;
align-items: center;
background-color: #FFF;
}
.title{
align-items: center
}
.change_name {
flex: 1;
font-size: 18px;
box-sizing: border-box;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
padding-left: 12px;
line-height: 100%;
height: 100%;
}
.change {
color: #FFF;
background-color: #1aad19;
font-size: 16px;
line-height: 53px;
padding: 0 16px;
}
button{
margin: 2px 36px;
font-size: 14px;

Loading…
Cancel
Save