deming/pages/index/index.vue

234 lines
7.5 KiB
Vue
Raw Normal View History

2020-05-29 03:13:55 +00:00
<template>
2020-06-02 00:47:57 +00:00
<view class="index">
<view class="top">
<view class="sosuo"></view>
<view class="tabs">
2020-06-02 08:45:02 +00:00
<u-tabs :is-scroll="false" bar-width="70" ref="tabs" :list="list" :current="num" :bar-style="{
'background-color':'#FF780F',
'bottom':'10rpx'
}"
inactive-color="#333"
:active-item-style="{
'color':'#333'
}"
:bold="false"
@change="dianji"></u-tabs>
2020-06-02 00:47:57 +00:00
</view>
<view class="sosuo"></view>
2020-05-29 09:10:25 +00:00
</view>
2020-06-02 08:45:02 +00:00
<swiper class="card" @change="dianji" :current="num">
2020-06-02 00:47:57 +00:00
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
2020-06-02 03:14:51 +00:00
<view class="box">
<indexad style="width:690rpx"></indexad>
<view class="list">
<view >
2020-06-30 10:06:50 +00:00
<videoItem v-for="item in articleList.filter((_, index) => !(index&1))" :key="item.article_id" :item="item" @getArticlelist="getArticlelist"></videoItem>
2020-06-02 03:14:51 +00:00
</view>
<view style="margin-left:20rpx">
2020-06-30 10:06:50 +00:00
<videoItem v-for="item in articleList.filter((_, index) => index&1)" :key="item.article_id" :item="item" @getArticlelist="getArticlelist"></videoItem>
2020-06-02 03:14:51 +00:00
</view>
2020-06-02 01:16:41 +00:00
</view>
</view>
2020-06-02 00:47:57 +00:00
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
2020-06-02 03:14:51 +00:00
<view class="box">
<indexad style="width:690rpx"></indexad>
<view class="list">
<view >
<zhiboItem v-for="item in 10"></zhiboItem>
</view>
<view style="margin-left:20rpx">
<zhiboItem v-for="item in 10"></zhiboItem>
</view>
2020-06-02 01:34:37 +00:00
</view>
</view>
2020-06-02 03:14:51 +00:00
2020-06-02 00:47:57 +00:00
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
2020-06-02 03:14:51 +00:00
<view class="box">
<view class="tuijian">
2020-07-01 09:32:36 +00:00
<view class="title" @click="toSearchPage">
2020-06-02 03:14:51 +00:00
<view class="left">
<view></view>
<text>推荐达人</text>
</view>
2020-07-01 09:32:36 +00:00
<image class="right" src="/static/image/common/1.png"></image>
2020-06-02 03:14:51 +00:00
</view>
<view class="tuijianlist">
2020-06-30 10:06:50 +00:00
<!-- <darenItem style="margin-right:23rpx"></darenItem>
<darenItem style="margin-right:23rpx"></darenItem> -->
2020-07-01 09:32:36 +00:00
<darenItem v-for="item in recommendList.slice(0,3)" :key="item.id" :info="item"></darenItem>
2020-06-02 03:14:51 +00:00
</view>
</view>
2020-06-02 07:37:01 +00:00
<view class="list">
<view >
2020-06-30 10:06:50 +00:00
<!-- <videoItem isguanzhu="true" v-for="item in 10"></videoItem> -->
<videoItem isguanzhu="true" v-for="item in articleList.filter((_, index) => !(index&1))" :key="item.article_id" :item="item" @getArticlelist="getArticlelist"></videoItem>
2020-06-02 07:37:01 +00:00
</view>
<view style="margin-left:20rpx">
2020-06-30 10:06:50 +00:00
<!-- <videoItem isguanzhu="true" v-for="item in 10"></videoItem> -->
<videoItem isguanzhu="true" v-for="item in articleList.filter((_, index) => index&1)" :key="item.article_id" :item="item" @getArticlelist="getArticlelist"></videoItem>
2020-06-02 07:37:01 +00:00
</view>
</view>
2020-06-02 03:14:51 +00:00
</view>
2020-06-02 00:47:57 +00:00
</scroll-view>
</swiper-item>
</swiper>
2020-05-29 09:10:25 +00:00
</view>
2020-05-29 03:13:55 +00:00
2020-06-02 00:47:57 +00:00
</template>
2020-05-29 09:10:25 +00:00
<style lang="scss" scoped>
2020-06-02 00:47:57 +00:00
.index{
width: 750rpx;
2020-05-29 09:10:25 +00:00
display: flex;
flex-direction: column;
2020-06-02 00:47:57 +00:00
height: 100vh;
.top{
2020-06-02 01:34:37 +00:00
padding: 0 30rpx;
2020-06-02 00:47:57 +00:00
display: flex;
justify-content: space-between;
width: 100%;
height: 88rpx;
align-items: center;
flex-shrink: 0;
.sosuo{
width: 32rpx;
height: 32rpx;
2020-06-02 08:45:02 +00:00
2020-06-02 00:47:57 +00:00
}
.tabs{
2020-06-02 08:45:02 +00:00
width: 334rpx;
/deep/ .u-tab-item{
2020-06-02 00:47:57 +00:00
font-weight: bold;
}
}
}
.card{
height: 100%;
2020-06-02 01:34:37 +00:00
width: 100%;
2020-06-02 03:14:51 +00:00
.box{
width: 100%;
2020-06-02 01:34:37 +00:00
padding: 0 30rpx;
2020-06-02 00:47:57 +00:00
}
2020-06-02 01:16:41 +00:00
.list{
display: flex;
}
2020-06-02 00:47:57 +00:00
}
2020-06-02 03:14:51 +00:00
.tuijian{
width: 750rpx;
margin-left: -30rpx;
height: 400rpx;
background-color: #ececec;
padding: 30rpx;
.title{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.left{
display: flex;
align-items: center;
>view{
width: 6rpx;
height: 30rpx;
background-color: #FF780F;
}
>text{
font-size: 30rpx;
color: 30rpx;
margin-left: 14rpx;
}
}
.right{
width: 14rpx;
height: 24rpx;
}
}
.tuijianlist{
width: 100%;
height: 282rpx;
margin-top: 30rpx;
display: flex;
2020-06-30 10:06:50 +00:00
> view:not(:last-child) {
margin-right: 23rpx;
}
2020-06-02 03:14:51 +00:00
}
}
2020-05-29 09:10:25 +00:00
}
2020-06-02 00:47:57 +00:00
</style>
<script>
import videoItem from "@/components/index/video-item/index"
2020-06-02 01:34:37 +00:00
import zhiboItem from "@/components/index/zhibo-item/index"
import indexad from "@/components/index/ad/index"
2020-06-02 03:14:51 +00:00
import darenItem from "@/components/index/daren-item/index"
2020-06-02 00:47:57 +00:00
export default {
name:"index",
data(){
return {
2020-06-02 08:45:02 +00:00
list:[
{
name: '发现'
}, {
name: '直播'
}, {
name: '关注'
}
],
2020-06-29 09:24:57 +00:00
num:0,
page: 0, // 0即第一页
articleList: [],
2020-06-30 10:06:50 +00:00
recommendList: [], // 推荐达人
2020-06-02 00:47:57 +00:00
}
},
components:{
2020-06-02 01:34:37 +00:00
videoItem,
zhiboItem,
2020-06-02 03:14:51 +00:00
indexad,
darenItem
2020-06-04 01:39:08 +00:00
},
2020-06-30 10:06:50 +00:00
onShow(){
this.getArticlelist();
this.getRecommendList();
2020-06-29 09:24:57 +00:00
},
2020-06-04 01:39:08 +00:00
methods:{
dianji(a){
2020-06-30 10:06:50 +00:00
// console.log(a)
2020-06-04 01:39:08 +00:00
if(typeof a == "object"){
this.num = a.detail.current
}else{
this.num = a
}
2020-06-29 09:24:57 +00:00
},
getArticlelist () {
this.$u.api.getArticlelist({
page: this.page,
is_video_img: 0, // 查询视频1 图文2 都查0
}).then(res => {
if(res.errCode == 0) {
this.articleList = res.data.list;
}
})
2020-06-30 10:06:50 +00:00
},
getRecommendList() {
this.$u.api.getRecommendList().then(res => {
2020-07-03 01:09:21 +00:00
console.log(res)
2020-06-30 10:06:50 +00:00
if(res.errCode == 0) {
this.recommendList = res.data.list;
}
})
},
2020-07-01 09:32:36 +00:00
toSearchPage() {
uni.navigateTo({
url: '/pageB/follow/index'
})
},
2020-06-15 02:00:14 +00:00
},
2020-05-29 09:10:25 +00:00
}
2020-06-02 00:47:57 +00:00
</script>