242 lines
4.9 KiB
Vue
242 lines
4.9 KiB
Vue
<template>
|
|
<view class="rankingList_content">
|
|
<view class="rankingList_header">
|
|
<scroll-view class="_header_list_scroll" scroll-x="true">
|
|
<view class="_header_list" v-for="m in headerList" :key="m.id" @tap="handelRankingList" :data-id="m.id">
|
|
<view :class="['_header_list_item',headerListActive == m.id ? 'active' : '']">
|
|
{{m.name}}
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
<view class="rankingList_body">
|
|
<view class="rankingList_body_box">
|
|
<view class="_body_box_book_list">
|
|
<view class="_book_list_item" v-for="(m,idx) in dataList" :key="m.id" @tap="toBooksReadingDetail(m)">
|
|
<view class="_book_list_item_left">
|
|
<image class="is_image" :src="m.cover"></image>
|
|
<view class="_book_list_item_ranking_icon">
|
|
<image class="is_image" :src="rankingIconList[idx]"></image>
|
|
</view>
|
|
</view>
|
|
<view class="_book_list_item_right">
|
|
<view class="_book_list_item_title">{{m.title}}</view>
|
|
<view class="_book_list_item_tips">{{m.category_name}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="rankingList_more">
|
|
<view class="rankingList_more_btn" @tap="toBooksTheCharts">
|
|
查看全部
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import ranking_one from '@/static/images/bookCity/ranking_one.png';
|
|
import ranking_two from '@/static/images/bookCity/ranking_two.png';
|
|
import ranking_three from '@/static/images/bookCity/ranking_three.png';
|
|
import ranking_four from '@/static/images/bookCity/ranking_four.png';
|
|
export default {
|
|
props: {
|
|
dataList: {
|
|
type: Array,
|
|
default: []
|
|
},
|
|
headerListActive: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
headerList: [{
|
|
id: '1',
|
|
name: '人气榜'
|
|
},
|
|
{
|
|
id: '2',
|
|
name: '畅销榜'
|
|
},
|
|
{
|
|
id: '3',
|
|
name: '新书榜'
|
|
},
|
|
{
|
|
id: '4',
|
|
name: '完结榜'
|
|
},
|
|
],
|
|
rankingIconList: [
|
|
ranking_one,
|
|
ranking_two,
|
|
ranking_three,
|
|
ranking_four
|
|
]
|
|
}
|
|
},
|
|
methods: {
|
|
handelRankingList(event) {
|
|
this.$emit('handelRankingList', event);
|
|
},
|
|
toBooksReadingDetail(row) {
|
|
uni.navigateTo({
|
|
url: `/pages/booksReadingDetail/booksReadingDetail?sid=${row.id}&t=${row.title}`
|
|
})
|
|
},
|
|
toBooksTheCharts() {
|
|
uni.navigateTo({
|
|
url: `/pages/booksTheCharts/index?chartsType=${this.headerListActive}`
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.is_image {
|
|
display: block;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.rankingList_content {
|
|
width: 100%;
|
|
|
|
.rankingList_header {
|
|
width: 100%;
|
|
|
|
._header_list_scroll {
|
|
white-space: nowrap;
|
|
|
|
// width: 1000rpx;
|
|
._header_list {
|
|
// display: flex;
|
|
display: inline-block;
|
|
margin-left: 10rpx;
|
|
|
|
._header_list_item {
|
|
width: 160rpx;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
line-height: 70rpx;
|
|
background-color: #F6F6F6;
|
|
border-radius: 8rpx;
|
|
color: #666666;
|
|
font-size: 30rpx;
|
|
}
|
|
|
|
._header_list_item.active {
|
|
color: #FC0538;
|
|
background-color: #FFDCE3;
|
|
}
|
|
}
|
|
|
|
._header_list:first-child {
|
|
margin-left: 0;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
.rankingList_body {
|
|
width: 100%;
|
|
|
|
.rankingList_body_box {
|
|
width: 100%;
|
|
|
|
._body_box_book_list {
|
|
width: 100%;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
|
|
._book_list_item {
|
|
|
|
display: flex;
|
|
width: 50%;
|
|
margin-top: 30rpx;
|
|
box-sizing: border-box;
|
|
|
|
|
|
._book_list_item_left {
|
|
position: relative;
|
|
width: 130rpx;
|
|
height: 180rpx;
|
|
flex: 0 0 auto;
|
|
z-index: 2;
|
|
border-radius: 8rpx;
|
|
overflow: hidden;
|
|
|
|
._book_list_item_ranking_icon {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 3;
|
|
width: 38rpx;
|
|
height: 38rpx;
|
|
}
|
|
}
|
|
|
|
._book_list_item_right {
|
|
flex: 1;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-around;
|
|
margin-left: 16rpx;
|
|
overflow: hidden;
|
|
|
|
._book_list_item_title {
|
|
width: 100%;
|
|
font-size: 30rpx;
|
|
color: #1A1A1A;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
._book_list_item_tips {
|
|
width: 100%;
|
|
font-size: 26rpx;
|
|
color: #999999;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
._book_list_item:nth-child(2n) {
|
|
padding-left: 15rpx;
|
|
}
|
|
|
|
._book_list_item:nth-child(2n-1) {
|
|
padding-right: 15rpx;
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
.rankingList_more {
|
|
width: 100%;
|
|
margin-top: 32rpx;
|
|
|
|
.rankingList_more_btn {
|
|
width: 100%;
|
|
height: 82rpx;
|
|
border-radius: 16rpx;
|
|
background-color: #F1F1F1;
|
|
color: #666666;
|
|
font-size: 28rpx;
|
|
text-align: center;
|
|
line-height: 82rpx;
|
|
}
|
|
}
|
|
}
|
|
</style> |