Parcourir la source

平台模块接口

suxinf il y a 4 ans
Parent
commit
dafed73d09

+ 2 - 12
src/views/parameter/ContentCategory1.vue

@@ -50,11 +50,7 @@ export default {
       sum: 0, // 一共有多少条数据
       pageSize: 20, // 每页展示的数据
       currentPage: 1,
-      tableData: [
-        { title: "服务", str: "123" },
-        { title: "产品", str: "124" },
-        { title: "品牌", str: "125" },
-      ],
+      tableData: [],
       modalFlag: false, // 控制模态框展示
       dictList: [],
     };
@@ -64,11 +60,6 @@ export default {
     totalPage() {
       return Math.ceil(this.sum / this.pageSize);
     },
-    // 获取路由参数
-    queryTag() {
-      console.log(111, this.$route.query);
-      return this.$route.query && this.$route.query.tag ? 0 : 1;
-    },
   },
   methods: {
     // 获取某一页面的数据,展示在表格
@@ -154,7 +145,6 @@ export default {
           if (res.data && res.data.code === 200) {
             this.tableData = res.data.data;
             this.sum = res.data.count;
-            console.log(res);
           } else {
             console.log(res);
           }
@@ -190,7 +180,7 @@ export default {
           });
       });
     },
-    // 编辑
+    // 编辑   接口
     updataDict: function (newName, index) {
       return new Promise((resolve, reject) => {
         this.$http({

+ 2 - 7
src/views/parameter/PlatformModule.vue

@@ -31,9 +31,7 @@
       </div>
     </div>
     <div v-else>
-      <DetailPage 
-        :parentData='parentData'
-      />
+      <DetailPage />
     </div>
   </div>
 </template>
@@ -59,7 +57,6 @@ export default {
       currentPage: 1,
       tableData: [],
       modalFlag: false, // 控制模态框展示
-      parentData: {}
     };
   },
   computed: {
@@ -125,9 +122,7 @@ export default {
     // 点击平台板块
     jumpRouter: function (index) {
       // 页面变化
-      this.$router.push({ query: { tag: "detail" } });
-      this.parentData = this.tableData[index]
-      console.log("点击平台模块",index);
+      this.$router.push({ query: { tag: "detail", id: this.tableData[index]['id'] } });
     },
     // 新增平台 接口
     addPublishPlatformInfo: function (platformName) {

+ 7 - 15
src/views/parameter/components/PlatformModule/DetailPage.vue

@@ -39,14 +39,6 @@ import Table from "./DetailPageTable";
 import Modal from "./DetailPageModal";
 
 export default {
-  props: {
-    parentData: {
-      type: Object,
-      default: () => {
-        return {};
-      },
-    },
-  },
   components: {
     Count,
     Table,
@@ -60,6 +52,7 @@ export default {
       currentPage: 1,
       tableData: [],
       modalFlag: false, // 控制模态框展示
+      parentId: (this.$route.query && this.$route.query.id) || ''
     };
   },
   computed: {
@@ -104,23 +97,23 @@ export default {
     // 点击编辑
     edit(index, newName) {
       let id = this.tableData[index]['id'];
-      let parentId = this.parentData['id'];
+      let parentId = this.parentId;
       this.updatePublishPlatformInfo(parentId, id, newName).then(() => {
-        this.selectPublishPlatformPage();
+        this.selectPublishPlatformPage(parentId);
       });
     },
     // 点击删除
     deleteData(index) {
       console.log("删除", index);
-      let parentId = this.parentData['id'];
+      let parentId = this.parentId;
       let id = this.tableData[index]['id'];
       this.deletePublishPlatformInfo(parentId, id).then(() => {
-        this.selectPublishPlatformPage();
+        this.selectPublishPlatformPage(parentId);
       });
     },
     // 新增板块模态框 保存
     submit: function (platetName) {
-      let parentId = this.parentData['id'];
+      let parentId = this.parentId;
       this.addPublishPlatformInfo(parentId, platetName)
       this.modalFlag = false;
     },
@@ -230,8 +223,7 @@ export default {
     },
   },
   mounted() {
-    console.log(this.parentData);
-    this.selectPublishPlatformPage(this.parentData['id']);
+    this.selectPublishPlatformPage(this.parentId);
   },
 };
 </script>