diff --git a/client/app.js b/client/app.js
index 9589747..5d61993 100755
--- a/client/app.js
+++ b/client/app.js
@@ -3,6 +3,20 @@ const qcloud = require('wafer2-client-sdk');
const config = require('./config');
App({
+ globalData:{
+ userslist:[
+ // for testing
+ // {
+ // avatar: "../images/tabbar/active.png",
+ // name: "blablabla"
+ // },
+ // {
+ // avatar: "../images/tabbar/active.png",
+ // name: "23333333"
+ // }
+ ]
+ },
+
onLaunch: function() {
qcloud.setLoginUrl(config.service.loginUrl);
}
diff --git a/client/app.json b/client/app.json
index 058091d..0fd3583 100755
--- a/client/app.json
+++ b/client/app.json
@@ -4,7 +4,9 @@
"pages/index/index",
"pages/me/me",
"pages/memories/memories",
- "pages/editntc/editntc"
+ "pages/editntc/editntc",
+ "pages/userdetail/userdetail",
+ "pages/userslist/userslist"
],
"window":{
"backgroundColor":"#73a96b",
diff --git a/client/pages/index/index.js b/client/pages/index/index.js
index 75b2edc..040fdf5 100755
--- a/client/pages/index/index.js
+++ b/client/pages/index/index.js
@@ -18,6 +18,14 @@ Page({
url: '../editntc/editntc'
})
},
+ /**
+ * Jump to userlist page
+ */
+ JumpToUserslist: function () {
+ wx.navigateTo({
+ url: '../userslist/userslist',
+ })
+ },
/**
* 生命周期函数--监听页面加载
*/
diff --git a/client/pages/index/index.wxml b/client/pages/index/index.wxml
index 0fbc4af..39628d7 100755
--- a/client/pages/index/index.wxml
+++ b/client/pages/index/index.wxml
@@ -15,4 +15,7 @@
Training starts at {{ time }}
+
+
+
diff --git a/client/pages/index/index.wxss b/client/pages/index/index.wxss
index cd0c17d..40882cf 100755
--- a/client/pages/index/index.wxss
+++ b/client/pages/index/index.wxss
@@ -46,4 +46,9 @@
text-align: center;
margin-top: 20px;
margin-bottom: 30px;
+}
+.view-teammates-button {
+ width: 80%;
+ text-align: center;
+ color:#73a96b;
}
\ No newline at end of file
diff --git a/client/pages/login/login.js b/client/pages/login/login.js
index 4f37f5f..6a89c47 100644
--- a/client/pages/login/login.js
+++ b/client/pages/login/login.js
@@ -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({
+ 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({
diff --git a/client/pages/me/me.js b/client/pages/me/me.js
index d2fcad9..0211bcd 100644
--- a/client/pages/me/me.js
+++ b/client/pages/me/me.js
@@ -1,6 +1,7 @@
// pages/me/me.js
const qcloud = require('wafer2-client-sdk');
const app = getApp();
+const config = require('../../config');
Page({
data: {
@@ -12,9 +13,7 @@ Page({
btnDisable: true
},
onLoad: function () {
- this.setData({
- personal: app.userInfo
- });
+ c
},
chineseNameInput: function (event) {
diff --git a/client/pages/userinfo/userinfo.js b/client/pages/userdetail/userdetail.js
old mode 100755
new mode 100644
similarity index 71%
rename from client/pages/userinfo/userinfo.js
rename to client/pages/userdetail/userdetail.js
index 57e1632..79e2105
--- a/client/pages/userinfo/userinfo.js
+++ b/client/pages/userdetail/userdetail.js
@@ -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 () {
-
+
}
})
\ No newline at end of file
diff --git a/client/pages/userinfo/userinfo.json b/client/pages/userdetail/userdetail.json
old mode 100755
new mode 100644
similarity index 100%
rename from client/pages/userinfo/userinfo.json
rename to client/pages/userdetail/userdetail.json
diff --git a/client/pages/userdetail/userdetail.wxml b/client/pages/userdetail/userdetail.wxml
new file mode 100644
index 0000000..4d29846
--- /dev/null
+++ b/client/pages/userdetail/userdetail.wxml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ {{userdetail.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client/pages/userdetail/userdetail.wxss b/client/pages/userdetail/userdetail.wxss
new file mode 100644
index 0000000..4c8dfbd
--- /dev/null
+++ b/client/pages/userdetail/userdetail.wxss
@@ -0,0 +1,10 @@
+.userinfo{
+ align-content: center;
+ justify-content: center;
+}
+
+.userinfo-avatar{
+ width: 100rpx;
+ height: 100rpx;
+ margin: 20px;
+}
\ No newline at end of file
diff --git a/client/pages/userinfo/userinfo.wxml b/client/pages/userinfo/userinfo.wxml
deleted file mode 100755
index 9b9cd0d..0000000
--- a/client/pages/userinfo/userinfo.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-pages/userinfo/userinfo.wxml
diff --git a/client/pages/userinfo/userinfo.wxss b/client/pages/userinfo/userinfo.wxss
deleted file mode 100755
index f5874a4..0000000
--- a/client/pages/userinfo/userinfo.wxss
+++ /dev/null
@@ -1 +0,0 @@
-/* pages/userinfo/userinfo.wxss */
\ No newline at end of file
diff --git a/client/pages/userslist/userslist.js b/client/pages/userslist/userslist.js
new file mode 100644
index 0000000..ad3e997
--- /dev/null
+++ b/client/pages/userslist/userslist.js
@@ -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 () {
+
+ }
+})
\ No newline at end of file
diff --git a/client/pages/userslist/userslist.json b/client/pages/userslist/userslist.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/client/pages/userslist/userslist.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/client/pages/userslist/userslist.wxml b/client/pages/userslist/userslist.wxml
new file mode 100644
index 0000000..5ac0ae0
--- /dev/null
+++ b/client/pages/userslist/userslist.wxml
@@ -0,0 +1,8 @@
+
+
+
+
+
+ {{item.name}}
+
+
\ No newline at end of file
diff --git a/client/pages/userslist/userslist.wxss b/client/pages/userslist/userslist.wxss
new file mode 100644
index 0000000..f00236f
--- /dev/null
+++ b/client/pages/userslist/userslist.wxss
@@ -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);
+
+
+}
\ No newline at end of file
diff --git a/server/controllers/memory.js b/server/controllers/memory.js
new file mode 100644
index 0000000..02b32bb
--- /dev/null
+++ b/server/controllers/memory.js
@@ -0,0 +1,12 @@
+const assert = require('assert');
+const { mysql } = require('../qcloud.js');
+const trainingTableName = "Training";
+
+async function get(ctx) {
+ var memory = await mysql(trainingTableName).orderBy('UpdatedTime', 'desc').select('*').limit(10);
+ ctx.body = memory;
+}
+
+module.exports = {
+ get
+};
\ No newline at end of file