浏览代码

平台活动

YY 2 年之前
父节点
当前提交
5e829809ae
共有 2 个文件被更改,包括 39 次插入39 次删除
  1. 4 11
      src/views/platActivi/act/detail.vue
  2. 35 28
      src/views/platActivi/act/index.vue

+ 4 - 11
src/views/platActivi/act/detail.vue

@@ -56,7 +56,7 @@ const { mapActions: dictData } = createNamespacedHelpers('dictData');
 
 export default {
   name: 'form-1',
-  props: {},
+  props: { id: { type: String } },
   components: {
     editor: () => import('@/components/editor.vue'),
   },
@@ -128,17 +128,10 @@ export default {
     },
     // 返回
     toBack() {
-      window.history.go('-1');
-    },
-  },
-  computed: {
-    id() {
-      return this.$route.query.id;
-    },
-    status() {
-      return this.$route.query.status;
+      this.$emit('toBack');
     },
   },
+  computed: {},
   metaInfo() {
     return { title: this.$route.meta.title };
   },
@@ -146,7 +139,7 @@ export default {
     test: {
       deep: true,
       immediate: true,
-      handler(val) { },
+      handler(val) {},
     },
   },
 };

+ 35 - 28
src/views/platActivi/act/index.vue

@@ -2,29 +2,32 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
-        <el-col :span="24" class="one"> <span>活动标题</span> </el-col>
-        <el-col :span="24" class="two">
-          <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
-        </el-col>
-        <el-col :span="24" class="thr">
-          <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
-        </el-col>
-        <el-col :span="24" class="four">
-          <data-table
-            :select="true"
-            :selected="selected"
-            @handleSelect="handleSelect"
-            :fields="fields"
-            :opera="opera"
-            @query="search"
-            :data="list"
-            :total="total"
-            @edit="toEdit"
-            @del="toDel"
-            @manage="toManage"
-          >
-          </data-table>
-        </el-col>
+        <span v-show="view === 'list'">
+          <el-col :span="24" class="one"> <span>活动标题</span> </el-col>
+          <el-col :span="24" class="two">
+            <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
+          </el-col>
+          <el-col :span="24" class="thr">
+            <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
+          </el-col>
+          <el-col :span="24" class="four">
+            <data-table
+              :select="true"
+              :selected="selected"
+              @handleSelect="handleSelect"
+              :fields="fields"
+              :opera="opera"
+              @query="search"
+              :data="list"
+              :total="total"
+              @edit="toEdit"
+              @del="toDel"
+              @manage="toManage"
+            >
+            </data-table>
+          </el-col>
+        </span>
+        <detail v-if="view === 'info'" :id="id" @toBack="toBack"></detail>
       </el-col>
     </el-row>
   </div>
@@ -40,10 +43,12 @@ export default {
   props: {},
   components: {
     search1: () => import('./parts/search-1.vue'),
+    detail: () => import('./detail.vue'),
   },
   data: function () {
     const that = this;
     return {
+      view: 'list',
       // 列表
       opera: [
         { label: '修改', method: 'edit' },
@@ -81,6 +86,7 @@ export default {
       selected: [],
       // 是否开启
       isuseList: [],
+      id: '',
     };
   },
   async created() {
@@ -101,14 +107,15 @@ export default {
     },
     // 新增
     toAdd() {
-      this.$router.push({ path: '/platActivi/act/detail' });
+      this.$set(this, `view`, 'info');
     },
     // 修改
     async toEdit({ data }) {
-      this.$router.push({
-        path: '/platActivi/act/detail',
-        query: { id: data.id },
-      });
+      this.$set(this, `id`, data.id);
+      this.$set(this, `view`, 'info');
+    },
+    toBack() {
+      this.view = 'list';
     },
     // 平台管理
     async toManage({ data }) {