| xqd
@@ -21,20 +21,20 @@ Page({
|
|
|
}],
|
|
|
selectedTab: 'video',
|
|
|
},
|
|
|
- onLoad: function(a) {
|
|
|
+ onLoad: function (a) {
|
|
|
// app.pageOnLoad(this);
|
|
|
this.loadMoreGoodsList('both');
|
|
|
},
|
|
|
swiperTab: function (e) {
|
|
|
var that = this;
|
|
|
- console.log(e);
|
|
|
+ // console.log(e);
|
|
|
that.setData({
|
|
|
selectedTab: e.detail.currentItemId
|
|
|
});
|
|
|
},
|
|
|
clickTab: function (e) {
|
|
|
var that = this;
|
|
|
- console.log(e)
|
|
|
+ // console.log(e)
|
|
|
if (this.data.selectedTab === e.target.dataset.current) {
|
|
|
return false;
|
|
|
} else {
|
| xqd
@@ -43,14 +43,14 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- onReady: function() {},
|
|
|
- onShow: function() {
|
|
|
+ onReady: function () { },
|
|
|
+ onShow: function () {
|
|
|
// app.pageOnShow(this);
|
|
|
},
|
|
|
- onHide: function() {},
|
|
|
- onUnload: function() {},
|
|
|
- onPullDownRefresh: function() {},
|
|
|
- loadMoreGoodsList: function(tab) {
|
|
|
+ onHide: function () { },
|
|
|
+ onUnload: function () { },
|
|
|
+ onPullDownRefresh: function () { },
|
|
|
+ loadMoreGoodsList: function (tab) {
|
|
|
var tab = tab || this.data.selectedTab;
|
|
|
var o = this;
|
|
|
// if (!is_loading_more) {
|
| xqd
@@ -96,38 +96,39 @@ Page({
|
|
|
'type': tab
|
|
|
},
|
|
|
success: res => {
|
|
|
- if (res.data.list.length > 0) {
|
|
|
- if(res.data.type == 'video') {
|
|
|
- var t = o.data.video_list.concat(res.data.list);
|
|
|
- o.setData({
|
|
|
- video_list: t,
|
|
|
- page: i + 1
|
|
|
- });
|
|
|
- } else if (res.data.type == 'article') {
|
|
|
- var t = o.data.article_list.concat(res.data.list);
|
|
|
- o.setData({
|
|
|
- article_list: t,
|
|
|
- page: i + 1
|
|
|
- });
|
|
|
- } else if (res.data.type == 'both') {
|
|
|
- var t = o.data.video_list.concat(res.data.video_list);
|
|
|
- o.setData({
|
|
|
- video_list: t,
|
|
|
- page: i + 1
|
|
|
- });
|
|
|
- var t = o.data.article_list.concat(res.data.article_list);
|
|
|
- o.setData({
|
|
|
- article_list: t,
|
|
|
- page: i + 1
|
|
|
- });
|
|
|
+ if (res.data.status == 'success') {
|
|
|
+ if (res.data.type != 'both' && res.data.list.length <= 0) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '到底了',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 800
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (res.data.type == 'video') {
|
|
|
+ var t = o.data.video_list.concat(res.data.list);
|
|
|
+ o.setData({
|
|
|
+ video_list: t,
|
|
|
+ page: i + 1
|
|
|
+ });
|
|
|
+ } else if (res.data.type == 'article') {
|
|
|
+ var t = o.data.article_list.concat(res.data.list);
|
|
|
+ o.setData({
|
|
|
+ article_list: t,
|
|
|
+ page: i + 1
|
|
|
+ });
|
|
|
+ } else if (res.data.type == 'both') {
|
|
|
+ var t = o.data.video_list.concat(res.data.video_list);
|
|
|
+ o.setData({
|
|
|
+ video_list: t,
|
|
|
+ page: i + 1
|
|
|
+ });
|
|
|
+ var t = o.data.article_list.concat(res.data.article_list);
|
|
|
+ o.setData({
|
|
|
+ article_list: t,
|
|
|
+ page: i + 1
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
- wx.showToast({
|
|
|
- title: '到底了',
|
|
|
- icon: 'none',
|
|
|
- duration: 800
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
})
|
| xqd
@@ -152,18 +153,18 @@ Page({
|
|
|
// });
|
|
|
// }
|
|
|
},
|
|
|
- play: function(a) {
|
|
|
+ play: function (a) {
|
|
|
var t = a.currentTarget.dataset.index;
|
|
|
wx.createVideoContext("video_" + this.data.show_video).pause(), this.setData({
|
|
|
show_video: t,
|
|
|
show: !0
|
|
|
});
|
|
|
},
|
|
|
- onReachBottom: function() {
|
|
|
+ onReachBottom: function () {
|
|
|
this.loadMoreGoodsList();
|
|
|
// is_no_more || this.loadMoreGoodsList();
|
|
|
},
|
|
|
- more: function(a) {
|
|
|
+ more: function (a) {
|
|
|
var t = this,
|
|
|
o = a.target.dataset.index,
|
|
|
i = t.data.video_list,
|
| xqd
@@ -173,11 +174,11 @@ Page({
|
|
|
});
|
|
|
this.animation = e, -1 != i[o].show ? (e.rotate(0).step(), i[o].show = -1) : (e.rotate(0).step(),
|
|
|
i[o].show = 0), t.setData({
|
|
|
- video_list: i,
|
|
|
- animationData: this.animation.export()
|
|
|
- });
|
|
|
+ video_list: i,
|
|
|
+ animationData: this.animation.export()
|
|
|
+ });
|
|
|
},
|
|
|
- redirectToArticle: function(e) {
|
|
|
+ redirectToArticle: function (e) {
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/article-detail/index?id=' + id
|