Parcourir la source

动态词包 逻辑修改 增加id

jiayufei il y a 4 ans
Parent
commit
0f6cde525e

+ 56 - 29
src/views/modules/creative-copywrit/creative-copywrit.vue

@@ -2059,38 +2059,42 @@ export default {
             let startPos = node.selectionStart; // input 第0个字符到选中的字符
             let endPos = node.selectionEnd; // 选中的字符到最后的字符
             let txt = node.value;
-            let finallyLenList = this.handleJudgeExec(txt);
-            if (finallyLenList.length >= 2) {
-                this.$message.error('最多选择两个词包');
-                return;
-            }
-            if (startPos === 0 || endPos === 0) {
-                txt += '{{' + item + '}}';
-                this.examinForm.setFieldsValue({[field]: txt});
-            }
-            else {
-                this.examinForm.setFieldsValue({[field]: txt.substring(0, startPos) + '{{' + item + '}}' + txt.substring(endPos)});
-                node.selectionStart = startPos + item.length + 6;
-                node.selectionEnd = startPos + item.length + 6;
-            }
-            node.focus();
-            node.blur();
+            this.$nextTick(() => {
+                let finallyLenList = this.handleJudgeExec(txt);
+                let updateFinallyResult = this.adNameTags.filter(item => finallyLenList.includes(item.name)).map(val => val.name);
+                if (updateFinallyResult.length >= 2) {
+                    this.$message.error('最多选择两个词包');
+                    return;
+                }
+                if (startPos === 0 || endPos === 0) {
+                    txt += '{{' + item + '}}';
+                    this.examinForm.setFieldsValue({[field]: txt});
+                }
+                else {
+                    this.examinForm.setFieldsValue({[field]: txt.substring(0, startPos) + '{{' + item + '}}' + txt.substring(endPos)});
+                    node.selectionStart = startPos + item.length + 6;
+                    node.selectionEnd = startPos + item.length + 6;
+                }
+                node.focus();
+                node.blur();
+            });
             this.$nextTick(() => {
                 const dynamicWordPackIds = [];
-                let finallyLenList = this.handleJudgeExec(this.examinForm.getFieldsValue()[field]);
+                let changeData = this.handleJudgeExec(this.examinForm.getFieldsValue()[field]);
+                let updateChangeData = this.adNameTags.filter(item => changeData.includes(item.name)).map(val => val.name);
                 const inputDefaultLen = this.examinForm.getFieldsValue()[field].length;
-                let tagsLen = finallyLenList.length * 4;
+                let tagsLen = updateChangeData.length * 4;
                 let tagsSureLen = 0;
                 let resultSelectSize = 0;
                 this.adNameTags.forEach(item => {
-                    finallyLenList.forEach(val => {
+                    updateChangeData.forEach(val => {
                         if (item.name === val) {
                             tagsSureLen += item.maxWordLen;
                             dynamicWordPackIds.push(item.creativeWordId);
                         }
                     });
                 });
-                finallyLenList.forEach(item => {
+                updateChangeData.forEach(item => {
                     tagsLen += item.length;
                 });
                 resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen;
@@ -2298,19 +2302,20 @@ export default {
             this.$nextTick(() => {
                 const dynamicWordPackIds = [];
                 let finallyLenList = this.handleJudgeExec(this.examinForm.getFieldsValue()[field]);
+                let updateFinallyResult = this.adNameTags.filter(item => finallyLenList.includes(item.name)).map(val => val.name);
                 const inputDefaultLen = this.defaultFormList.filter(item => item.id === formId)[0].value.length;
-                let tagsLen = finallyLenList.length * 4;
+                let tagsLen = updateFinallyResult.length * 4;
                 let tagsSureLen = 0;
                 let resultSelectSize = 0;
                 this.adNameTags.forEach(item => {
-                    finallyLenList.forEach(val => {
+                    updateFinallyResult.forEach(val => {
                         if (item.name === val) {
                             tagsSureLen += item.maxWordLen;
                             dynamicWordPackIds.push(item.creativeWordId);
                         }
                     });
                 });
-                finallyLenList.forEach(item => {
+                updateFinallyResult.forEach(item => {
                     tagsLen += item.length;
                 });
                 resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen;
@@ -2424,19 +2429,40 @@ export default {
                 if (res.success) {
                     if (res.result.slogans.length) {
                         res.result.slogans.forEach(item => {
+                            let finallyLenList = this.handleJudgeExec(item.slogan);
+                            let resultSelectSize = 0;
+                            if (finallyLenList.length) {
+                                const inputDefaultLen = item.slogan.length;
+                                let tagsLen = finallyLenList.length * 4;
+                                let tagsSureLen = 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;
+                            }
+                            else {
+                                resultSelectSize = item.slogan.length;
+                            }
                             item.name = 'username' + item.id;
                             item.value = item.slogan;
-                            item.lenSize = item.slogan.length,
+                            item.lenSize = resultSelectSize;
                             item.tabStatus = 'alone';
                             item.defaultTagsList = this.adNameTags;
                             item.updateTagsList = this.adNameTags.slice(0, 4);
                         });
                         this.defaultFormList = res.result.slogans;
-                        this.$nextTick(() => {
-                            this.defaultFormList.forEach(item => {
-                                this.defaultFormList.setFieldsValue({[item.name]: item.slogan});
-                            });
-                        });
+                        // this.$nextTick(() => {
+                        //     this.defaultFormList.forEach(item => {
+                        //         this.defaultFormList.setFieldsValue({[item.name]: item.slogan});
+                        //     });
+                        // });
                     }
                     else {
                         for (let i = 0; i < 3; i++) {
@@ -2462,6 +2488,7 @@ export default {
             this.causeVisible = true;
             this.recommendVisible = false;
             this.titleResult = [];
+            this.checkArr = [];
         },
         handleCauseCancel() {
             this.causeVisible = false;

+ 7 - 7
src/views/modules/headline-view/headline-view.vue

@@ -18,7 +18,7 @@
                         <div class="costInfo">
                             <div class="yesterdayInfo">
                                 <div style="margin-bottom:8px">昨日花费</div>
-                                <div style="font-size:14px;font-weight:600">{{ yearCostReportList.lastCost || 0 }}</div>
+                                <div style="font-size:14px;font-weight:600">{{ Number(yearCostReportList.lastCost) | decimalsHandle }}</div>
                             </div>
                             <a-divider type="vertical"/>
                             <div class="tongbi">
@@ -34,7 +34,7 @@
                                 <div style="font-size:14px;font-weight:600">{{ yearCostReportList.compare || 0 }}</div>
                             </div>
                         </div>
-                        <div class="costNum">{{ yearCostReportList.nowCost || 0 }}</div>
+                        <div class="costNum">{{ Number(yearCostReportList.nowCost) | decimalsHandle }}</div>
                     </div>
                     <div class="accountBodyLeftCostRight">
                         <div
@@ -51,8 +51,8 @@
                     <div class="top">                       
                         <div class="item" v-for="item in throwColumns" :key="item.dataIndex">
                             <div class="todyCost">
-                                <span v-if="item.type === 'double'">{{ item.today }}</span>
-                                <span v-else-if="item.type === 'string'">{{ item.today }}</span>
+                                <span v-if="item.type === 'double'">{{ Number(item.today) | decimalsHandle }}</span>
+                                <span v-else-if="item.type === 'string'">{{ Number(item.today) | decimalsHandle }}</span>
                                 <span v-else-if="item.type === 'int'">{{ item.today !== 0 ? item.today + '%' : 0 }}</span>
                                 <span class="sign">
                                     <a-icon type="rise" class="rise" v-show="item.today - item.yesterday > 0"/>
@@ -61,8 +61,8 @@
                             </div>
                             <div class="yesterdayCost">
                                 <span>/ 昨日: </span>
-                                <span v-if="item.type === 'double'">{{ item.yesterday }}</span>
-                                <span v-else-if="item.type === 'string'">{{ item.yesterday }}</span>
+                                <span v-if="item.type === 'double'">{{ Number(item.yesterday) | decimalsHandle }}</span>
+                                <span v-else-if="item.type === 'string'">{{ Number(item.yesterday) | decimalsHandle }}</span>
                                 <span v-else-if="item.type === 'int'">{{ item.yesterday !== 0 ? item.yesterday + '%' : 0 }}</span>
                             </div>
                             <span
@@ -110,7 +110,7 @@
                 <div class="accountBodyRightInfo">
                     <div class="accountBodyRightInfoItem">
                         <span class="name">余额:</span>
-                        <span>{{ topAccountMsg.accountMap && topAccountMsg.accountMap.validBalance }}</span>
+                        <span>{{ topAccountMsg.accountMap && Number(topAccountMsg.accountMap.validBalance) | decimalsHandle }}</span>
                     </div>
                     <div class="accountBodyRightInfoItem">
                         <span class="name">投放状态:</span>

+ 2 - 2
vue.config.js

@@ -87,8 +87,8 @@ module.exports = {
         // target: 'http://192.168.1.251/', //请求本地 需要jeecg-boot后台项目 
         // target:'http://118.24.244.213:8804',
         // target: 'http://192.168.1.43:8080', // 子安
-        target: 'http://192.168.1.8:8806', // 学超
-      //  target:'http://139.186.165.84:8806', //测试
+        // target: 'http://192.168.1.8:8806', // 学超
+       target:'http://139.186.165.84:8806', //测试
         // target:'http://apipre.tjyourong.com.cn', //预生产
 
         ws: false,