|
@@ -2,7 +2,8 @@ import Swiper from 'swiper/bundle'
|
2
|
2
|
import gsap from 'gsap'
|
3
|
3
|
import Common from '../common/js/Common'
|
4
|
4
|
import {
|
5
|
|
- isMobile
|
|
5
|
+ isMobile,
|
|
6
|
+ fetchRequest
|
6
|
7
|
} from '../common/js/utils'
|
7
|
8
|
|
8
|
9
|
export default class App {
|
|
@@ -72,9 +73,35 @@ export default class App {
|
72
|
73
|
|
73
|
74
|
// });
|
74
|
75
|
// }
|
|
76
|
+ numberOfViews()
|
|
77
|
+ getNums()
|
|
78
|
+ async function numberOfViews() {
|
|
79
|
+ try {
|
|
80
|
+ const canshu = document.querySelector('.canshu');
|
|
81
|
+ let path = canshu.getAttribute('data-path');
|
|
82
|
+ let uuid = canshu.getAttribute('data-uuid');
|
|
83
|
+ await fetchRequest(`/front/viev/add?path=${path}&uuid=${uuid}`,'GET')
|
|
84
|
+
|
|
85
|
+ } catch (error) {}
|
|
86
|
+ }
|
|
87
|
+ async function getNums() {
|
|
88
|
+ try {
|
|
89
|
+ const canshu = document.querySelector('.canshu');
|
|
90
|
+ let path = canshu.getAttribute('data-path');
|
|
91
|
+ let uuid = canshu.getAttribute('data-uuid');
|
|
92
|
+ const res = await fetchRequest(`/front/viev/get?path=${path}&uuid=${uuid}`,'GET')
|
|
93
|
+ if(res){
|
|
94
|
+ const nums = document.querySelectorAll('.nums')
|
|
95
|
+ nums.forEach((item)=>{
|
|
96
|
+ item.innerHTML = '浏览次数:' + res.data || 0
|
|
97
|
+ })
|
|
98
|
+ }
|
|
99
|
+
|
|
100
|
+ } catch (error) {}
|
|
101
|
+ }
|
75
|
102
|
}
|
76
|
103
|
|
77
|
|
-
|
|
104
|
+
|
78
|
105
|
|
79
|
106
|
|
80
|
107
|
}
|