|
|
@ -91,9 +91,9 @@ Page({
|
|
|
|
student.fetch();
|
|
|
|
student.fetch();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
student.set("ispresent", presence.get("present"));
|
|
|
|
student.set("present", presence.get("present"));
|
|
|
|
student.set("isasking",presence.get("isasking"));
|
|
|
|
student.set("isasking",presence.get("isasking"));
|
|
|
|
student.set("mark", presence.get("mark"))
|
|
|
|
student.set("mark", presence.get("mark"));
|
|
|
|
if(student.id==AV.User.current().id){
|
|
|
|
if(student.id==AV.User.current().id){
|
|
|
|
this.my_presence = presence;
|
|
|
|
this.my_presence = presence;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -112,15 +112,19 @@ Page({
|
|
|
|
//console.log(this.class);
|
|
|
|
//console.log(this.class);
|
|
|
|
teacher = this.class.get("teacher");
|
|
|
|
teacher = this.class.get("teacher");
|
|
|
|
console.log("fetch_class");
|
|
|
|
console.log("fetch_class");
|
|
|
|
//console.log(teacher);
|
|
|
|
console.log(teacher);
|
|
|
|
if(typeof teacher.toJson == "function"){
|
|
|
|
teacher = teacher.toJSON();
|
|
|
|
teacher = teacher.toJson()
|
|
|
|
// if(typeof teacher.toJson == "function"){
|
|
|
|
}
|
|
|
|
// teacher = teacher.toJson();
|
|
|
|
|
|
|
|
// console.log("toJson");
|
|
|
|
|
|
|
|
// }
|
|
|
|
this.setData({
|
|
|
|
this.setData({
|
|
|
|
class_name: this.class.get("name"),
|
|
|
|
class_name: this.class.get("name"),
|
|
|
|
class_id: this.class.get("objectId"),
|
|
|
|
class_id: this.class.get("objectId"),
|
|
|
|
teacher: teacher
|
|
|
|
teacher: teacher
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log(teacher);
|
|
|
|
|
|
|
|
//this.setData(teacher);
|
|
|
|
}).catch(error=>console.error(error.message))
|
|
|
|
}).catch(error=>console.error(error.message))
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -128,9 +132,18 @@ Page({
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
onLoad: function (options) {
|
|
|
|
|
|
|
|
wx.showLoading({
|
|
|
|
|
|
|
|
title: '加载中'
|
|
|
|
|
|
|
|
})
|
|
|
|
this.setData({current_user: AV.User.current()});
|
|
|
|
this.setData({current_user: AV.User.current()});
|
|
|
|
this.class_id = options.class_id;
|
|
|
|
this.class_id = options.class_id;
|
|
|
|
this.fetch_class.bind(this)(this.class_id).then(this.pull_presence.bind(this)).then((presences)=>{this.origin_presences=presences, this.my_presence.enter()});
|
|
|
|
this.fetch_class.bind(this)(this.class_id)
|
|
|
|
|
|
|
|
.then(()=>{
|
|
|
|
|
|
|
|
this.pull_presence.bind(this)();
|
|
|
|
|
|
|
|
wx.hideLoading();
|
|
|
|
|
|
|
|
console.log(this.data);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then(this.my_presence.enter);
|
|
|
|
console.log("onLoad");
|
|
|
|
console.log("onLoad");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|