|
@@ -1,5 +1,6 @@
|
|
|
<script setup>
|
|
|
import {ref} from 'vue'
|
|
|
+import { onLongPress } from '@vueuse/core'
|
|
|
import {apiGetPoster} from '@/api/common'
|
|
|
|
|
|
const props=defineProps({
|
|
@@ -7,6 +8,8 @@ const props=defineProps({
|
|
|
shareData:Object
|
|
|
})
|
|
|
|
|
|
+const imgDom=ref(null)
|
|
|
+
|
|
|
let show=ref(false)
|
|
|
let showPoster=ref(false)
|
|
|
let posterImg=ref('')
|
|
@@ -28,19 +31,30 @@ const handleCreatePoster=async ()=>{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const onLongPressImg=()=>{
|
|
|
+ const a=document.createElement('a')
|
|
|
+ a.setAttribute("download",'名字')
|
|
|
+ a.style.display = "none"
|
|
|
+ a.href=posterImg.value+'?response-content-type=application/octet-stream'
|
|
|
+ document.body.appendChild(a);
|
|
|
+ a.click()
|
|
|
+}
|
|
|
+
|
|
|
+onLongPress(imgDom, onLongPressImg)
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
|
|
|
<template>
|
|
|
<div class="share-poster-wrap" @touchmove.prevent>
|
|
|
- <img @click="handleCreatePoster" :style="props.style" class="share-icon" src="@/assets/hzyb/share-poster-icon.png"/>
|
|
|
+ <img @click="handleCreatePoster" :style="props.style" class="share-icon" src=""/>
|
|
|
|
|
|
<div class="poster-mask" v-if="show||showPoster" @click="showPoster=false" @touchmove.prevent></div>
|
|
|
<div class="loading-box" v-if="show">
|
|
|
- <img class="load-img" src="@/assets/hzyb/loading.png"/>
|
|
|
+ <img class="load-img" src=""/>
|
|
|
<div>海报生成中...</div>
|
|
|
</div>
|
|
|
- <img v-if="showPoster" class="poster-img" :src="posterImg" show-menu-by-longpress />
|
|
|
+ <img v-if="showPoster" ref="imgDom" class="poster-img" :src="posterImg" @longpress="" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|