diff --git a/assets/img/home/icon-app.png b/assets/img/home/icon-app.png
new file mode 100644
index 0000000..5e7dfea
Binary files /dev/null and b/assets/img/home/icon-app.png differ
diff --git a/assets/img/home/icon-customer.png b/assets/img/home/icon-customer.png
new file mode 100644
index 0000000..518b401
Binary files /dev/null and b/assets/img/home/icon-customer.png differ
diff --git a/assets/img/home/icon-totop-light.png b/assets/img/home/icon-totop-light.png
new file mode 100644
index 0000000..66d6725
Binary files /dev/null and b/assets/img/home/icon-totop-light.png differ
diff --git a/assets/img/home/icon-totop.png b/assets/img/home/icon-totop.png
new file mode 100644
index 0000000..9f03d1a
Binary files /dev/null and b/assets/img/home/icon-totop.png differ
diff --git a/layouts/default.vue b/layouts/default.vue
index e61e33d..a317081 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -24,7 +24,6 @@ export default {
data() {
return {
isSticky: false,
- ticking: false,
};
},
computed: {
@@ -45,16 +44,8 @@ export default {
window.removeEventListener("scroll", this.scrollEventMethod);
},
methods: {
- scrollEventMethod(e) {
- const that = this;
- // 节流
- if (!that.ticking) {
- window.requestAnimationFrame(function () {
- that.ticking = false;
- that.isSticky = window.scrollY > 300;
- });
- that.ticking = true;
- }
+ scrollEventMethod() {
+ this.isSticky = window.scrollY > 300;
},
},
};
diff --git a/pages/index/index.vue b/pages/index/index.vue
index b01ae58..4c0a35b 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -43,6 +43,7 @@
+
@@ -61,11 +62,12 @@ import {
import Banner from "./module/Banner.vue";
import Seckil from "./module/Seckill.vue";
import Pick from "./module/Pick.vue";
+import TabbarFixed from "./module/TabbarFixed.vue";
const SECKILL_COUNT = 20; // 秒杀商品数
const NEW_COUNT = 5; // 新品上架商品数
export default {
- components: { Banner, Seckil, Pick, UiGoodsItem, UiPagination },
+ components: { Banner, Seckil, Pick, UiGoodsItem, UiPagination, TabbarFixed },
async asyncData({ store }) {
// 获取秒杀数据
let seckillData = { activityTimeVO: null };
@@ -122,12 +124,24 @@ export default {
total: 0,
loading: false,
currentPage: 0,
+ scrollTop: 0,
};
},
created() {
this.getSelectProducts();
},
+ mounted() {
+ // 监听滚动事件
+ window.addEventListener("scroll", this.scrollEventMethod);
+ },
+ destroyed() {
+ window.removeEventListener("scroll", this.scrollEventMethod);
+ },
methods: {
+ scrollEventMethod() {
+ this.scrollTop = window.scrollY;
+ },
+
// 刷新秒杀活动状态
async handleSeckillRefresh() {
const { result: seckillData } = await ApiGetHomeSeckill();
diff --git a/pages/index/module/Banner.vue b/pages/index/module/Banner.vue
index 5655f54..f6b6dd2 100644
--- a/pages/index/module/Banner.vue
+++ b/pages/index/module/Banner.vue
@@ -26,11 +26,11 @@ export default {
return {
bannerList: [
{
- url: "https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/banner4.jpg",
+ url: "https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/goods13.jpg",
id: 13,
},
{
- url: "https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/1.png",
+ url: "https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/goods30.jpg",
id: 30,
},
{
@@ -38,7 +38,7 @@ export default {
id: 15,
},
{
- url: "https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/3banner.png",
+ url: "https://msb-edu-dev.oss-cn-beijing.aliyuncs.com/uc/account-avatar/goods40.jpg",
id: 40,
},
],
diff --git a/pages/index/module/TabbarFixed.vue b/pages/index/module/TabbarFixed.vue
new file mode 100644
index 0000000..c5625cf
--- /dev/null
+++ b/pages/index/module/TabbarFixed.vue
@@ -0,0 +1,131 @@
+
+
+
+
+
扫一扫上方二维码 下载APP
+
+
+
+
下载app
+
+
+
+
+
联系客服
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/store/index.js b/store/index.js
index d39677c..a7a54c4 100644
--- a/store/index.js
+++ b/store/index.js
@@ -44,11 +44,11 @@ const mutations = {
},
};
const actions = {
- async nuxtServerInit({ state, commit, dispatch }) {
+ nuxtServerInit({ state, commit, dispatch }) {
const token = this.$cookies.get(TOKEN_KEY);
if (!state.token && token) {
commit("setToken", token);
- await dispatch("getUserInfo");
+ dispatch("getUserInfo");
}
},
async getUserInfo({ commit }) {