Browse Source

动态词包 迭代

jiayufei 4 years ago
parent
commit
e141ea143d

+ 2 - 2
src/views/modules/account-config/account-config-server.js

@@ -1,4 +1,4 @@
-export const urlAcount = 'http://118.24.244.213:8080'; // 线上
+// export const urlAcount = 'http://118.24.244.213:8080'; // 线上
 // export const urlAcount = 'http://apipre.tjyourong.com.cn'; // 预生产
 // export const urlAcount = 'http://192.168.1.43:8080'; // 子安
-// export const urlAcount = 'http://139.186.165.84:8080'; // 测试
+export const urlAcount = 'http://139.186.165.84:8080'; // 测试

+ 76 - 50
src/views/modules/creative-copywrit/creative-copywrit.vue

@@ -1498,7 +1498,7 @@
                                         item.name,
                                         { rules: [
                                             {required: true, message: '请输入创意标题'},
-                                            {min: 5, max: 30, message: '创意标题5-30个字'}
+                                            {validator: validatePass, trigger: 'blur'}
                                         ]}
                                     ]"
                                     class="examin-form-input"
@@ -1508,7 +1508,7 @@
                                 />
                                 <span class="examin-form-num">{{ item.lenSize }}/30</span>
                                 <a-icon class="examin-form-icon" type="delete" @click="handleDelOrigin(item)"/>
-                                <!-- <div class="ad-name-tags-class">
+                                <div class="ad-name-tags-class">
                                     <div v-if="item.tabStatus === 'alone'" class="name-tags-left">
                                         <a-tag
                                             v-for="val in item.updateTagsList"
@@ -1531,7 +1531,7 @@
                                     </div>
                                     <div v-if="item.tabStatus === 'alone'"><a @click="handleMoreTagsShow(item.id, 'more')">更多</a></div>
                                     <div v-if="item.tabStatus === 'all'"><a @click="handleMoreTagsShow(item.id, 'little')">收起</a></div>
-                                </div> -->
+                                </div>
                             </a-form-item>
                         </a-form>
                     </div>
@@ -1582,22 +1582,22 @@
                                         item.name,
                                         { rules: [
                                             {required: true, message: '请输入创意标题'},
-                                            {min: 5, max: 30, message: '创意标题5-30个字'}
+                                            {validator: validatePass, trigger: 'blur'}
                                         ]}
                                     ]"
                                     class="examin-form-input"
                                     placeholder="请输入"
                                     @change="handleFormInputChang($event, item)"
                                 />
-                                <span class="examin-form-num">{{ handleFilterName(item.name) }}/30</span>
+                                <span class="examin-form-num">{{ item.lenSize }}/30</span>
                                 <a-icon class="examin-form-icon" type="delete" @click="handleDelOrigin(item)"/>
-                                <!-- <div class="ad-name-tags-class">
+                                <div class="ad-name-tags-class">
                                     <div v-if="item.tabStatus === 'alone'" class="name-tags-left">
                                         <a-tag
                                             v-for="val in item.updateTagsList"
                                             :key="val.id"
                                             color="#1890ff"
-                                            @click="handleGetChangeAll(val.name, item.name, val.maxWordLen, item.id)"
+                                            @click="handleGetChangeAll(val.name, item.name, item.id)"
                                         >
                                             + {{ val.name }}
                                         </a-tag>
@@ -1607,14 +1607,14 @@
                                             v-for="val in item.defaultTagsList"
                                             :key="val.id"
                                             color="#1890ff"
-                                            @click="handleGetChangeAll(val.name, item.name, val.maxWordLen, item.id)"
+                                            @click="handleGetChangeAll(val.name, item.name, item.id)"
                                         >
                                             + {{ val.name }}
                                         </a-tag>
                                     </div>
                                     <div v-if="item.tabStatus === 'alone'"><a @click="handleMoreTagsShow(item.id, 'more')">更多</a></div>
                                     <div v-if="item.tabStatus === 'all'"><a @click="handleMoreTagsShow(item.id, 'little')">收起</a></div>
-                                </div> -->
+                                </div>
                             </a-form-item>
                         </a-form>
                     </div>
@@ -2014,6 +2014,30 @@ export default {
                 console.log(error, 'eeee');
             });
         },
+        validatePass(rule, value, callback) {
+            let finallyLenList = this.judge(value);
+            const inputDefaultLen = value;
+            let tagsLen = finallyLenList.length * 4;
+            let tagsSureLen = 0;
+            let resultSelectSize = 0;
+            this.adNameTags.forEach(item => {
+                finallyLenList.forEach(val => {
+                    if (item.name === val) {
+                        tagsSureLen += item.maxWordLen;
+                    }
+                });
+            });
+            finallyLenList.forEach(item => {
+                tagsLen += item.length;
+            });
+            resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen;
+            if (resultSelectSize < 30 && resultSelectSize > 5) {
+                callback();
+            }
+            else {
+                callback(new Error('创意标题5-30个字'));
+            }
+        },
         judge(item) {
             // let re = /{{(.*?)}}/g;
             let re = /\{\{(.+?)\}\}/g;
@@ -2041,28 +2065,30 @@ export default {
             }
             node.focus();
             node.blur();
-            let finallyLenList = this.judge(this.examinForm.getFieldsValue()[field]);
-            const inputDefaultLen = this.examinForm.getFieldsValue()[field].length;
-            let tagsLen = finallyLenList.length * 4;
-            let tagsSureLen = 0;
-            let resultSelectSize = 0;
-            this.adNameTags.forEach(item => {
-                finallyLenList.forEach(val => {
-                    if (item.name === val) {
-                        tagsSureLen += item.maxWordLen;
+            this.$nextTick(() => {
+                let finallyLenList = this.judge(this.examinForm.getFieldsValue()[field]);
+                const inputDefaultLen = this.examinForm.getFieldsValue()[field].length;
+                let tagsLen = finallyLenList.length * 4;
+                let tagsSureLen = 0;
+                let resultSelectSize = 0;
+                this.adNameTags.forEach(item => {
+                    finallyLenList.forEach(val => {
+                        if (item.name === val) {
+                            tagsSureLen += item.maxWordLen;
+                        }
+                    });
+                });
+                finallyLenList.forEach(item => {
+                    tagsLen += item.length;
+                });
+                resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen;
+                this.defaultFormList.forEach(item => {
+                    if (item.id === formId) {
+                        item.lenSize = resultSelectSize;
+                        item.value = this.examinForm.getFieldsValue()[field];
                     }
                 });
             });
-            finallyLenList.forEach(item => {
-                tagsLen += item.length;
-            });
-            resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen;
-            this.defaultFormList.forEach(item => {
-                if (item.id === formId) {
-                    item.lenSize = resultSelectSize;
-                    item.value = this.examinForm.getFieldsValue()[field];
-                }
-            });
         },
         handleMaterTitleClick() {
             this.materTitltStatus = !this.materTitltStatus;
@@ -2251,31 +2277,30 @@ export default {
                     changeFiled.push(item.value);
                 }
             });
-            let finallyLenList = this.judge(this.examinForm.getFieldsValue()[field]);
-            const inputDefaultLen = this.defaultFormList.filter(item => item.id === formId)[0].value.length;
-            let tagsLen = finallyLenList.length * 4;
-            let tagsSureLen = 0;
-            let resultSelectSize = 0;
-            this.adNameTags.forEach(item => {
-                finallyLenList.forEach(val => {
-                    if (item.name === val) {
-                        tagsSureLen += item.maxWordLen;
+            this.$nextTick(() => {
+                let finallyLenList = this.judge(this.examinForm.getFieldsValue()[field]);
+                const inputDefaultLen = this.defaultFormList.filter(item => item.id === formId)[0].value.length;
+                let tagsLen = finallyLenList.length * 4;
+                let tagsSureLen = 0;
+                let resultSelectSize = 0;
+                this.adNameTags.forEach(item => {
+                    finallyLenList.forEach(val => {
+                        if (item.name === val) {
+                            tagsSureLen += item.maxWordLen;
+                        }
+                    });
+                });
+                finallyLenList.forEach(item => {
+                    tagsLen += item.length;
+                });
+                resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen;
+                this.defaultFormList.forEach(item => {
+                    if (item.id === formId) {
+                        item.lenSize = resultSelectSize;
                     }
                 });
+                this.titleFiledResult = changeFiled;
             });
-            finallyLenList.forEach(item => {
-                tagsLen += item.length;
-            });
-            resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen;
-            this.defaultFormList.forEach(item => {
-                if (item.id === formId) {
-                    item.lenSize = resultSelectSize;
-                }
-            });
-            console.log(this.adNameTags, this.defaultFormList, 'lens--lens');
-            console.log(finallyLenList, inputDefaultLen, tagsLen, tagsSureLen, 'finallyLenList--finallyLenList');
-            console.log(resultSelectSize, 'resultSelectSize--resultSelectSize--resultSelectSize');
-            this.titleFiledResult = changeFiled;
         },
         handleCheckBoxChang(data) {
             this.applyTypeOption = data;
@@ -2380,6 +2405,7 @@ export default {
                         res.result.slogans.forEach(item => {
                             item.name = 'username' + item.id;
                             item.value = item.slogan;
+                            item.lenSize = item.slogan.length,
                             item.tabStatus = 'alone';
                             item.defaultTagsList = this.adNameTags;
                             item.updateTagsList = this.adNameTags.slice(0, 4);

+ 1 - 1
vue.config.js

@@ -80,7 +80,7 @@ module.exports = {
         // target: 'http://192.168.1.219:8081', //请求本地 需要jeecg-boot后台项目  赵西安
         // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
         // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
-         target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
+        //  target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
         //  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目