Authored by TaoHuang

fix

<template>
<div class="list-comp">
<div class="title">邀请记录</div>
<div :class="getClass" ref="header">
<div class="header">
<div style="width: 25%; text-align: left;">我邀请的好友</div>
<div class="register-time">注册时间</div>
<div style="width: 20%; text-align: right;">我的佣金</div>
<div class="list-wrapper">
<div class="header-wrapper header-padding" v-if="fixed">
<div class="header">
<div style="width: 25%; text-align: left;">我邀请的好友</div>
<div class="register-time">注册时间</div>
<div style="width: 20%; text-align: right;">我的佣金</div>
</div>
</div>
<Scroll ref="scroll" class="list" :options="scrollOptions" :scrollEvents="['scroll']" :data="list"
@scroll="scroll"
@pulling-up="onPullingUp">
<Banner ref="banner"></Banner>
<div class="list-comp" ref="header">
<div class="title">邀请记录</div>
<div class="header-wrapper">
<div class="header">
<div style="width: 25%; text-align: left;">我邀请的好友</div>
<div class="register-time">注册时间</div>
<div style="width: 20%; text-align: right;">我的佣金</div>
</div>
</div>
</div>
</div>
<Scroll ref="scroll" class="list" :options="scrollOptions" :data="list" v-if="list.length" @pulling-up="onPullingUp">
<div class="item" v-for="item in list">
<div class="name" style="width: 25%; text-align: center; text-overflow:ellipsis; overflow: hidden; white-space: nowrap;">{{item.nickname}}</div>
<div class="register-time" >{{item.dateStr}}</div>
<div class="amount" style="width: 20%; text-align: center;">{{item.amountStr}}</div>
<template v-if="list.length">
<div class="item" v-for="item in list">
<div class="name"
style="width: 25%; text-align: center; text-overflow:ellipsis; overflow: hidden; white-space: nowrap;">
{{item.nickname}}
</div>
<div class="register-time">{{item.dateStr}}</div>
<div class="amount" style="width: 20%; text-align: center;">{{item.amountStr}}</div>
</div>
</template>
<div class="empty" v-else>
快去邀请好友吧!
</div>
</Scroll>
<div class="empty" v-else>
快去邀请好友吧!
</div>
<div>
</div>
<div class="footer">
</div>
</Scroll>
</div>
</template>
<script>
import {Scroll} from 'cube-ui';
import {createNamespacedHelpers} from 'vuex';
const {mapState, mapActions} = createNamespacedHelpers('gain');
export default {
inject: ['getBody'],
data() {
return {
scrollOptions: {
pullUpLoad: true
import { Scroll } from 'cube-ui';
import Banner from './banner';
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions } = createNamespacedHelpers('gain');
export default {
data() {
return {
scrollOptions: {
bounce: {
top: false
},
pullUpLoad: true
},
fixed: false
};
},
mounted() {
this.fetchList();
this.fetchResource().then(() => {
this.$nextTick(() => {
this.$refs.scroll.$forceUpdate();
});
});
},
methods: {
...mapActions(['fetchList', 'fetchResource']),
async onPullingUp() {
const result = await this.fetchList();
if (!result) {
this.$refs.scroll.$forceUpdate();
}
},
fixed: false
};
},
mounted() {
this.fetchList();
this.getBody(($body) => {
this.$body = $body;
$body.addEventListener('scroll', this.scroll);
});
},
methods: {
...mapActions(['fetchList']),
async onPullingUp() {
const result = await this.fetchList();
if (!result) {
this.$refs.scroll.$forceUpdate();
scroll({ y }) {
const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight;
if (-y >= height) {
this.fixed = true;
} else {
this.fixed = false;
}
}
},
scroll() {
if (this.$body.scrollTop >= this.$refs.header.offsetTop) {
this.fixed = true;
} else {
this.fixed = false;
}
}
},
computed: {
...mapState(['list']),
getClass() {
return ['header-wrapper', {
fixed: this.fixed
}];
computed: {
...mapState(['list']),
},
components: {
Scroll,
Banner
}
},
components: {
Scroll
}
};
};
</script>
<style lang="scss" scoped>
.list-comp {
padding: 40px 30px 30px;
margin-bottom: 98px;
.title {
font-size: 34px;
color: #222;
text-align: center;
font-weight: bold;
margin-bottom: 20px;
}
padding: 40px 30px 0 30px;
}
.header-wrapper {
position: relative;
height: 100px;
}
.header-padding {
margin: 0 30px 0 30px;
z-index: 100;
background-color: white;
width: calc(100% - 60px);
}
.header {
display: flex;
font-size: 28px;
color: #b0b0b0;
justify-content: space-between;
height: 100px;
line-height: 100px;
.list-wrapper {
height: 100%;
}
.fixed {
position: absolute;
}
}
.list-comp {
height: 100%;
}
.header:before {
content: " ";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 1px;
border-top: 1px solid #b0b0b0;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
}
.title {
font-size: 34px;
color: #222;
text-align: center;
font-weight: bold;
margin-bottom: 20px;
}
.register-time {
.header-wrapper {
position: relative;
height: 100px;
}
.header {
display: flex;
font-size: 28px;
color: #b0b0b0;
justify-content: space-between;
height: 100px;
line-height: 100px;
.fixed {
position: absolute;
width: 100%;
text-align: center;
}
}
.list {
max-height: 1010px;
}
.header:before {
content: " ";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 1px;
border-top: 1px solid #b0b0b0;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
}
.item {
height: 100px;
font-size: 28px;
color: #444;
display: flex;
border-bottom: 0.5PX solid #e0e0e0;
line-height: 100px;
position: relative;
justify-content: space-between;
}
.register-time {
position: absolute;
width: 100%;
text-align: center;
}
.empty {
width: 100%;
height: 350px;
font-size: 28px;
color: #b0b0b0;
line-height: 350px;
text-align: center;
}
.list {
height: 100%;
}
.item {
height: 100px;
font-size: 28px;
color: #444;
display: flex;
border-bottom: 0.5PX solid #e0e0e0;
line-height: 100px;
position: relative;
justify-content: space-between;
padding: 0 30px 0 30px;
}
.empty {
width: 100%;
height: 150px;
font-size: 28px;
color: #b0b0b0;
line-height: 150px;
text-align: center;
}
.footer {
height: 98px;
width: 100%;
}
</style>
... ...
<template>
<LayoutApp title="邀新返佣" :show-back="false">
<div class="body" ref="body">
<Banner></Banner>
<List></List>
</div>
<Footer class="footer"></Footer>
... ... @@ -11,32 +10,12 @@
<script>
import Layout from '../components/layout/layout-app';
import Footer from './components/footer';
import Banner from './components/banner';
import List from './components/list';
import {createNamespacedHelpers} from 'vuex';
const {mapActions} = createNamespacedHelpers('gain');
export default {
provide() {
return {
getBody: this.getBodyElem
};
},
mounted() {
this.fetchResource();
},
methods: {
...mapActions(['fetchResource']),
getBodyElem(found) {
return found && found(this.$refs.body);
}
},
components: {
LayoutApp: Layout,
Footer,
Banner,
List
}
};
... ...
{
"name": "ufo-app-web",
"version": "1.0.10",
"version": "1.0.15",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...