Переглянути джерело

传播反馈编辑初始化问题修改

suxinf 4 роки тому
батько
коміт
3c1d8acecd
1 змінених файлів з 36 додано та 23 видалено
  1. 36 23
      src/views/data/components/UploadLinkEditModal.vue

+ 36 - 23
src/views/data/components/UploadLinkEditModal.vue

@@ -154,6 +154,7 @@ export default {
       mediaTitle: this.LinkData.mediaTitle || "", //'文章标题',
       mediaUrl: this.LinkData.mediaUrl || "",
       dictList: [],
+      initParentId: ''
     };
   },
   methods: {
@@ -193,7 +194,7 @@ export default {
           dealerId: this.userId,
           dataId: this.ziliaoId,
           informationName: this.ziliaoName,
-        //   releaseTime: this.ziliaoTime,
+          //   releaseTime: this.ziliaoTime,
           releaseTime: this.ziliaoTime,
           carType: this.carTypeValue,
 
@@ -213,7 +214,7 @@ export default {
           goodCount: this.goodCount,
           bbsCount: this.bbsCount,
           lookingCount: this.lookingCount,
-        //   informationId: "1386025423408103425"
+          //   informationId: "1386025423408103425"
         },
       };
       if (this.LinkData.id) {
@@ -262,27 +263,34 @@ export default {
         });
     },
     channelType: function (data) {
-      this.$http({
-        url: "/base/publishPlatformManager/selectPublishPlatformPage",
-        method: "post",
-        data,
-      })
-        .then((res) => {
-          console.log(res, "1122");
-          this.releasePlate = [];
-          if (res.data.code === 200) {
-            if (!data) {
-              console.log(res, 33);
-              this.releaseChannel = res.data.data;
-            } else {
-              this.releasePlate = res.data.data;
-              console.log(1);
-            }
-          }
+      return new Promise((resolve, reject) => {
+        this.$http({
+          url: "/base/publishPlatformManager/selectPublishPlatformPage",
+          method: "post",
+          data,
         })
-        .catch((err) => {
-          console.log(err);
-        });
+          .then((res) => {
+            this.releasePlate = [];
+            if (res.data.code === 200) {
+              if (!data) {
+                let initPlat = this.LinkData.publishPlatformName;
+                this.releaseChannel = res.data.data;
+                this.releaseChannel.forEach((item) => {
+                  if (item.platformName === initPlat) {
+                      this.initParentId = item.id;
+                  }
+                });
+              } else {
+                this.releasePlate = res.data.data;
+              }
+            }
+            resolve();
+          })
+          .catch((err) => {
+            console.log(err);
+            reject()
+          });
+      });
     },
     // 获取内容分类、媒体平台、常用参数接口的标识,再调接口时需要用到
     selectSysDataDictList: function () {
@@ -351,7 +359,12 @@ export default {
   mounted() {
     this.initialData();
     this.getCarType();
-    this.channelType();
+    this.channelType().then(() => {
+      let req = {
+        parentId: this.initParentId,
+      };
+      this.channelType(req)
+    });
     this.selectSysDataDictList().then(() => {
       this.getContent1();
       this.getContent2();