// pages/course/course.js /*Page({ /** * 页面的初始数据 data: { }, /** * 生命周期函数--监听页面加载 onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 onReady() { }, /** * 生命周期函数--监听页面显示 onShow() { }, /** * 生命周期函数--监听页面隐藏 onHide() { }, /** * 生命周期函数--监听页面卸载 onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 onReachBottom() { }, /** * 用户点击右上角分享 onShareAppMessage() { } })*/ // pages/index/index.js Page({ data: { mounth:"11", // 显示月份 // 头部数据 (数据也可以存储在数据库中读取出来,这样代码可以减少许多) allOver:[{ id:0, // ID week:"日", // 周 date:"23" // 日 },{ id:1, week:"一", date:"24" },{ id:2, week:"二", date:"25" },{ id:3, week:"三", date:"26" },{ id:4, week:"四", date:"27" },{ id:5, week:"五", date:"28" },{ id:6, week:"六", date:"29" }], // 课程数据 (如果要从数据库取数据,需要进行排序) courseInfo:[{ id:0, week:"星期日", // 代表当天拥有的课程 courseList:[ // 同理也需要排序,可以根据position来进行定位 { id:0, position:1, ifexist:false, },{ id:1, position:2, ifexist:true, // 存在与否属性 courseName:"高等数学", // 课程名称 courseRoom:"A-201" // 课程教室 },{ id:2, position:3, ifexist:false, },{ id:3, position:4, ifexist:false, }] },{ id:1, week:"星期一", courseList:[{ id:0, position:1, ifexist:true, courseName:"线性代数", courseRoom:"B-301", },{ id:1, position:2, ifexist:true, courseName:"计算机导论", courseRoom:"N25-101" },{ id:2, position:3, ifexist:false, },{ id:3, position:4, ifexist:false, }] },{ id:2, week:"星期二", courseList:[{ id:0, position:1, ifexist:false },{ id:1, position:2, ifexist:true, courseName:"数据结构", courseRoom:"S3-201" },{ id:2, position:3, ifexist:false, },{ id:3, position:4, ifexist:false, }] },{ id:3, week:"星期三", courseList:[{ id:0, position:1, ifexist:false, },{ id:1, position:2, ifexist:false, },{ id:2, position:3, ifexist:true, courseName:"互联网开发", courseRoom:"N18-214" },{ id:3, position:4, ifexist:false, }] },{ id:4, week:"星期四", courseList:[{ id:0, position:1, ifexist:true, courseName:"程序设计基础", courseRoom:"N25-333" },{ id:1, position:2, ifexist:false, },{ id:2, position:3, ifexist:false, },{ id:3, position:4, ifexist:false, }] },{ id:5, week:"星期五", courseList:[{ id:0, position:1, ifexist:true, courseName:"接口技术", courseRoom:"N25-331" },{ id:1, position:2, ifexist:false, },{ id:2, position:3, ifexist:false, },{ id:3, position:4, ifexist:false, }] },{ id:6, week:"星期六", courseList:[{ id:0, position:1, ifexist:true, courseName:"Java程序设计", courseRoom:"S5-101" },{ id:1, position:2, ifexist:false, },{ id:2, position:3, ifexist:false, },{ id:3, position:4, ifexist:false, }] }] }, onLoad(options) { }, })