Ver Fonte

通知通告

guhongwei há 4 anos atrás
pai
commit
2311e77b48

+ 6 - 0
src/router/index.js

@@ -212,6 +212,12 @@ const routes = [
     meta: { title: '通知通告', isleftarrow: false },
     component: () => import('../viewTwo/notice/index.vue'),
   },
+  {
+    path: '/viewTwo/notice/detail',
+    name: 'notice',
+    meta: { title: '通知通告详情', isleftarrow: true },
+    component: () => import('../viewTwo/notice/detail.vue'),
+  },
   // 新闻资讯
   {
     path: '/viewTwo/news/index',

+ 154 - 0
src/viewTwo/notice/detail.vue

@@ -0,0 +1,154 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="detail">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow" @onClickLeft="onClickLeft"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="main">
+          <el-col :span="24" class="title">{{ info.title }}</el-col>
+          <el-col :span="24" class="other">
+            <p>
+              <span class="textOver">信息来源:{{ info.orgin || '暂无' }}</span>
+              <span class="textOver">发布时间:{{ info.publish_time || '暂无' }}</span>
+            </p>
+          </el-col>
+          <el-col :span="24" v-if="info.picture != null || undefined" class="img">
+            <van-image :src="info.picture">
+              <div slot="error" class="image-slot">
+                <i class="el-icon-picture-outline"></i>
+              </div>
+            </van-image>
+          </el-col>
+          <el-col :span="24" class="con" v-html="info.content"> </el-col>
+          <el-col :span="24" class="four" v-if="info.filepath">
+            <h4>附件:</h4>
+            <el-link :href="info.filepath" :underline="false">{{ info.filepathname || '附件下载' }}</el-link>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+import NavBar from '@/layout/common/topInfo.vue';
+const { mapActions: journnews } = createNamespacedHelpers('journnews');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'detail',
+  props: {},
+  components: {
+    NavBar,
+  },
+  data: function() {
+    return {
+      // 头部标题
+      title: '',
+      // meta为true
+      isleftarrow: '',
+      // 返回
+      navShow: true,
+      //详情
+      info: {},
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...journnews(['fetch']),
+    //查询详情
+    async search() {
+      const res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `info`, res.data);
+      }
+    },
+    // 返回
+    onClickLeft() {
+      this.$router.push({ path: '/viewTwo/notice/index' });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.detail {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  // min-height: 570px;
+  // margin: 0 0 50px 0;
+  padding: 10px;
+  .title {
+    text-align: center;
+    color: #044b79;
+    font-size: 18px;
+    font-weight: bolder;
+  }
+  .other {
+    font-size: 16px;
+    color: #666;
+    padding: 20px 0;
+    border-bottom: 1px dashed #ccc;
+    p:nth-child(1) {
+      span {
+        display: inline-block;
+        width: 50%;
+      }
+    }
+    p:nth-child(2) {
+      text-align: center;
+    }
+  }
+  .img {
+    text-align: center;
+    margin: 0 0 15px 0;
+    .el-image {
+      width: 60%;
+    }
+  }
+  .con {
+    margin-top: 20px;
+  }
+}
+/deep/table {
+  width: 100%;
+}
+/deep/.con p img {
+  width: 100%;
+  height: 300px;
+  margin: 5px 0px;
+  display: block;
+}
+/deep/.con div img {
+  width: 100%;
+  height: 260px;
+  display: block;
+}
+/deep/.con p {
+  font-size: 14px;
+  color: #444;
+}
+</style>

+ 91 - 7
src/viewTwo/notice/index.vue

@@ -1,32 +1,116 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24">
-        <p>通知通告</p>
+      <el-col :span="24" class="style">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="down">
+          <el-col :span="24" class="search">
+            <van-search v-model="name" @search="search" placeholder="请输入信息标题" />
+          </el-col>
+          <el-col :span="24" class="data">
+            <list :list="list"></list>
+          </el-col>
+        </el-col>
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+import NavBar from '@/layout/common/topInfo.vue';
+import list from './parts/list.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: journcolumn } = createNamespacedHelpers('journcolumn');
+const { mapActions: journnews } = createNamespacedHelpers('journnews');
+
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
   },
   name: 'index',
   props: {},
-  components: {},
+  components: {
+    NavBar,
+    list,
+  },
   data: function() {
-    return {};
+    return {
+      // 头部标题
+      title: '',
+      // meta为true
+      isleftarrow: '',
+      // 返回
+      navShow: true,
+      active: 0,
+      // 栏目列表
+      columnList: [],
+      // 查询
+      name: '',
+      list: [],
+    };
+  },
+  async created() {
+    await this.searchColumn();
+    await this.search();
+  },
+  methods: {
+    ...journcolumn(['query', 'delete', 'update', 'create']),
+    ...journnews({ newQuery: 'query' }),
+    async search({ ...info } = {}) {
+      let column = this.columnList.find(i => i.site == 'tztg');
+      if (column) {
+        if (this.name) info.title = this.name;
+        const res = await this.newQuery({ column_id: column.id, ...info });
+        if (this.$checkRes(res)) {
+          this.$set(this, `list`, res.data);
+        }
+      }
+    },
+    // 查询栏目
+    async searchColumn() {
+      const res = await this.query();
+      if (this.$checkRes(res)) {
+        this.$set(this, `columnList`, res.data);
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
   },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
   watch: {},
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  height: 100%;
+  position: relative;
+  background-color: #f9fafc;
+  .top {
+    height: 40px;
+    overflow: hidden;
+  }
+  .down {
+    .search {
+      position: fixed;
+      width: 100%;
+      z-index: 999;
+    }
+    .data {
+      position: absolute;
+      width: 100%;
+      top: 95px;
+    }
+  }
+}
+</style>

+ 67 - 0
src/viewTwo/notice/parts/list.vue

@@ -0,0 +1,67 @@
+<template>
+  <div id="tec">
+    <el-row>
+      <el-col :span="24" class="tec">
+        <el-col :span="24" v-for="(item, index) in list" :key="index" class="list" @click.native="detailBtn(item)">
+          <p class="title textOver">{{ item.title }}</p>
+          <p>
+            <span class="textOver">发布时间:{{ item.publish_time }}</span>
+            <span class="textOver">来源:{{ item.orgin || '暂无' }}</span>
+          </p>
+        </el-col>
+      </el-col>
+      <el-backtop :bottom="50" :right="10"> </el-backtop>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'tec',
+  props: {
+    list: { type: Array },
+  },
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {
+    //详情
+    detailBtn(data) {
+      this.$router.push({ path: '/viewTwo/notice/detail', query: { id: data.id } });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.tec {
+  padding: 0 10px;
+  .list {
+    padding: 10px 0px;
+    border-bottom: 1px dashed #ccc;
+    .title {
+      font-size: 18px;
+      font-weight: bold;
+    }
+    p:nth-child(2) {
+      margin-top: 5px;
+      span {
+        display: inline-block;
+        width: 50%;
+        height: 42px;
+        line-height: 42px;
+        color: #666;
+      }
+    }
+  }
+}
+</style>