|
|
@@ -133,6 +133,7 @@
|
|
|
>
|
|
|
</product-large>
|
|
|
</div>
|
|
|
+ <img src="../assets/png-zhiding.png" @click="goTop" class="goTop" v-if="bodyScroll > 200" alt="" />
|
|
|
</van-pull-refresh>
|
|
|
<van-dialog v-model:show="riskShow" theme="round-button" className="risk">
|
|
|
<div class="risk-box">
|
|
|
@@ -176,7 +177,7 @@ import RankInfo from '../components/creator/RankInfo.vue';
|
|
|
|
|
|
export default {
|
|
|
name: 'home',
|
|
|
- inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll'],
|
|
|
+ inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll', 'bodyScroll'],
|
|
|
mixins: [banner, product],
|
|
|
components: {
|
|
|
Swiper,
|
|
|
@@ -338,30 +339,29 @@ export default {
|
|
|
message: '加载中...',
|
|
|
forbidClick: true
|
|
|
});
|
|
|
- return Promise.all([
|
|
|
- this.getBanner(),
|
|
|
- this.getProduct().then(res => {
|
|
|
- this.products = res.filter(item => {
|
|
|
- return item.type === 'collection';
|
|
|
- });
|
|
|
- this.news = res
|
|
|
- .filter(item => {
|
|
|
- return item.type === 'news';
|
|
|
- })
|
|
|
- .slice(0, 5);
|
|
|
- }),
|
|
|
- this.$http.get('/user/topTen').then(res => {
|
|
|
- this.hotUsers = res.slice(0, 5);
|
|
|
- })
|
|
|
- ]).then(() => {
|
|
|
+ return Promise.all([this.getBanner(), this.getProduct(), this.getHot()]).then(() => {
|
|
|
this.$toast.clear();
|
|
|
return Promise.resolve();
|
|
|
});
|
|
|
// this.getNews();
|
|
|
},
|
|
|
+ getHot() {
|
|
|
+ return this.$http.get('/user/topTen').then(res => {
|
|
|
+ this.hotUsers = res.slice(0, 5);
|
|
|
+ return Promise.resolve();
|
|
|
+ });
|
|
|
+ },
|
|
|
getProduct() {
|
|
|
return this.$http.get('/collection/recommend').then(res => {
|
|
|
- return Promise.resolve(res);
|
|
|
+ this.products = res.filter(item => {
|
|
|
+ return item.type === 'collection';
|
|
|
+ });
|
|
|
+ this.news = res
|
|
|
+ .filter(item => {
|
|
|
+ return item.type === 'news';
|
|
|
+ })
|
|
|
+ .slice(0, 5);
|
|
|
+ return Promise.resolve();
|
|
|
});
|
|
|
},
|
|
|
getBanner() {
|
|
|
@@ -390,6 +390,9 @@ export default {
|
|
|
return Promise.resolve();
|
|
|
});
|
|
|
},
|
|
|
+ goTop() {
|
|
|
+ this.changeScroll(0, true);
|
|
|
+ },
|
|
|
getList() {
|
|
|
if (this.page === 0) {
|
|
|
this.list = [];
|
|
|
@@ -488,6 +491,8 @@ export default {
|
|
|
},
|
|
|
activated() {
|
|
|
this.$nextTick(() => {
|
|
|
+ this.getProduct();
|
|
|
+ this.getHot();
|
|
|
if (window.cordova && StatusBar && StatusBar.isVisible) {
|
|
|
StatusBar.styleDefault();
|
|
|
}
|
|
|
@@ -758,7 +763,7 @@ export default {
|
|
|
margin: 16px 16px 0;
|
|
|
overflow: hidden;
|
|
|
&.news {
|
|
|
- padding-bottom: 18px;
|
|
|
+ padding-bottom: 24px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -909,4 +914,14 @@ export default {
|
|
|
position: relative;
|
|
|
}
|
|
|
}
|
|
|
+.goTop {
|
|
|
+ position: fixed;
|
|
|
+ right: 16px;
|
|
|
+ bottom: 100px;
|
|
|
+ bottom: calc(env(safe-area-inset-bottom) + 100px);
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ display: block;
|
|
|
+ z-index: 20;
|
|
|
+}
|
|
|
</style>
|