guhongwei 4 سال پیش
والد
کامیت
2ee92624b6

+ 28 - 0
src/views/news/list-model/model-2.vue

@@ -75,6 +75,34 @@ export default {
     }
     .info {
       padding: 0 10px;
+      .title {
+        overflow: hidden;
+        text-overflow: ellipsis;
+        -webkit-line-clamp: 3;
+        word-break: break-all;
+        display: -webkit-box;
+        -webkit-box-orient: vertical;
+        font-size: 16px;
+        margin: 0 0 5px 0;
+      }
+      .other {
+        .text {
+          font-size: 14px;
+          color: #666;
+          span {
+            color: #000;
+          }
+        }
+      }
+    }
+  }
+  .list:hover {
+    cursor: pointer;
+    .info {
+      .title {
+        color: #409eff;
+        font-weight: bold;
+      }
     }
   }
 }

+ 79 - 0
src/views/news/list-model/model-3.vue

@@ -0,0 +1,79 @@
+<template>
+  <div id="model-3">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
+          <el-col :span="24" class="title textOver">
+            {{ item.title }}
+          </el-col>
+          <el-col :span="24" class="other">
+            <el-col :span="12" class="text textOver">
+              信息来源:<span>{{ item.origin }}</span>
+            </el-col>
+            <el-col :span="12" class="text textOver">
+              发布时间:<span>{{ item.release_time }}</span>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'model-3',
+  props: {
+    list: { type: Array, default: () => [] },
+  },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .list {
+    padding: 12px 10px;
+    border-bottom: 1px solid #ccc;
+    .title {
+      font-size: 16px;
+      margin: 0 0 5px 0;
+    }
+    .other {
+      .text {
+        font-size: 14px;
+        color: #666;
+        span {
+          color: #000;
+        }
+      }
+    }
+  }
+  .list:hover {
+    cursor: pointer;
+    .title {
+      color: #409eff;
+      font-weight: bold;
+    }
+  }
+}
+</style>

+ 79 - 0
src/views/news/list-model/model-4.vue

@@ -0,0 +1,79 @@
+<template>
+  <div id="model-4">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
+          <el-col :span="24" class="title textOver">
+            {{ item.title }}
+          </el-col>
+          <el-col :span="24" class="other">
+            <el-col :span="12" class="text textOver">
+              信息来源:<span>{{ item.origin }}</span>
+            </el-col>
+            <el-col :span="12" class="text textOver">
+              发布时间:<span>{{ item.release_time }}</span>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'model-4',
+  props: {
+    list: { type: Array, default: () => [] },
+  },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .list {
+    padding: 12px 10px;
+    border-bottom: 1px solid #ccc;
+    .title {
+      font-size: 16px;
+      margin: 0 0 5px 0;
+    }
+    .other {
+      .text {
+        font-size: 14px;
+        color: #666;
+        span {
+          color: #000;
+        }
+      }
+    }
+  }
+  .list:hover {
+    cursor: pointer;
+    .title {
+      color: #409eff;
+      font-weight: bold;
+    }
+  }
+}
+</style>

+ 1 - 1
src/views/news/list/kjxw.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="kjxw">
-    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize">
+    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize" searchModel="title">
       <component :is="model" :list="list"></component>
     </list-page>
     <template v-else> 详情 </template>

+ 55 - 11
src/views/news/list/mtjj.vue

@@ -1,33 +1,77 @@
 <template>
   <div id="mtjj">
-    <el-row>
-      <el-col :span="24" class="main"> test </el-col>
-    </el-row>
+    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize" searchModel="title">
+      <component :is="model" :list="list"></component>
+    </list-page>
+    <template v-else> 详情 </template>
   </div>
 </template>
 
 <script>
+const _ = require('lodash');
+import listPage from '@c/list/list-page.vue';
+const { newsColumn } = require('@common/dict/index');
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: news } = createNamespacedHelpers('news');
 export default {
   name: 'mtjj',
-  props: {},
-  components: {},
+  props: ['listModel'],
+  components: {
+    listPage,
+    model3: () => import('../list-model/model-3.vue'),
+  },
   data: function () {
-    return {};
+    return {
+      // 栏目
+      column: newsColumn,
+      // 列表
+      list: [],
+      total: 0,
+      pageSize: 7,
+      // 详情
+      detail: {},
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...news(['query', 'fetch']),
+    async search({ skip = 0, limit = this.pageSize, ...info } = {}) {
+      info.column_name = this.column[this.listModel];
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 查询详情
+    async searchInfo() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `detail`, res.data);
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
+    model() {
+      const moduleNumber = this.listModel || 0;
+      return `model${moduleNumber}`;
+    },
+    id() {
+      return this.$route.query.id;
+    },
   },
   metaInfo() {
     return { title: this.$route.meta.title };
   },
   watch: {
-    test: {
-      deep: true,
+    id: {
+      handler(ne) {
+        if (ne) this.searchInfo();
+      },
       immediate: true,
-      handler(val) {},
     },
   },
 };

+ 1 - 1
src/views/news/list/tgtg.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="zwdt">
-    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize">
+    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize" searchModel="title">
       <component :is="model" :list="list"></component>
     </list-page>
     <template v-else> 详情 </template>

+ 55 - 11
src/views/news/list/xxgk.vue

@@ -1,33 +1,77 @@
 <template>
   <div id="xxgk">
-    <el-row>
-      <el-col :span="24" class="main"> test </el-col>
-    </el-row>
+    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize" searchModel="title">
+      <component :is="model" :list="list"></component>
+    </list-page>
+    <template v-else> 详情 </template>
   </div>
 </template>
 
 <script>
+const _ = require('lodash');
+import listPage from '@c/list/list-page.vue';
+const { newsColumn } = require('@common/dict/index');
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: news } = createNamespacedHelpers('news');
 export default {
   name: 'xxgk',
-  props: {},
-  components: {},
+  props: ['listModel'],
+  components: {
+    listPage,
+    model4: () => import('../list-model/model-4.vue'),
+  },
   data: function () {
-    return {};
+    return {
+      // 栏目
+      column: newsColumn,
+      // 列表
+      list: [],
+      total: 0,
+      pageSize: 7,
+      // 详情
+      detail: {},
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...news(['query', 'fetch']),
+    async search({ skip = 0, limit = this.pageSize, ...info } = {}) {
+      info.column_name = this.column[this.listModel];
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 查询详情
+    async searchInfo() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `detail`, res.data);
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
+    model() {
+      const moduleNumber = this.listModel || 0;
+      return `model${moduleNumber}`;
+    },
+    id() {
+      return this.$route.query.id;
+    },
   },
   metaInfo() {
     return { title: this.$route.meta.title };
   },
   watch: {
-    test: {
-      deep: true,
+    id: {
+      handler(ne) {
+        if (ne) this.searchInfo();
+      },
       immediate: true,
-      handler(val) {},
     },
   },
 };

+ 1 - 1
src/views/news/list/zwdt.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="zwdt">
-    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize">
+    <list-page v-bind="$attrs" :total="total" v-if="!id" @toSearch="search" :pageSize="pageSize" searchModel="title">
       <component :is="model" :list="list"></component>
     </list-page>
     <template v-else> 详情 </template>