From 645dc50be5dd39e3137f471eac0bcddbe8bbd866 Mon Sep 17 00:00:00 2001 From: ktb Date: Sat, 25 Mar 2017 17:29:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AA=E5=AD=98=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/status/detail.js | 49 ++++++++++++++++++++++------- pages/status/detail.wxml | 68 +++++++++++++++++++++++++++++++++------- pages/status/detail.wxss | 22 ++++++++++++- pages/status/index.js | 32 ++----------------- pages/status/index.wxml | 9 ------ 5 files changed, 117 insertions(+), 63 deletions(-) diff --git a/pages/status/detail.js b/pages/status/detail.js index 4867aca..f57d923 100644 --- a/pages/status/detail.js +++ b/pages/status/detail.js @@ -1,6 +1,8 @@ // pages/status/detail.js +var app = getApp() Page({ data:{ + statuses:[], comments:'' }, onLoad:function(options){ @@ -9,19 +11,16 @@ Page({ var that = this; //获取闪存信息 wx.request({ - url: 'http://api.cnblogs.com/api/statuses/@all', + url: 'http://api.cnblogs.com/api/statuses/' + status_id, data: { - pageIndex:1, - pageSize:10, - tag:'is' }, header: { "Content-Type":"application/x-www-form-urlencoded", - "Authorization":"Bearer " + app.globle.access_token + "Authorization":"Bearer " + app.globalData.access_token }, - success: function(res3) { + success: function(res) { that.setData({ - statuses_all:res3.data + statuses:res.data }) } }), @@ -33,11 +32,11 @@ Page({ }, header: { "Content-Type":"application/x-www-form-urlencoded", - "Authorization":"Bearer " + app.globle.access_token + "Authorization":"Bearer " + app.globalData.access_token }, - success: function(res) { + success: function(res2) { that.setData({ - comments:res.data + comments:res2.data }) } }) @@ -53,5 +52,33 @@ Page({ }, onUnload:function(){ // 页面关闭 - } + }, + content: function(text) { + console.log(text.detail.value); + this.setData({ + content:text.detail.value + }) + }, + put:function(text){ + + }, + formSubmit: function(e) { + var content = e.detail.value.content; + //发表闪存评论 + wx.request({ + // url: 'http://api.cnblogs.com/api/statuses/'+ status_id +'/comments', + url: 'http://api.cnblogs.com/api/statuses/1093141/comments', + method: 'post', + data: { + ReplyTo:1093141, + Content:content + }, + header: { + "Content-Type":"application/x-www-form-urlencoded", + "Authorization":"Bearer " + app.globalData.access_token + }, + success: function(res2) { + } + }) + }, }) \ No newline at end of file diff --git a/pages/status/detail.wxml b/pages/status/detail.wxml index 4411e2e..d238d54 100644 --- a/pages/status/detail.wxml +++ b/pages/status/detail.wxml @@ -1,15 +1,59 @@ - - - - - {{item.UserDisplayName}} - {{item.Content}} - - 文字来源 - {{item.DateAdded}} - - 回应 - + + + + + + + + + + {{statuses.UserDisplayName}} + {{statuses.Content}} + + 文字来源 + {{statuses.DateAdded}} + + 回应 + + + + + + + + + + + + + + {{item.UserDisplayName}} + {{item.Content}} + + {{item.DateAdded}} + + 回应 + + + + + + + +
+ + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/pages/status/detail.wxss b/pages/status/detail.wxss index bb59c92..4781a2a 100644 --- a/pages/status/detail.wxss +++ b/pages/status/detail.wxss @@ -1 +1,21 @@ -/* pages/status/detail.wxss */ \ No newline at end of file +/* pages/status/detail.wxss */ +.pd10{ + padding:10px; +} +.inheight{ + height:17px; + border:1px solid black; + padding:5px; +} +.comments{ + position:fixed; + bottom:0px; + width:100% +} +.pdb60{ + padding-bottom:62px; +} +.wxgreen{ + background-color:#1AAD19; + color:white; +} \ No newline at end of file diff --git a/pages/status/index.js b/pages/status/index.js index 03e53f2..f653e44 100644 --- a/pages/status/index.js +++ b/pages/status/index.js @@ -1,4 +1,5 @@ // pages/status/index.js +var app = getApp() Page({ data:{ tabs: ["我的回应", "提到我的", "选项三"], @@ -12,35 +13,6 @@ Page({ //获取token onLoad:function(options){ var that = this; - // 页面初始化 options为页面跳转所带来的参数 - wx.request({ - url: 'http://api.cnblogs.com/token', - data: { - username: 'H/AwJ6wflZ0D4jVm98KlnMWe5dCGrpJnO9BKRVBSHjXWkCTIMBMFNXHb0Ym+3q9DveNfFQBZH9Ezdat3ynvNCe70G84ild6lZib1a3OWvvB882GW4FEYZHFVVsYbeTHS9Vj8lRlC8BufFaTrQoVRZdHjw12P5jpstPwig8nmhuk=' , - password: 'RPK06yaugPZfLeXp2eRdKRSJmA8AaQ1oVR8A7IW1UwgVO3zdz07HxoJwzeg9hDR0/oGD2rCO9zHxoow8cqRE4tjtIrRE2xbLROCzATa1QbENPtd6EBLPiastlDkvhpP+s2JwhbfxeuciQ66/YmTd3KS8TJfmM2iM/BcjNN4hJ40=', - grant_type: 'password' - }, - header: { - "Content-Type":"application/x-www-form-urlencoded", - "Authorization":"Basic NTMxMmI0ZDMtODk3YS00ZWFjLTlkZmMtZWJiYzNkMTYwYmY1Ok5MdWtlRHRlMDktMkV5ZjBhbnFsZXpOeVZGTTVSb0N0SjF0d3dLTXZRalcwdFNWYmlzR3Y2MXRjblVnbjFfaHMyWTZrcU8yQ0xheDVlOTIw" - }, - success: function(res) { - console.log(res.data) - } - }), - //获取用户信息 - wx.request({ - url: 'http://api.cnblogs.com/api/Users', - data: { - }, - header: { - "Content-Type":"application/x-www-form-urlencoded", - "Authorization":"Bearer " + app.globle.access_token - }, - success: function(res2) { - console.log(res2.data) - } - }), //获取闪存信息 wx.request({ url: 'http://api.cnblogs.com/api/statuses/@all', @@ -51,7 +23,7 @@ Page({ }, header: { "Content-Type":"application/x-www-form-urlencoded", - "Authorization":"Bearer " + app.globle.access_token + "Authorization":"Bearer " + app.globalData.access_token }, success: function(res3) { that.setData({ diff --git a/pages/status/index.wxml b/pages/status/index.wxml index 920ee39..b9f3ee0 100644 --- a/pages/status/index.wxml +++ b/pages/status/index.wxml @@ -37,15 +37,6 @@
- - - - - - 用户名二 - 由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。 - -
-- Gitee