-
Notifications
You must be signed in to change notification settings - Fork 2
Added userslist page and userdetail page. #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ZhangYihanNus
wants to merge
5
commits into
MaxPoon:master
Choose a base branch
from
ZhangYihanNus:namelist
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f094b61
Initialized userlist page and JumpTo function
ZhangYihanNus 848ac56
Edited userslists page
ZhangYihanNus 65c99f7
Added userslist page
ZhangYihanNus 1f1af69
Commented testing data.
ZhangYihanNus 9e721b6
Added userdetail page.
ZhangYihanNus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,26 +5,28 @@ const app = getApp(); | |
|
|
||
| function successfulLoginCallback(res) { | ||
| app.userInfo = res; | ||
| console.log(res); | ||
| wx.switchTab({ | ||
| url: '../index/index', | ||
| }) | ||
| // qcloud.request({ | ||
| // url: config.service.userUrl + '?OpenId=' + app.userInfo.openId, | ||
| // method: 'GET', | ||
| // success: function (res) { | ||
| // //able to get user's personal information from server | ||
| // app.userInfo = Object.assign(app.userInfo, res.body); | ||
| // }, | ||
| // fail: function (err) { | ||
| // // fail | ||
| // console.log('failed to get userinfo; err:'); | ||
| // console.log(err); | ||
| // }, | ||
| // complete: function () { | ||
| // // complete | ||
| // console.log('complete qcloud.request for getting userinfo'); | ||
| // } | ||
| // }); | ||
| qcloud.request({ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we comment out the block above and write this new block of code? |
||
| url: config.service.userUrl + '?OpenId=' + app.userInfo.openId, | ||
| method: 'GET', | ||
| success: function (res) { | ||
| //able to get user's personal information from server | ||
| console.log(res); | ||
| app.userInfo = Object.assign(app.userInfo, res.body); | ||
| }, | ||
| fail: function (err) { | ||
| // fail | ||
| console.log('failed to get userinfo; err:'); | ||
| console.log(err); | ||
| }, | ||
| complete: function () { | ||
| // complete | ||
| console.log('complete qcloud.request for getting userinfo'); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| Page({ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 17 additions & 10 deletions
27
client/pages/userinfo/userinfo.js → client/pages/userdetail/userdetail.js
100755 → 100644
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,73 @@ | ||
| // pages/userinfo/userinfo.js | ||
| // pages/userdetail/userdetail.js | ||
| const qcloud = require('wafer2-client-sdk'); | ||
| const app = getApp(); | ||
| const config = require('../../config'); | ||
|
|
||
| Page({ | ||
|
|
||
| /** | ||
| * 页面的初始数据 | ||
| */ | ||
| data: { | ||
|
|
||
| userdetail: {}, | ||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面加载 | ||
| */ | ||
| onLoad: function (options) { | ||
|
|
||
| this.setData({ | ||
| userdetail: app.globalData.userslist[options.index] | ||
| }); | ||
| console.log(this.data.userdetail); | ||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面初次渲染完成 | ||
| */ | ||
| onReady: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面显示 | ||
| */ | ||
| onShow: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面隐藏 | ||
| */ | ||
| onHide: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面卸载 | ||
| */ | ||
| onUnload: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 页面相关事件处理函数--监听用户下拉动作 | ||
| */ | ||
| onPullDownRefresh: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 页面上拉触底事件的处理函数 | ||
| */ | ||
| onReachBottom: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 用户点击右上角分享 | ||
| */ | ||
| onShareAppMessage: function () { | ||
|
|
||
| } | ||
| }) |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <!--pages/userdetail/userdetail.wxml--> | ||
| <view class="container"> | ||
|
|
||
|
|
||
| <view class="userinfo"> <!-- avatar and username --> | ||
| <image class="userinfo-avatar" src="{{userdetail.avatar}}" mode="cover"></image> | ||
| <text class="userinfo-nickname">{{userdetail.name}}</text> | ||
| </view> | ||
|
|
||
|
|
||
| <view class="body"> <!-- info --> | ||
| <view class="info"> <!-- Chinese name --> | ||
| <!-- <text>Chinese name</text> --> | ||
| <!-- <text>{{userdetail.chinesename}}</text> --> | ||
| </view> | ||
| <view class="info"> <!-- English name --> | ||
| <!-- <text>English name</text> --> | ||
| <!-- <text>{{userdetail.englishname}}</text> --> | ||
| </view> | ||
| </view> | ||
|
|
||
|
|
||
| </view> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| .userinfo{ | ||
| align-content: center; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .userinfo-avatar{ | ||
| width: 100rpx; | ||
| height: 100rpx; | ||
| margin: 20px; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| // pages/userlist/userlist.js | ||
| const qcloud = require('wafer2-client-sdk'); | ||
| const app = getApp(); | ||
| const config = require('../../config'); | ||
|
|
||
| Page({ | ||
|
|
||
| /** | ||
| * 页面的初始数据 | ||
| */ | ||
| data: { | ||
| //userslist info | ||
| userslist: [] | ||
| }, | ||
|
|
||
|
|
||
| /** | ||
| * 生命周期函数--监听页面加载 | ||
| */ | ||
| onLoad: function (options) { | ||
| console.log("onLoad userslist page"); | ||
| this.getUserslist(); | ||
| }, | ||
|
|
||
| getUserslist: function (event) { | ||
| let that=this; | ||
| qcloud.request({ | ||
| url: config.service.userUrl, | ||
| method: "GET", | ||
| // try to get all users' userinfo | ||
| success: function (res) { | ||
| // console.log(res); | ||
| console.log("Successfully gotten userslist.") | ||
| if(res.dara.code===0) { | ||
| app.setData({ | ||
| // userslist: res.data.xxx | ||
| }); | ||
| } | ||
| }, | ||
| fail: function (err) { | ||
| console.log("Failed to get userslist."); | ||
| console.log(err); | ||
| }, | ||
| complete: function() { | ||
| console.log("complete getting userslist."); | ||
| that.setData({ | ||
| userslist: app.globalData.userslist | ||
| }); | ||
| } | ||
| }); | ||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面初次渲染完成 | ||
| */ | ||
| onReady: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面显示 | ||
| */ | ||
| onShow: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面隐藏 | ||
| */ | ||
| onHide: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 生命周期函数--监听页面卸载 | ||
| */ | ||
| onUnload: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 页面相关事件处理函数--监听用户下拉动作 | ||
| */ | ||
| onPullDownRefresh: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 页面上拉触底事件的处理函数 | ||
| */ | ||
| onReachBottom: function () { | ||
|
|
||
| }, | ||
|
|
||
| /** | ||
| * 用户点击右上角分享 | ||
| */ | ||
| onShareAppMessage: function () { | ||
|
|
||
| } | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "usingComponents": {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <view class='userslist_wrap'> | ||
| <navigator class='user_item' url='../userdetail/userdetail?index={{index}}' wx:for='{{userslist}}' wx:key='{{OpenId}}'> | ||
| <!-- avator --> | ||
| <image class='user_avatar' src='{{item.avatar}}'></image> | ||
| <!-- name --> | ||
| <text class='user_name'>{{item.name}}</text> | ||
| </navigator> | ||
| </view> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| .user_avatar { | ||
| width: 100rpx; | ||
| height: 100rpx; | ||
| border-radius: 50%; | ||
| border: 3rpx solid; | ||
| border-color:rgb(218, 218, 218); | ||
| margin: 20rpx; | ||
| } | ||
| .user-name { | ||
| font-size: 120px; | ||
| } | ||
| .user_item { | ||
| height: 60px; | ||
| display: flex; | ||
| align-items: center; | ||
| border-bottom: 3rpx solid; | ||
| border-bottom-color: rgb(233, 233, 233); | ||
|
|
||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the name should be either users or user list, not users list. and the "L" in "list" should be capitalized.