Parcourir la source

复制分享链接

lifanagju_citu il y a 10 mois
Parent
commit
8a1bd94499
1 fichiers modifiés avec 10 ajouts et 5 suppressions
  1. 10 5
      src/views/recruit/personal/position/components/details.vue

+ 10 - 5
src/views/recruit/personal/position/components/details.vue

@@ -115,7 +115,7 @@
       @close="shareDialog = false"
     >
       <div>
-        <div class="pa-4" style="background-color: #f0f0f0; border-radius: 8px;">{{ shareUrl }}</div>
+        <div class="pa-4" style="background-color: #f0f0f0; border-radius: 8px;">{{ shareUrlTxt }}</div>
         <v-btn v-if="!getToken()" class="mt-1" color="warning" variant="text">您还未登录,登录后分享可享受分享有礼活动!</v-btn>
         <v-btn class="mt-4 ml-3" color="success" @click="copyText">复制分享链接</v-btn>
         <v-btn class="mt-4 ml-3" color="primary" variant="outlined" @click="openShareLink">打开分享链接</v-btn>
@@ -137,7 +137,7 @@
 
 <script setup>
 defineOptions({ name: 'position-details' })
-import { ref } from 'vue'
+import { computed, ref } from 'vue'
 import { useRouter } from 'vue-router'
 import { timesTampChange } from '@/utils/date'
 import { getPersonResumeCv } from '@/api/resume'
@@ -209,17 +209,22 @@ const handleShare = async () => {
     file: 'file',
   }).toString()
   shareDialog.value = true
-  // window.open(shareUrl.value)
 }
 const openShareLink = () => { window.open(shareUrl.value) }
+
+// 复制分享链接
+const shareUrlTxt = computed(() => {
+  return 'http://menduner.citupro.com:7878' + shareUrl.value
+})
 const copyText = async () => {
   try {
+    const txt = shareUrlTxt.value
     if (navigator.clipboard && navigator.clipboard.writeText) {
-      await navigator.clipboard.writeText(shareUrl.value)
+      await navigator.clipboard.writeText(txt)
       Snackbar.success('复制成功')
     } else {
       const textArea = document.createElement("textarea")
-      textArea.value = shareUrl.value
+      textArea.value = txt
       textArea.style.position = "fixed" // 避免在页面上滚动  
       textArea.style.top = 0
       textArea.style.left = 0