优化分享

This commit is contained in:
zyronon 2021-11-09 18:22:55 +08:00
parent cc07a3f72d
commit 5d28b9d6ca

View File

@ -8,22 +8,25 @@
height="60vh" height="60vh"
mode="light"> mode="light">
<div class="video-share"> <div class="video-share">
<div class="shares"> <div class="shares">
<div class="to" @click="closeShare($emit('share2WeChat'),'type1')"> <div class="to" @click="closeShare('weChat')">
<div class="wrapper"> <div class="wrapper">
<div v-if="loading.type1" class="loading-wrapper" style="width: 80%;height: 80%;"> <div v-if="loading.weChat" class="loading-wrapper" style="width: 80%;height: 80%;">
<LoadingCircle v-model="progress"/> <LoadingCircle v-model="progress"/>
</div> </div>
<img v-else src="@/assets/img/icon/components/share/wechat.webp" alt=""> <img v-else src="@/assets/img/icon/components/share/wechat.webp" alt="">
</div> </div>
<span>微信</span> <span>{{ displayText('weChat') }}</span>
</div> </div>
<div class="to" @click="closeShare($emit('showShare2WeChatZone'))"> <div class="to" @click="closeShare('weChatZone')">
<div class="wrapper"> <div class="wrapper">
<img src="@/assets/img/icon/components/share/wechatquan.png" alt=""> <div v-if="loading.weChatZone" class="loading-wrapper" style="width: 80%;height: 80%;">
<LoadingCircle v-model="progress"/>
</div> </div>
<span>朋友圈</span> <img v-else src="@/assets/img/icon/components/share/wechatquan.png" alt="">
</div>
<!-- <span>{{ displayText('weChatZone') }}</span>-->
<sssss></sssss>
</div> </div>
<template v-if="false"> <template v-if="false">
<div class="to" @click="closeShare($emit('share2QQZone'))"> <div class="to" @click="closeShare($emit('share2QQZone'))">
@ -110,7 +113,7 @@
</from-bottom-dialog> </from-bottom-dialog>
</template> </template>
<script> <script lang="jsx">
import {mapState} from "vuex"; import {mapState} from "vuex";
import FromBottomDialog from "../../../components/dialog/FromBottomDialog"; import FromBottomDialog from "../../../components/dialog/FromBottomDialog";
import LoadingCircle from "./LoadingCircle"; import LoadingCircle from "./LoadingCircle";
@ -120,8 +123,13 @@ export default {
name: "Share", name: "Share",
components: { components: {
FromBottomDialog, FromBottomDialog,
LoadingCircle LoadingCircle,
// DouyinCode // DouyinCode,
sssss: {
render() {
return <span>1231</span>
}
}
}, },
props: { props: {
modelValue: false, modelValue: false,
@ -138,21 +146,43 @@ export default {
default: true default: true
}, },
}, },
computed: { computed: {
...mapState(['friends']), ...mapState(['friends']),
}, },
watch: {
modelValue(newVal) {
if (!newVal) {
this.loading = {
weChat: false,
weChatZone: false,
}
this.progress = 0
this.isShowMore = false
}
}
},
data() { data() {
return { return {
isCollect: false, isCollect: false,
isShowMore: true, isShowMore: true,
loading: { loading: {
typ1: false weChat: false,
weChatZone: false,
},
text: {
weChat: '微信',
weChatZone: '朋友圈'
}, },
progress: 0 progress: 0
} }
}, },
methods: { methods: {
displayText(type) {
if (this.loading[type]) {
return this.progress !== 100 ? '下载中' : this.text[type]
}
return this.text[type]
},
async copyLink() { async copyLink() {
this.closeShare() this.closeShare()
this.$showLoading() this.$showLoading()
@ -172,16 +202,22 @@ export default {
toggleCall(item) { toggleCall(item) {
item.select = !item.select item.select = !item.select
}, },
closeShare(v1, v2) { closeShare(type) {
this.loading[v2] = true if (this.progress === 100) {
// this.$emit("update:modelValue", false) this.$notice('未实现分享跳转到其他App')
} else {
this.loading[type] = true
let interval = setInterval(() => { let interval = setInterval(() => {
if (this.progress <= 100) { if (this.progress < 100) {
this.progress++ this.progress++
} else { } else {
clearInterval(interval) clearInterval(interval)
this.loading[type] = false
// this.$emit("update:modelValue", false)
this.$notice('未实现分享跳转到其他App')
}
}, 10)
} }
}, 12)
}, },
closeShare1() { closeShare1() {
this.$emit("update:modelValue", false) this.$emit("update:modelValue", false)