|
@@ -74,18 +74,24 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import { getCardLookCountRank } from '@/api/index.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ times: '',
|
|
|
top_bg: this.$store.state.baseURL + '/resource/icon/base/phb-bg.png',
|
|
|
tit_bg: this.$store.state.baseURL + '/resource/icon/llph.png',
|
|
|
rz: this.$store.state.baseURL + '/resource/icon/rz.png',
|
|
|
navList: [{
|
|
|
title: '周排行',
|
|
|
- state: 0
|
|
|
+ time: ((new Date().setHours(0, 0, 0) - (new Date().getDay() - 1) *24 * 60 * 60 *1000)/1000).toFixed(0),
|
|
|
+ list: [],
|
|
|
+ loaded: false
|
|
|
}, {
|
|
|
title: '月排行',
|
|
|
- state: 1
|
|
|
+ time: (new Date(new Date(new Date().getFullYear(), new Date().getMonth(), 1).setHours(0, 0, 0)).getTime()/1000).toFixed(0),
|
|
|
+ list: [],
|
|
|
+ loaded: false
|
|
|
}],
|
|
|
currentIndex: 0,
|
|
|
}
|
|
@@ -95,6 +101,8 @@
|
|
|
},
|
|
|
onShow() {
|
|
|
console.log(this.$store.state.baseURL)
|
|
|
+ this.times = ((new Date().setHours(0, 0, 0) - (new Date().getDay() - 1) *24 * 60 * 60 *1000)/1000).toFixed(0)
|
|
|
+ this.getCardLookCountRank()
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
|
|
@@ -105,7 +113,23 @@
|
|
|
methods: {
|
|
|
navClick(index) {
|
|
|
this.currentIndex = index
|
|
|
+ },
|
|
|
+ getCardLookCountRank() {
|
|
|
+ let that = this
|
|
|
+ let navitem = that.navList[that.currentIndex]
|
|
|
+ if(navitem.loaded) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ getCardLookCountRank({
|
|
|
+ time: that.times
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ navitem.loaded = true
|
|
|
+ }).catch(err => {
|
|
|
+ navitem.loaded = false
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|