Skip to content

Commit

Permalink
代码格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
宁泽林 committed Sep 27, 2019
1 parent 3e72746 commit 00110c3
Show file tree
Hide file tree
Showing 17 changed files with 1,874 additions and 1,851 deletions.
357 changes: 179 additions & 178 deletions pages/about/about.js

Large diffs are not rendered by default.

190 changes: 93 additions & 97 deletions pages/comments/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,109 +20,105 @@ import config from '../../utils/config.js'
var pageCount = config.getPageCount;

Page({
data: {
title: '最新评论列表',
showerror: "none",
showallDisplay: "block",
readLogs: []
data: {
title: '最新评论列表',
showerror: "none",
showallDisplay: "block",
readLogs: []

},
onShareAppMessage: function () {
var title = "分享"+config.getWebsiteName+"的最新评论";
var path = "pages/comments/comments";
return {
title: title,
path: path,
success: function (res) {
// 转发成功
},
fail: function (res) {
// 转发失败
}
}
},
reload: function (e) {
var self = this;
this.setData({
readLogs: []
});
self.setData({
showallDisplay: "none",
showerror: "none",
},
onShareAppMessage: function() {
var title = "分享" + config.getWebsiteName + "的最新评论";
var path = "pages/comments/comments";
return {
title: title,
path: path,
success: function(res) {
// 转发成功
},
fail: function(res) {
// 转发失败
}
}
},
reload: function(e) {
var self = this;
this.setData({
readLogs: []
});
self.setData({
showallDisplay: "none",
showerror: "none",

});
self.fetchCommentsData();
},
onLoad: function (options) {
var self = this;
self.fetchCommentsData();
},
//获取文章列表数据
fetchCommentsData: function () {
var self = this;
wx.showLoading({
title: '正在加载',
mask: true
});
var getNewComments = wxRequest.getRequest(Api.getNewComments());
getNewComments.then(response => {
if (response.statusCode == 200) {
this.setData({
readLogs: self.data.readLogs.concat(response.data.map(function (item) {
item[0] = item.post;
item[1] = util.removeHTML(item.content.rendered + '(' + item.author_name + ')');
item[2] = "0";
return item;
}))
});
self.setData({
showallDisplay: "block"
});

}
else {
console.log(response);
this.setData({
showerror: 'block'
});
});
self.fetchCommentsData();
},
onLoad: function(options) {
var self = this;
self.fetchCommentsData();
},
//获取文章列表数据
fetchCommentsData: function() {
var self = this;
wx.showLoading({
title: '正在加载',
mask: true
});
var getNewComments = wxRequest.getRequest(Api.getNewComments());
getNewComments.then(response => {
if (response.statusCode == 200) {
this.setData({
readLogs: self.data.readLogs.concat(response.data.map(function(item) {
item[0] = item.post;
item[1] = util.removeHTML(item.content.rendered + '(' + item.author_name + ')');
item[2] = "0";
return item;
}))
});
self.setData({
showallDisplay: "block"
});

}
}).catch(function () {
self.setData({
showerror: "block",
floatDisplay: "none"
});
} else {
console.log(response);
this.setData({
showerror: 'block'
});

})
.finally(function () {
wx.hideLoading();
})
},
// 跳转至查看文章详情
redictDetail: function (e) {
// console.log('查看文章');
var id = e.currentTarget.id,
url = '../detail/detail?id=' + id;
wx.navigateTo({
url: url
})
},
onPullDownRefresh: function () {
var self = this;
this.setData({
readLogs: []
});
}
}).catch(function() {
self.setData({
showallDisplay: "none",
showerror: "none",

showerror: "block",
floatDisplay: "none"
});
self.fetchCommentsData();
//消除下刷新出现空白矩形的问题。
wx.stopPullDownRefresh();

}
})

})
.finally(function() {
wx.hideLoading();
})
},
// 跳转至查看文章详情
redictDetail: function(e) {
// console.log('查看文章');
var id = e.currentTarget.id,
url = '../detail/detail?id=' + id;
wx.navigateTo({
url: url
})
},
onPullDownRefresh: function() {
var self = this;
this.setData({
readLogs: []
});
self.setData({
showallDisplay: "none",
showerror: "none",

});
self.fetchCommentsData();
//消除下刷新出现空白矩形的问题。
wx.stopPullDownRefresh();

}
})
Loading

0 comments on commit 00110c3

Please sign in to comment.