Bladeren bron

文案库 添加 编辑删除搜索

jiayufei 4 jaren geleden
bovenliggende
commit
e0bfc443f5
2 gewijzigde bestanden met toevoegingen van 146 en 16 verwijderingen
  1. 144 14
      src/views/modules/copy-library/copy-library.vue
  2. 2 2
      vue.config.js

+ 144 - 14
src/views/modules/copy-library/copy-library.vue

@@ -118,7 +118,7 @@
                         :scroll="{x: 1500}"
                     >
                         <span slot="appointAction" slot-scope="text, record">
-                            <a @click="handleAppointEdit(record)">编辑</a>
+                            <a @click="handleCurrencyEdit(record)">编辑</a>
                             <a-divider type="vertical"/>
                             <a @click="handleAppointDelete(record)">删除</a>
                         </span>
@@ -140,7 +140,7 @@
         </div>
         <a-modal
             v-if="causeVisible"
-            title="新建文案"
+            :title="copywritingType === 'add' ? '新建文案' : '编辑文案'"
             dialog-class="copywrit-modal"
             :visible="causeVisible"
             @ok="handleCauseSure"
@@ -152,8 +152,8 @@
                     <div class="acount-title-right">
                         <div class="only-title-mater">
                             <a-radio-group v-model="copywrittypeName" button-style="solid" @change="handleFormLayoutChange">
-                                <a-radio-button value="horizontal">通用</a-radio-button>
-                                <a-radio-button value="vertical">指定素材</a-radio-button>
+                                <a-radio-button value="horizontal" :disabled="copywritingEditList.controlTypeModel === '2'">通用</a-radio-button>
+                                <a-radio-button value="vertical" :disabled="copywritingEditList.controlTypeModel === '1'">指定素材</a-radio-button>
                             </a-radio-group>
                         </div>
                     </div>
@@ -166,7 +166,7 @@
                         </div>
                     </div>
                 </div>
-                <div v-if="copywrittypeName === 'horizontal'" class="acount-title">
+                <div v-if="copywrittypeName === 'horizontal' && copywritingType === 'add'" class="acount-title">
                     <div class="acount-title-left">文件上传</div>
                     <div class="acount-title-right">
                         <div class="only-title-mater">
@@ -199,14 +199,14 @@
                         </div>
                     </div>
                 </div>
-                <div v-if="copywrittypeName === 'vertical'" class="acount-title push-plate">
+                <div v-if="copywrittypeName === 'vertical' && copywritingType === 'add'" class="acount-title push-plate">
                     <div class="acount-title-left">创意标题</div>
                     <div class="acount-title-right">
                         <a-button type="primary" @click="handleAddOrigin"><a-icon type="plus" />创意标题</a-button>
                         <span style="margin-left: 20px;">已填:{{ titleFiledResult.length || 0 }}</span>
                     </div>
                 </div>
-                <div v-if="copywrittypeName === 'vertical'" class="acount-title">
+                <div v-if="copywrittypeName === 'vertical' && copywritingType === 'add'" class="acount-title">
                     <div class="acount-title-left"></div>
                     <div class="acount-title-right">
                         <a-form :form="examinForm">
@@ -264,6 +264,63 @@
                         </a-form>
                     </div>
                 </div>
+                <div v-if="copywritingType === 'edit'" class="acount-title push-plate">
+                    <div class="acount-title-left">创意标题</div>
+                    <div class="acount-title-right">
+                        <a-form :form="examinForm">
+                            <a-form-item
+                                v-for="item in defaultFormList"
+                                :key="item.id"
+                                class="examin-form-model"
+                                :label-col="labelCol"
+                                :wrapper-col="wrapperCol"
+                                label=""
+                            >
+                                <a-input
+                                    v-decorator="[
+                                        item.name,
+                                        {rules: [
+                                            {validator: validatePass, trigger: 'blur'}
+                                        ]}
+                                    ]"
+                                    class="examin-form-input"
+                                    :id="item.name"
+                                    placeholder="请输入"
+                                    @change="handleFormInputChang($event, item.name, item.id)"
+                                />
+                                <span class="examin-form-num">{{ item.lenSize }}/30</span>
+                                <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, item.id)"
+                                        >
+                                            + {{ val.name }}
+                                        </a-tag>
+                                    </div>
+                                    <div v-if="item.tabStatus === 'all'" class="name-tags-left">
+                                        <a-tag
+                                            v-for="val in item.defaultTagsList"
+                                            :key="val.id"
+                                            color="#1890ff"
+                                            @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>
+                            </a-form-item>
+                        </a-form>
+                    </div>
+                </div>
             </div>
         </a-modal>
         <a-modal
@@ -366,6 +423,8 @@ export default {
     data() {
         return {
             moment,
+            copywritingEditList: {},
+            copywritingType: 'add',
             projectModelValue: '',
             optimizationOption: [], // 账户option
             controlTypeModel: '1',
@@ -669,8 +728,60 @@ export default {
     },
     methods: {
         ...mapGetters(['nickname', 'avatar', 'userInfo']),
-        handleGetCurrencyEditData() {
-            
+        handleCurrencyEdit(data) {
+            console.log(data, this.controlTypeModel, 'data, --data');
+            const defaultData = data;
+            defaultData.controlTypeModel = this.controlTypeModel;
+            if (this.controlTypeModel === '1') {
+                this.advertisingAccount[0] = defaultData.accountId;
+            }
+            this.causeVisible = true;
+            this.copywritingType = 'edit';
+            this.copywrittypeName = this.controlTypeModel === '1' ? 'horizontal' : 'vertical';
+            this.copywritingEditList = defaultData;
+            this.$nextTick(() => {
+                let changeValue = this.controlTypeModel === '1' ? data.textCopywriter : data.slogan;
+                let finallyLenList = this.handleJudgeExec(changeValue);
+                let newOptionList = [];
+                finallyLenList.forEach(item => {
+                    this.adNameTags.forEach(val => {
+                        if (item === val.name) {
+                            newOptionList.push(val);
+                        }
+                    });
+                });
+                let resultSelectSize = 0;
+                if (newOptionList.length) {
+                    const inputDefaultLen = this.handleExportRules(changeValue);
+                    let tagsLen = newOptionList.length * 2;
+                    let tagsSureLen = 0;
+                    newOptionList.forEach(item => {
+                        this.adNameTags.forEach(val => {
+                            if (item.name === val.name) {
+                                tagsSureLen += val.maxWordLen;
+                            }
+                        });
+                    });
+                    finallyLenList.forEach(item => {
+                        tagsLen += item.length;
+                    });
+                    resultSelectSize = inputDefaultLen - tagsLen + tagsSureLen + newOptionList.length;
+                }
+                else {
+                    resultSelectSize = this.handleExportRules(changeValue);
+                }
+                const defaultList = this.adNameTags;
+                const randomNum = new Date().getTime() + Math.ceil(Math.random() * 1000);
+                this.defaultFormList.push({
+                    id: randomNum,
+                    name: 'username' + randomNum,
+                    value: changeValue,
+                    lenSize: resultSelectSize,
+                    tabStatus: 'alone',
+                    defaultTagsList: defaultList,
+                    updateTagsList: defaultList.slice(0, 4)
+                });
+            });
         },
         handleCurrencyDelete(data) {
             let that = this;
@@ -1151,7 +1262,7 @@ export default {
                 });
             }
         },
-        handleUploadWxecl() {
+        handleUploadWxeclAdd() {
             if (!this.advertisingAccount.length) {
                 this.$message.error('请选择账户');
                 return;
@@ -1219,12 +1330,28 @@ export default {
                 }
             });
         },
+        handleUploadWxeclEdit() {
+            console.log('通用编辑');
+        },
+        handleVerticalEdit() {
+            console.log('指定编辑');
+        },
         handleCauseSure() {
-            if (this.copywrittypeName === 'horizontal') {
-                this.handleUploadWxecl();
+            if (this.copywritingType === 'add') {
+                if (this.copywrittypeName === 'horizontal') {
+                    this.handleUploadWxeclAdd();
+                }
+                else if (this.copywrittypeName === 'vertical') {
+                    this.handleVerticalAdd();
+                }
             }
-            else if (this.copywrittypeName === 'vertical') {
-                this.handleVerticalAdd();
+            else if (this.copywritingType === 'edit') {
+                if (this.copywrittypeName === 'horizontal') {
+                    this.handleUploadWxeclEdit();
+                }
+                else if (this.copywrittypeName === 'vertical') {
+                    this.handleVerticalEdit();
+                }
             }
         },
         handleCauseCancel() {
@@ -1234,6 +1361,7 @@ export default {
             this.causeVisible = false;
             this.defaultFormList = [];
             this.modalSelectMaterial = [];
+            this.copywritingType = '';
         },
         handleGetCreativeWord() {
             getAction('/ctop/ByteDanceCreativeWordPackage/list').then(result => {
@@ -1265,6 +1393,8 @@ export default {
         },
         handleAddAccountConfig() {
             this.causeVisible = true;
+            this.copywritingType = 'add';
+            this.copywritingEditList = {};
         },
         handleLaunchData(date, dateString) {
             this.configForm.launchDateRange = dateString;

+ 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:8806', // 子安
-				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,