From 3a568032b010e5e5fb8553a9a56b406ed0c782f7 Mon Sep 17 00:00:00 2001 From: dlj Date: Sat, 25 Mar 2017 17:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E7=AD=94=E5=8D=9A=E9=97=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=AD=94=E6=A1=88=E7=9A=84?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=88=97=E8=A1=A8=E5=8F=8A=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/question/comments.js | 47 +++++++++++++++++++++++++++ pages/question/comments.json | 1 + pages/question/comments.wxml | 37 +++++++++++++++++++++ pages/question/comments.wxss | 1 + pages/question/index.js | 4 +-- pages/question/view.js | 63 ++++++++++++++++++++++++++++++++---- pages/question/view.wxml | 27 ++++++++++++---- 7 files changed, 166 insertions(+), 14 deletions(-) create mode 100644 pages/question/comments.js create mode 100644 pages/question/comments.json create mode 100644 pages/question/comments.wxml create mode 100644 pages/question/comments.wxss diff --git a/pages/question/comments.js b/pages/question/comments.js new file mode 100644 index 0000000..363a125 --- /dev/null +++ b/pages/question/comments.js @@ -0,0 +1,47 @@ +// pages/question/comments.js +var app = getApp(); +Page({ + data:{ + commonts:{} + }, + 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('获取用户信息失败!'); + } + }); + }, + onReady:function(){ + // 页面渲染完成 + }, + onShow:function(){ + // 页面显示 + }, + onHide:function(){ + // 页面隐藏 + }, + onUnload:function(){ + // 页面关闭 + } +}) \ No newline at end of file diff --git a/pages/question/comments.json b/pages/question/comments.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/pages/question/comments.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pages/question/comments.wxml b/pages/question/comments.wxml new file mode 100644 index 0000000..6e5f5a4 --- /dev/null +++ b/pages/question/comments.wxml @@ -0,0 +1,37 @@ + + + + {{question.Title}} + {{question.Content}} + + + 评论 + + + + + {{commont.Content}} + + {{item.PostUserInfo.UserName}}| + 园豆:{{item.PostUserInfo.QScore}}| + {{item.DateAdded}}| + + + + + + + + + 文本域 + + + +