diff --git a/app.json b/app.json index 7cb299d..2969b24 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,6 @@ { "pages": [ + "pages/classes/classes", "pages/changeuser/changeuser", "pages/index/index", @@ -10,11 +11,11 @@ "pages/game/game", "pages/shouquan/shouquan", "pages/outside/outside", - "pages/classroom/classroom", "pages/setting/setting", "pages/user/user", "pages/addclass/addclass", "pages/classdetail/classdetail", + "pages/classroom/classroom", "pages/classsetting/classsetting" ], "window": { diff --git a/components/icon/myicon.wxss b/components/icon/myicon.wxss index 9b67b59..2091f3b 100644 --- a/components/icon/myicon.wxss +++ b/components/icon/myicon.wxss @@ -1,10 +1,11 @@ @font-face {font-family: "iconfont"; - src: url('iconfont.eot?t=1571740835844'); /* IE9 */ - src: url('iconfont.eot?t=1571740835844#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAcoAAsAAAAADOAAAAbaAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDSAqMQIooATYCJAMYCw4ABCAFhG0HahvwChFVpJWT/RhwN6bvicrMSrUYPYtc3yJlmXlxR7hlswnhaIxwxqm1TdVPJW3DURMJrUPrEaQqgtSUFxF4+P9Dve/9kaRjbox3Uo9XCxLAEmzQghahFq5ZCVWFWaFKshZ9n3Q+NwHaA/z5Y6mXTYf5rmouF/Wu0xZVOBqPEmhAkfU3wpvhRHDH2iTMwmh0Z/Vr3A8QQNrDQ0/FlSIYVF4Y4VGT4UP7g6GSUXukyDDeOefWlWgVEIa5FLsHACuT30f/0DQMANMKeA8ShhQNgtwgE5yLSyFJL1wCab4SACgXARzgAehAb9zKFMAz5JPIFG9nnWcAoA2lOlczWgRLguOCc0MhKkGvgcz4EfQfXqoaqAOJ0JhZ2U0QZEIzwAm2MANEsMQMMILjzEBHcG4GCJzQz9iRBrA5kv0GT8DbHtMUy4itjEgSGaMmFM2wRm6q7rrJ6VE6BoUZcTomZrTfXxsIWNEDP4rtLQGf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N4bjZR3/kfjw6m+OGIJdhQRvJgTBt4+aqE+VLjOlbKYpns+5Gc9HfRrM8TW2NaLdzc1xNPWzEihUjsJEYCyH5euKKcaPGjhotcntMhZOneCqLLxdXedIBosnybdsBy13P828am2ZJZ4YwTYua04N6s4ZAgAveDMMvGAb+ic3Efvqr/pmv0p/Vv7ggur/h4YJYSw65adgmkv10sx+LmhPCpFydWa+fRBBmQvg1V9dcl/urEDo1Johf9XqTLneSQJgIYpJe37zrZTALAABCF8t6fCgAAP6L/Q1CO9t63JoopfIQl1ovlcu4aN2Pb8U/e/oa2/9moP7Bq557/9tKUiG1NK4iIeSiwD6xOWfwNxrRftQAxe7EhR5AoPCC1D0GljsSU/4yRGRjyZu5Yqtgn+CPrRaQBnahGDqhVuYNNNPG0A3dwpRrJRdPWzbBVNQRrixEEBYchDTnD4oF913YhZmvoVnzHXQLMYUpL3G45rSzsJt7CVEjo/+BrOSkgny9SUd/oJsgynIgUfyirGwrXY7neu8bCeUcJ1Stvta1IlVypBd6GEJgykt2kPXR1HV+O50U7wVHyXG08agEQg0yZICBtRxOYolaubZpNP8DtEYglD2LWi1/Qalit06aaKgxgPqOJNCie5k4UUu7mkRKCoUzSywixaQEwe9iZBx/Lwek2tGwER25m0ZkqSHQyHH9WPzKm2CKt0uPjBI1WnzXj8xObG8F9w2GRqS5aWwm9h61SLqJq2RgZZD0vjOroeGe9GgEAAA=') format('woff2'), - url('iconfont.woff?t=1571740835844') format('woff'), - url('iconfont.ttf?t=1571740835844') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ - url('iconfont.svg?t=1571740835844#iconfont') format('svg'); /* iOS 4.1- */ + src: url('iconfont.eot?t=1571919948950'); /* IE9 */ + src: url('iconfont.eot?t=1571919948950#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAd0AAsAAAAADWgAAAcmAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVg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IsBhWlngucNZ+wM1dj0FqaIVSzNsVoRT+ORaGz2frMeOxS4LQb7n4PQzGF6Spq/9sAeB2Wc0prou7ZIQ10gLs4ij2PHEWwKxGIlWlVF0eEiNVUXdeqqTFwYOyLASKTEVahUrl1NITza6pFxYPzfmC7mIEHCgh/tfywQMreP0qVIQ+AfnB5qwbYMt0rodtpOcQ2K6QHhQrNOceawskBN0ftZmCKyUpWjeHAh9bSUDutc1e92l/MWmEbv2kIMKeRQQg0tDGYvtrnkHM/B57ZjybrqzCTJYs5j8npV7aZKs9qKiDw9aB8azaHBnj7rfKecWBICAAAA') format('woff2'), + url('iconfont.woff?t=1571919948950') format('woff'), + url('iconfont.ttf?t=1571919948950') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ + url('iconfont.svg?t=1571919948950#iconfont') format('svg'); /* iOS 4.1- */ + } .iconfont { @@ -32,6 +33,11 @@ .myicon-internet_class:before { content: "\e67f"; } + +.myicon-close:before { + content: "\e637"; +} + .myicon__info { color: #fff; left: 100%; diff --git a/lib/live-query-binding.js b/lib/live-query-binding.js index 8d08007..2dba462 100644 --- a/lib/live-query-binding.js +++ b/lib/live-query-binding.js @@ -1,4 +1,5 @@ module.exports = (subscription, initialStats, onChange) => { + console.log("query_bingding"); let stats = [...initialStats] const remove = value => { stats = stats.filter(target => target.id !== value.id) @@ -7,7 +8,7 @@ module.exports = (subscription, initialStats, onChange) => { const upsert = value => { let existed = false; stats = stats.map(target => (target.id === value.id ? ((existed = true), value) : target)) - if (!existed) stats = [value, ...stats] + if (!existed) stats = [...stats,value] return onChange(stats) } subscription.on('create', upsert) diff --git a/model/message.js b/model/message.js new file mode 100644 index 0000000..7747a8a --- /dev/null +++ b/model/message.js @@ -0,0 +1,26 @@ +const AV = require("../lib/av-live-query-weapp-min") + +class Message extends AV.Object{ + get text(){ + return this.get("text"); + } + set text(value){ + this.set("text", value); + } + get sender(){ + return this.get("sender"); + } + set sender(value){ + this.set("sender", value); + } + get class(){ + return this.get("class"); + } + set class(value){ + this.set("class", value); + } +} + +AV.Object.register(Message, "Message"); + +module.exports = Message; \ No newline at end of file diff --git a/pages/addclass/addclass.wxml b/pages/addclass/addclass.wxml index f9dc285..d63e6fa 100644 --- a/pages/addclass/addclass.wxml +++ b/pages/addclass/addclass.wxml @@ -20,6 +20,5 @@ - \ No newline at end of file diff --git a/pages/addclass/addclass.wxss b/pages/addclass/addclass.wxss index e50d560..4713583 100644 --- a/pages/addclass/addclass.wxss +++ b/pages/addclass/addclass.wxss @@ -52,6 +52,7 @@ .label { color: #999; + display: inline; } .create-class{ diff --git a/pages/classroom/classroom.js b/pages/classroom/classroom.js index 89cd933..12d6276 100644 --- a/pages/classroom/classroom.js +++ b/pages/classroom/classroom.js @@ -2,6 +2,7 @@ const AV = require("../../lib/av-live-query-weapp-min") const { jsonify } = require('../../utils/leancloudutils'); const bind = require("../../lib/live-query-binding") +const Message = require("../../model/message") Page({ /** @@ -14,10 +15,12 @@ Page({ student.present 是否出席 student.isasking :0:没有提问,1:提问,2:请回答 */ + class:null, students: [], presences: [], my_presence: null, - is_askiny: null, + asking_presence: null, + idStudentMap: {}, data: { //以下数据的同步由该代码文件实现,数据的呈现由classroom.wxml实现 students: [], // 该课程所有的学生, 元素类型见上文中的student @@ -29,6 +32,59 @@ Page({ //属性如下:objectId, username, name class_name: "", //课程名称 class_id: "", //该课程的主键(编号) + message_text: "", + messages: [], + show_conversation: true + }, + pull_messages: function(){ + query = new AV.Query("Message"); + query.equalTo("class", this.class); + query.include("sender"); + set_messages = this.set_messages.bind(this); + return AV.Promise.all([query.find().then(set_messages), query.subscribe()]).then(([messages, subscription]) => { + this.messageSubscription = subscription; + if (this.messageUnbind) this.messageUnbind(); + this.messageUnbind = bind(subscription, messages, set_messages); + }).catch(error => console.error(error.message)); + }, + set_messages: function(messages){ + console.log("set_messages"); + messages = messages.map(message=>{ + sender = message.get("sender"); + console.log(this.idStudentMap); + console.log(sender.id); + console.log(!sender.get("name") && sender.id in this.idStudentMap) + if(!sender.get("name")&&sender.id in this.idStudentMap){ + sender = this.idStudentMap[sender.id]; + } + message.set("sender_name", sender.get("name")); + message.set("sender_username", sender.get("username")); + return message; + }) + console.log(jsonify({ messages })); + this.setData(jsonify({messages})); + return messages; + }, + send_message:function(event){ + let {message_text} = this.data; + if(message.trim()==""){return;} + message = new Message({ + text: message_text, + class: this.class, + sender: AV.User.current() + }) + message.save().then(()=>{ + this.setData({message_text: ""}); + console.log("send_message") + }).catch(console.error); + }, + close_conversation: function(event){ + this.setData({show_conversation: false}); + this.messageSubscription.unsubscribe(); + this.messageUnbind(); + }, + update_message:function({detail:{value}}){ + this.setData({message_text: value}); }, enter_setting: function(event){ wx.navigateTo({ @@ -43,9 +99,9 @@ Page({ }, select_stu: function(event){ id = event.currentTarget.dataset.id; - if(id!='none'){ - console.log(id); - }else{console.log("none");id=""} + if(id=='none'){ + id=""; + } this.setData({select_stu_id: id}); }, @@ -53,14 +109,13 @@ Page({ userid = event.currentTarget.dataset.id; status = event.currentTarget.dataset.status; console.log("set_isasking"); - console.log(status); - console.log(typeof status); - this.asking_present = this.presences.filter(presence=>presence.get("user").id==userid)[0]; - this.asking_present.isasking = status; + this.asking_presence = this.presences.filter(presence=>presence.get("user").id==userid)[0]; + console.log(this.asking_presence); + this.asking_presence.isasking = status; wx.showLoading({ title: '请稍候', }) - this.asking_present.save().then(()=>{ + this.asking_presence.save().then(()=>{ wx.hideLoading(); }, ()=>{ wx.hideLoading(); @@ -71,11 +126,10 @@ Page({ }); }, add_mark: function(event){ + console.log("add_mark"); id = event.currentTarget.dataset.id; mark = event.currentTarget.dataset.mark; - console.log("add_mark"); - console.log(mark); - console.log(typeof mark); + console.log(this.presences); presence = this.presences.filter(presence => presence.get("user").id == id)[0]; if(presence==null){ console.warn("没有选择学生"); @@ -90,21 +144,22 @@ Page({ pull_presence: function(){ var query = new AV.Query("Presence"); - //console.log(this.class); query.equalTo("class", this.class); query.include("user"); set_presence = this.set_presence.bind(this); - return AV.Promise.all([query.find().then(set_presence), query.subscribe()]).then(([presents, subscription])=>{ - this.PresentSubscription = subscription; - if(this.presentUnbind) this.presentUnbind(); - this.presentUnbind = bind(subscription, presents, set_presence); + return AV.Promise.all([query.find().then(set_presence), query.subscribe()]).then(([presences, subscription])=>{ + this.presenceSubscription = subscription; + if(this.presenceUnbind) this.presenceUnbind(); + console.log("shwo set_presence"); + console.log(presences); + console.log(set_presence); + this.presenceUnbind = bind(subscription, presences, set_presence); }).catch(error=> console.error(error.message)); }, set_presence: function(presences){ console.log("set_presence"); - //console.log(presences); + console.log(presences); this.presences = presences; - console.log(this.presences); students = this.presences.map((presence)=>{ student = presence.get("user"); if(student.get("username")==null){ @@ -115,6 +170,7 @@ Page({ student.fetch(); } } + this.idStudentMap[student.id]=student; student.set("present", presence.get("present")); student.set("isasking",presence.get("isasking")); student.set("mark", presence.get("mark")); @@ -125,7 +181,6 @@ Page({ return student; }); this.students = students; - console.log(students); this.setData(jsonify({students})); return presences; }, @@ -135,23 +190,14 @@ Page({ query.equalTo("objectId", class_id); query.include("teacher"); return query.find().then((classes) => { - //console.log(this.class); this.class = classes[0]; teacher = this.class.get("teacher"); - console.log("pull_class"); - console.log(teacher); teacher = teacher.toJSON(); - // if(typeof teacher.toJson == "function"){ - // teacher = teacher.toJson(); - // console.log("toJson"); - // } this.setData({ class_name: this.class.get("name"), class_id: this.class.get("objectId"), teacher: teacher }); - console.log(teacher); - //this.setData(teacher); }).catch(error=>console.error(error.message)) }, @@ -164,16 +210,18 @@ Page({ }) this.setData({current_user: AV.User.current().toJSON()}); this.class_id = options.class_id; + this.class = AV.Object.createWithoutData("Class_", this.class_id); + this.pull_presence.bind(this)().then((presences) => { + this.my_presence.enter(); + }); this.pull_class.bind(this)(this.class_id) - .then(()=>{ - wx.setNavigationBarTitle({ - title: this.data.class_name, - }) - console.log("pull_presence"); - this.pull_presence.bind(this)().then((presences) => { this.my_presence.enter(); this.presences = presences;}); - wx.hideLoading(); - console.log("hideLoading"); - }); + .then(() => { + wx.setNavigationBarTitle({ + title: this.data.class_name, + }) + wx.hideLoading();//better place?? + }); + this.pull_messages.bind(this)(); console.log("onLoad"); }, @@ -189,9 +237,8 @@ Page({ */ onShow: function () { console.log("onShow"); - console.log("enter class when onShow"); - console.log(AV.User.current()); if(this.my_presence){ + console.log("enter class when onShow"); this.my_presence.enter(); } }, @@ -210,14 +257,17 @@ Page({ onUnload: function () { this.my_presence.leave(); console.log("onUnload"); - this.PresentSubscription.unsubscribe(); - this.presentUnbind(); + this.presenceSubscription.unsubscribe(); + this.presenceUnbind(); + this.messageSubscription.unsubscribe(); + this.messageUnbind(); }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { + console.log(this.idStudentMap); this.pull_presence.bind(this)(); this.pull_class.bind(this)(this.class_id) .then(() => { diff --git a/pages/classroom/classroom.wxml b/pages/classroom/classroom.wxml index 461a332..5ed07e1 100644 --- a/pages/classroom/classroom.wxml +++ b/pages/classroom/classroom.wxml @@ -1,4 +1,24 @@ - + + + + + + + + {{message.sender_name}}:{{message.text}} + + + + + + 发送 + + 课程名称:{{class_name}} 教员姓名:{{teacher.name}} @@ -31,4 +51,5 @@ 更多 + diff --git a/pages/classroom/classroom.wxss b/pages/classroom/classroom.wxss index 3f6d221..a961e3a 100644 --- a/pages/classroom/classroom.wxss +++ b/pages/classroom/classroom.wxss @@ -1,55 +1,48 @@ - -.grid-celll -{ - margin-left:auto; - margin-right:auto; - text-align: center; - width:230rpx; - display: flex; - flex-direction: column; - flex-wrap: wrap; +movable-area{ + height: 100%; + width: 100%; } +movable-view{ - -.grid-cell { - padding: 30rpx 0; - border-bottom: 1rpx solid #eee; - position: relative; + background: lightgrey; + opacity: .6; + width: 130px; + height: 200px; + font-size: 10px; } - -.bla { - color:black; - +.close{ + position: fixed; + right: 0; + top: 0; } - -.reed { - color: red; - position: absolute; - right: 3rpx; - top: 50%; - height: 40rpx; - line-height: 40rpx; - margin-top: -20rpx; +.message-list{ + height: 175px; + width: 130px; } - -.gre { - color: greenyellow; +.message-footer{ + position: fixed; + bottom: 0; + width: 100%; + border-color: gray; + border-top: 1rpx solid; +} +.message{ + padding-left: 4px; +} +.send-message{ + align-self: center; + color: green; position: absolute; - right: 3rpx; - top: 50%; - height: 40rpx; - line-height: 40rpx; - margin-top: -20rpx; + right:0; } - -.index { - font-family: 'PingFang SC'; +.send-message:hover{ + opacity: 0.6; } -.sco { - margin: 20rpx 50rpx; +.classroom{ + width: 100%; + height: 100%; } - .student-list{ display: -webkit-flex; display: flex; diff --git a/pages/classsetting/classsetting.js b/pages/classsetting/classsetting.js index 5eb9eee..2a9a8ec 100644 --- a/pages/classsetting/classsetting.js +++ b/pages/classsetting/classsetting.js @@ -45,6 +45,9 @@ Page({ query_presence = new AV.Query("Presence"); query_presence.equalTo("class", class_); query_presence.find().then(AV.Object.destroyAll); + query_message = new AV.Query("Message"); + query_message.equalTo("class", class_); + query_message.find().then(AV.Object.destroyAll); query_file = new AV.Query("File_"); query_file.equalTo("class", class_); query_file.find().then(files=>{ diff --git a/pages/test/test.js b/pages/test/test.js new file mode 100644 index 0000000..8aeebcd --- /dev/null +++ b/pages/test/test.js @@ -0,0 +1,68 @@ +// pages/test/test.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + data:[{index:2,value:"一"}, + {index:1, value:"二"}, + {index:2, value:'三'}] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/test/test.json b/pages/test/test.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/test/test.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/test/test.wxml b/pages/test/test.wxml new file mode 100644 index 0000000..465b252 --- /dev/null +++ b/pages/test/test.wxml @@ -0,0 +1,6 @@ + +pages/test/test.wxml + + + {{d.value}} + \ No newline at end of file diff --git a/pages/test/test.wxss b/pages/test/test.wxss new file mode 100644 index 0000000..3ee2480 --- /dev/null +++ b/pages/test/test.wxss @@ -0,0 +1 @@ +/* pages/test/test.wxss */ \ No newline at end of file