Browse Source

feat: 群发小程序封面比例校验&客户管理流失时间

zhengxy 11 months ago
parent
commit
e28e0c7c37

+ 25 - 1
project/src/components/assembly/editCon.vue

@@ -240,7 +240,7 @@
240 240
 
241 241
           <!-- <el-button type="primary" plain size="mini">裁剪</el-button> -->
242 242
         </div>
243
-        <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
243
+        <p class="uploadImgHint" style="margin-left:20px;">*仅支持PNG及JPG,封面显示图片宽高比为5:4,且文件大小不得超过10M。</p>
244 244
         <div class="buttons">
245 245
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
246 246
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
@@ -916,6 +916,11 @@ export default {
916 916
         if (this.miniprogramVisible) {//小程序
917 917
           this.miniprogram.pic_media_id = res.rst.material_id;
918 918
           this.miniprogram.pic_url = res.rst.url;
919
+          try {
920
+            this.handleCheckImgWH(file)
921
+          } catch (error) {
922
+            console.log(error)
923
+          }
919 924
         }
920 925
         if (this.linkExtendVisible) {//推广链接
921 926
           this.linkExtend.picurl = res.rst.url;
@@ -997,6 +1002,25 @@ export default {
997 1002
       await this.handleGetMiniProOptions()
998 1003
       this.$message.success('刷新成功')
999 1004
     },
1005
+    // 判断小程序封面图片比例是否为5:4 => 给出提示
1006
+    handleCheckImgWH(file) {
1007
+      const reader = new FileReader()
1008
+      reader.readAsDataURL(file.raw)
1009
+      reader.onload = () => {
1010
+        const img = new Image()
1011
+        img.src = reader.result
1012
+        img.onload = () => {
1013
+          const ratio = img.width / img.height
1014
+          const requiredRatio = 5 / 4
1015
+          if (Math.abs(ratio - requiredRatio) > 0.01) {
1016
+            this.$message.warning({
1017
+              message: '小程序封面图片宽高比为5:4,建议使用【图片裁剪】进行调整',
1018
+              duration: 5000,
1019
+            })
1020
+          }
1021
+        }
1022
+      }
1023
+    },
1000 1024
   }
1001 1025
 }
1002 1026
 </script>

+ 25 - 1
project/src/components/assembly/editConWelGroup.vue

@@ -226,7 +226,7 @@
226 226
             </div>
227 227
           </div>
228 228
         </div>
229
-        <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
229
+        <p class="uploadImgHint" style="margin-left:20px;">*仅支持PNG及JPG,封面显示图片宽高比为5:4,且文件大小不得超过10M。</p>
230 230
         <div class="buttons">
231 231
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
232 232
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
@@ -895,6 +895,11 @@ export default {
895 895
         if (this.miniprogramVisible) {//小程序
896 896
           this.miniprogram.pic_media_id = res.rst.material_id;
897 897
           this.miniprogram.pic_url = res.rst.url;
898
+          try {
899
+            this.handleCheckImgWH(file)
900
+          } catch (error) {
901
+            console.log(error)
902
+          }
898 903
         }
899 904
         if (this.linkExtendVisible) {//推广链接
900 905
           this.linkExtend.picurl = res.rst.url;
@@ -976,6 +981,25 @@ export default {
976 981
       await this.handleGetMiniProOptions()
977 982
       this.$message.success('刷新成功')
978 983
     },
984
+    // 判断小程序封面图片比例是否为5:4 => 给出提示
985
+    handleCheckImgWH(file) {
986
+      const reader = new FileReader()
987
+      reader.readAsDataURL(file.raw)
988
+      reader.onload = () => {
989
+        const img = new Image()
990
+        img.src = reader.result
991
+        img.onload = () => {
992
+          const ratio = img.width / img.height
993
+          const requiredRatio = 5 / 4
994
+          if (Math.abs(ratio - requiredRatio) > 0.01) {
995
+            this.$message.warning({
996
+              message: '小程序封面图片宽高比为5:4,建议使用【图片裁剪】进行调整',
997
+              duration: 5000,
998
+            })
999
+          }
1000
+        }
1001
+      }
1002
+    },
979 1003
   }
980 1004
 }
981 1005
 </script>

+ 1 - 1
project/src/components/assembly/multipleLinkEdit.vue

@@ -62,7 +62,7 @@
62 62
               <i v-else class="el-icon-plus avatar-uploader-icon" />
63 63
             </el-upload>
64 64
           </div>
65
-          <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
65
+          <p class="uploadImgHint" style="margin-left:20px;">*仅支持PNG及JPG,封面显示图片宽高比为5:4,且文件大小不得超过10M。</p>
66 66
         </div>
67 67
       </div>
68 68
       <!-- E 小程序 -->

+ 35 - 11
project/src/components/customManage/manage.vue

@@ -1,27 +1,29 @@
1 1
 <template>
2 2
   <div v-loading="loading">
3 3
     <!-- 使用说明 -->
4
-    <instructions doc="customManage"></instructions>
4
+    <instructions doc="customManage" />
5 5
 
6 6
     <div class="screenBox">
7 7
       <!-- 搜索客户 -->
8
-      <self-input :reset='resetFlag' @inputChange='(val)=>{input_keyword = val;init(1)}'></self-input>
8
+      <self-input :reset='resetFlag' @inputChange='(val)=>{input_keyword = val;init(1)}' />
9 9
       <!-- 所属客服 -->
10
-      <self-customerservice :reset='resetFlag' @customerDefine="(val)=>{user_id_list=val;init(1)}"></self-customerservice>
10
+      <self-customerservice :reset='resetFlag' @customerDefine="(val)=>{user_id_list=val;init(1)}" />
11 11
       <!-- 企业标签 -->
12
-      <enterprise-tag :reset='resetFlag' @tagDefine="tagDefine"></enterprise-tag>
12
+      <enterprise-tag :reset='resetFlag' @tagDefine="tagDefine" />
13 13
       <!-- 添加时间 -->
14
-      <date-picker :reset='resetFlag' @changeTime="changeTime"></date-picker>
14
+      <date-picker :reset='resetFlag' @changeTime="changeTime" />
15 15
       <!-- 添加渠道 -->
16
-      <self-channel :reset='resetFlag' @channelDefine="(val)=>{add_way = val;init(1)}"></self-channel>
16
+      <self-channel :reset='resetFlag' @channelDefine="(val)=>{add_way = val;init(1)}" />
17 17
       <!-- 性别 暂时获取不到 -->
18
-      <self-gender :reset='resetFlag' @genderChange="(val)=>{gender = val;init(1)}"></self-gender>
18
+      <self-gender :reset='resetFlag' @genderChange="(val)=>{gender = val;init(1)}" />
19 19
       <!-- 流失状态 -->
20
-      <loss-body :reset='resetFlag' @lossChange="lossChange"></loss-body>
20
+      <loss-body :reset='resetFlag' @lossChange="lossChange" />
21 21
       <!-- 付费情况 -->
22
-      <screen-pay :reset='resetFlag' @payChange="payChange"></screen-pay>
22
+      <screen-pay :reset='resetFlag' @payChange="payChange" />
23 23
       <!-- 充值时间 -->
24 24
       <date-picker :reset='resetFlag' title="充值时间" @changeTime="onChangePayTime" />
25
+      <!-- 流失时间 -->
26
+      <date-picker :reset='resetFlag' title="流失时间" timeFlag :defaultTime="['00:00:00', '23:59:59']" @changeTime="onChangeLossTime" />
25 27
       <div class="reset" @click="resetEvent">重置</div>
26 28
     </div>
27 29
     <div class="tableInfo">
@@ -116,9 +118,12 @@
116 118
           </div>
117 119
         </template>
118 120
       </el-table-column>
119
-      <el-table-column label="客户状态" show-overflow-tooltip align="center">
121
+      <el-table-column label="客户状态" show-overflow-tooltip align="center" min-width="110">
120 122
         <template slot-scope="scope">
121
-          <span v-if="scope.row.relation_enable==0" class="c-F03F5C">已流失</span>
123
+          <div v-if="scope.row.relation_enable==0" class="c-F03F5C">已流失
124
+            <p v-if="scope.row.loss_time">{{ scope.row.loss_time.split(' ')[0] }}</p>
125
+            <p v-if="scope.row.loss_time">{{ scope.row.loss_time.split(' ')[1] }}</p>
126
+          </div>
122 127
           <span v-if="scope.row.relation_enable==1" class="c-448AFF">未流失</span>
123 128
           <span v-if="scope.row.relation_enable==2" class="c-FFB055">待分配</span>
124 129
         </template>
@@ -209,6 +214,8 @@ export default {
209 214
       add_date_end: '',//添加日期 截止
210 215
       last_pay_time_start: '',//充值时间 起始
211 216
       last_pay_time_end: '',//充值时间 截止
217
+      loss_time_start: '',//流失时间 起始
218
+      loss_time_end: '',//流失时间 截止
212 219
       loss_status: null,//客户流失状态 没有筛选时传null 0未流失 1已流失
213 220
       pay_status: null,//	付款状态 没有筛选时传null 0未付款 1已付款
214 221
       pay_num_min: '',//最小付款次数,当pay_status是1时必传
@@ -278,6 +285,8 @@ export default {
278 285
           add_date_end: this.add_date_end,
279 286
           last_pay_time_start: this.last_pay_time_start,
280 287
           last_pay_time_end: this.last_pay_time_end,
288
+          loss_time_start: this.loss_time_start,
289
+          loss_time_end: this.loss_time_end,
281 290
           add_way: this.add_way,
282 291
           pay_status: this.pay_status,
283 292
           pay_num_min: this.pay_num_min,
@@ -379,6 +388,8 @@ export default {
379 388
       this.add_date_end = '';
380 389
       this.last_pay_time_start = '';
381 390
       this.last_pay_time_end = '';
391
+      this.loss_time_start = '';
392
+      this.loss_time_end = '';
382 393
       this.loss_status = null;
383 394
       this.pay_status = null;
384 395
       this.pay_num_min = '';
@@ -436,6 +447,17 @@ export default {
436 447
       }
437 448
       this.init(1)
438 449
     },
450
+    // 监听“流失时间”筛选变化
451
+    onChangeLossTime (time) {
452
+      if (!time || time && time.length == 0) {
453
+        this.loss_time_start = '';
454
+        this.loss_time_end = '';
455
+      } else {
456
+        this.loss_time_start = time[0]
457
+        this.loss_time_end = time[1]
458
+      }
459
+      this.init(1)
460
+    },
439 461
     tagDefine (data) {//标签选择回调
440 462
       if (data.tag == 1 || data.tag == 2) {
441 463
         if (data.tag_id_list && data.tag_id_list.length != 0) {
@@ -472,6 +494,8 @@ export default {
472 494
           add_date_end: this.add_date_end,
473 495
           last_pay_time_start: this.last_pay_time_start,
474 496
           last_pay_time_end: this.last_pay_time_end,
497
+          loss_time_start: this.loss_time_start,
498
+          loss_time_end: this.loss_time_end,
475 499
           add_way: this.add_way,
476 500
           pay_status: this.pay_status,
477 501
           pay_num_min: this.pay_num_min,