You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
1.8 KiB
94 lines
1.8 KiB
5 years ago
|
const { Class } = require("../../model/class");
|
||
|
const { login } = require("../../model/user");
|
||
|
const AV = require("../../lib/av-live-query-weapp-min.js");
|
||
|
const { jsonify } = require('../../utils/leancloudutils');
|
||
|
// pages/class/class.js
|
||
|
|
||
|
const getDataForRender = class_ => ({
|
||
|
name: class_.get('name'),
|
||
|
objectId: class_.get('objectId')
|
||
|
});
|
||
|
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
classes : [],
|
||
|
data: {
|
||
|
classes: [
|
||
|
]
|
||
|
},
|
||
|
enter_class: function(event){
|
||
|
console.log(event);
|
||
|
var class_id = event.currentTarget.dataset.class_id;
|
||
|
var class_name = event.currentTarget.dataset.class_name;
|
||
|
wx.navigateTo({
|
||
|
url: "../classroom/classroom?class_id="+class_id+"&"+"class_name="+class_name,
|
||
|
})
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow: function () {
|
||
|
var query = new AV.Query("Class_");
|
||
|
query.find().then((classes) => {
|
||
|
this.classes = classes
|
||
|
this.setData(jsonify({ classes }));
|
||
|
})
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh: function () {
|
||
|
var query = new AV.Query("Class_");
|
||
|
query.find().then((classes) => {
|
||
|
this.classes = classes
|
||
|
this.setData(jsonify({classes}));
|
||
|
})
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage: function () {
|
||
|
|
||
|
}
|
||
|
})
|