Browse Source

fix: 客户群发链接输入框优化&朋友圈链接格式判断

zhengxy 1 year ago
parent
commit
f91fa40e71

+ 23 - 2
project/src/components/assembly/conTwo.vue

@@ -35,8 +35,9 @@
35 35
         <div class="box">
36 36
           <div class="itemBox">
37 37
             <div class="txt"><em>*</em>图文链接:</div>
38
-            <div class="conEle">
39
-              <el-input v-model="linkUrl.link.url" size="mini" placeholder="链接地址请以http或https开头"></el-input>
38
+            <div class="conEle textInput">
39
+              <el-input v-model="linkUrl.link.url" size="mini" placeholder="链接地址请以http或https开头" type="textarea" :rows="6"></el-input>
40
+              <i v-show="linkUrl.link.url" class="clearButton el-input__icon el-icon-circle-close el-input__clear" @click.prevent="linkUrl.link.url=''" />
40 41
             </div>
41 42
           </div>
42 43
           <div class="itemBox">
@@ -442,4 +443,24 @@ export default {
442 443
   margin-top: 10px;
443 444
   line-height: 16px;
444 445
 }
446
+.textInput {
447
+  position: relative;
448
+
449
+  .clearButton {
450
+    position: absolute;
451
+    border-radius: 5px;
452
+    right: -2px;
453
+    z-index: 9;
454
+    border: none;
455
+    top: -4px;
456
+    height: 40px;
457
+    cursor: pointer;
458
+    color: #ccc;
459
+    transform: translateX(2px);
460
+  }
461
+
462
+  .clearButton:hover {
463
+    color: #878d99;
464
+  }
465
+}
445 466
 </style>

+ 28 - 8
project/src/components/assembly/editCon.vue

@@ -101,8 +101,7 @@
101 101
         <label><em>*</em>链接标题:</label>
102 102
         <div class="input">
103 103
           <div class="flex">
104
-            <el-input class="input" type="textarea" size="small" placeholder="请输入链接标题" v-model="link.title" clearable>
105
-            </el-input>
104
+            <el-input class="input" type="textarea" size="small" placeholder="请输入链接标题" v-model="link.title" clearable></el-input>
106 105
             <span class="font_zj">{{ $getStrBytes(link.title) }}/128字节</span>
107 106
           </div>
108 107
           <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(link.title) > 128"> <i
@@ -112,9 +111,9 @@
112 111
       <div class="lineItem">
113 112
         <label><em>*</em>链接地址:</label>
114 113
         <div class="input">
115
-          <div class="flex">
116
-            <el-input class="input" type="textarea" size="small" placeholder="请输入链接地址" v-model="link.url" clearable>
117
-            </el-input>
114
+          <div class="flex textInput">
115
+            <el-input class="input" type="textarea" size="small" placeholder="请输入链接地址" v-model="link.url" clearable :rows="6"></el-input>
116
+            <i v-show="link.url" class="clearButton el-input__icon el-icon-circle-close el-input__clear" @click.prevent="link.url=''" />
118 117
             <span class="font_zj">{{ $getStrBytes(link.url) }}/2048字节</span>
119 118
           </div>
120 119
           <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(link.url) > 2048"> <i
@@ -230,9 +229,9 @@
230 229
       <div class="lineItem">
231 230
         <label><em>*</em>链接地址:</label>
232 231
         <div class="input">
233
-          <div class="flex">
234
-            <el-input class="input" type="textarea" size="small" placeholder="请输入链接地址" v-model="linkExtend.jump_url"
235
-              clearable></el-input>
232
+          <div class="flex textInput">
233
+            <el-input class="input" type="textarea" size="small" placeholder="请输入链接地址" v-model="linkExtend.jump_url" clearable :rows="6"></el-input>
234
+            <i v-show="linkExtend.jump_url" class="clearButton el-input__icon el-icon-circle-close el-input__clear" @click.prevent="linkExtend.jump_url=''" />
236 235
             <span class="font_zj">{{ $getStrBytes(linkExtend.jump_url) }}/2048字节</span>
237 236
           </div>
238 237
           <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(linkExtend.jump_url) > 2048"> <i
@@ -954,4 +953,25 @@ export default {
954 953
   line-height: 20px;
955 954
   padding-left: 6px;
956 955
 }
956
+
957
+.textInput {
958
+  position: relative;
959
+
960
+  .clearButton {
961
+    position: absolute;
962
+    border-radius: 5px;
963
+    right: 94px;
964
+    z-index: 9;
965
+    border: none;
966
+    top: -4px;
967
+    height: 40px;
968
+    cursor: pointer;
969
+    color: #ccc;
970
+    transform: translateX(2px);
971
+  }
972
+
973
+  .clearButton:hover {
974
+    color: #878d99;
975
+  }
976
+}
957 977
 </style>

+ 27 - 3
project/src/components/customOperate/createFriendsCircle.vue

@@ -330,7 +330,7 @@ export default {
330 330
         this.$refs.conTwo.getFinallyAttach(type)
331 331
       })
332 332
     },
333
-    createFriendsCircleSend (attachments) {//通知成员发送
333
+    async createFriendsCircleSend (attachments) {//通知成员发送
334 334
       if (this.fc_type == '') {
335 335
         this.$message({
336 336
           message: '请选择朋友圈类型!',
@@ -396,11 +396,14 @@ export default {
396 396
         } else if (msgName == 'link') {
397 397
           if (attachments[0].link.media_id == '' || attachments[0].link.url == '') {
398 398
             this.$message({
399
-              message: '视频为必传内容!',
399
+              message: '链接为必传内容!',
400 400
               type: "warning"
401 401
             })
402 402
             return
403 403
           }
404
+
405
+          const isTrue = await this.handleConfirmLink(attachments[0].link.url)
406
+          if (!isTrue) return
404 407
         }  else if (msgName == 'radar') {
405 408
           if (attachments[0].radar.radar_id == '') {
406 409
             this.$message({
@@ -445,7 +448,6 @@ export default {
445 448
         }
446 449
         send_time = this.send_time.date + ' ' + this.send_time.time
447 450
       }
448
-
449 451
       this.$loading(this.$loadingConfig)
450 452
       this.$axios.post(this.URL.BASEURL + this.URL.createFriendsCircleSend, {
451 453
         rule_id: this.is_copy ? '' : this.rule_id ? this.rule_id : '',
@@ -521,6 +523,28 @@ export default {
521 523
         this.customerMatchCountLoading = false
522 524
       });
523 525
     },
526
+
527
+    handleConfirmLink(link) {
528
+      return new Promise(async (resolve, reject) => {
529
+        let num = link.split('?').length;
530
+        if ( num>2 ) {// 有两个问号
531
+          try {
532
+            await this.$confirm(`请确认链接地址:${link}`, '提示', {
533
+              closeOnClickModal:false,
534
+              type: 'warning',
535
+              showCancelButton: true,
536
+              confirmButtonText: '确认无误',
537
+              cancelButtonText: '去修改',
538
+            })
539
+            resolve(true)
540
+          } catch (error) {
541
+            resolve(false)
542
+          }
543
+        } else {
544
+          resolve(true)
545
+        }
546
+      })
547
+    }
524 548
   }
525 549
 }
526 550
 </script>