瀏覽代碼

优化邀请好友复制功能

leo 1 年之前
父節點
當前提交
bec857fac9
共有 5 個文件被更改,包括 85 次插入664 次删除
  1. 1 0
      nuxt.config.js
  2. 61 647
      package-lock.json
  3. 1 0
      package.json
  4. 17 17
      pages/claimCloudPhone/components/bargainingAssistance.vue
  5. 5 0
      plugins/vue-clipboard2.js

+ 1 - 0
nuxt.config.js

@@ -83,6 +83,7 @@ export default {
     '~/plugins/jweixin',
     // '~/plugins/umeng-datasources',
     '@/plugins/vant',
+    '@/plugins/vue-clipboard2',
     '~/plugins/common',
 
   ],

文件差異過大導致無法顯示
+ 61 - 647
package-lock.json


+ 1 - 0
package.json

@@ -48,6 +48,7 @@
     "vconsole": "^3.14.6",
     "vee-validate": "^3.4.14",
     "vue": "^2.7.8",
+    "vue-clipboard2": "^0.3.3",
     "vue-data-dict": "^1.0.6",
     "vue-lottie": "^0.2.1",
     "vue-server-renderer": "^2.7.8",

+ 17 - 17
pages/claimCloudPhone/components/bargainingAssistance.vue

@@ -178,7 +178,7 @@
       <template v-if="bargainingTipsBool">
         <div class="bargaining-amount">
           <div class="bargaining-amount-text">
-            <div> 恭喜您</div>
+            <div>恭喜您</div>
             砍价成功<span>10.52元</span>
           </div>
           <lottie
@@ -312,14 +312,15 @@
         为您带来更多精彩的活动和内容。<br />
       </div> -->
     </van-dialog>
-    <van-dialog style="background: #fff !important" v-model="copyVisble" showCancelButton :showConfirmButton="false">
+    <!-- <van-dialog
+      style="background: #fff !important"
+      v-model="copyVisble"
+      showCancelButton
+      :showConfirmButton="false"
+    >
       <div class="copy-visble">请手动复制以下内容</div>
-      <van-field
-        v-model="copyValue"
-        rows="4"
-        type="textarea"
-      />
-    </van-dialog>
+      <van-field v-model="copyValue" rows="4" type="textarea" />
+    </van-dialog> -->
     <Verify
       @success="success"
       mode="pop"
@@ -339,7 +340,6 @@ import customProgress from './customProgress.vue';
 import loadList from '@/components/loadList';
 import { fileKeyToUrl } from '@/plugins/file-center.js';
 import Verify from '@/components/verifition/Verify';
-import { writeToClipboard } from '@/plugins/plugins.js';
 import lottie from '@/components/lottie';
 export default {
   props: {
@@ -404,8 +404,8 @@ export default {
       species,
       redPacket,
       glory,
-      copyVisble: false,
-      copyValue: ''
+      // copyVisble: false,
+      // copyValue: '',
     };
   },
   components: {
@@ -757,16 +757,16 @@ export default {
                   if (this.$userAgent.isSzx || this.$userAgent.isSzxBrowser) {
                     this.$native.share(shareInfo);
                   } else {
-                    writeToClipboard(
-                      res.data.link,
-                      () => {
+                    this.$copyText(res.data.link).then(
+                      (e) => {
                         setTimeout(() => {
                           this.$toast('链接复制成功');
                         });
                       },
-                      () => {
-                        this.copyValue = res.data.link
-                        this.copyVisble = true
+                      (e) => {
+                        setTimeout(() => {
+                          this.$toast('链接复制失败');
+                        });
                       },
                     );
                   }

+ 5 - 0
plugins/vue-clipboard2.js

@@ -0,0 +1,5 @@
+import Vue from 'vue'
+import VueClipboard from 'vue-clipboard2'
+
+VueClipboard.config.autoSetContainer = true // add this line
+Vue.use(VueClipboard)