优化uploader页面

This commit is contained in:
zyronon 2021-09-06 15:07:28 +08:00
parent 4a36eec3fc
commit c00c5edc82
6 changed files with 223 additions and 90 deletions

View File

@ -1,8 +1,8 @@
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/'
// baseUrl: 'http://localhost//index.php/v1', // baseUrl: 'http://localhost//index.php/v1',
// filePreview:'http://localhost/static/uploads/' // filePreview:'http://localhost/static/uploads/'
} }

View File

@ -6,42 +6,39 @@
</template> </template>
</BaseHeader> </BaseHeader>
<div class="content"> <div class="content">
<Share v-model="test"/> <div class="my-buttons">
<div class="follow-display">
<div class="follow-wrapper" :class="isFollowed ? 'follow-wrapper-followed' : ''">
<div class="no-follow" @click="isFollowed = true">
<img src="../assets/img/icon/add-white.png" alt="">
<span>关注</span>
</div>
<div class="followed">
<div class="l-button" @click="isFollowed = false">
<span>已关注</span>
<img src="../assets/img/icon/arrow-up-white.png" alt="">
</div>
<div class="l-button">
<span>私信</span>
</div>
</div>
</div>
</div>
<div class="option" @click="isFollowed = !isFollowed">
<img src="../assets/img/icon/arrow-up-white.png" alt="">
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import SlideColumnList from "../components/slide/SlideColumnList";
import SlideRowList from "../components/slide/SlideRowList";
import Video1 from "../components/Video";
import Comment from "../components/Comment";
import Share from "../components/Share";
import Me from "./me/Me";
export default { export default {
name: "Test", name: "Test",
props: {}, props: {},
components: {SlideColumnList, SlideRowList, Video1, Comment, Share, Me},
data() { data() {
return { return {
videos: [ isFollowed: true
{
"id": "d2f55373-80dd-4c14-93a7-7a40e9cbf049",
"posterUrl": "images/20210815/0.png",
"videoUrl": "http://qy9rc9xff.hn-bkt.clouddn.com/9.mp4",
"title": "",
"likeNum": null,
"commentNum": null,
"sharedNum": null,
"duration": null,
"musicId": "126f9654-450b-466c-8003-085199a7f9b9",
"browseCount": 0,
"createTime": "1629683008",
"createBy": "3e301843-e8bb-41c0-8240-9c4b42a17341",
"status": 1
}
],
test:true
} }
}, },
computed: {}, computed: {},
@ -65,6 +62,103 @@ export default {
.content { .content {
padding-top: 6rem; padding-top: 6rem;
display: flex;
align-items: center;
justify-content: center;
.my-buttons {
margin-top: 2rem;
overflow: hidden;
width: 80%;
display: flex;
justify-content: flex-end;
align-items: center;
@width: 3.6rem;
.follow-display {
flex: 1;
overflow: hidden;
.follow-wrapper {
width: 200%;
display: flex;
flex-wrap: nowrap;
transition: all .3s ease;
&.follow-wrapper-followed {
transform: translate3d(-50%, 0, 0);
}
.no-follow {
width: calc(100% - 0.5rem);
color: white;
border-radius: .2rem;
background: @primary-btn-color;
height: @width;
display: flex;
align-items: center;
justify-content: center;
margin-right: .5rem;
box-sizing: border-box;
span {
margin-left: .2rem;
}
}
.followed {
width: 100%;
display: flex;
justify-content: space-around;
align-items: center;
.l-button {
color: white;
border-radius: .2rem;
background: @second-btn-color;
height: @width;
width: 50%;
margin-right: .5rem;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
span {
margin-left: .2rem;
}
img {
transform: rotate(180deg);
}
}
}
}
}
.option {
position: relative;
width: @width;
height: @width;
font-size: 1.2rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: .2rem;
background: @second-btn-color;
color: white;
}
img {
@width: 1.6rem;
width: @width;
height: @width;
}
}
} }
} }
</style> </style>

View File

@ -1,6 +1,8 @@
<template> <template>
<div id="home-index"> <div id="home-index">
<SlideRowList v-model:active-index="baseActiveIndex"> <SlideRowList
name="baseSlide"
v-model:active-index="baseActiveIndex">
<SlideItem> <SlideItem>
<SlideRowList <SlideRowList
v-model:active-index="activeIndex" v-model:active-index="activeIndex"
@ -103,7 +105,7 @@
<Footer v-bind:init-tab="1"/> <Footer v-bind:init-tab="1"/>
</SlideItem> </SlideItem>
<SlideItem style="font-size: 40px;overflow:auto;"> <SlideItem style="font-size: 40px;overflow:auto;">
<Uploader></Uploader> <Uploader/>
</SlideItem> </SlideItem>
</SlideRowList> </SlideRowList>

View File

@ -430,6 +430,12 @@ export default {
bus.on('baseSlide-end', () => this.canScroll = true) bus.on('baseSlide-end', () => this.canScroll = true)
}, },
methods: { methods: {
setLoadingFalse() {
this.loadings.loading0 = false
this.loadings.loading1 = false
this.loadings.loading2 = false
this.loadings.loading3 = false
},
click(e) { click(e) {
if (this.baseActiveIndex === 0) return if (this.baseActiveIndex === 0) return
if (this.baseActiveIndex === 1) { if (this.baseActiveIndex === 1) {
@ -467,7 +473,6 @@ export default {
if (videoOb.video.total === -1) { if (videoOb.video.total === -1) {
this.loadings['loading' + newVal] = true this.loadings['loading' + newVal] = true
let res = await this.$api.videos.collect({pageNo: this.videos.collect.pageNo, pageSize: this.pageSize,}) let res = await this.$api.videos.collect({pageNo: this.videos.collect.pageNo, pageSize: this.pageSize,})
this.loadings['loading' + newVal] = false
if (res.code === this.SUCCESS) this.videos.collect = res.data if (res.code === this.SUCCESS) this.videos.collect = res.data
} }
} else { } else {
@ -488,9 +493,9 @@ export default {
if (res.code === this.SUCCESS) this.videos.like = res.data if (res.code === this.SUCCESS) this.videos.like = res.data
break break
} }
this.loadings['loading' + newVal] = false
} }
} }
this.setLoadingFalse()
let scrollAreaHeight = await this.getScrollAreaHeight(newVal) let scrollAreaHeight = await this.getScrollAreaHeight(newVal)
if (oldVal !== null) { if (oldVal !== null) {

View File

@ -11,6 +11,10 @@
opacity: 0; opacity: 0;
} }
.Uploader { .Uploader {
position: fixed; position: fixed;
background: @main-bg; background: @main-bg;
@ -358,16 +362,32 @@
} }
.my-buttons { .my-buttons {
margin-top: 2rem;
overflow: hidden;
display: flex; display: flex;
justify-content: space-between; justify-content: flex-end;
align-items: center; align-items: center;
@width: 3.6rem; @width: 3.6rem;
.follow-display {
flex: 1;
overflow: hidden;
.follow-wrapper {
width: 200%;
display: flex;
flex-wrap: nowrap;
transition: all .3s ease;
&.follow-wrapper-followed {
transform: translate3d(-50%, 0, 0);
}
.no-follow { .no-follow {
width: calc(100% - 0.5rem);
color: white; color: white;
border-radius: .2rem; border-radius: .2rem;
background: @primary-btn-color; background: @primary-btn-color;
flex: 1;
height: @width; height: @width;
display: flex; display: flex;
align-items: center; align-items: center;
@ -381,7 +401,7 @@
} }
.followed { .followed {
flex: 1; width: 100%;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
@ -407,6 +427,10 @@
} }
} }
} }
}
}
.option { .option {
position: relative; position: relative;

View File

@ -52,10 +52,7 @@
<img src="../../assets/img/icon/me/qrcode-gray.png" alt="" @click.stop="$nav('/my-card')"> <img src="../../assets/img/icon/me/qrcode-gray.png" alt="" @click.stop="$nav('/my-card')">
</div> </div>
<div class="signature f12"> <div class="signature f12">
<template v-if="!userinfo.desc"> <span class="text">{{ userinfo.desc }}</span>
<span>点击添加介绍让大家认识你...</span>
<img src="../../assets/img/icon/me/write-gray.png" alt="">
</template>
</div> </div>
<div class="more"> <div class="more">
<div class="age item" v-if="userinfo.birthday"> <div class="age item" v-if="userinfo.birthday">
@ -89,12 +86,14 @@
</div> </div>
</div> </div>
<div class="my-buttons"> <div class="my-buttons">
<div class="no-follow" v-if="false"> <div class="follow-display">
<div class="follow-wrapper" :class="isFollowed ? 'follow-wrapper-followed' : ''">
<div class="no-follow" @click="isFollowed = true">
<img src="../../assets/img/icon/add-white.png" alt=""> <img src="../../assets/img/icon/add-white.png" alt="">
<span>关注</span> <span>关注</span>
</div> </div>
<div class="followed" v-else> <div class="followed">
<div class="l-button"> <div class="l-button" @click="isFollowed = false">
<span>已关注</span> <span>已关注</span>
<img src="../../assets/img/icon/arrow-up-white.png" alt=""> <img src="../../assets/img/icon/arrow-up-white.png" alt="">
</div> </div>
@ -102,7 +101,9 @@
<span>私信</span> <span>私信</span>
</div> </div>
</div> </div>
<div class="option"> </div>
</div>
<div class="option" @click="isFollowed = !isFollowed">
<img src="../../assets/img/icon/arrow-up-white.png" alt=""> <img src="../../assets/img/icon/arrow-up-white.png" alt="">
</div> </div>
</div> </div>
@ -162,6 +163,7 @@ export default {
components: {Posters, Indicator}, components: {Posters, Indicator},
data() { data() {
return { return {
isFollowed: false,
previewImg: '', previewImg: '',
contentIndex: 0, contentIndex: 0,
baseActiveIndex: 0, baseActiveIndex: 0,
@ -231,7 +233,7 @@ export default {
return this.$store.state.bodyWidth return this.$store.state.bodyWidth
}, },
videoSlideRowListStyle() { videoSlideRowListStyle() {
return {height: this.refs.videoSlideHeight !== 0 ? this.refs.videoSlideHeight + 'px' : 'calc(100vh - 14.6rem)'} return {height: this.refs.videoSlideHeight !== 0 ? this.refs.videoSlideHeight + 'px' : 'calc(100vh - 9.6rem)'}
}, },
SlideItemStyle() { SlideItemStyle() {
if (this.tempScroll || this.isScroll) return {overflow: 'auto'} if (this.tempScroll || this.isScroll) return {overflow: 'auto'}
@ -252,7 +254,7 @@ export default {
this.refs.headerHeight = this.$refs.header.offsetHeight this.refs.headerHeight = this.$refs.header.offsetHeight
this.refs.descHeight = this.$refs.desc.offsetHeight this.refs.descHeight = this.$refs.desc.offsetHeight
this.refs.maxSlideHeight = this.$refs.videoSlideRowList.wrapperHeight this.refs.maxSlideHeight = this.$refs.videoSlideRowList.wrapperHeight
this.initSlideHeight = this.bodyHeight - 50 - this.refs.descHeight - 50 this.initSlideHeight = this.bodyHeight - 50 - this.refs.descHeight
this.canTransformY = this.refs.descHeight - this.floatHeight this.canTransformY = this.refs.descHeight - this.floatHeight
this.changeIndex(0, null) this.changeIndex(0, null)
}) })
@ -261,6 +263,12 @@ export default {
bus.on('baseSlide-end', () => this.canScroll = true) bus.on('baseSlide-end', () => this.canScroll = true)
}, },
methods: { methods: {
setLoadingFalse() {
this.loadings.loading0 = false
this.loadings.loading1 = false
this.loadings.loading2 = false
this.loadings.loading3 = false
},
click(e) { click(e) {
if (this.baseActiveIndex === 0) return if (this.baseActiveIndex === 0) return
if (this.baseActiveIndex === 1) { if (this.baseActiveIndex === 1) {
@ -298,7 +306,6 @@ export default {
if (videoOb.video.total === -1) { if (videoOb.video.total === -1) {
this.loadings['loading' + newVal] = true this.loadings['loading' + newVal] = true
let res = await this.$api.videos.collect({pageNo: this.videos.collect.pageNo, pageSize: this.pageSize,}) let res = await this.$api.videos.collect({pageNo: this.videos.collect.pageNo, pageSize: this.pageSize,})
this.loadings['loading' + newVal] = false
if (res.code === this.SUCCESS) this.videos.collect = res.data if (res.code === this.SUCCESS) this.videos.collect = res.data
} }
} else { } else {
@ -319,9 +326,10 @@ export default {
if (res.code === this.SUCCESS) this.videos.like = res.data if (res.code === this.SUCCESS) this.videos.like = res.data
break break
} }
this.loadings['loading' + newVal] = false
} }
} }
this.setLoadingFalse()
let scrollAreaHeight = await this.getScrollAreaHeight(newVal) let scrollAreaHeight = await this.getScrollAreaHeight(newVal)
if (oldVal !== null) { if (oldVal !== null) {