From 0f3f8b274b5dd7bf1716085e4b017de15356e297 Mon Sep 17 00:00:00 2001 From: educoder_weapp Date: Sun, 20 Oct 2019 23:39:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 6 ++- app.wxss | 18 ++++++- images/course.png | Bin 0 -> 1018 bytes pages/changeuser/changeuser.js | 88 +++++++++++++++++++++++++++++++ pages/changeuser/changeuser.json | 5 ++ pages/changeuser/changeuser.wxml | 15 ++++++ pages/changeuser/changeuser.wxss | 15 ++++++ pages/classes/classes.json | 1 + pages/classes/classes.wxml | 17 +++--- pages/classes/classes.wxss | 56 +++++++++++++------- pages/classroom/classroom.js | 2 +- pages/setting/setting.js | 4 ++ pages/setting/setting.json | 4 ++ pages/setting/setting.wxml | 4 ++ pages/setting/setting.wxss | 7 +++ pages/user/user.js | 56 ++++++++++++++++++++ pages/user/user.json | 4 ++ pages/user/user.wxml | 16 ++++++ pages/user/user.wxss | 21 ++++++++ 19 files changed, 311 insertions(+), 28 deletions(-) create mode 100644 images/course.png create mode 100644 pages/changeuser/changeuser.js create mode 100644 pages/changeuser/changeuser.json create mode 100644 pages/changeuser/changeuser.wxml create mode 100644 pages/changeuser/changeuser.wxss create mode 100644 pages/setting/setting.js create mode 100644 pages/setting/setting.json create mode 100644 pages/setting/setting.wxml create mode 100644 pages/setting/setting.wxss create mode 100644 pages/user/user.js create mode 100644 pages/user/user.json create mode 100644 pages/user/user.wxml create mode 100644 pages/user/user.wxss diff --git a/app.json b/app.json index cd58d30..c887095 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,8 @@ { "pages": [ "pages/classes/classes", + "pages/changeuser/changeuser", + "pages/index/index", "pages/config/config", "pages/https/https", @@ -9,7 +11,9 @@ "pages/game/game", "pages/shouquan/shouquan", "pages/outside/outside", - "pages/classroom/classroom" + "pages/classroom/classroom", + "pages/setting/setting", + "pages/user/user" ], "window": { "backgroundTextStyle": "light", diff --git a/app.wxss b/app.wxss index 145c85b..774db91 100644 --- a/app.wxss +++ b/app.wxss @@ -1,10 +1,26 @@ -page, .lab { +page { height: 100%; + background-color: #f2f2f2; } .flex-wrap{ display: flex; flex-direction: row; } +.form-wrap { + border-top: 1px solid #eee; + margin: 8px 0; +} +.tappable:hover { + opacity: .6; +} + +.hint, +.error { + display: block; + margin: 8px 0; + color: #888; + font-size: 14px; +} .lab { display: flex; diff --git a/images/course.png b/images/course.png new file mode 100644 index 0000000000000000000000000000000000000000..277c5c27b800b78915b467b867cc02797746d5ad GIT binary patch literal 1018 zcmVp>2vo#X%h0q+LWemx?aZL2+`i4sFiX8}d<590WxQiXsjo zB8XqO*g-@QoTLuzr3b~2(z~mJg0|!yN%f??goZSi+a{Oa zX0-1fPSQ-=5Y}9xPX2F!zfJaSHqMbihvhj41kby!qQ_V7{#piIt&p)2q;V& zy(xKcUx{geK*yb+Y!Q>bfm`)lF7vaRB7_l8hDypxKbXz}yvGIf9f*uVR(n`23Bn1m z!P>TE63y!t6tc_0&0_k~EyB&;pi~ z#TfvDU~F-~5IrrQ#cHfO4nYk?P9KvEt$0!SlZ-s@cY=p(VE<;~H%YX$$e#EMn|?H$S{3rK@t zul>%0`ASO@)UQ*|Z|YB~0WMSqSdjW9329Z(LK@0PRY3-Lm_bHuckXkgg%hjIo%IgUyfSB)D z5~=f9{X^LBVwAvNN&==!fLb*5n^Az*tO>SvotLdrX=*v7{elA$sl}`|6D532GQb`* z(W%%EGxj<^$)Jl-{ti&{9uV~mdyN-)6Z8tm@8|Zz)oSPDbED&{eO~thy!I@4{dyf( zK&`jPcnR=|FR%c=DJ%N-eeVzv9msEdu>ikYWc(Ty{rkQ%z^luK4eZqfz2Xbp1ic0b zT|mcB<#wADLwdb%t$P7M1qT-3wax|&FzoXK3kW;FsITw42}T`Y*yF_l;`;!Pzs!W4 of}&kN{@{ + this.setData(jsonify({current_user: AV.User.current()})); + wx.showToast({ + title: '更改用户成功', + icon: 'success', + });}, + (error)=>{ + wx.showToast({ + title: "抱歉,暂时无法登陆此用户", + icon: "none"}) + }).catch(error=>console.error(error.message)); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData(jsonify({current_user: AV.User.current()})); + query = new AV.Query("User"); + return query.find().then((users)=>{this.setData(jsonify({users}))}); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/changeuser/changeuser.json b/pages/changeuser/changeuser.json new file mode 100644 index 0000000..ed511b2 --- /dev/null +++ b/pages/changeuser/changeuser.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "更改登陆用户", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/pages/changeuser/changeuser.wxml b/pages/changeuser/changeuser.wxml new file mode 100644 index 0000000..e2d4d41 --- /dev/null +++ b/pages/changeuser/changeuser.wxml @@ -0,0 +1,15 @@ + + + + 当前登陆用户: 姓 名:{{current_user.name}} + 用户名:{{current_user.username}} + + 点击切换用户: + + + + {{user.name}}{{user.username}} + + + + diff --git a/pages/changeuser/changeuser.wxss b/pages/changeuser/changeuser.wxss new file mode 100644 index 0000000..0512d21 --- /dev/null +++ b/pages/changeuser/changeuser.wxss @@ -0,0 +1,15 @@ +/* pages/changeuser/changeuser.wxss */ +.user-list{ + display: flex; + flex-direction: column; +} +.user-item{ + background: white; + border-bottom: 1px solid #eee; + padding: 16rpx 16px; + position: relative; +} + +.user-item text{ + vertical-align: middle; +} \ No newline at end of file diff --git a/pages/classes/classes.json b/pages/classes/classes.json index 7360326..462a05a 100644 --- a/pages/classes/classes.json +++ b/pages/classes/classes.json @@ -1,4 +1,5 @@ { + "navigationBarTitleText": "课程列表", "usingComponents": {}, "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/classes/classes.wxml b/pages/classes/classes.wxml index 1afd37e..b9ef92a 100644 --- a/pages/classes/classes.wxml +++ b/pages/classes/classes.wxml @@ -5,10 +5,15 @@ classes: 课程列表 type: Array class.objectId 唯一键 class.name 课程名称 --> - - - - {{class.name}} + + + + + {{class.name}} + + - - \ No newline at end of file + + 设置 + + diff --git a/pages/classes/classes.wxss b/pages/classes/classes.wxss index 015bcde..8c0de37 100644 --- a/pages/classes/classes.wxss +++ b/pages/classes/classes.wxss @@ -1,28 +1,46 @@ -.header { - height: 54px; - align-items: center; - background-color: #FFF; -} .class-list { - padding: 4px 6px 48px; + display: flex; + flex-direction: column; } .classroom { - font-size: 18px; - height: 30px; - padding: 10px 12px; - overflow: hidden; - align-items: center; - background-color: #fff; - margin: 1px 0; - border-radius: 3px; + background: white; + padding: 30rpx 12px; + border-bottom: 1rpx solid #EEE; + position: relative; +} + +.classroom:after { + content: '进入课堂>'; + display: block; + position: absolute; + right: 3rpx; + top: 50%; + height: 40rpx; + line-height: 40rpx; + margin-top: -20rpx; + margin-right: 30rpx; + color: #999; } .classroom text { - white-space: nowrap; - display: block; - width: 100%; - height: 50px; - line-height: 17px; + vertical-align: middle; } + +.classroom icon { + margin-right: 25rpx; +} + +.footer { + position: fixed; + bottom: 0; + height: 44px; + width: 100%; + line-height: 44px; + color: #666; + border-top: 1px solid #eee; + background: #fff; + font-size: 16px; + text-align: center; +} \ No newline at end of file diff --git a/pages/classroom/classroom.js b/pages/classroom/classroom.js index 2e9ebcf..0e1a0bb 100644 --- a/pages/classroom/classroom.js +++ b/pages/classroom/classroom.js @@ -45,7 +45,7 @@ Page({ ask: function (event) { //学生提问的函数 console.log(event); - set_asking() + //set_asking() }, rep: function (event) { console.log(event); diff --git a/pages/setting/setting.js b/pages/setting/setting.js new file mode 100644 index 0000000..3054f84 --- /dev/null +++ b/pages/setting/setting.js @@ -0,0 +1,4 @@ + +Page({ + +}) \ No newline at end of file diff --git a/pages/setting/setting.json b/pages/setting/setting.json new file mode 100644 index 0000000..e8d793c --- /dev/null +++ b/pages/setting/setting.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "设置", + "enablePullDownRefresh": false +} diff --git a/pages/setting/setting.wxml b/pages/setting/setting.wxml new file mode 100644 index 0000000..635d729 --- /dev/null +++ b/pages/setting/setting.wxml @@ -0,0 +1,4 @@ + + 更改用户名密码 + 更改登陆用户 + \ No newline at end of file diff --git a/pages/setting/setting.wxss b/pages/setting/setting.wxss new file mode 100644 index 0000000..c758974 --- /dev/null +++ b/pages/setting/setting.wxss @@ -0,0 +1,7 @@ +.navigator { + background: white; + border-bottom: 1px solid #eee; + padding: 0 12px; + height: 46px; + line-height: 46px; +} diff --git a/pages/user/user.js b/pages/user/user.js new file mode 100644 index 0000000..a20b059 --- /dev/null +++ b/pages/user/user.js @@ -0,0 +1,56 @@ +const { User } = require('../../lib/av-live-query-weapp-min'); + +Page({ + data: { + username: '', + password: '', + error: null, + authData: '', + }, + onLoad: function() { + const user = User.current(); + if (user) { + this.setData({ + username: user.get('username'), + authData: JSON.stringify(user.get('authData'), undefined, 2), + }); + } + }, + updateUsername: function ({ + detail: { + value + } + }) { + this.setData({ + username: value + }); + }, + updatePassword: function ({ + detail: { + value + } + }) { + this.setData({ + password: value + }); + }, + save: function () { + this.setData({ + error: null, + }); + const { username, password } = this.data; + const user = User.current(); + if (username) user.set({ username }); + if (password) user.set({ password }); + user.save().then(() => { + wx.showToast({ + title: '更新成功', + icon: 'success', + }); + }).catch(error => { + this.setData({ + error: error.message, + }); + }); + } +}); \ No newline at end of file diff --git a/pages/user/user.json b/pages/user/user.json new file mode 100644 index 0000000..cc73869 --- /dev/null +++ b/pages/user/user.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "登陆信息修改", + "enablePullDownRefresh": false +} diff --git a/pages/user/user.wxml b/pages/user/user.wxml new file mode 100644 index 0000000..df6fc39 --- /dev/null +++ b/pages/user/user.wxml @@ -0,0 +1,16 @@ + + + + 用户名 + + + + 新密码 + + + + {{error}} + + 当前用户 authData: + + diff --git a/pages/user/user.wxss b/pages/user/user.wxss new file mode 100644 index 0000000..c8a3965 --- /dev/null +++ b/pages/user/user.wxss @@ -0,0 +1,21 @@ +.input-wrap { + background: #fff; + border-bottom: 1px solid #eee; + margin: 0 -12px; + padding: 0 12px; + height: 46px; + line-height: 46px; +} +.label { + color: #999; + width: 4.5em; +} +.account-info-input { + font-size: 18px; + line-height: 100%; + height: 100%; + width: 100%; +} +textarea { + width: 100%; +} \ No newline at end of file