寺庙列表加载功能多
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="content-expand">
|
<div class="content-expand">
|
||||||
<div class="content" :class="[contentOverflow && !show && 'multiple-line-3']" ref="wrapper" :style="{height: (show ? contentHeight : 50) + 'px'}">
|
<div class="content" :class="[contentOverflow && !show && 'multiple-line-3']" ref="wrapper" :style="{height: (show ? contentHeight : 100) + 'px'}">
|
||||||
<div ref="content">
|
<div ref="content">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="expand" v-if="contentOverflow" @click="toggle">
|
<span class="expand" v-if="contentOverflow" @click="toggle">
|
||||||
<i class="iconfont icon-double-arrow-down-" :class="[show && 'iconfont-expand']"></i>
|
<i class="iconfont icon-double-arrow-down-" :class="[show && 'iconfont-expand']"></i>
|
||||||
|
<span class="label">{{show ? '收起全文': '展开全文'}}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -19,7 +20,8 @@ export default {
|
|||||||
wrapperHeight: 0,
|
wrapperHeight: 0,
|
||||||
contentHeight: 0,
|
contentHeight: 0,
|
||||||
show: false,
|
show: false,
|
||||||
wrapperContainerHeight: 0
|
wrapperContainerHeight: 0,
|
||||||
|
defaultContentHeight: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -28,10 +30,15 @@ export default {
|
|||||||
return this.contentHeight > this.wrapperHeight;
|
return this.contentHeight > this.wrapperHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
this.wrapperHeight = this.$refs.wrapper.offsetHeight
|
this.wrapperHeight = this.$refs.wrapper.offsetHeight
|
||||||
this.contentHeight = this.$refs.content.offsetHeight
|
this.contentHeight = this.$refs.content.offsetHeight
|
||||||
|
this.defaultContentHeight = this.$refs.content.querySelector('.goods-content').offsetHeight / (3/2)
|
||||||
|
console.log(this.defaultContentHeight)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.wrapperContainerHeight = this.wrapperHeight;
|
this.wrapperContainerHeight = this.wrapperHeight;
|
||||||
})
|
})
|
||||||
@@ -71,6 +78,10 @@ export default {
|
|||||||
.iconfont-expand{
|
.iconfont-expand{
|
||||||
transform: rotateZ(180deg);
|
transform: rotateZ(180deg);
|
||||||
}
|
}
|
||||||
|
.label{
|
||||||
|
padding-left: .1rem;
|
||||||
|
font-size: .35rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
<template>
|
||||||
|
<div class="detail-content-expand">
|
||||||
|
<div class="content" :class="[contentOverflow && !show && '']" ref="wrapper" :style="{height: (show ? contentHeight : defaultContentHeight) + 'px'}">
|
||||||
|
<div ref="content">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="expand" v-if="contentOverflow" @click="toggle">
|
||||||
|
<i class="iconfont icon-double-arrow-down-" :class="[show && 'iconfont-expand']"></i>
|
||||||
|
<span class="label">{{show ? '收起全文': '展开全文'}}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'detail-content-expand',
|
||||||
|
props: {
|
||||||
|
selector: {
|
||||||
|
type: String,
|
||||||
|
default: '.goods-content'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
wrapperHeight: 0,
|
||||||
|
contentHeight: 0,
|
||||||
|
show: false,
|
||||||
|
wrapperContainerHeight: 0,
|
||||||
|
defaultContentHeight: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
contentOverflow: {
|
||||||
|
get(){
|
||||||
|
return this.contentHeight > this.wrapperHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
this.wrapperHeight = this.$refs.wrapper.offsetHeight
|
||||||
|
this.contentHeight = this.$refs.content.offsetHeight
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.wrapperContainerHeight = this.wrapperHeight;
|
||||||
|
this.refresh();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toggle(){
|
||||||
|
this.show = !this.show
|
||||||
|
},
|
||||||
|
refresh(){
|
||||||
|
const selector = this.$refs.content.querySelector(this.selector);
|
||||||
|
if(!selector) {
|
||||||
|
this.defaultContentHeight = 100;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('selector', selector)
|
||||||
|
this.defaultContentHeight = selector.offsetHeight / (4/1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.detail-content-expand{
|
||||||
|
.content{
|
||||||
|
line-height: 1.4;
|
||||||
|
font-size: .35rem;
|
||||||
|
color: #888;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
text-align: justify;
|
||||||
|
margin-top: .3rem;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 4em;
|
||||||
|
transition: height .3s linear;
|
||||||
|
}
|
||||||
|
.expand{
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 1.07rem;
|
||||||
|
color: #888;
|
||||||
|
.iconfont{
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
}
|
||||||
|
.iconfont-expand{
|
||||||
|
transform: rotateZ(180deg);
|
||||||
|
}
|
||||||
|
.label{
|
||||||
|
padding-left: .1rem;
|
||||||
|
font-size: .35rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -8,6 +8,7 @@ import Order from './order';
|
|||||||
import ScrollView from './scroll-view'
|
import ScrollView from './scroll-view'
|
||||||
import Uploader from './uploader'
|
import Uploader from './uploader'
|
||||||
import ContentExpand from './content-expand'
|
import ContentExpand from './content-expand'
|
||||||
|
import detailContentExpand from './detail-content-expand'
|
||||||
import UserDynamic from './user-dynamic';
|
import UserDynamic from './user-dynamic';
|
||||||
import RandomMoney from './random-money'
|
import RandomMoney from './random-money'
|
||||||
import ThankGiving from './Thanksgiving'
|
import ThankGiving from './Thanksgiving'
|
||||||
@@ -27,6 +28,7 @@ Vue.component(Order.name, Order)
|
|||||||
Vue.component(ScrollView.name, ScrollView)
|
Vue.component(ScrollView.name, ScrollView)
|
||||||
Vue.component(Uploader.name, Uploader)
|
Vue.component(Uploader.name, Uploader)
|
||||||
Vue.component(ContentExpand.name, ContentExpand)
|
Vue.component(ContentExpand.name, ContentExpand)
|
||||||
|
Vue.component(detailContentExpand.name, detailContentExpand)
|
||||||
Vue.component(UserDynamic.name, UserDynamic)
|
Vue.component(UserDynamic.name, UserDynamic)
|
||||||
Vue.component(RandomMoney.name, RandomMoney)
|
Vue.component(RandomMoney.name, RandomMoney)
|
||||||
Vue.component(ThankGiving.name, ThankGiving)
|
Vue.component(ThankGiving.name, ThankGiving)
|
||||||
|
|||||||
@@ -8,9 +8,10 @@
|
|||||||
<div class="image-group">
|
<div class="image-group">
|
||||||
<img :src="cover" v-for="(cover, index) in covers" :key="index" alt="" />
|
<img :src="cover" v-for="(cover, index) in covers" :key="index" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div v-html="data.content" class="process-content">
|
<detail-content-expand selector=".process-content">
|
||||||
|
<div v-html="data.content" class="process-content"></div>
|
||||||
|
</detail-content-expand>
|
||||||
|
|
||||||
</div>
|
|
||||||
<button class="purchase" @click.stop="onGoodsDetail">{{ data.btn_title }}</button>
|
<button class="purchase" @click.stop="onGoodsDetail">{{ data.btn_title }}</button>
|
||||||
<div class="bar">
|
<div class="bar">
|
||||||
<span class="join">已有{{ data.sales }}人参与</span>
|
<span class="join">已有{{ data.sales }}人参与</span>
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
<div class="panel-head">
|
<div class="panel-head">
|
||||||
<span class="title">详情</span>
|
<span class="title">详情</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-html="data.content" class="goods-content"></div>
|
<detail-content-expand ref="contentWrap" selector=".process-content">
|
||||||
|
<div v-html="data.content" class="process-content"></div>
|
||||||
|
</detail-content-expand>
|
||||||
</div>
|
</div>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<div class="panel" v-if="goodsDynamicList.length > 0">
|
<div class="panel" v-if="goodsDynamicList.length > 0">
|
||||||
@@ -285,6 +287,11 @@ export default {
|
|||||||
await this.getDynamicDataByGoodsId(goods_id, goods_type);
|
await this.getDynamicDataByGoodsId(goods_id, goods_type);
|
||||||
await this.getPayRecords(this.lTypeId, 1);
|
await this.getPayRecords(this.lTypeId, 1);
|
||||||
this.data = response;
|
this.data = response;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
|
||||||
|
this.$refs.contentWrap.refresh()
|
||||||
|
console.log('a', this.$refs.contentWrap)
|
||||||
|
})
|
||||||
if(!this.onlySpecs){
|
if(!this.onlySpecs){
|
||||||
const { donate_number, money, id } = this.data.spec[0];
|
const { donate_number, money, id } = this.data.spec[0];
|
||||||
const priceUnit = donate_number || money;
|
const priceUnit = donate_number || money;
|
||||||
@@ -399,6 +406,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.process-content{
|
||||||
|
*{
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.caret{
|
.caret{
|
||||||
padding-bottom: .2rem;
|
padding-bottom: .2rem;
|
||||||
.head{
|
.head{
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
<div class="panel-head">
|
<div class="panel-head">
|
||||||
<span class="title">详情</span>
|
<span class="title">详情</span>
|
||||||
</div>
|
</div>
|
||||||
|
<detail-content-expand>
|
||||||
<div v-html="data.content" class="goods-content"></div>
|
<div v-html="data.content" class="goods-content"></div>
|
||||||
|
</detail-content-expand>
|
||||||
</div>
|
</div>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<div class="support">
|
<div class="support">
|
||||||
|
|||||||
@@ -113,9 +113,9 @@
|
|||||||
<img src="@/assets/img/user-popup/功德箱.png" alt="">
|
<img src="@/assets/img/user-popup/功德箱.png" alt="">
|
||||||
<span>功德箱</span>
|
<span>功德箱</span>
|
||||||
</li>
|
</li>
|
||||||
<li @click="onPushForRouteName('temple-list')">
|
<li @click="onPushForRouteName('home')">
|
||||||
<img src="@/assets/img/user-popup/查看更多寺院.png" alt="">
|
<img src="@/assets/img/user-popup/查看更多寺院.png" alt="">
|
||||||
<span>查看更多寺院</span>
|
<span>自在福田首页</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -284,6 +284,7 @@ export default {
|
|||||||
}
|
}
|
||||||
.merit-scroll-container{
|
.merit-scroll-container{
|
||||||
height: 3.39rem;
|
height: 3.39rem;
|
||||||
|
margin: 0;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
.merit-scroll-wrapper{
|
.merit-scroll-wrapper{
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
<div class="temple-list-container" :style="{height: containerHeight + 'px'}" v-if="mode === 'list'" >
|
<div class="temple-list-container" :style="{height: containerHeight + 'px'}" v-if="mode === 'list'" >
|
||||||
<scroll-view
|
<scroll-view
|
||||||
|
|
||||||
class="temple-container content"
|
class="temple-container content"
|
||||||
:height="containerHeight - 20"
|
:height="containerHeight - 20"
|
||||||
ref="scroll"
|
ref="scroll"
|
||||||
@@ -66,7 +65,8 @@ export default {
|
|||||||
lng: '',
|
lng: '',
|
||||||
lat: '',
|
lat: '',
|
||||||
map: null,
|
map: null,
|
||||||
positioning: false
|
positioning: false,
|
||||||
|
noMore: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inject: ['root', 'parentHeight'],
|
inject: ['root', 'parentHeight'],
|
||||||
@@ -126,6 +126,7 @@ export default {
|
|||||||
this.templeList = res.results;
|
this.templeList = res.results;
|
||||||
} else {
|
} else {
|
||||||
this.templeList = this.templeList.concat(res.results);
|
this.templeList = this.templeList.concat(res.results);
|
||||||
|
this.noMore = res.results.length < 10;
|
||||||
}
|
}
|
||||||
if(this.mode === 'map'){
|
if(this.mode === 'map'){
|
||||||
this.setMarker();
|
this.setMarker();
|
||||||
@@ -171,7 +172,9 @@ export default {
|
|||||||
this.getTempleList();
|
this.getTempleList();
|
||||||
},
|
},
|
||||||
loadMore(){
|
loadMore(){
|
||||||
console.log('加载更多')
|
if(this.noMore) return;
|
||||||
|
this.page += 1;
|
||||||
|
this.getTempleList();
|
||||||
},
|
},
|
||||||
refresh(){
|
refresh(){
|
||||||
console.log('refresh')
|
console.log('refresh')
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user