From 73dd4ed545ee85fedd08e68926116753c22dc64a Mon Sep 17 00:00:00 2001 From: educoder_weapp Date: Fri, 18 Oct 2019 18:41:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=80=E4=BA=9Bmo?= =?UTF-8?q?dels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + app.js | 2 +- app.json | 3 +- readme.txt.txt => constants/api.js | 0 constants/appconstants.js | 1 + model/class.js | 23 +++++++++++ model/presence.js | 16 ++++++++ model/user.js | 0 pages/class.wxml | 0 pages/class.wxss | 0 pages/class/class.js | 66 ++++++++++++++++++++++++++++++ pages/class/class.json | 3 ++ pages/class/class.wxml | 3 ++ pages/class/class.wxss | 1 + pages/index/index.js | 3 +- utils.js | 0 utils/userutils.js | 0 读我.txt | 8 +++- 18 files changed, 126 insertions(+), 5 deletions(-) rename readme.txt.txt => constants/api.js (100%) create mode 100644 constants/appconstants.js create mode 100644 model/class.js create mode 100644 model/presence.js create mode 100644 model/user.js create mode 100644 pages/class.wxml create mode 100644 pages/class.wxss create mode 100644 pages/class/class.js create mode 100644 pages/class/class.json create mode 100644 pages/class/class.wxml create mode 100644 pages/class/class.wxss create mode 100644 utils.js create mode 100644 utils/userutils.js diff --git a/.gitignore b/.gitignore index 14ea590..9d10d27 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ $RECYCLE.BIN/ .Spotlight-V100 .TemporaryItems .Trashes +lib_refer +project.config.json # Node.js node_modules/ diff --git a/app.js b/app.js index 4edc902..e7e59cf 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ //app.js //导入leancloud库,与后台交互 -const AV = require('./utils/av-live-query-weapp-min'); +const AV = require('./lib/av-live-query-weapp-min'); //初始化 AV.init({ diff --git a/app.json b/app.json index 8fac543..6294d88 100644 --- a/app.json +++ b/app.json @@ -8,7 +8,8 @@ "pages/game/game", "pages/shouquan/shouquan", "pages/outside", - "pages/outside/outside" + "pages/outside/outside", + "pages/class/class" ], "window": { "backgroundTextStyle": "light", diff --git a/readme.txt.txt b/constants/api.js similarity index 100% rename from readme.txt.txt rename to constants/api.js diff --git a/constants/appconstants.js b/constants/appconstants.js new file mode 100644 index 0000000..d9b8108 --- /dev/null +++ b/constants/appconstants.js @@ -0,0 +1 @@ +export const marster_key = ""; //to be completed \ No newline at end of file diff --git a/model/class.js b/model/class.js new file mode 100644 index 0000000..0d17ce1 --- /dev/null +++ b/model/class.js @@ -0,0 +1,23 @@ +const AV = require('../lib/av-live-query-weapp-min'); + +class Class extends AV.Object{ + get name(){ + return this.get("name"); + } + set name(value){ + this.set("name", value); + } + get students(){ + return this.get("students"); + } + add_student(user){ + this.addUnique("students", user.id); + } + del_student(user){ + let students = this.get("students"); + if(user.id in students){ + this.remove(user.id); + } + } + +} \ No newline at end of file diff --git a/model/presence.js b/model/presence.js new file mode 100644 index 0000000..ac1b644 --- /dev/null +++ b/model/presence.js @@ -0,0 +1,16 @@ +const AV = require('../lib/av-live-query-weapp-min'); + +class Presence extends AV.Object{ + set user(value){ + this.set("user", value); + } + get user(){ + return this.get("user"); + } + set class(value){ + this.set("class", value); + } + get class(){ + return this.get("class"); + } +} \ No newline at end of file diff --git a/model/user.js b/model/user.js new file mode 100644 index 0000000..e69de29 diff --git a/pages/class.wxml b/pages/class.wxml new file mode 100644 index 0000000..e69de29 diff --git a/pages/class.wxss b/pages/class.wxss new file mode 100644 index 0000000..e69de29 diff --git a/pages/class/class.js b/pages/class/class.js new file mode 100644 index 0000000..694d348 --- /dev/null +++ b/pages/class/class.js @@ -0,0 +1,66 @@ +// pages/class/class.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + 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/class/class.json b/pages/class/class.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/class/class.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/class/class.wxml b/pages/class/class.wxml new file mode 100644 index 0000000..2f7bc55 --- /dev/null +++ b/pages/class/class.wxml @@ -0,0 +1,3 @@ + +pages/class/class.wxml +界面待完成 diff --git a/pages/class/class.wxss b/pages/class/class.wxss new file mode 100644 index 0000000..3d5fb7d --- /dev/null +++ b/pages/class/class.wxss @@ -0,0 +1 @@ +/* pages/class/class.wxss */ \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index f1def29..3da9585 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -7,7 +7,8 @@ Page({ { id: 'https', title: '实验一:HTTPS' }, { id: 'session', title: '实验二:会话' }, { id: 'websocket', title: '实验三:WebSocket' }, - { id: 'game', title: '实验四:剪刀石头布小游戏' } + { id: 'game', title: '实验四:剪刀石头布小游戏' }, + { id: "class", title: "进入教室"} ], done: lab.getFinishLabs() }, diff --git a/utils.js b/utils.js new file mode 100644 index 0000000..e69de29 diff --git a/utils/userutils.js b/utils/userutils.js new file mode 100644 index 0000000..e69de29 diff --git a/读我.txt b/读我.txt index 9ebb734..904c984 100644 --- a/读我.txt +++ b/读我.txt @@ -1,11 +1,15 @@ -登录微信公众平台,前往 设置 > 开发设置 > 服务器配置 > 「修改」 链接,增加下述域名为白名单中的域名 +# 后台数据交互部分日志 + +## 登录微信公众平台,前往 设置 > 开发设置 > 服务器配置 > 「修改」 链接,增加下述域名为白名单中的域名 +request合法域名 fqcxn98z.api.lncldglobal.com fqcxn98z.engine.lncldglobal.com fqcxn98z.rtm.lncldglobal.com fqcxn98z.push.lncldglobal.com app-router.leancloud.cn +socket合法域名 us-w1-backend2.leancloud.cn us-w1-backend3.leancloud.cn us-w1-backend4.leancloud.cn us-w1-backend5.leancloud.cn -us-w1-backend6.leancloud.cn \ No newline at end of file +us-w1-backend6.leancloud.cn