Browse Source

优化

pull/29/head
zyronon 2 years ago
parent
commit
27812ff11c
  1. 2
      src/assets/less/variables.less
  2. 2
      src/components/Scroll.vue
  3. 8
      src/components/slide/BVideo.vue
  4. 10
      src/pages/slideHooks/Community.vue
  5. 4
      src/pages/slideHooks/IndicatorHome.vue
  6. 62
      src/pages/slideHooks/Shop.vue
  7. 19
      src/pages/slideHooks/index.vue

2
src/assets/less/variables.less

@ -1,5 +1,5 @@
@footer-height: 50rem; @footer-height: 50rem;
@header-height: 60rem; @header-height: 50rem;
@indicator-height: 50rem; @indicator-height: 50rem;
@padding-page: 15rem; @padding-page: 15rem;

2
src/components/Scroll.vue

@ -97,7 +97,7 @@ export default {
} }
}, },
scrollBottom() { scrollBottom() {
nextTick(()=>{ nextTick(() => {
this.wrapper.scrollTo({top: this.wrapper.scrollHeight - this.wrapper.clientHeight}) this.wrapper.scrollTo({top: this.wrapper.scrollHeight - this.wrapper.clientHeight})
}) })
} }

8
src/components/slide/BVideo.vue

@ -245,11 +245,13 @@ export default {
bus.off(EVENT_KEY.CLOSE_SUB_TYPE, this.onCloseSubType) bus.off(EVENT_KEY.CLOSE_SUB_TYPE, this.onCloseSubType)
}, },
methods: { methods: {
onOpenSubType({index, height}) { onOpenSubType({id, height}) {
if (id !== this.item.id) return
this.isMarginTop = true this.isMarginTop = true
Utils.$setCss(this.$refs.video, 'margin-top', `${height}px`) Utils.$setCss(this.$refs.video, 'margin-top', `${height}px`)
}, },
onCloseSubType({index}) { onCloseSubType({id}) {
if (id !== this.item.id) return
this.isMarginTop = false this.isMarginTop = false
Utils.$setCss(this.$refs.video, 'margin-top', `0px`) Utils.$setCss(this.$refs.video, 'margin-top', `0px`)
}, },
@ -370,7 +372,7 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
transition: height, margin-top .3s; transition: height, margin-top .3s;
background: black; //background: black;
/*position: absolute;*/ /*position: absolute;*/
} }

10
src/pages/slideHooks/Community.vue

@ -70,19 +70,21 @@ onMounted(() => {
font-size: 14rem; font-size: 14rem;
color: white; color: white;
padding-top: @header-height; padding-top: @header-height;
background: rgb(21, 23, 36);
.Scroll { .Scroll {
background: black;
//height: calc(100vh - @header-height) !important;
height: calc(100vh - @header-height - @footer-height) !important; height: calc(100vh - @header-height - @footer-height) !important;
} }
.goods-list { @p: 1rem;
.goods-list {
padding: @p;
box-sizing: border-box;
} }
.goods { .goods {
width: 50%; width: calc(50% - @p);
padding: 3rem; padding: 3rem;
box-sizing: border-box; box-sizing: border-box;

4
src/pages/slideHooks/IndicatorHome.vue

@ -188,8 +188,6 @@ export default {
<style scoped lang="less"> <style scoped lang="less">
@import "@/assets/less/index"; @import "@/assets/less/index";
@height: 60rem;
.indicator-home { .indicator-home {
position: fixed; position: fixed;
font-size: 16rem; font-size: 16rem;
@ -198,7 +196,7 @@ export default {
z-index: 2; z-index: 2;
width: 100%; width: 100%;
color: white; color: white;
height: @height; height: @header-height;
transition: all .3s; transition: all .3s;
.notice { .notice {

62
src/pages/slideHooks/Shop.vue

@ -1,5 +1,9 @@
<template> <template>
<div id="Shop"> <div id="Shop">
<div class="bg">
<div class="top"></div>
<div class="bottom"></div>
</div>
<div class="search"> <div class="search">
<div class="search-input"> <div class="search-input">
<img src="@/assets/img/icon/search-gray.png" alt=""> <img src="@/assets/img/icon/search-gray.png" alt="">
@ -13,6 +17,8 @@
</div> </div>
</div> </div>
<Scroll class="Scroll" <Scroll class="Scroll"
fixedHeight="100"
@fixed="e=>state.fixed = e"
@pulldown="loadData"> @pulldown="loadData">
<div class="options"> <div class="options">
<div class="option"> <div class="option">
@ -30,6 +36,7 @@
</div> </div>
</div> </div>
<div v-masonry class="goods-list" <div v-masonry class="goods-list"
:class="{fixed:state.fixed}"
transition-duration="0s" transition-duration="0s"
item-selector=".goods"> item-selector=".goods">
<div v-masonry-tile class="goods" v-for="(item, index) in state.list"> <div v-masonry-tile class="goods" v-for="(item, index) in state.list">
@ -66,7 +73,8 @@ import Scroll from "@/components/Scroll.vue";
const state = reactive({ const state = reactive({
list: [], list: [],
listEl: null listEl: null,
fixed: false
}) })
function loadData() { function loadData() {
@ -98,12 +106,39 @@ onMounted(() => {
font-size: 14rem; font-size: 14rem;
color: white; color: white;
padding-top: @header-height; padding-top: @header-height;
position: relative;
background: white;
.bg {
top: 0;
position: absolute;
width: 100vw;
height: 30vh;
//background: red;
@th: 70%;
@eColor: rgb(32, 28, 58);
.top {
height: @th;
background: linear-gradient(to bottom, rgb(56, 30, 77), @eColor);
}
.bottom {
height: 100% - @th;
background: red;
background: linear-gradient(to bottom, @eColor, white);
}
}
.search { .search {
position: relative;
z-index: 2;
display: flex; display: flex;
align-items: center; align-items: center;
height: @header-height; height: @header-height;
padding: 0 20rem; padding: 9rem 20rem;
box-sizing: border-box;
img { img {
width: 20rem; width: 20rem;
@ -112,9 +147,11 @@ onMounted(() => {
.search-input { .search-input {
border: 3rem solid rgb(140, 48, 74); border: 3rem solid rgb(140, 48, 74);
border-radius: 8rem; border-radius: 8rem;
padding: 10rem 20rem; height: 100%;
padding: 0 10rem;
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center;
.placeholder { .placeholder {
flex: 1; flex: 1;
@ -143,7 +180,9 @@ onMounted(() => {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
gap: 20rem; gap: 20rem;
padding: 0 20rem; height: 40rem;
padding: 4rem 20rem;
box-sizing: border-box;
img { img {
width: 20rem; width: 20rem;
@ -151,11 +190,12 @@ onMounted(() => {
} }
.option { .option {
font-size: 13rem;
flex: 1; flex: 1;
display: flex; display: flex;
background: rgb(63, 58, 78); background: rgb(63, 58, 78);
padding: 8rem; padding: 6rem 8rem;
border-radius: 8rem; border-radius: 6rem;
} }
} }
@ -170,22 +210,26 @@ onMounted(() => {
.nav { .nav {
margin: 10rem; margin: 10rem;
padding-bottom: 10rem;
word-break: keep-all; word-break: keep-all;
//border-bottom: 2rem solid white; //border-bottom: 2rem solid white;
} }
} }
.Scroll { .Scroll {
position: relative;
z-index: 2;
//height: calc(100vh - @header-height) !important; //height: calc(100vh - @header-height) !important;
height: calc(100vh - @header-height - @footer-height) !important; height: calc(100vh - @header-height * 2 - @footer-height) !important;
}
.fixed {
background: white;
} }
@p: 5rem; @p: 5rem;
.goods-list { .goods-list {
padding: @p; padding: @p;
background: white;
} }
.goods { .goods {

19
src/pages/slideHooks/index.vue

@ -50,7 +50,7 @@
</div> </div>
</div> </div>
<div class="sub-type-notice" <div class="sub-type-notice"
v-if="state.subType===-1" v-if="state.subType===-1 && state.navIndex === 0"
@click="showSubType">附近吃喝玩乐 @click="showSubType">附近吃喝玩乐
</div> </div>
<div class="slide-content" <div class="slide-content"
@ -74,6 +74,7 @@
</SlideItem> </SlideItem>
<SlideItem> <SlideItem>
<VInfinite <VInfinite
:style="{background: 'black'}"
name="main" name="main"
v-model:index="state.itemIndex" v-model:index="state.itemIndex"
:render="render" :render="render"
@ -89,16 +90,6 @@
</SlideItem> </SlideItem>
</H> </H>
</div> </div>
<div>
<span>{{ state.baseIndex }}</span>
<button @click="state.baseIndex++"></button>
<button @click="state.baseIndex--"></button>
</div>
<div>
<span>{{ state.navIndex }}</span>
<button @click="state.navIndex++"></button>
<button @click="state.navIndex--"></button>
</div>
<Footer v-bind:init-tab="1"/> <Footer v-bind:init-tab="1"/>
</SlideItem> </SlideItem>
<SlideItem class=" gray"> <SlideItem class=" gray">
@ -301,8 +292,9 @@ function showSubType(e) {
setTimeout(() => { setTimeout(() => {
state.subTypeIsTop = true state.subTypeIsTop = true
}, 300) }, 300)
let id = state.recommendVideos[state.itemIndex].id
bus.emit(EVENT_KEY.OPEN_SUB_TYPE, { bus.emit(EVENT_KEY.OPEN_SUB_TYPE, {
index: 0, id,
height: subTypeRef.value.getBoundingClientRect().height height: subTypeRef.value.getBoundingClientRect().height
}) })
} }
@ -312,7 +304,8 @@ function pageClick(e) {
if (state.subType !== -1) { if (state.subType !== -1) {
state.subType = -1 state.subType = -1
state.subTypeIsTop = false state.subTypeIsTop = false
bus.emit(EVENT_KEY.CLOSE_SUB_TYPE, {index: 0,}) let id = state.recommendVideos[state.itemIndex].id
bus.emit(EVENT_KEY.CLOSE_SUB_TYPE, {id})
Utils.$stopPropagation(e) Utils.$stopPropagation(e)
} }
} }

Loading…
Cancel
Save