Browse Source

优化首页页面

pull/19/head
zyronon 4 years ago
parent
commit
3c56093da4
  1. 17
      src/components/slide/SlideColumnList.vue
  2. 8
      src/config/index.js
  3. 1
      src/pages/home/Index2.vue

17
src/components/slide/SlideColumnList.vue

@ -71,9 +71,8 @@ export default {
if (oldVal.length === 0) { if (oldVal.length === 0) {
let startIndex = 0 let startIndex = 0
if (this.currentSlideItemIndex >= this.defaultVirtualItemTotal) { if (this.currentSlideItemIndex >= this.defaultVirtualItemTotal) {
startIndex = this.currentSlideItemIndex - (this.defaultVirtualItemTotal + 1) / 2 startIndex = this.currentSlideItemIndex - (this.defaultVirtualItemTotal - 1) / 2
} }
console.log('start',startIndex)
this.list.slice(startIndex, startIndex + 5).map( this.list.slice(startIndex, startIndex + 5).map(
(item, index) => { (item, index) => {
let el = null let el = null
@ -87,14 +86,13 @@ export default {
}) })
let that = this let that = this
if (that.currentSlideItemIndex > 2) { if (that.currentSlideItemIndex > 2) {
this.checkChildren()
this.$setCss(this.slideList, 'transform', `translate3d(0px, this.$setCss(this.slideList, 'transform', `translate3d(0px,
${-this.currentSlideItemIndex * this.wrapperHeight}px, 0px)`) ${-this.currentSlideItemIndex * this.wrapperHeight}px, 0px)`)
$(".video-slide-item").each(function () { $(".video-slide-item").each(function () {
$(this).css('top', (that.currentSlideItemIndex - 2) * that.wrapperHeight) $(this).css('top', (that.currentSlideItemIndex - 2) * that.wrapperHeight)
}) })
} }
setTimeout(this.checkChildren, 100)
} else { } else {
let endLength = oldVal.length + 3 let endLength = oldVal.length + 3
newVal.slice(oldVal.length, endLength).map((item, index) => { newVal.slice(oldVal.length, endLength).map((item, index) => {
@ -141,16 +139,19 @@ export default {
this.slideItems = this.slideList.children this.slideItems = this.slideList.children
this.wrapperHeight = this.$getCss(this.slideList, 'height') this.wrapperHeight = this.$getCss(this.slideList, 'height')
for (let i = 0; i < this.slideItems.length; i++) { if (!this.virtual){
let el = this.slideItems[i] for (let i = 0; i < this.slideItems.length; i++) {
this.slideItemsHeights.push(this.$getCss(el, 'height')) let el = this.slideItems[i]
this.slideItemsHeights.push(this.$getCss(el, 'height'))
}
} }
}, },
touchStart(e) { touchStart(e) {
console.log('this.slideItemsHeights',this.slideItemsHeights)
this.$setCss(this.slideList, 'transition-duration', `0ms`) this.$setCss(this.slideList, 'transition-duration', `0ms`)
this.showIndicator && this.$setCss(this.indicatorRef, 'transition-duration', `0ms`) this.showIndicator && this.$setCss(this.indicatorRef, 'transition-duration', `0ms`)
this.toolbarStyleTransitionDuration = 0 this.toolbarStyleTransitionDuration = 0
this.startLocationX = e.touches[0].pageX this.startLocationX = e.touches[0].pageX
this.startLocationY = e.touches[0].pageY this.startLocationY = e.touches[0].pageY
this.startTime = Date.now() this.startTime = Date.now()

8
src/config/index.js

@ -1,6 +1,6 @@
export default { export default {
baseUrl: 'http://192.168.0.105//index.php/v1', // baseUrl: 'http://192.168.0.105//index.php/v1',
filePreview:'http://192.168.0.105/static/uploads/', // filePreview:'http://192.168.0.105/static/uploads/',
// baseUrl: 'http://192.168.10.164//index.php/v1', baseUrl: 'http://192.168.10.164//index.php/v1',
// filePreview:'http://192.168.10.164/static/uploads/' filePreview:'http://192.168.10.164/static/uploads/'
} }

1
src/pages/home/Index2.vue

@ -96,6 +96,7 @@
:list="videos" :list="videos"
:renderSlide="render" :renderSlide="render"
v-model:active-index="videoActiveIndex" v-model:active-index="videoActiveIndex"
v-model:active-index1="videoActiveIndex"
@end="end" @end="end"
> >
</SlideColumnList> </SlideColumnList>

Loading…
Cancel
Save