lhl 1 year ago
parent
commit
33c6cd8267
2 changed files with 34 additions and 2 deletions
  1. 8 0
      api/index.js
  2. 26 2
      pages/user/model/phb.vue

+ 8 - 0
api/index.js

@@ -53,3 +53,11 @@ export function getWorkerList(data) {
 		data
 	});
 }
+//https://api.myjie.cn/api/pub/
+export function getCardLookCountRank(data) {
+	return request({
+		url: '/api/pub/getCardLookCountRank',
+		method: 'post',
+		data
+	});
+}

+ 26 - 2
pages/user/model/phb.vue

@@ -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>