Browse Source

复制链接

Xiao_123 10 months ago
parent
commit
d87da02fa3
1 changed files with 33 additions and 24 deletions
  1. 33 24
      src/views/recruit/personal/position/components/details.vue

+ 33 - 24
src/views/recruit/personal/position/components/details.vue

@@ -58,7 +58,10 @@
                 <v-img :src="info.contact.avatar || 'https://minio.citupro.com/dev/menduner/7.png'" :width="45" style="height: 45px;"></v-img>
                 <div class="ml-2">
                   <div class="contact-name">{{ info.contact.name }}</div>
-                  <div class="contact-info">{{ info.enterprise.name }} · {{ info.contact.postNameCn }}</div>
+                  <div class="contact-info">
+                    {{ info.enterprise.name }}
+                     <span v-if="info?.enterprise?.name && info?.contact?.postNameCn">·</span>
+                    {{ info.contact.postNameCn }}</div>
                 </div>
               </div>
               <!-- <div class="float-right">
@@ -202,30 +205,36 @@ 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(txt)
+  //     Snackbar.success('复制成功')
+  //   } else {
+  //     const textArea = document.createElement("textarea")
+  //     textArea.value = txt
+  //     textArea.style.position = "fixed" // 避免在页面上滚动  
+  //     textArea.style.top = 0
+  //     textArea.style.left = 0
+  //     textArea.style.width = "2em"
+  //     textArea.style.height = "2em"
+  //     textArea.style.padding = 0
+  //     textArea.style.border = "none"
+  //     textArea.style.outline = "none"
+  //     textArea.style.boxShadow = "none"
+  //     textArea.style.background = "transparent"
+  //     document.body.appendChild(textArea)
+  //     textArea.focus()
+  //     textArea.select()
+  //     const successful = document.execCommand('copy')
+  //     Snackbar.success(successful ? '复制成功' : '复制失败,请手动复制。')
+  //   }
+  // } catch (err) {
+  //   Snackbar.error('复制失败,请手动复制。')
+  // }
   try {
-    const txt = shareUrlTxt.value
-    if (navigator.clipboard && navigator.clipboard.writeText) {
-      await navigator.clipboard.writeText(txt)
-      Snackbar.success('复制成功')
-    } else {
-      const textArea = document.createElement("textarea")
-      textArea.value = txt
-      textArea.style.position = "fixed" // 避免在页面上滚动  
-      textArea.style.top = 0
-      textArea.style.left = 0
-      textArea.style.width = "2em"
-      textArea.style.height = "2em"
-      textArea.style.padding = 0
-      textArea.style.border = "none"
-      textArea.style.outline = "none"
-      textArea.style.boxShadow = "none"
-      textArea.style.background = "transparent"
-      document.body.appendChild(textArea)
-      textArea.focus()
-      textArea.select()
-      const successful = document.execCommand('copy')
-      Snackbar.success(successful ? '复制成功' : '复制失败,请手动复制。')
-    }
+    await navigator.clipboard.writeText(shareUrlTxt.value)
+    Snackbar.success('复制成功')
   } catch (err) {
     Snackbar.error('复制失败,请手动复制。')
   }