diff --git a/.gitignore b/.gitignore
index e43b0f988953ae3a84b00331d0ccf5f7d51cb3cf..e63f4fb0c5b4cf64ded2f9b6b0dc128f3822bff6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-.DS_Store
+.DS_Store
+/nbproject/private/
\ No newline at end of file
diff --git a/app.js b/app.js
index 382ba808fd4b12eeaa51796f3802910f7975d451..b7c75c81280dbdac47fbe9ce299749239eb9b1d2 100644
--- a/app.js
+++ b/app.js
@@ -2,38 +2,61 @@
App({
onLaunch: function () {
//调用API从本地缓存中获取数据
- var user_oauth = wx.getStorageSync('user-oauth') || {}
-
- //if (!user_oauth) {
- wx.redirectTo({ 'url': '/pages/user/login' });
- //}
- this.accessToken = user_oauth.access_token;
- this.user = wx.getStorageSync('user') || {};
+ var logs = wx.getStorageSync('logs') || [];
+ logs.unshift(Date.now());
+ wx.setStorageSync('logs', logs);
},
- getUserInfo: function (cb) {
- var that = this
- if (this.globalData.userInfo) {
- typeof cb == "function" && cb(this.globalData.userInfo)
+ getAccessToken: function (cb) {
+ var that = this;
+ if (that.accessToken) {
+ typeof cb == "function" && cb(this.accessToken);
} else {
- //调用登录接口
- /*wx.login({
- success: function () {
- wx.getUserInfo({
- success: function (res) {
- that.globalData.userInfo = res.userInfo
- typeof cb == "function" && cb(that.globalData.userInfo)
- }
- })
- }
- })*/
+ wx.request({
+ url: 'https://api.cnblogs.com/token', //仅为示例,并非真实的接口地址
+ method: 'POST',
+ data: {
+ username: 'g9dDrMoMV4DzZrOAMcAnCegdisk20T6ddm6ySsUrbpdeID7bL9iV5QcjRISv/2/QfwK5SGClWe7YX8FAghw0jZYTtjUnB1kyPN5H712oKmxiVKMLzm35Yd6kYu5dql/FsCGujeEuzIxN9Mu92g1Xve92jZDz8nLIPe4vhk3nt1I=',
+ password: 'kTYhPUx6wxSTwWicd+7w5vhIgx6m0QzMYR5LCWmgICSmy+qWJbjpqi4U2/U0i0dSxFVnF9f1iyW9poPbW1xgHcQ46SGwQSRLv2SNnqwMEWph5DzGnMQzE1w7C5hVDMS2YwS8RgAO+U5euG778uCWAu/SejzeCf+37HqJrjN1IzQ=',
+ grant_type: 'password'
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'Authorization': 'Basic NTMxMmI0ZDMtODk3YS00ZWFjLTlkZmMtZWJiYzNkMTYwYmY1Ok5MdWtlRHRlMDktMkV5ZjBhbnFsZXpOeVZGTTVSb0N0SjF0d3dLTXZRalcwdFNWYmlzR3Y2MXRjblVnbjFfaHMyWTZrcU8yQ0xheDVlOTIw'
+ },
+ success: function (res) {
+ that.accessToken = res.data.accessToken;
+ typeof cb == "function" && cb(that.globalData.accessToken);
+ },
+ fail: function () {
+ console.log('获取token失败!');
+ }
+ });
}
},
- cnbConfig: {
- apiPrefix: "https://api.cnblogs.com/",
- clientId: "5312b4d3-897a-4eac-9dfc-ebbc3d160bf5",
- clientSecret: "NLukeDte09-2Eyf0anqlezNyVFM5RoCtJ1twwKMvQjW0tSVbisGv61tcnUgn1_hs2Y6kqO2CLax5e920",
- publicKey: "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCp0wHYbg/NOPO3nzMD3dndwS0MccuMeXCHgVlGOoYyFwLdS24Im2e7YyhB0wrUsyYf0/nhzCzBK8ZC9eCWqd0aHbdgOQT6CuFQBMjbyGYvlVYU2ZP7kG9Ft6YV6oc9ambuO7nPZh+bvXH0zDKfi02prknrScAKC0XhadTHT3Al0QIDAQAB"
+ getUserInfo: function (cb) {
+ var that = this;
+ var accessToken = that.accessToken;
+ if (this.user) {
+ typeof cb == "function" && cb(this.user);
+ } else {
+ wx.request({
+ url: 'https://api.cnblogs.com/api/Users', //仅为示例,并非真实的接口地址
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer ' + accessToken
+ },
+ success: function (res) {
+ that.user = res.data;
+ typeof cb == "function" && cb(that.user);
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+ }
},
- accessToken: '',
- user: {}
-})
\ No newline at end of file
+ user: null,
+ accessToken: 'oIyW4j2T6YdaCs6ou-4iosGlp_2E4rs-IV7WRYj8kYJiU1np6jaL_HMZ9daHoVGaTFaF63mWgf80-7VqA3KGHPh7Nkp4gisDz26iTgc3i1IOQeZZMc15W2ytqi1SslFf9qlaIqY3QW7bHUEhY3ViaA052_15JX5yLNhJUuo1TW6TioDrZTp1w4378DBAh9zlyo9RColn6w3e3_3xXaoU3g'
+});
diff --git a/app.json b/app.json
index 01b66a6659e236a4d16c166296950bc08cd737f7..102a00d304052538d20c70ebf526e8f0665e2e16 100644
--- a/app.json
+++ b/app.json
@@ -1,7 +1,11 @@
{
"pages": [
"pages/index/index",
+ "pages/status/index",
+ "pages/status/detail",
"pages/question/index",
+ "pages/question/view",
+ "pages/question/comments",
"pages/user/login",
"pages/user/index",
"pages/status/index",
@@ -38,4 +42,4 @@
}
]
}
-}
\ No newline at end of file
+}
diff --git a/pages/question/comments.js b/pages/question/comments.js
index 363a125f65f1a1d5fab3a3a636dff35be3f7af47..be224950c48a3be0a6a343892f52a7f8891e2839 100644
--- a/pages/question/comments.js
+++ b/pages/question/comments.js
@@ -2,35 +2,28 @@
var app = getApp();
Page({
data:{
- commonts:{}
+ commentInput:'',
+ answer:{},
+ commonts:{},
+ userInfo: {}
},
onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
var that = this;
- //获取回答详情
- wx.request({
- url: 'https://api.cnblogs.com/api/questions/answers/'+options.id+'/comments',
- method: 'GET',
- data: {
- },
- header: {
- 'Authorization': 'Bearer '+ app.accessToken
- },
- success: function (res) {
- var data = {};
- data.status = true;
- data.data = res.data;
- if(res.data.length < 1){
- data.status = false;
- }
- that.setData({
- commonts: data
- });
- },
- fail: function () {
- console.log('获取用户信息失败!');
- }
+ app.getUserInfo(function (userInfo) {
+ //更新数据
+ that.setData({
+ userInfo: userInfo
});
+ });
+ var data ={};
+ data.Id = options.id;
+ data.Qid = options.qid;
+ data.Content = options.content;
+ that.setData({
+ answer: data
+ });
+ getComments(that,options.id);
},
onReady:function(){
// 页面渲染完成
@@ -43,5 +36,84 @@ Page({
},
onUnload:function(){
// 页面关闭
+ },
+ comment:function(e){
+ var that = this;
+ var questionId=e.target.dataset.questionId;
+ var answerId=e.target.dataset.answerId;
+ if(!answerId){
+
+ }
+ console.log(this.data.commentInput)
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/'+questionId+'/answers/'+answerId+'/comments', //仅为示例,并非真实的接口地址
+ method: 'POST',
+ data: {
+ "Content": this.data.commentInput
+ },
+ header: {
+ 'Authorization': 'Bearer '+ app.accessToken
+ },
+ success: function (res) {
+ getComments(that,answerId);
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+ },
+ delete:function(e){
+ var that = this;
+ var questionId=e.target.dataset.questionId;
+ var answerId=e.target.dataset.answerId;
+ var commentId=e.target.dataset.commentId;
+ if(!answerId){
+
+ }
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/'+questionId+'/answers/'+answerId+'/comments/'+commentId, //仅为示例,并非真实的接口地址
+ method: 'DELETE',
+ data: {
+
+ },
+ header: {
+ 'Authorization': 'Bearer '+ app.accessToken
+ },
+ success: function (res) {
+ getComments(that,answerId);
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+ },
+ listenCommentInput:function(event){
+ this.data.commentInput = event.detail.value;
}
-})
\ No newline at end of file
+});
+//获取回答相关评论
+function getComments(that, answer_id) {
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/answers/' + answer_id + '/comments',
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer ' + app.accessToken
+ },
+ success: function (res) {
+ var data = {};
+ data.status = true;
+ data.data = res.data;
+ if (res.data.length < 1) {
+ data.status = false;
+ }
+ that.setData({
+ commonts: data
+ });
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+}
\ No newline at end of file
diff --git a/pages/question/comments.wxml b/pages/question/comments.wxml
index 6e5f5a4af224fa1fabfd3d8a418c31a7b830a502..7b0e5a81bbcb42ab86eb23e94a230666b84db049 100644
--- a/pages/question/comments.wxml
+++ b/pages/question/comments.wxml
@@ -1,20 +1,21 @@
- {{question.Title}}
- {{question.Content}}
+ {{answer.Content}}
评论
-
+
- {{commont.Content}}
+ {{comment.Content}}
- {{item.PostUserInfo.UserName}}|
- 园豆:{{item.PostUserInfo.QScore}}|
-
+ @{{comment.PostUserInfo.UserName}}
+ 园豆:{{comment.PostUserInfo.QScore}}
+
+
+
@@ -27,11 +28,11 @@
-
+
0/200
-
+
diff --git a/pages/question/index.js b/pages/question/index.js
index ce1f56928eb9b90338487792c00cc86737d34e13..16da73e45ab47bbbd0f63cdee0fe232f47320dca 100644
--- a/pages/question/index.js
+++ b/pages/question/index.js
@@ -2,51 +2,25 @@
var app = getApp();
Page({
data:{
- tabs: ["问题列表", "我的关注", "我的博问", "博问标签"],
+ tabs: ["问题列表", "我的博问"],
activeIndex: 0,
sliderOffset: 0,
sliderLeft: 0,
questions:[],
myQuestions:[],
+ userInfo: {}
},
onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
- var that = this
- //获取问题列表
- wx.request({
- url: 'https://api.cnblogs.com/api/questions/@sitehome', //仅为示例,并非真实的接口地址
- method: 'GET',
- data: {
- },
- header: {
- 'Authorization': 'Bearer '+ app.accessToken
- },
- success: function (res) {
- that.setData({
- questions: res.data
- });
- },
- fail: function () {
- console.log('获取用户信息失败!');
- }
- });
- wx.request({
- url: 'https://api.cnblogs.com/api/questions/@myquestion', //仅为示例,并非真实的接口地址
- method: 'GET',
- data: {
- },
- header: {
- 'Authorization': 'Bearer '+ app.accessToken
- },
- success: function (res) {
- that.setData({
- myQuestions: res.data
- });
- },
- fail: function () {
- console.log('获取用户信息失败!');
- }
+ var that = this;
+ app.getUserInfo(function (userInfo) {
+ //更新数据
+ that.setData({
+ userInfo: userInfo
});
+ });
+ getList(that);
+ getOwnerList(that);
},
tabClick: function (e) {
this.setData({
@@ -57,6 +31,22 @@ Page({
onReady:function(){
// 页面渲染完成
},
+ onPullDownRefresh: function () {
+ var that = this;
+ wx.showNavigationBarLoading();
+ pageIndex = 1;
+ this.setData({
+ questions: []
+ });
+ getList(that);
+ wx.stopPullDownRefresh;
+ wx.hideNavigationBarLoading();
+ },
+
+ onReachBottom: function () {
+ var that = this;
+ getList(that);
+ },
onShow:function(){
// 页面显示
},
@@ -66,4 +56,60 @@ Page({
onUnload:function(){
// 页面关闭
}
-})
\ No newline at end of file
+});
+
+var pageIndex = 1;
+var pageSize = 10;
+//获取首页问题列表
+function getList(that) {
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/@sitehome?pageIndex=' + pageIndex + '&pageSize=' + pageSize, //仅为示例,并非真实的接口地址
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer ' + app.accessToken
+ },
+ success: function (res) {
+ var list = that.data.questions;
+ for(var i = 0; i < res.data.length; i++){
+ list.push(res.data[i]);
+ }
+ that.setData({
+ questions: list
+ });
+ pageIndex ++;
+ },
+ fail: function () {
+ console.log('获取博问列表失败!');
+ }
+ });
+}
+
+var mpageIndex = 1;
+var mpageSize = 10;
+//获取自己的提问列表
+function getOwnerList(that) {
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/@myquestion?pageIndex=' + mpageIndex + '&pageSize=' + mpageSize, //仅为示例,并非真实的接口地址
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer ' + app.accessToken
+ },
+ success: function (res) {
+ var list = that.data.myQuestions;
+ for(var i = 0; i < res.data.length; i++){
+ list.push(res.data[i]);
+ }
+ that.setData({
+ myQuestions: list
+ });
+ mpageIndex ++;
+ },
+ fail: function () {
+ console.log('获取用户博问列表失败!');
+ }
+ });
+}
\ No newline at end of file
diff --git a/pages/question/index.wxml b/pages/question/index.wxml
index 2064c933a171d0e6de95a53669125818c465861d..f9182c9df6e7445bd543d22b8b27014037f69c2a 100644
--- a/pages/question/index.wxml
+++ b/pages/question/index.wxml
@@ -31,11 +31,10 @@
- 选项二的内容
-
+
-
+
@@ -52,7 +51,6 @@
- 选项四的内容
diff --git a/pages/question/view.js b/pages/question/view.js
index f4a0b241bace897f03f4bebbc22196f9e110021e..1f6d671597f2acbd9efb8d3dbcb8f591f454da12 100644
--- a/pages/question/view.js
+++ b/pages/question/view.js
@@ -1,73 +1,43 @@
// pages/question/view.js
var app = getApp();
+var WxParse = require('../../vendor/wxParse/wxParse.js');
Page({
data:{
- question:{},
- answers:{},
+ inputOptions:{},
+ question:[],
+ answers:[],
+ editAnswer:'',
+ isEdit:false,
answerInput:'',
- is_answer:false
+ is_answer:false,
+ userInfo: {}
},
onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
var that = this;
- //获取问题详情
- wx.request({
- url: 'https://api.cnblogs.com/api/questions/'+options.id, //仅为示例,并非真实的接口地址
- method: 'GET',
- data: {
- },
- header: {
- 'Authorization': 'Bearer '+ app.accessToken
- },
- success: function (res) {
- that.setData({
- question: res.data
- });
- },
- fail: function () {
- console.log('获取用户信息失败!');
- }
- });
- //判断当前用户是否回答过某个问题
- wx.request({
- url: 'https://api.cnblogs.com/api/questions/'+options.id+'?userId='+app.user.SpaceUserId, //仅为示例,并非真实的接口地址
- method: 'HEAD',
- data: {
- },
- header: {
- 'Authorization': 'Bearer '+ app.accessToken
- },
- success: function (res) {
- console.log(res)
- },
- fail: function () {
- console.log('获取用户信息失败!');
- }
- });
- //获取问题的回答列表
- wx.request({
- url: 'https://api.cnblogs.com/api/questions/'+options.id+'/answers', //仅为示例,并非真实的接口地址
- method: 'GET',
- data: {
- },
- header: {
- 'Authorization': 'Bearer '+ app.accessToken
- },
- success: function (res) {
- var data = {};
- data.status = true;
- data.data = res.data;
- if(res.data.length < 1){
- data.status = false;
- }
- that.setData({
- answers: data
- });
- },
- fail: function () {
- console.log('获取用户信息失败!');
- }
+ that.setData({
+ inputOptions: options
+ });
+ app.getUserInfo(function (userInfo) {
+ //更新数据
+ that.setData({
+ userInfo: userInfo
});
+ });
+ getDetail(that,options.id);
+ getAnswers(that,options.id);
+ },
+ onPullDownRefresh: function () {
+ var that = this;
+ wx.showNavigationBarLoading();
+ this.setData({
+ question: [],
+ answers:[]
+ });
+ getDetail(that,that.data.inputOptions.id);
+ getAnswers(that,that.data.inputOptions.id);
+ wx.stopPullDownRefresh;
+ wx.hideNavigationBarLoading();
},
onReady:function(){
// 页面渲染完成
@@ -82,29 +52,135 @@ Page({
// 页面关闭
},
answer:function(e){
- var questionId=e.target.dataset.questionId;
+ var that = this;
+ var answer=e.detail.value.answer;
+ var questionId=e.detail.target.dataset.questionId;
if(!questionId){
}
- console.log(this.data.answerInput)
wx.request({
url: 'https://api.cnblogs.com/api/questions/'+questionId+'/answers', //仅为示例,并非真实的接口地址
method: 'POST',
data: {
- "Answer": this.data.answerInput
+ "Answer": answer
+ },
+ header: {
+ 'Authorization': 'Bearer '+ app.accessToken
+ },
+ success: function (res) {
+ getAnswers(that,questionId);
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+ },
+ patch:function(e){
+ var that = this;
+ var answer=e.detail.value.answer;
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/'+that.data.editAnswer.questionId+'/answers/'+that.data.editAnswer.answerId, //仅为示例,并非真实的接口地址
+ method: 'PATCH',
+ data: {
+ "Answer": answer
},
header: {
'Authorization': 'Bearer '+ app.accessToken
},
success: function (res) {
- console.log(res)
+ getAnswers(that,that.data.editAnswer.questionId);
},
fail: function () {
console.log('获取用户信息失败!');
}
});
},
+ delete:function(e){
+ var that = this;
+ var questionId=e.target.dataset.questionId;
+ var answerId=e.target.dataset.answerId;
+ if(!answerId){
+ return;
+ }
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/'+questionId+'/answers/'+answerId, //仅为示例,并非真实的接口地址
+ method: 'DELETE',
+ data: {
+
+ },
+ header: {
+ 'Authorization': 'Bearer '+ app.accessToken
+ },
+ success: function (res) {
+ getAnswers(that,questionId);
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+ },
+ edit: function (e) {
+ var that = this;
+ var data={};
+ var oldContent = e.target.dataset.editAnswer;
+ var questionId = e.target.dataset.questionId;
+ var answerId = e.target.dataset.answerId;
+ data.oldContent=oldContent;
+ data.answerId=answerId;
+ data.questionId=questionId;
+ that.setData({
+ isEdit: true,
+ editAnswer: data
+ });
+ },
listenAnswerInput:function(event){
this.data.answerInput = event.detail.value;
}
-});
\ No newline at end of file
+});
+ //获取问题详情
+function getDetail(that,question_id) {
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/' + question_id,
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer ' + app.accessToken
+ },
+ success: function (res) {
+ that.setData({
+ question: res.data
+ });
+ WxParse.wxParse('ques_content', 'html', that.data.question.Content, that, 5);
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+}
+//获取问题的回答列表
+function getAnswers(that,question_id){
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/' + question_id + '/answers',
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer ' + app.accessToken
+ },
+ success: function (res) {
+ var data = {};
+ data.status = true;
+ data.data = res.data;
+ if (res.data.length < 1) {
+ data.status = false;
+ }
+ that.setData({
+ answers: data
+ });
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+}
\ No newline at end of file
diff --git a/pages/question/view.wxml b/pages/question/view.wxml
index 76d66e38b45033553d1e44d1245bf16c41eba325..4698a2db55fa6a40c2ac3556fa26c7e244475a20 100644
--- a/pages/question/view.wxml
+++ b/pages/question/view.wxml
@@ -1,21 +1,24 @@
+
{{question.Title}}
- {{question.Content}}
+
回答
-
+
{{answer.Answer}}
- {{answer.AnswerUserInfo.UserName}}|
- 园豆:{{answer.AnswerUserInfo.QScore}}|
-
+ @{{answer.AnswerUserInfo.UserName}}
+ 园豆:{{answer.AnswerUserInfo.QScore}}
+
+
+
@@ -23,16 +26,19 @@
-
- 文本域
-
+
+
+
+
+
+
diff --git a/pages/question/view.wxss b/pages/question/view.wxss
index 2553439523087edadaa0b6e776f1ff81ea819deb..742968d801659fc52339d439707d1a4ef87c10ed 100644
--- a/pages/question/view.wxss
+++ b/pages/question/view.wxss
@@ -1 +1,7 @@
-/* pages/question/view.wxss */
\ No newline at end of file
+/* pages/question/view.wxss */
+.hide {
+ display:none;
+}
+.show {
+ display: block;
+}
\ No newline at end of file
diff --git a/pages/user/index.js b/pages/user/index.js
index 017aa2605abedf18de89c2d3dbd09e52ffa342da..0a81de7ee37a0cd2c0549a0eefa486f2b8f85347 100644
--- a/pages/user/index.js
+++ b/pages/user/index.js
@@ -1,54 +1,33 @@
// pages/user/index.js
//获取应用实例
-var util = require('../../utils/util.js')
-//var NodeRSA = require('../../vendor/node-rsa/NodeRSA.js')
var app = getApp()
Page({
- data: {
+ data:{
points: '0',
userInfo: {}
},
- onLoad: function (options) {
+ onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
- var that = this
- //调用应用实例的方法获取全局数据
- app.getUserInfo(function (userInfo) {
- //更新数据
- that.setData({
- userInfo: userInfo
- })
- })
-
-
-
- wx.request({
- url: "https://api.cnblogs.com/token",
- header: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Authorization': 'Basic NTMxMmI0ZDMtODk3YS00ZWFjLTlkZmMtZWJiYzNkMTYwYmY1Ok5MdWtlRHRlMDktMkV5ZjBhbnFsZXpOeVZGTTVSb0N0SjF0d3dLTXZRalcwdFNWYmlzR3Y2MXRjblVnbjFfaHMyWTZrcU8yQ0xheDVlOTIw'
- },
- method: "POST",
- data: {
- username: "YbcFojk0tHPrDoVttjrJkn/VfbJRSfLyj/5iS6fuJrySFK4KVcIMMMxNSWGfoEEVk1Bh+B6fY/z75DP23+VBaREl6arWFMnOblu9PS8XqYbZJOpFSAdH1rnvwB4RoTvPF/l3dffjm+aZZjpFcu1o+pDzPeu5J8rf/yPch18/6ng=",
- password: "qO9eVi3rVUpMkaqvf8ehRabWFXRN7v9jfAWpR8VoiWqciM7Cca8h1GoSV2Ce7CbhiFwL1tKdax4yZQvWYwNHZGeKvIa7bk0YL9tAVvBPWumArbLWZZU2/1pihzaU/sfG9IU/AW4xu7qb/CjfY4KLuEiH+OULq7lz8iHVUvGs3pg=",
- grant_type: 'password'
- },
- success: function (res) {
- console.log(res.data)
- }
- })
+ console.log('onLoad')
+ var that = this
+ //调用应用实例的方法获取全局数据
+ app.getUserInfo(function(userInfo){
+ //更新数据
+ that.setData({
+ userInfo:userInfo
+ })
+ })
},
-
- onReady: function () {
+ onReady:function(){
// 页面渲染完成
},
- onShow: function () {
+ onShow:function(){
// 页面显示
},
- onHide: function () {
+ onHide:function(){
// 页面隐藏
},
- onUnload: function () {
+ onUnload:function(){
// 页面关闭
}
})
\ No newline at end of file
diff --git a/pages/user/index.wxml b/pages/user/index.wxml
index 8310321359faafd920b8ebeadb05ac7d165b9d9c..2267509438d1afcfabaa3ab59bdc57e50f3556c0 100644
--- a/pages/user/index.wxml
+++ b/pages/user/index.wxml
@@ -1,10 +1,10 @@
-
- {{userInfo.nickName}}
+
+ {{userInfo.DisplayName}}
- 园龄 {{points}}
+ 园龄 {{userInfo.Seniority}}