|
|
@@ -3,7 +3,7 @@
|
|
|
<div class="share-box">
|
|
|
<img :src="imgUrl" v-if="imgUrl" alt="" class="shareImgUrl" />
|
|
|
<div class="share-img" v-else ref="postRef">
|
|
|
- <img src="@/assets/png-yaoqinghaoyou.png" class="bg" alt="" />
|
|
|
+ <img src="@/assets/bg_share_card.png" class="bg" alt="" />
|
|
|
<div class="qrcode">
|
|
|
<qrcode-vue :value="shareUrl" :size="124" level="H" />
|
|
|
</div>
|
|
|
@@ -15,13 +15,14 @@
|
|
|
</n-modal>
|
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
+<script setup lang="ts">
|
|
|
import { NModal, NButton } from 'naive-ui'
|
|
|
import { ref, computed } from 'vue'
|
|
|
import QrcodeVue from 'qrcode.vue'
|
|
|
import html2canvas from 'html2canvas'
|
|
|
import resolveUrl from 'resolve-url'
|
|
|
import { useUserStore } from '@/store'
|
|
|
+import { Ref } from 'vue'
|
|
|
const showModal = ref(false)
|
|
|
|
|
|
const imgUrl = ref('')
|
|
|
@@ -32,11 +33,11 @@ const shareUrl = computed(() => {
|
|
|
return resolveUrl(baseURL, '#/login?invitor=' + userStore.userInfo.id)
|
|
|
})
|
|
|
|
|
|
-const postRef = ref(null)
|
|
|
+const postRef: Ref<HTMLElement | null> = ref(null)
|
|
|
function init() {
|
|
|
showModal.value = true
|
|
|
setTimeout(() => {
|
|
|
- html2canvas(postRef.value, {
|
|
|
+ html2canvas(postRef.value!, {
|
|
|
useCORS: true,
|
|
|
allowTaint: true,
|
|
|
backgroundColor: null,
|
|
|
@@ -58,7 +59,7 @@ function down() {
|
|
|
document.body.appendChild(tempLink)
|
|
|
tempLink.click()
|
|
|
document.body.removeChild(tempLink)
|
|
|
- window.URL.revokeObjectURL(imgUrl)
|
|
|
+ window.URL.revokeObjectURL(imgUrl.value)
|
|
|
}
|
|
|
|
|
|
defineExpose({ init })
|