Sfoglia il codice sorgente

账户配置 校验 添加

jiayufei 4 anni fa
parent
commit
d0181f5a6f

+ 5 - 0
src/views/modules/account-config/account-config.less

@@ -24,3 +24,8 @@
         margin-top: 20px;
         margin-top: 20px;
     }
     }
 }
 }
+.handle-p {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}

+ 47 - 18
src/views/modules/account-config/account-config.vue

@@ -49,12 +49,10 @@
                     <a-divider type="vertical" />
                     <a-divider type="vertical" />
                     <a @click="handleListDelete(record)">删除</a>
                     <a @click="handleListDelete(record)">删除</a>
                     <a-divider type="vertical" />
                     <a-divider type="vertical" />
-                    <a-popover v-model="isModVisible" title="" trigger="click">
+                    <a-popover v-model="record.visible" title="" trigger="click">
                         <template slot="content">
                         <template slot="content">
-                            <p>
+                            <p class="handle-p">
                                 <a-input v-model="modContent" placeholder="请输入" style="width: 140px;"/>
                                 <a-input v-model="modContent" placeholder="请输入" style="width: 140px;"/>
-                            </p>
-                            <p>
                                 <a-button
                                 <a-button
                                     size="small"
                                     size="small"
                                     type="primary"
                                     type="primary"
@@ -63,18 +61,26 @@
                                 >
                                 >
                                     确定
                                     确定
                                 </a-button>
                                 </a-button>
-                                <a-button size="small" @click="handleModPopover">取消</a-button>
                             </p>
                             </p>
+                            <!-- <p>
+                                <a-button
+                                    size="small"
+                                    type="primary"
+                                    style="margin-left: 15px;margin-right: 15px;"
+                                    @click="handlePopoverSure(record, 'mod')"
+                                >
+                                    确定
+                                </a-button>
+                                <!-- <a-button size="small" @click="handleModPopover">取消</a-button> -->
+                            <!-- </p> -->
                         </template>
                         </template>
                         <a @click="handleModBid(record)">修改出价</a>
                         <a @click="handleModBid(record)">修改出价</a>
                     </a-popover>
                     </a-popover>
                     <a-divider type="vertical" />
                     <a-divider type="vertical" />
-                    <a-popover v-model="isBudgetVisible" title="" trigger="click">
+                    <a-popover v-model="record.show" title="" trigger="click">
                         <template slot="content">
                         <template slot="content">
-                            <p>
+                            <p class="handle-p">
                                 <a-input v-model="budgetContent" placeholder="请输入" style="width: 140px;"/>
                                 <a-input v-model="budgetContent" placeholder="请输入" style="width: 140px;"/>
-                            </p>
-                            <p>
                                 <a-button
                                 <a-button
                                     size="small"
                                     size="small"
                                     type="primary"
                                     type="primary"
@@ -83,8 +89,18 @@
                                 >
                                 >
                                     确定
                                     确定
                                 </a-button>
                                 </a-button>
-                                <a-button size="small" @click="handleBudgetPopover">取消</a-button>
                             </p>
                             </p>
+                            <!-- <p>
+                                <a-button
+                                    size="small"
+                                    type="primary"
+                                    style="margin-left: 15px;margin-right: 15px;"
+                                    @click="handlePopoverSure(record, 'budget')"
+                                >
+                                    确定
+                                </a-button> -->
+                                <!-- <a-button size="small" @click="handleBudgetPopover">取消</a-button> -->
+                            <!-- </p> -->
                         </template>
                         </template>
                         <a @click="handleBudgetRevision(record)">修改预算</a>
                         <a @click="handleBudgetRevision(record)">修改预算</a>
                     </a-popover>
                     </a-popover>
@@ -117,6 +133,7 @@ export default {
     },
     },
     data() {
     data() {
         return {
         return {
+            modBidTypeId: '',
             modContent: '',
             modContent: '',
             budgetContent: '',
             budgetContent: '',
             isBudgetVisible: false,
             isBudgetVisible: false,
@@ -198,16 +215,20 @@ export default {
     },
     },
     methods: {
     methods: {
         ...mapGetters(['nickname', 'avatar', 'userInfo']),
         ...mapGetters(['nickname', 'avatar', 'userInfo']),
-        handlePopoverSure(data, type) {
+        changeTag(data) {
+            console.log(data);
+        },
+        handlePopoverSure(record, type) {
             const defaultList = {
             const defaultList = {
-                accountId: data.accountId,
+                accountId: record.accountId,
                 bid: this.modContent,
                 bid: this.modContent,
                 budget: this.budgetContent,
                 budget: this.budgetContent,
-                adId: data.adId ? data.adId : '',
-                id: data.id
+                adId: record.adId ? record.adId : '',
+                id: record.id
             };
             };
             let paramsData = new FormData();
             let paramsData = new FormData();
             if (type === 'mod') {
             if (type === 'mod') {
+                record.visible = false;
                 paramsData.append('accountId', defaultList.accountId);
                 paramsData.append('accountId', defaultList.accountId);
                 paramsData.append('adId', defaultList.adId);
                 paramsData.append('adId', defaultList.adId);
                 paramsData.append('type', 1);
                 paramsData.append('type', 1);
@@ -215,8 +236,9 @@ export default {
                 paramsData.append('id', defaultList.id);
                 paramsData.append('id', defaultList.id);
             }
             }
             else if (type === 'budget') {
             else if (type === 'budget') {
+                record.show = false;
                 paramsData.append('accountId', defaultList.accountId);
                 paramsData.append('accountId', defaultList.accountId);
-                paramsData.append('adId', data.adId);
+                paramsData.append('adId', record.adId);
                 paramsData.append('type', 2);
                 paramsData.append('type', 2);
                 paramsData.append('budget', defaultList.budget);
                 paramsData.append('budget', defaultList.budget);
                 paramsData.append('id', defaultList.id);
                 paramsData.append('id', defaultList.id);
@@ -226,8 +248,8 @@ export default {
         handlePopoverChange(data) {
         handlePopoverChange(data) {
             putAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/updStaOrCpaOrBudgetById', data).then(result => {
             putAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/updStaOrCpaOrBudgetById', data).then(result => {
                 if (result.code === 0) {
                 if (result.code === 0) {
-                    this.isModVisible = false;
-                    this.isBudgetVisible = false;
+                    this.modContent = '';
+                    this.budgetContent = '';
                     this.$message.success(result.message);
                     this.$message.success(result.message);
                     this.handleInitTable();
                     this.handleInitTable();
                 }
                 }
@@ -251,6 +273,10 @@ export default {
             };
             };
             getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/list', paramsData).then(result => {
             getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/list', paramsData).then(result => {
                 if (result.code === 0) {
                 if (result.code === 0) {
+                    result.result.records.forEach(item => {
+                        item.show = false;
+                        item.visible = false;
+                    });
                     this.dataSource = result.result.records;
                     this.dataSource = result.result.records;
                     this.totalAll = result.result.total;
                     this.totalAll = result.result.total;
                 }
                 }
@@ -292,6 +318,7 @@ export default {
         },
         },
         handleModBid(data) {
         handleModBid(data) {
             this.isModVisible = true;
             this.isModVisible = true;
+            this.modBidTypeId = data.id;
         },
         },
         handleQueryList(event) {
         handleQueryList(event) {
             event.preventDefault();
             event.preventDefault();
@@ -307,11 +334,13 @@ export default {
         handleSwitchChang(checked, data) {
         handleSwitchChang(checked, data) {
             const paramsData = {
             const paramsData = {
                 id: data.id,
                 id: data.id,
-                state: checked ? 0 : 1
+                state: checked ? 0 : 1,
+                accountId: data.accountId
             };
             };
             const forDate = new FormData();
             const forDate = new FormData();
             forDate.append('id', paramsData.id);
             forDate.append('id', paramsData.id);
             forDate.append('state', paramsData.state);
             forDate.append('state', paramsData.state);
+            forDate.append('accountId', paramsData.accountId);
             putAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/updStaById', forDate).then(result => {
             putAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/updStaById', forDate).then(result => {
                 if (result.code === 0) {
                 if (result.code === 0) {
                     this.$message.success(result.message);
                     this.$message.success(result.message);

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

@@ -479,6 +479,33 @@ export default {
                 callback('请输入正确的格式');
                 callback('请输入正确的格式');
             }
             }
         };
         };
+        let handleCharacterLen100 = (rule, value, callback) => {
+            const length = this.handleExportRules(value);
+            if (1 <= length && length <= 100) {
+                callback();
+            }
+            else {
+                callback('只能输入1-100个字符');
+            }
+        };
+        let handleCharacterLen20 = (rule, value, callback) => {
+            const length = this.handleExportRules(value);
+            if (4 <= length && length <= 20) {
+                callback();
+            }
+            else {
+                callback('只能输入4-20个字符');
+            }
+        };
+        let handleCharacterLen7 = (rule, value, callback) => {
+            const length = this.handleExportRules(value);
+            if (1 <= length && length <= 7) {
+                callback();
+            }
+            else {
+                callback('只能输入1-7个字符');
+            }
+        };
         return {
         return {
             adBudgetNum: 0,
             adBudgetNum: 0,
             campaignStatus: false,
             campaignStatus: false,
@@ -536,22 +563,22 @@ export default {
                 ],
                 ],
                 campaignName: [
                 campaignName: [
                     {required: true, message: '请输入广告组名称', trigger: 'blur'},
                     {required: true, message: '请输入广告组名称', trigger: 'blur'},
-                    {min: 1, max: 100, message: '长度位1-100字符', trigger: 'blur'}
+                    {validator: handleCharacterLen100, trigger: 'blur'}
                 ],
                 ],
                 creativeSource: [
                 creativeSource: [
                     {required: true, message: '请输入', trigger: 'blur'},
                     {required: true, message: '请输入', trigger: 'blur'},
-                    {min: 4, max: 20, message: '长度位4-20字符', trigger: 'blur'}
+                    {validator: handleCharacterLen20, trigger: 'blur'}
                 ],
                 ],
                 adCpaBid: [
                 adCpaBid: [
                     {required: true, message: '请输入', trigger: 'blur'}
                     {required: true, message: '请输入', trigger: 'blur'}
                 ],
                 ],
                 adName: [
                 adName: [
                     {required: true, message: '请输入广告计划名称'},
                     {required: true, message: '请输入广告计划名称'},
-                    {min: 1, max: 100, message: '长度位1-100字符'}
+                    {validator: handleCharacterLen100, trigger: 'blur'}
                 ],
                 ],
                 creativeProductDescription: [
                 creativeProductDescription: [
                     {required: true, message: '请输入', trigger: 'blur'},
                     {required: true, message: '请输入', trigger: 'blur'},
-                    {min: 1, max: 7, message: '长度位1-7字符', trigger: 'blur'}
+                    {validator: handleCharacterLen7, trigger: 'blur'}
                 ],
                 ],
                 adConvertType: [{required: true, message: '请选择', trigger: 'change'}],
                 adConvertType: [{required: true, message: '请选择', trigger: 'change'}],
                 adConvertId: [{required: true, message: '请选择', trigger: 'change'}],
                 adConvertId: [{required: true, message: '请选择', trigger: 'change'}],
@@ -695,6 +722,20 @@ export default {
     methods: {
     methods: {
         ...mapGetters(['nickname', 'avatar', 'userInfo']),
         ...mapGetters(['nickname', 'avatar', 'userInfo']),
         moment,
         moment,
+        handleExportRules(value) {
+            let cnReg = /([\u4e00-\u9fa5]|[\u3000-\u303F]|[\uFF00-\uFF60])/;
+            let length = 0;
+            let strArr = value.split('');
+            strArr.forEach(item => {
+                if (cnReg.test(item)) {
+                    length += 2;
+                }
+                else {
+                    length += 1;
+                }
+            });
+            return length;
+        },
         handleGetPackage() {
         handleGetPackage() {
             const params = {
             const params = {
                 urlPath: this.configForm.adDownloadUrl,
                 urlPath: this.configForm.adDownloadUrl,
@@ -739,9 +780,7 @@ export default {
             }
             }
         },
         },
         handleAccountMode(e) {
         handleAccountMode(e) {
-            if (e.target.value === '1') {
-                this.configForm.accountBudget = '';
-            }
+            this.configForm.accountBudget = '';
         },
         },
         handleAdDownLoadType(e) {
         handleAdDownLoadType(e) {
             this.optimizationOption = [];
             this.optimizationOption = [];
@@ -783,12 +822,12 @@ export default {
             getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/queryById', {id: routeQuery.id}).then(result => {
             getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/queryById', {id: routeQuery.id}).then(result => {
                 if (result.code === 0) {
                 if (result.code === 0) {
                     const detailData = result.result;
                     const detailData = result.result;
-                    this.configForm.accountId = detailData.accountId || '';
-                    this.configForm.dpLinkStartIndex = detailData.dpLinkStartIndex || '';
-                    this.configForm.dpLinkEndIndex = detailData.dpLinkEndIndex || '';
-                    this.configForm.accountBudgetMode = detailData.accountBudgetMode || '';
-                    this.configForm.accountBudget = detailData.accountBudget || '';
-                    this.configForm.campaignLandingType = detailData.campaignLandingType || '';
+                    this.configForm.accountId = detailData.accountId;
+                    this.configForm.dpLinkStartIndex = detailData.dpLinkStartIndex;
+                    this.configForm.dpLinkEndIndex = detailData.dpLinkEndIndex;
+                    this.configForm.accountBudgetMode = detailData.accountBudgetMode;
+                    this.configForm.accountBudget = detailData.accountBudget;
+                    this.configForm.campaignLandingType = detailData.campaignLandingType;
                     this.configForm.advertisingType = detailData.advertisingType || '1';
                     this.configForm.advertisingType = detailData.advertisingType || '1';
                     this.configForm.campaignName = detailData.campaignName || '';
                     this.configForm.campaignName = detailData.campaignName || '';
                     this.configForm.adName = detailData.adName || '';
                     this.configForm.adName = detailData.adName || '';
@@ -860,7 +899,8 @@ export default {
                     }
                     }
                     if (detailData.creativeSceneInventory) {
                     if (detailData.creativeSceneInventory) {
                         this.configForm.adverPosition = 'c';
                         this.configForm.adverPosition = 'c';
-                        this.radioChangeValue = detailData.creativeSceneInventory;
+                        this.configForm.radioChangeValue = detailData.creativeSceneInventory;
+                        console.log(this.radioChangeValue, 'this.radioChangeValue--this.radioChangeValue');
                     }
                     }
                     else if (detailData.creativeInventoryType) {
                     else if (detailData.creativeInventoryType) {
                         this.configForm.adverPosition = 'b';
                         this.configForm.adverPosition = 'b';
@@ -1172,6 +1212,9 @@ export default {
             if (paramsFormData.adAndroidVersion = 'a') {
             if (paramsFormData.adAndroidVersion = 'a') {
                 paramsFormData.adAndroidOsv = paramsFormData.androidChangeValue;
                 paramsFormData.adAndroidOsv = paramsFormData.androidChangeValue;
             }
             }
+            else if (paramsFormData.adAndroidVersion = 'NONE') {
+                paramsFormData.adAndroidOsv = 'NONE';
+            }
             paramsFormData.productSellingPoints = this.configForm.defaultFormList && this.configForm.defaultFormList.map(item => item.value);
             paramsFormData.productSellingPoints = this.configForm.defaultFormList && this.configForm.defaultFormList.map(item => item.value);
             paramsFormData.creativeThirdIndustryId = paramsFormData.creativeThirdIndustryIds[2];
             paramsFormData.creativeThirdIndustryId = paramsFormData.creativeThirdIndustryIds[2];
             paramsFormData.creativeProductImageCode = this.md5Result;
             paramsFormData.creativeProductImageCode = this.md5Result;