|
|
@ -16,8 +16,14 @@ |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="ranking-list"> |
|
|
<view class="ranking-list"> |
|
|
|
|
|
<!-- 加载中状态 --> |
|
|
|
|
|
<view class="loading" v-if="loading"> |
|
|
|
|
|
<uni-icons type="loading" size="40" color="#01a4fe" spin></uni-icons> |
|
|
|
|
|
<text>加载中...</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
<!-- 空状态 --> |
|
|
<!-- 空状态 --> |
|
|
<view class="empty" v-if="rankingData.length === 0"> |
|
|
|
|
|
|
|
|
<view class="empty" v-else-if="rankingData.length === 0"> |
|
|
<uni-icons style="margin-left: 20px;" custom-prefix="iconfont" type="icon-kongshuju" size="80" color="#ccc"></uni-icons> |
|
|
<uni-icons style="margin-left: 20px;" custom-prefix="iconfont" type="icon-kongshuju" size="80" color="#ccc"></uni-icons> |
|
|
<text style="margin-top: 20px;">暂无读者排行数据</text> |
|
|
<text style="margin-top: 20px;">暂无读者排行数据</text> |
|
|
</view> |
|
|
</view> |
|
|
@ -31,6 +37,7 @@ |
|
|
]" |
|
|
]" |
|
|
v-for="(item, index) in rankingData" |
|
|
v-for="(item, index) in rankingData" |
|
|
:key="index" |
|
|
:key="index" |
|
|
|
|
|
v-else |
|
|
> |
|
|
> |
|
|
<!-- 第一名 --> |
|
|
<!-- 第一名 --> |
|
|
<uni-icons class="ranking-icon" v-if="index === 0" custom-prefix="iconfont" type="icon-TOP2" size="26" color="#E6CB97"></uni-icons> |
|
|
<uni-icons class="ranking-icon" v-if="index === 0" custom-prefix="iconfont" type="icon-TOP2" size="26" color="#E6CB97"></uni-icons> |
|
|
@ -78,6 +85,7 @@ export default { |
|
|
return { |
|
|
return { |
|
|
rankingData: [], |
|
|
rankingData: [], |
|
|
defaultCover: '/static/images/default-book.png', |
|
|
defaultCover: '/static/images/default-book.png', |
|
|
|
|
|
loading: true, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -111,7 +119,7 @@ export default { |
|
|
const formattedDate = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}` |
|
|
const formattedDate = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}` |
|
|
|
|
|
|
|
|
const params = { |
|
|
const params = { |
|
|
'libcode': config.LIB_CODE, |
|
|
|
|
|
|
|
|
'libcode': 'GD', |
|
|
'starttime': formattedDate, |
|
|
'starttime': formattedDate, |
|
|
'endtime': this.getFormattedDate(new Date()), |
|
|
'endtime': this.getFormattedDate(new Date()), |
|
|
'rownum': 10, |
|
|
'rownum': 10, |
|
|
@ -132,9 +140,11 @@ export default { |
|
|
} else { |
|
|
} else { |
|
|
this.rankingData = []; |
|
|
this.rankingData = []; |
|
|
} |
|
|
} |
|
|
|
|
|
this.loading = false; |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
console.error('排行接口错误', error) |
|
|
console.error('排行接口错误', error) |
|
|
this.rankingData = []; |
|
|
this.rankingData = []; |
|
|
|
|
|
this.loading = false; |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -194,6 +204,18 @@ export default { |
|
|
min-height: 60vh; |
|
|
min-height: 60vh; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* 加载中状态 */ |
|
|
|
|
|
.loading { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-direction: column; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
height: 50vh; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
color: #999; |
|
|
|
|
|
font-size: 14px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* 空状态 */ |
|
|
/* 空状态 */ |
|
|
.empty { |
|
|
.empty { |
|
|
height: 50vh; |
|
|
height: 50vh; |
|
|
|