浏览代码

动态词包 迭代

jiayufei 4 年之前
父节点
当前提交
0ed71bfdc0

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

@@ -1,3 +1,3 @@
-// export const urlAcount = 'http://118.24.244.213:8080'; // 线上
-export const urlAcount = 'http://192.168.1.43:8080'; // 子安
+export const urlAcount = 'http://118.24.244.213:8080'; // 线上
+// export const urlAcount = 'http://192.168.1.43:8080'; // 子安
 // export const urlAcount = 'http://139.186.165.84:8080'; // 测试

+ 2 - 2
src/views/modules/account-config/account-config.vue

@@ -209,7 +209,7 @@ export default {
     data() {
         let adMinBidValidator = (rule, value, callback) => {
             const finallyResult = Number(this.configForm.adMaxBid);
-            if (finallyResult !== '' && value && Number(value) < finallyResult) {
+            if (finallyResult !== '' && value && Number(value) <= finallyResult) {
                 callback();
             }
             else {
@@ -226,7 +226,7 @@ export default {
         };
         let adMaxBidValidator = (rule, value, callback) => {
             const finallyResult = Number(this.configForm.adMinBid);
-            if (finallyResult && value && Number(value) < finallyResult) {
+            if (finallyResult && value && Number(value) <= finallyResult) {
                 callback('最高出价不能低于最低出价');
             }
             else if (Number(this.updateModTxt.adBudget) < Number(value)) {

+ 1 - 1
src/views/modules/account-config/components/configuration-modal.vue

@@ -2381,7 +2381,6 @@ export default {
             });
         },
         handleRelaxSure() {
-            this.sureLoading = true;
             let paramsFormData = this.configForm;
             if (this.adBudgetShowTitle) {
                 return;
@@ -2495,6 +2494,7 @@ export default {
             paramsFormData.userId = this.userInfo().id;
             this.$refs.ruleForm.validate(valid => {
                 if (valid) {
+                    this.sureLoading = true;
                     if (this.modalTitle === 'add') {
                         this.handleAddList(paramsFormData);
                     }

+ 62 - 16
src/views/modules/creative-copywrit/creative-copywrit.vue

@@ -1504,9 +1504,9 @@
                                     class="examin-form-input"
                                     :id="item.name"
                                     placeholder="请输入"
-                                    @change="handleFormInputChang($event, item)"
+                                    @change="handleFormInputChang($event, item.name, item.id)"
                                 />
-                                <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 v-if="item.tabStatus === 'alone'" class="name-tags-left">
@@ -1514,7 +1514,7 @@
                                             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>
@@ -1524,7 +1524,7 @@
                                             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>
@@ -2014,35 +2014,55 @@ export default {
                 console.log(error, 'eeee');
             });
         },
-        judge(item, lens, formId) {
-            console.log(item, this.defaultFormList, 'item---select');
-            let re = /{{(.*?)}}/g;
+        judge(item) {
+            // let re = /{{(.*?)}}/g;
+            let re = /\{\{(.+?)\}\}/g;
             let array = [];
             let temp;
-            let changeLen = 0;
             while ((temp = re.exec(item))) {
                 array.push(temp[1]);
             };
-            console.log(array, 'array--array');
+            return array;
         },
         // 点击获取光标位置进行字段插入
-        handleGetChangeAll(item, field, lens, formId) {
+        handleGetChangeAll(item, field, formId) {
             let node = document.getElementById(field);
             let startPos = node.selectionStart; // input 第0个字符到选中的字符
             let endPos = node.selectionEnd; // 选中的字符到最后的字符
             let txt = node.value;
             if (startPos === 0 || endPos === 0) {
-                txt += '-{{' + item + '}}-';
+                txt += '{{' + item + '}}';
                 this.examinForm.setFieldsValue({[field]: txt});
             }
             else {
-                this.examinForm.setFieldsValue({[field]: txt.substring(0, startPos) + '-{{' + item + '}}-' + txt.substring(endPos)});
+                this.examinForm.setFieldsValue({[field]: txt.substring(0, startPos) + '{{' + item + '}}' + txt.substring(endPos)});
                 node.selectionStart = startPos + item.length + 6;
                 node.selectionEnd = startPos + item.length + 6;
             }
-            this.judge(this.examinForm.getFieldsValue()[field], lens, formId);
             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;
+                    }
+                });
+            });
+            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;
@@ -2074,6 +2094,7 @@ export default {
                     id: randomNum,
                     name: 'username' + randomNum,
                     value: '',
+                    lenSize: 0,
                     tabStatus: 'alone',
                     defaultTagsList: this.adNameTags,
                     updateTagsList: this.adNameTags.slice(0, 4)
@@ -2218,11 +2239,10 @@ export default {
                 this.solganForm.setFieldsValue({[data.name]: data.slogan});
             });
         },
-        handleFormInputChang(e, data) {
-            this.judge(e.target.value);
+        handleFormInputChang(e, field, formId) {
             const changeFiled = [];
             this.defaultFormList.forEach(item => {
-                if (item.id === data.id) {
+                if (item.id === formId) {
                     item.value = e.target.value;
                 }
             });
@@ -2231,6 +2251,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;
+                    }
+                });
+            });
+            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) {
@@ -2316,6 +2360,7 @@ export default {
                 id: randomNum,
                 name: 'username' + randomNum,
                 value: '',
+                lenSize: 0,
                 tabStatus: 'alone',
                 defaultTagsList: this.adNameTags,
                 updateTagsList: this.adNameTags.slice(0, 4)
@@ -2353,6 +2398,7 @@ export default {
                                 id: randomNum,
                                 name: 'username' + randomNum,
                                 value: '',
+                                lenSize: 0,
                                 tabStatus: 'alone',
                                 defaultTagsList: this.adNameTags,
                                 updateTagsList: this.adNameTags.slice(0, 4)