diff --git a/pages/question/index.js b/pages/question/index.js
index 826d295eb1cc31a34c66cbc1d6912189a71c7677..053f9d70a09268c7a52bca7881cd35afe97603b4 100644
--- a/pages/question/index.js
+++ b/pages/question/index.js
@@ -1,41 +1,52 @@
// pages/question/index.js
+var app = getApp();
Page({
data:{
tabs: ["问题列表", "我的关注", "我的博问", "博问标签"],
activeIndex: 0,
sliderOffset: 0,
sliderLeft: 0,
- questions:[
- {
- "Id": 1,
- "Title": "0基础学习 PHP 求推荐课程 初中高 完整学习线路",
- "Url": "http",
- "Description": "1,51CTO 上付费的PHP 线路 是否有价值,上面说付费可以联系讲师答疑 不知真假 2,网盘里面的免费资源非常多,但是好的资源需要花好多时间去筛选。 第一个问题 : 想全面掌握PHP 采用哪一种方式好呢? 第二个问题: 有收徒的大神没?小弟在职学PHP 目前没有编程基础,但是可以付费学习",
- "Author": "不知道",
- "BlogApp": "sample string 6",
- "Avatar": "http://img1.3lian.com/2015/w7/85/d/101.jpg",
- "PostDate": "2017-02-19",
- "ViewCount": 9,
- "AnswerCount": 10,
- "DiggCount": 11
- },
- {
- "Id": 1,
- "Title": "sample string 2",
- "Url": "sample string 3",
- "Description": "sample string 4",
- "Author": "sample string 5",
- "BlogApp": "sample string 6",
- "Avatar": "http://img1.3lian.com/2015/w7/85/d/101.jpg",
- "PostDate": "2017-02-19",
- "ViewCount": 9,
- "AnswerCount": 10,
- "DiggCount": 11
- }
-],
+ questions:[],
+ myQuestions:[],
},
onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
+ var that = this
+ //获取问题列表
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/@sitehome', //仅为示例,并非真实的接口地址
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer '+ app.globalData.access_token
+ },
+ 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.globalData.access_token
+ },
+ success: function (res) {
+ that.setData({
+ myQuestions: res.data
+ });
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
},
tabClick: function (e) {
this.setData({
diff --git a/pages/question/index.wxml b/pages/question/index.wxml
index fc59d54f126787a07ff812f6700ecf98327c1d4e..2064c933a171d0e6de95a53669125818c465861d 100644
--- a/pages/question/index.wxml
+++ b/pages/question/index.wxml
@@ -14,16 +14,16 @@
-
+
-
+
{{item.Title}}
- {{item.Description}}
+ {{item.Summary}}
- @{{item.Author}}
- {{item.PostDate}}
+ @{{item.QuestionUserInfo.UserName}}
+ {{item.DateAdded}}
回复 {{item.AnswerCount}}
@@ -32,7 +32,26 @@
选项二的内容
- 选项三的内容
+
+
+
+
+
+
+
+
+ {{item.Title}}
+ {{item.Summary}}
+
+ @{{item.QuestionUserInfo.UserName}}
+ {{item.DateAdded}}
+ 回复 {{item.AnswerCount}}
+
+
+
+
+
+
选项四的内容
diff --git a/pages/question/view.js b/pages/question/view.js
new file mode 100644
index 0000000000000000000000000000000000000000..52bbd1750853c1b545c0be1c3bffd696a50f2b39
--- /dev/null
+++ b/pages/question/view.js
@@ -0,0 +1,59 @@
+// pages/question/view.js
+var app = getApp();
+Page({
+ data:{
+ question:{},
+ answers:{},
+ },
+ 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.globalData.access_token
+ },
+ success: function (res) {
+ that.setData({
+ question: res.data
+ });
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+ wx.request({
+ url: 'https://api.cnblogs.com/api/questions/'+options.id+'/answers', //仅为示例,并非真实的接口地址
+ method: 'GET',
+ data: {
+ },
+ header: {
+ 'Authorization': 'Bearer '+ app.globalData.access_token
+ },
+ success: function (res) {
+ that.setData({
+ answers: res.data
+ });
+ },
+ fail: function () {
+ console.log('获取用户信息失败!');
+ }
+ });
+ },
+ onReady:function(){
+ // 页面渲染完成
+ },
+ onShow:function(){
+ // 页面显示
+ },
+ onHide:function(){
+ // 页面隐藏
+ },
+ onUnload:function(){
+ // 页面关闭
+ }
+})
\ No newline at end of file
diff --git a/pages/question/view.json b/pages/question/view.json
new file mode 100644
index 0000000000000000000000000000000000000000..9e26dfeeb6e641a33dae4961196235bdb965b21b
--- /dev/null
+++ b/pages/question/view.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/pages/question/view.wxml b/pages/question/view.wxml
new file mode 100644
index 0000000000000000000000000000000000000000..0c5600aaee7b5bcf315beae8b11a408ee469cd0e
--- /dev/null
+++ b/pages/question/view.wxml
@@ -0,0 +1,23 @@
+
+
+
+ {{question.Title}}
+ {{question.Content}}
+
+ 回答
+
+
+
+
+ {{item.Answer}}
+
+ {{item.AnswerUserInfo.UserName}}|
+ 园豆:{{item.AnswerUserInfo.QScore}}|
+
+
+
+
+
+
+
+
diff --git a/pages/question/view.wxss b/pages/question/view.wxss
new file mode 100644
index 0000000000000000000000000000000000000000..2553439523087edadaa0b6e776f1ff81ea819deb
--- /dev/null
+++ b/pages/question/view.wxss
@@ -0,0 +1 @@
+/* pages/question/view.wxss */
\ No newline at end of file