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 0000000..277c5c2 Binary files /dev/null and b/images/course.png differ diff --git a/pages/changeuser/changeuser.js b/pages/changeuser/changeuser.js new file mode 100644 index 0000000..b0e0998 --- /dev/null +++ b/pages/changeuser/changeuser.js @@ -0,0 +1,88 @@ +// pages/changeuser/changeuser.js +const AV = require("../../lib/av-live-query-weapp-min") +const { jsonify } = require("../../utils/leancloudutils") + +Page({ + + /** + * 页面的初始数据 + */ + data: { + current_user: {}, + users: [] + }, + login: function(event){ + username = event.currentTarget.dataset.username; + //console.log(event); + console.log(username); + AV.User.logIn(username, "123456").then((user)=>{ + 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