Browse Source

消息提示

xiuli.gao 2 years ago
parent
commit
015ae71515

+ 10 - 0
ceshi.html

1
+<!DOCTYPE html>
2
+<html>
3
+<body>
4
+
5
+<?php
6
+echo strlen("Hello");
7
+?>
8
+
9
+</body>
10
+</html>

+ 1 - 1
index.html

7
         hm.src = "https://hm.baidu.com/hm.js?d61b9e2caf4d46ccda7471b5385e2333";
7
         hm.src = "https://hm.baidu.com/hm.js?d61b9e2caf4d46ccda7471b5385e2333";
8
         var s = document.getElementsByTagName("script")[0];
8
         var s = document.getElementsByTagName("script")[0];
9
         s.parentNode.insertBefore(hm, s);
9
         s.parentNode.insertBefore(hm, s);
10
-      })();</script><link href=./static/css/app.2b0dfd779354ead704f8791d88407017.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.c20f75253d08152a4c31.js></script><script type=text/javascript src=./static/js/app.8c0f6e8492617ab7c119.js></script></body></html>
10
+      })();</script><link href=./static/css/app.9c78249d5b4e40a63dc3727c5001b4e9.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ab22ff568c2314851ba.js></script><script type=text/javascript src=./static/js/app.ee77755dd17754c288be.js></script></body></html>

+ 1 - 0
project/package.json

23
     "node-sass": "^4.12.0",
23
     "node-sass": "^4.12.0",
24
     "sass-loader": "^7.1.0",
24
     "sass-loader": "^7.1.0",
25
     "switch-address": "^1.0.4",
25
     "switch-address": "^1.0.4",
26
+    "umy-ui": "^1.1.6",
26
     "vue": "^2.5.2",
27
     "vue": "^2.5.2",
27
     "vue-axios": "^3.2.5",
28
     "vue-axios": "^3.2.5",
28
     "vue-masked-input": "^0.5.2",
29
     "vue-masked-input": "^0.5.2",

+ 1 - 0
project/src/assets/config/interface_api.js

102
   wxad_getAuthUrl: "/wxad/getAuthUrl",
102
   wxad_getAuthUrl: "/wxad/getAuthUrl",
103
   pitcher_dramaEdit: "/api/pitcher/dramaEdit",
103
   pitcher_dramaEdit: "/api/pitcher/dramaEdit",
104
   pitcher_dramaAdd: "/api/pitcher/dramaAdd",
104
   pitcher_dramaAdd: "/api/pitcher/dramaAdd",
105
+  php_strLength: "/api/welcomeMsg/strLength",
105
 };
106
 };
106
 
107
 
107
 export { api };
108
 export { api };

+ 12 - 0
project/src/assets/js/common.js

208
     return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
208
     return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
209
   }
209
   }
210
 
210
 
211
+}
212
+
213
+export function getStrBytes (string) {//获取对应的字节数
214
+  if (string) {
215
+    var blob = new Blob([string]);
216
+    let size = blob && blob.size;
217
+    let n = string.match(/\n/g, "");//一个\n加一个字节
218
+    size += n ? n.length : 0;
219
+    return size
220
+  } else {
221
+    return 0
222
+  }
211
 }
223
 }

+ 69 - 16
project/src/components/assembly/editCon.vue

4
       <!-- <div class="insert" v-if="source=='welcom'">
4
       <!-- <div class="insert" v-if="source=='welcom'">
5
         <span @click="insertAtCursor">「插入客户昵称」</span>
5
         <span @click="insertAtCursor">「插入客户昵称」</span>
6
       </div> -->
6
       </div> -->
7
-      <textarea class="textarea self-scrollbar-3" ref="textarea" v-if="!disabled" autocomplete="off" maxlength="1000" :placeholder="source=='welcom'?'请输入欢迎语':'请输入群发内容'" v-model="content" @input="contentChange"></textarea>
7
+      <textarea class="textarea self-scrollbar-3" ref="textarea" v-if="!disabled" autocomplete="off" :placeholder="source=='welcom'?'请输入欢迎语':'请输入群发内容'" v-model="content" @input="contentChange"></textarea>
8
       <!-- <div contentEditable='true' id="textarea" class="textarea self-scrollbar-3" v-if="!disabled" autocomplete="off" maxlength="1000" v-html="content" :placeholder="source=='welcom'?'请输入欢迎语':'请输入群发内容'" @input="contentChange">
8
       <!-- <div contentEditable='true' id="textarea" class="textarea self-scrollbar-3" v-if="!disabled" autocomplete="off" maxlength="1000" v-html="content" :placeholder="source=='welcom'?'请输入欢迎语':'请输入群发内容'" @input="contentChange">
9
         {{content}}
9
         {{content}}
10
       </div> -->
10
       </div> -->
11
       <div class="textarea self-scrollbar-3 pointer-drop" style="white-space: pre-wrap;color:#666" v-else>{{content}}</div>
11
       <div class="textarea self-scrollbar-3 pointer-drop" style="white-space: pre-wrap;color:#666" v-else>{{content}}</div>
12
-      <div class="maxFont">{{content.length}}/1000</div>
12
+      <div class="flex">
13
+        <div class="warning_hint" v-if="$getStrBytes(content)>4000"> <i class="el-icon-warning-outline"></i> 消息文本内容,最多4000个字节,已超出!</div>
14
+        <div class="maxFont" style="flex:1">{{$getStrBytes(content)}}/4000字节</div>
15
+      </div>
13
       <div class="fujian" v-if="attachments&&attachments.length>0">
16
       <div class="fujian" v-if="attachments&&attachments.length>0">
14
         <draggable class="syllable_ul" element="ul" :disabled="disabled" :list="attachments" :options="{group:'name', animation:100}">
17
         <draggable class="syllable_ul" element="ul" :disabled="disabled" :list="attachments" :options="{group:'name', animation:100}">
15
           <div class="fujianItem" :class="disabled?'pointer-drop':''" v-for="(item,index) in attachments" :key="index">
18
           <div class="fujianItem" :class="disabled?'pointer-drop':''" v-for="(item,index) in attachments" :key="index">
121
     <el-dialog title="添加链接" :visible.sync="linkVisible" width="500px" center :close-on-click-modal="false">
124
     <el-dialog title="添加链接" :visible.sync="linkVisible" width="500px" center :close-on-click-modal="false">
122
       <div class="lineItem">
125
       <div class="lineItem">
123
         <label><em>*</em>链接标题:</label>
126
         <label><em>*</em>链接标题:</label>
124
-        <el-input class="input" size="small" placeholder="请输入链接标题" v-model="link.title" clearable>
125
-        </el-input>
127
+        <div class="input">
128
+          <div class="flex">
129
+            <el-input class="input" type="textarea" size="small" placeholder="请输入链接标题" v-model="link.title" clearable></el-input>
130
+            <span class="font_zj">{{$getStrBytes(link.title)}}/128字节</span>
131
+          </div>
132
+          <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(link.title)>128"> <i class="el-icon-warning-outline"></i> 链接标题,最多128个字节,已超出!</div>
133
+        </div>
126
       </div>
134
       </div>
127
       <div class="lineItem">
135
       <div class="lineItem">
128
         <label><em>*</em>链接地址:</label>
136
         <label><em>*</em>链接地址:</label>
129
-        <el-input class="input" size="small" placeholder="请输入链接地址" v-model="link.url" clearable>
130
-        </el-input>
137
+        <div class="input">
138
+          <div class="flex">
139
+            <el-input class="input" type="textarea" size="small" placeholder="请输入链接地址" v-model="link.url" clearable></el-input>
140
+            <span class="font_zj">{{$getStrBytes(link.url)}}/2048字节</span>
141
+          </div>
142
+          <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(link.url)>2048"> <i class="el-icon-warning-outline"></i> 链接地址,最多2048个字节,已超出!</div>
143
+        </div>
144
+        <!-- <el-input class="input" size="small" placeholder="请输入链接地址" v-model="link.url" clearable></el-input> -->
131
       </div>
145
       </div>
132
       <div class="lineItem">
146
       <div class="lineItem">
133
         <label>图文封面:</label>
147
         <label>图文封面:</label>
139
       <p class="uploadImgHint" style="margin-left:40px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。</p>
153
       <p class="uploadImgHint" style="margin-left:40px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。</p>
140
       <div class="lineItem">
154
       <div class="lineItem">
141
         <label>封面描述:</label>
155
         <label>封面描述:</label>
142
-        <el-input class="input" size="small" placeholder="请输入封面描述" v-model="link.desc" clearable>
143
-        </el-input>
156
+        <div class="input">
157
+          <div class="flex">
158
+            <el-input class="input" type="textarea" size="small" placeholder="请输入封面描述" v-model="link.desc" clearable></el-input>
159
+            <span class="font_zj">{{$getStrBytes(link.desc)}}/512字节</span>
160
+          </div>
161
+          <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(link.desc)>512"> <i class="el-icon-warning-outline"></i> 封面描述,最多512个字节,已超出!</div>
162
+        </div>
163
+        <!-- <el-input class="input" size="small" placeholder="请输入封面描述" v-model="link.desc" clearable></el-input> -->
144
       </div>
164
       </div>
145
       <div class="buttons">
165
       <div class="buttons">
146
         <el-button type="primary" plain size="mini" @click="linkVisible = false">取消</el-button>
166
         <el-button type="primary" plain size="mini" @click="linkVisible = false">取消</el-button>
148
       </div>
168
       </div>
149
     </el-dialog>
169
     </el-dialog>
150
     <!-- 小程序 -->
170
     <!-- 小程序 -->
151
-    <el-dialog title="添加小程序" :visible.sync="miniprogramVisible" width="600px" center :close-on-click-modal="false">
171
+    <el-dialog title="添加小程序" :visible.sync="miniprogramVisible" width="650px" center :close-on-click-modal="false">
152
       <div style="padding:0 15px;">
172
       <div style="padding:0 15px;">
153
         <div class="self-hint" style="margin-bottom:20px;border:none">
173
         <div class="self-hint" style="margin-bottom:20px;border:none">
154
           <i class="el-icon-message-solid"></i>
174
           <i class="el-icon-message-solid"></i>
156
         </div>
176
         </div>
157
         <div class="lineItem">
177
         <div class="lineItem">
158
           <label><em>*</em>小程序标题:</label>
178
           <label><em>*</em>小程序标题:</label>
159
-          <el-input class="input" size="small" placeholder="请输入小程序标题" v-model="miniprogram.title" clearable></el-input>
179
+          <div class="input">
180
+            <div class="flex">
181
+              <el-input class="input" type="textarea" size="small" placeholder="请输入小程序标题" v-model="miniprogram.title" clearable></el-input>
182
+              <span class="font_zj">{{$getStrBytes(miniprogram.title)}}/64字节</span>
183
+            </div>
184
+            <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(miniprogram.title)>64"> <i class="el-icon-warning-outline"></i> 小程序标题,最多64个字节,已超出!</div>
185
+          </div>
186
+          <!-- <el-input class="input" size="small" placeholder="请输入小程序标题" v-model="miniprogram.title" clearable></el-input> -->
160
         </div>
187
         </div>
161
         <div class="lineItem">
188
         <div class="lineItem">
162
           <label><em>*</em>小程序appID:</label>
189
           <label><em>*</em>小程序appID:</label>
163
           <div style="flex:1">
190
           <div style="flex:1">
164
             <el-input class="input" size="small" placeholder="请输入小程序appID" v-model="miniprogram.appid" clearable></el-input>
191
             <el-input class="input" size="small" placeholder="请输入小程序appID" v-model="miniprogram.appid" clearable></el-input>
165
-            <p class="otherHint"><a href="https://docs.qq.com/doc/p/cb25fa9e1aba98ce5f8b942f2900f0247b9e5dc6?dver=2.1.27292865" target="_blank">如何获取小程序appID?</a></p>
192
+            <p class="otherHint" style="color:#f9a527">*小程序appID<a href="https://docs.qq.com/doc/p/cb25fa9e1aba98ce5f8b942f2900f0247b9e5dc6?dver=2.1.27292865" target="_blank">(如何获取小程序appID)</a>,必须是关联到企业的小程序应用。</p>
166
           </div>
193
           </div>
167
         </div>
194
         </div>
168
         <div class="lineItem">
195
         <div class="lineItem">
179
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
206
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
180
           </el-upload>
207
           </el-upload>
181
         </div>
208
         </div>
182
-        <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。</p>
209
+        <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
183
         <div class="buttons">
210
         <div class="buttons">
184
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
211
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
185
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
212
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
317
       this.imgVisible = false;
344
       this.imgVisible = false;
318
     },
345
     },
319
     linkDefine () {//链接确定
346
     linkDefine () {//链接确定
320
-      if (this.link.title == '') {
347
+      if (this.link.title == '' || this.$getStrBytes(this.link.title) > 128) {
321
         this.$message({
348
         this.$message({
322
-          message: '请输入链接标题',
349
+          message: '请正确输入链接标题',
323
           type: "warning"
350
           type: "warning"
324
         })
351
         })
325
         return
352
         return
331
         })
358
         })
332
         return
359
         return
333
       }
360
       }
361
+      if (this.link && this.link.url != '' && this.$getStrBytes(this.link.url) > 2048) {
362
+        this.$message({
363
+          message: '请正确输入链接地址',
364
+          type: "warning"
365
+        })
366
+        return
367
+      }
368
+      if (this.link && this.link.desc != '' && this.$getStrBytes(this.link.desc) > 512) {
369
+        this.$message({
370
+          message: '请正确输入封面描述',
371
+          type: "warning"
372
+        })
373
+        return
374
+      }
334
       let obj = {
375
       let obj = {
335
         "msgtype": "link",
376
         "msgtype": "link",
336
         "link": this.link
377
         "link": this.link
345
       this.linkVisible = false;
386
       this.linkVisible = false;
346
     },
387
     },
347
     miniprogramDefine () {//小程序确定
388
     miniprogramDefine () {//小程序确定
348
-      if (this.miniprogram.title == '') {
389
+      if (this.miniprogram.title == '' || this.$getStrBytes(this.miniprogram.title) > 64) {
349
         this.$message({
390
         this.$message({
350
-          message: '请输入小程序标题',
391
+          message: '请正确输入小程序标题',
351
           type: "warning"
392
           type: "warning"
352
         })
393
         })
353
         return
394
         return
750
   margin-top: -10px;
791
   margin-top: -10px;
751
   margin-bottom: 10px;
792
   margin-bottom: 10px;
752
 }
793
 }
794
+.warning_hint {
795
+  color: red;
796
+  font-size: 13px;
797
+  margin-left: 10px;
798
+  line-height: 20px;
799
+}
800
+.font_zj {
801
+  font-size: 12px;
802
+  width: 96px;
803
+  line-height: 20px;
804
+  padding-left: 6px;
805
+}
753
 </style>
806
 </style>

+ 7 - 0
project/src/components/customOperate/createMassMsg.vue

294
         })
294
         })
295
         return
295
         return
296
       }
296
       }
297
+      if (this.content != '' && this.$getStrBytes(this.content) > 4000) {
298
+        this.$message({
299
+          message: '请检查消息文本内容,最多4000个字节,已超出!',
300
+          type: "error"
301
+        })
302
+        return
303
+      }
297
       this.$loading(this.$loadingConfig)
304
       this.$loading(this.$loadingConfig)
298
       this.$axios.post(this.URL.BASEURL + this.URL.massMsg_set, {
305
       this.$axios.post(this.URL.BASEURL + this.URL.massMsg_set, {
299
         rule_id: this.$route.params.rule_id ? this.$route.params.rule_id : '',
306
         rule_id: this.$route.params.rule_id ? this.$route.params.rule_id : '',

+ 14 - 0
project/src/components/customOperate/welcom_message.vue

202
         })
202
         })
203
         return
203
         return
204
       }
204
       }
205
+      if (this.main_msg_data.content != '' && this.$getStrBytes(this.main_msg_data.content) > 4000) {
206
+        this.$message({
207
+          message: '请检查【主】欢迎语内容,最多4000个字节,已超出!',
208
+          type: "error"
209
+        })
210
+        return
211
+      }
205
       let msg_data = []
212
       let msg_data = []
206
       if (this.is_day_parting) {//开启分段欢迎语
213
       if (this.is_day_parting) {//开启分段欢迎语
207
         for (let i = 0; i < this.timeIntervalList.length; i++) {
214
         for (let i = 0; i < this.timeIntervalList.length; i++) {
213
             })
220
             })
214
             return
221
             return
215
           }
222
           }
223
+          if (item.content != '' && this.$getStrBytes(item.content) > 4000) {
224
+            this.$message({
225
+              message: `请检查【时段${i + 1}】欢迎语内容,最多4000个字节,已超出!`,
226
+              type: "error"
227
+            })
228
+            return
229
+          }
216
           if (!item.weeks || item.weeks.length == 0) {
230
           if (!item.weeks || item.weeks.length == 0) {
217
             this.$message({
231
             this.$message({
218
               message: `请选择【时段${i + 1}】发送日期!`,
232
               message: `请选择【时段${i + 1}】发送日期!`,

+ 2 - 1
project/src/main.js

24
 
24
 
25
 import { setLocal, getLocal, delLocal, delAllLocal } from '@/assets/js/storage.js'
25
 import { setLocal, getLocal, delLocal, delAllLocal } from '@/assets/js/storage.js'
26
 import { setCookie, getCookie, delCookie, delAllCookie } from '@/assets/js/cookie.js'
26
 import { setCookie, getCookie, delCookie, delAllCookie } from '@/assets/js/cookie.js'
27
-import { copy, getDay, NumberHandle, isChn, formatNum, formateHours, formateMinute, day_format, date_compatible, timeStamp_to_date } from '@/assets/js/common.js'
27
+import { getStrBytes, copy, getDay, NumberHandle, isChn, formatNum, formateHours, formateMinute, day_format, date_compatible, timeStamp_to_date } from '@/assets/js/common.js'
28
 import exportToPdf from '@/assets/js/exportToPdf.js'
28
 import exportToPdf from '@/assets/js/exportToPdf.js'
29
 Vue.use(exportToPdf)
29
 Vue.use(exportToPdf)
30
 Vue.prototype.$getDay = getDay;
30
 Vue.prototype.$getDay = getDay;
37
 Vue.prototype.$date_compatible = date_compatible;
37
 Vue.prototype.$date_compatible = date_compatible;
38
 Vue.prototype.$day_format = day_format;
38
 Vue.prototype.$day_format = day_format;
39
 Vue.prototype.$copy = copy;
39
 Vue.prototype.$copy = copy;
40
+Vue.prototype.$getStrBytes = getStrBytes;
40
 Vue.prototype.$store = store;
41
 Vue.prototype.$store = store;
41
 Vue.prototype.$localSelfStore = { setLocal, getLocal, delLocal, delAllLocal }
42
 Vue.prototype.$localSelfStore = { setLocal, getLocal, delLocal, delAllLocal }
42
 Vue.prototype.$cookie = { setCookie, getCookie, delCookie, delAllCookie }
43
 Vue.prototype.$cookie = { setCookie, getCookie, delCookie, delAllCookie }

File diff suppressed because it is too large
+ 0 - 1
static/css/app.2b0dfd779354ead704f8791d88407017.css


File diff suppressed because it is too large
+ 1 - 0
static/css/app.9c78249d5b4e40a63dc3727c5001b4e9.css


File diff suppressed because it is too large
+ 8 - 0
static/js/3.4bc5f3c03b0df59408e1.js


File diff suppressed because it is too large
+ 8 - 0
static/js/4.69963fa8523e04a3fc4e.js


File diff suppressed because it is too large
+ 1 - 1
static/js/3.ad77b4211476f60746d7.js


File diff suppressed because it is too large
+ 0 - 1
static/js/5.e71cc17793683fbbf052.js


File diff suppressed because it is too large
+ 1 - 1
static/js/4.c082cdad09434c0eee75.js


File diff suppressed because it is too large
+ 0 - 1
static/js/6.4482ecd1256618ba0f6b.js


File diff suppressed because it is too large
+ 2 - 2
static/js/9.8177ef946198ee767b89.js


File diff suppressed because it is too large
+ 3 - 3
static/js/app.8c0f6e8492617ab7c119.js


File diff suppressed because it is too large
+ 1 - 1
static/js/manifest.c20f75253d08152a4c31.js