store article 8.13
This commit is contained in:
@@ -42,11 +42,11 @@
|
||||
<view class="main">
|
||||
<scroll-view class="video-image" scroll-y v-if="cur==0 && indextop.length" :style="{ height: scrollHeiht }">
|
||||
<view v-for="item in indextop" :key="item.id" class="container-top">
|
||||
<videoTop :url="item.article_pic" v-if="item.type == 2" @click.native="toDetailsPage(item.article_id)"></videoTop>
|
||||
<imageTop v-else :url="item.article_pic" @click.native="toDetailsPage(item.article_id)"></imageTop>
|
||||
<videoTop :url="item.article_pic" v-if="item.type == 2" @click.native="toDetailsPage({ id: item.article_id, type: item.type })"></videoTop>
|
||||
<imageTop v-else :url="item.article_pic" @click.native="toDetailsPage({ id: item.article_id, type: item.type })"></imageTop>
|
||||
</view>
|
||||
<view v-if="indexlist.length" class="container-bottom">
|
||||
<listitem v-for="item in indexlist" :key="item.id" :type="item.type" :url="item.article_pic" class="bottom-item" @click.native="toDetailsPage(item.article_id)"></listitem>
|
||||
<listitem v-for="item in indexlist" :key="item.id" :type="item.type" :url="item.article_pic" class="bottom-item" @click.native="toDetailsPage({ id: item.article_id, type: item.type })"></listitem>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="item" v-if="cur==1">
|
||||
@@ -149,11 +149,10 @@ export default {
|
||||
}
|
||||
|
||||
},
|
||||
toDetailsPage(id) {
|
||||
toDetailsPage({ id, type }) {
|
||||
// console.log(11);
|
||||
this.$u.route('pageB/photo/index', {
|
||||
id: id
|
||||
});
|
||||
let src = type == 1 ? 'pageB/photo/index' : 'pageB/video/video';
|
||||
this.$u.route(src, { id: id });
|
||||
},
|
||||
switchCurrent(current) {
|
||||
this.cur = current;
|
||||
@@ -194,15 +193,17 @@ export default {
|
||||
}).then(res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.errCode == 0) {
|
||||
// this.articleList = res.data.list;
|
||||
let articleList = res.data.list;
|
||||
// articleList.unshift({}, {}, {}, {});
|
||||
// articleList.push({}, {});
|
||||
if(JSON.stringify(res.data) != '[]') {
|
||||
if(res.data.list.length > 0) {
|
||||
this.indextop = [res.data.list[0]]
|
||||
if(articleList.length > 0) {
|
||||
this.indextop = [articleList[0]]
|
||||
// this.indextop = [res.data.list[0], res.data.list[1]];
|
||||
}
|
||||
if(res.data.list.length > 1) {
|
||||
this.indextop.push(res.data.list[1]);
|
||||
this.indexlist.push(...res.data.list.slice(2,));
|
||||
if(articleList.length > 1) {
|
||||
this.indextop.push(articleList[1]);
|
||||
this.indexlist.push(...articleList.slice(2,));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user