feat: 首页支持上拉刷新,首页固定图标位置适配屏宽,UI调整

feature/task1.0.0_xg
xiaoguang 3 years ago
parent 950a2d3699
commit 641ea8a7fe

@ -158,7 +158,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.header-cart-popover { .header-cart-popover {
padding: 16px 20px !important; padding: 16px 20px 50px 20px !important;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -194,17 +194,19 @@ export default {
} }
} }
.header-cart-popover { .header-cart-popover {
padding: 20px 16px;
.header-cart-products { .header-cart-products {
padding: 0 10px 20px 0;
max-height: 360px; max-height: 360px;
overflow: auto; overflow: auto;
padding: 0 10px 16px 0;
&--failure-color { &--failure-color {
color: #999999 !important; color: #999999 !important;
} }
.header-cart-products__wrap { .header-cart-products__wrap {
margin-bottom: 20px; margin-bottom: 20px;
cursor: pointer; cursor: pointer;
&:last-child {
margin-bottom: 0;
}
.cart_products-wrap_cover { .cart_products-wrap_cover {
width: 60px; width: 60px;
height: 60px; height: 60px;

@ -195,14 +195,14 @@ export default {
} }
} }
.tab-category-menu__right { .tab-category-menu__right {
padding: 15px 26px; padding: 30px 26px 35px 26px;
box-shadow: 7px 0px 10px 1px rgba(0, 0, 0, 0.1); box-shadow: 7px 0px 10px 1px rgba(0, 0, 0, 0.1);
border: 1px solid #eeeeee; border: 1px solid #eeeeee;
background: #ffffff; background: #ffffff;
border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;
.category-menu-right__wrap { .category-menu-right__wrap {
height: 36px; height: 36px;
margin-top: 23px; margin-top: 15px;
line-height: 36px; line-height: 36px;
padding: 0 16px; padding: 0 16px;
font-size: 12px; font-size: 12px;

@ -228,6 +228,7 @@ export default {
z-index: 10; z-index: 10;
background: #ffffff; background: #ffffff;
box-shadow: 0px 4px 10px 1px rgba(0, 0, 0, 0.1); box-shadow: 0px 4px 10px 1px rgba(0, 0, 0, 0.1);
z-index: 9999;
&--hide-shadow { &--hide-shadow {
box-shadow: none; box-shadow: none;
/deep/.el-menu { /deep/.el-menu {

@ -128,6 +128,9 @@ export default {
background-size: 100% 100%; background-size: 100% 100%;
padding: 49px 26px; padding: 49px 26px;
margin-right: 30px; margin-right: 30px;
border: 1px solid #ffffff;
box-shadow: 0px 4px 10px 1px rgba(0, 0, 0, 0.06);
border-radius: 4px;
.home-head-info__avatar { .home-head-info__avatar {
width: 65px; width: 65px;
height: 65px; height: 65px;
@ -154,13 +157,16 @@ export default {
padding: 0 58px; padding: 0 58px;
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
box-shadow: 0px 4px 10px 1px rgba(0, 0, 0, 0.1); box-shadow: 0px 4px 10px 1px rgba(0, 0, 0, 0.06);
cursor: pointer; cursor: pointer;
.account-home-content__item { .account-home-content__item {
position: relative; position: relative;
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
text-align: center; text-align: center;
&:last-child {
padding-right: 0;
}
.account-home-content__item--count { .account-home-content__item--count {
position: absolute; position: absolute;
top: -3px; top: -3px;

@ -37,7 +37,7 @@
</el-upload> </el-upload>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="昵称" prop="nickname"> <el-form-item label="昵称" prop="nickname" class="form-item__nickname">
<el-input <el-input
class="user-info-content__nickname" class="user-info-content__nickname"
placeholder="请输入昵称" placeholder="请输入昵称"
@ -203,6 +203,9 @@ export default {
border: 1px solid #eeeeee; border: 1px solid #eeeeee;
} }
} }
.form-item__nickname {
margin-left: -10px;
}
.user-info-content__nickname { .user-info-content__nickname {
height: 35px; height: 35px;
width: 210px; width: 210px;

@ -31,12 +31,6 @@
:key="item.id" :key="item.id"
></UiGoodsItem> ></UiGoodsItem>
</div> </div>
<UiPagination
:current-page="currentPage"
:page-size="query.length"
:total="total"
@current-change="handleCurrentChange"
/>
</div> </div>
</div> </div>
</div> </div>
@ -45,8 +39,8 @@
</template> </template>
<script> <script>
import _ from "lodash";
import UiGoodsItem from "@/components/UiGoodsItem.vue"; import UiGoodsItem from "@/components/UiGoodsItem.vue";
import UiPagination from "@/components/UiPagination.vue";
import { import {
ApiGetHomeSeckill, ApiGetHomeSeckill,
ApiGetCurrentTime, ApiGetCurrentTime,
@ -62,9 +56,10 @@ import Pick from "./module/Pick.vue";
import TabbarFixed from "./module/TabbarFixed.vue"; import TabbarFixed from "./module/TabbarFixed.vue";
const SECKILL_COUNT = 20; // const SECKILL_COUNT = 20; //
const NEW_COUNT = 5; // const NEW_COUNT = 5; //
const FOOTER_BAR_HEIGHT = 200; //
export default { export default {
components: { Banner, Seckil, Pick, UiGoodsItem, UiPagination, TabbarFixed }, components: { Banner, Seckil, Pick, UiGoodsItem, TabbarFixed },
async asyncData({ store }) { async asyncData({ store }) {
// //
let seckillData = { activityTimeVO: null }; let seckillData = { activityTimeVO: null };
@ -120,6 +115,7 @@ export default {
loading: false, loading: false,
currentPage: 0, currentPage: 0,
scrollTop: 0, scrollTop: 0,
ticking: false,
}; };
}, },
created() { created() {
@ -133,9 +129,21 @@ export default {
window.removeEventListener("scroll", this.scrollEventMethod); window.removeEventListener("scroll", this.scrollEventMethod);
}, },
methods: { methods: {
scrollEventMethod() { scrollEventMethod: _.debounce(function () {
this.scrollTop = window.scrollY; this.scrollTop = window.scrollY;
}, const contentHeight = document.body.scrollHeight; //
const clientHeight = document.body.clientHeight; //
if (
window.scrollY + clientHeight >= contentHeight - FOOTER_BAR_HEIGHT &&
this.total &&
this.selectProducts.length < this.total
) {
this.query.pageIndex += 1;
//
this.getSelectProducts();
}
}, 200),
// //
async handleSeckillRefresh() { async handleSeckillRefresh() {
@ -153,13 +161,9 @@ export default {
if (result) { if (result) {
const { total, records } = result; const { total, records } = result;
this.total = total; this.total = total;
this.selectProducts = records; this.selectProducts = this.selectProducts.concat(records);
} }
}, },
handleCurrentChange(page) {
this.query.pageIndex = page;
this.getSelectProducts();
},
}, },
}; };
</script> </script>

@ -212,8 +212,8 @@ export default {
.home-pick-recommend { .home-pick-recommend {
width: 590px; width: 590px;
height: 340px; min-height: 340px;
padding: 16px 20px; padding: 16px 20px 20px;
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
&--tag-wrap { &--tag-wrap {
@ -263,8 +263,8 @@ export default {
position: absolute; position: absolute;
right: 0; right: 0;
bottom: 0; bottom: 0;
width: 158px; width: 170px;
height: 158px; height: 170px;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -298,8 +298,8 @@ export default {
} }
.home-pick-new { .home-pick-new {
width: 590px; width: 590px;
height: 340px; min-height: 340px;
padding: 14px 20px 16px 20px; padding: 16px 20px 20px;
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
&__products { &__products {

@ -3,6 +3,7 @@
v-if="tabBarVisible" v-if="tabBarVisible"
class="home-tabbar-fixed flex" class="home-tabbar-fixed flex"
:class="{ 'home-tabbar-fixed--change': appHover }" :class="{ 'home-tabbar-fixed--change': appHover }"
:style="tabBarStyle"
> >
<div v-show="appHover" class="home-tabbar-fixed__qrcode"> <div v-show="appHover" class="home-tabbar-fixed__qrcode">
<img src="~/assets/img/common/app-qrcode.png" /> <img src="~/assets/img/common/app-qrcode.png" />
@ -63,6 +64,7 @@ export default {
messageHover: false, messageHover: false,
totopHover: false, totopHover: false,
tabBarVisible: false, tabBarVisible: false,
tabBarStyle: null,
}; };
}, },
computed: { computed: {
@ -72,6 +74,7 @@ export default {
}, },
mounted() { mounted() {
this.getTabBarVisible(); this.getTabBarVisible();
this.getTabBarStyle();
}, },
methods: { methods: {
getTabBarVisible() { getTabBarVisible() {
@ -80,6 +83,16 @@ export default {
this.tabBarVisible = true; this.tabBarVisible = true;
} }
}, },
//
getTabBarStyle() {
const clientHeight = document.body.clientHeight;
const TOP = 630;
const NORMAL_HEIGHT = 1080;
this.tabBarStyle = {
top: `${(TOP / NORMAL_HEIGHT) * clientHeight}px`,
};
},
onOpenMessagePage() { onOpenMessagePage() {
if (!this.$isLoginValidate()) { if (!this.$isLoginValidate()) {
return; return;
@ -97,7 +110,6 @@ export default {
position: fixed; position: fixed;
z-index: 99; z-index: 99;
left: 50%; left: 50%;
top: 568px;
margin-left: 630px; margin-left: 630px;
border: 1px solid #f8f8f8; border: 1px solid #f8f8f8;
&--change { &--change {

@ -131,7 +131,6 @@ export default {
length: PAGE_SIZE, length: PAGE_SIZE,
activityTimeId: 0, activityTimeId: 0,
}, },
ticking: false,
isSticky: false, isSticky: false,
timeInterval: null, // timeInterval: null, //
seckillTip: "", // seckillTip: "", //
@ -193,15 +192,7 @@ export default {
}, },
methods: { methods: {
scrollEventMethod() { scrollEventMethod() {
const that = this; this.isSticky = window.scrollY > 400;
//
if (!that.ticking) {
window.requestAnimationFrame(function () {
that.ticking = false;
that.isSticky = window.scrollY > 400;
});
that.ticking = true;
}
}, },
async getSeckillTimes() { async getSeckillTimes() {
const { result } = await ApiGetSeckillTimes(); const { result } = await ApiGetSeckillTimes();
@ -233,7 +224,7 @@ export default {
percentage: percentage:
saleNumber === 0 saleNumber === 0
? 0 ? 0
: (saleNumber / item.number).toFixed(2) * 100, : (saleNumber / item.number).toFixed(3) * 100,
}; };
}); });
} }
@ -387,6 +378,7 @@ export default {
position: relative; position: relative;
width: 100%; width: 100%;
height: 288px; height: 288px;
padding: 20px;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;

Loading…
Cancel
Save