瀏覽代碼

Merge branch 'master' of http://git.cc-lotus.info/service-platform/web-website

wuhongyuq 5 年之前
父節點
當前提交
2eb015d0a6

+ 125 - 0
src/components/government/governmentList.vue

@@ -0,0 +1,125 @@
+<template>
+  <div id="governmentDetail">
+    <el-row>
+      <el-col :span="24" class="top">
+        <top></top>
+      </el-col>
+      <el-col :span="24" class="logo">
+        <div class="w_1200">
+          <logo :info="info"></logo>
+        </div>
+      </el-col>
+      <el-col :span="24" class="menu">
+        <div class="w_1200">
+          <menuInfo></menuInfo>
+        </div>
+      </el-col>
+      <el-col :span="24" class="main">
+        <div class="w_1200">
+          <el-col :span="5" class="left">
+            <el-col :span="24" class="leftTop">
+              <natives :nativeList="nativeList" v-on="$listeners"></natives>
+            </el-col>
+            <el-col :span="24" class="leftDiao">
+              <examine></examine>
+            </el-col>
+          </el-col>
+          <el-col :span="19" class="right">
+            <rightcont v-on="$listeners" :columnName="columnName" :contentList="contentList" :total="total" v-if="display === 'list'"></rightcont>
+            <policyrightcont v-else :columnTitle="columnTitle" :policyInfo="policyInfo"></policyrightcont>
+          </el-col>
+        </div>
+      </el-col>
+      <el-col :span="24" class="foot">
+        <div class="w_1200">
+          <foot :info="info"></foot>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import top from '@/layout/index/top.vue';
+import logo from '@/layout/index/logo.vue';
+import menuInfo from '@/layout/index/menuInfo.vue';
+import foot from '@/layout/index/foot.vue';
+import natives from '@/layout/government/natives.vue';
+import examine from '@/layout/personCenter/question.vue';
+import message from '@/layout/government/message.vue';
+import rightcont from '@/layout/government/rightcont.vue';
+import policyrightcont from '@/layout/government/policyrightcont.vue';
+export default {
+  name: 'government',
+  props: {
+    info: null, //站点信息
+    nativeList: null, //标签栏
+    columnTitle: null, //栏目名称
+    columnName: null, //栏目标题
+    contentList: null, //内容
+    total: null,
+    display: { type: String, default: 'list' },
+    policyInfo: null, //信息详情
+  },
+  components: {
+    top, //头部
+    logo, //logo
+    menuInfo, //导航
+    foot, //底部
+    natives, //列表-分类导航
+    examine, //网上调查(引用于科技人才中的question)
+    rightcont, //右边栏
+    policyrightcont,
+  },
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.w_1200 {
+  width: 1200px;
+  margin: 0 auto;
+}
+.top {
+  height: 40px;
+  overflow: hidden;
+  background-color: rgba(11, 58, 125, 0.8);
+}
+.logo {
+  height: 200px;
+  overflow: hidden;
+}
+.menu {
+  height: 70px;
+  overflow: hidden;
+}
+.main {
+  min-height: 800;
+  overflow: hidden;
+  margin: 10px 0;
+}
+.main .left {
+  width: 240px;
+  min-height: 800px;
+  margin: 0 10px 0 0;
+}
+.main .left .leftTop {
+  height: 420px;
+  background-color: #fff;
+  margin: 0 0 10px 0;
+}
+.main .left .leftDiao {
+  background: #fff;
+  height: 370px;
+  overflow: hidden;
+}
+.foot {
+  float: left;
+  width: 100%;
+  height: 120px;
+  overflow: hidden;
+}
+</style>

+ 3 - 3
src/layout/government/native.vue

@@ -7,7 +7,7 @@
     <el-col>
       <el-menu default-active="1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" text-color="#215299" active-text-color="#215299">
         <el-menu-item index="1" v-for="(item, index) in nativeList" :key="index"
-          ><span slot="title" @click="clickUrl(item.id)">{{ item.name }}</span></el-menu-item
+          ><span slot="title" @click="clickUrl()">{{ item.name }}</span></el-menu-item
         >
       </el-menu>
     </el-col>
@@ -27,8 +27,8 @@ export default {
   created() {},
   computed: {},
   methods: {
-    clickUrl(id) {
-      this.$emit('clickLists', { id });
+    clickUrl() {
+      this.$router.push({ path: '/government/governmentList' });
     },
     handleOpen(key, keyPath) {
       console.log(key, keyPath);

+ 65 - 0
src/layout/government/natives.vue

@@ -0,0 +1,65 @@
+<template>
+  <div id="native">
+    <el-col class="swfl">
+      <el-image style="width:22px;height:22px;margin:0 5px -5px 0;" :src="src"></el-image>
+      <span>标签栏</span>
+    </el-col>
+    <el-col>
+      <el-menu default-active="1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" text-color="#215299" active-text-color="#215299">
+        <el-menu-item index="1" v-for="(item, index) in nativeList" :key="index"
+          ><span slot="title" @click="clickUrl(item.id)">{{ item.name }}</span></el-menu-item
+        >
+      </el-menu>
+    </el-col>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'native',
+  props: {
+    nativeList: null,
+  },
+  components: {},
+  data: () => ({
+    src: require('@/assets/swfl.png'),
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    clickUrl(id) {
+      this.$emit('clickLists', { id });
+    },
+    handleOpen(key, keyPath) {
+      console.log(key, keyPath);
+    },
+    handleClose(key, keyPath) {
+      console.log(key, keyPath);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.swfl {
+  height: 60px;
+  width: 240px;
+  line-height: 60px;
+  background-color: #22529a;
+  text-align: center;
+}
+.swfl span {
+  font-size: 22px;
+  color: #ffffff;
+}
+/deep/.el-menu-item {
+  height: 60px;
+  text-align: center;
+  line-height: 60px;
+  border-bottom: 1px dashed;
+  font-size: 22px;
+}
+/deep/.el-menu-item:last-child {
+  border-bottom: none;
+}
+</style>

+ 90 - 0
src/layout/government/policyrightcont.vue

@@ -0,0 +1,90 @@
+<template>
+  <div id="policyrightcont">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="topInfo">
+          <span>{{ columnTitle }}</span>
+        </el-col>
+        <el-col :span="24" class="infoMess">
+          <el-col :span="24" class="title">
+            {{ policyInfo.title }}
+          </el-col>
+          <el-col :span="24" class="infoDate">
+            <p>
+              <span>发布人:{{ policyInfo.publish }}</span>
+              <span>来源:{{ policyInfo.orgin }}</span>
+              <span>发布时间: {{ policyInfo.meta && policyInfo.meta.createdAt ? new Date(policyInfo.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
+            </p>
+          </el-col>
+          <el-col v-if="policyInfo.picture" class="image">
+            <el-image style="width:50%" :src="policyInfo.picture"></el-image>
+          </el-col>
+          <el-col :span="24" class="content">
+            <p v-html="policyInfo.content"></p>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'policyrightcont',
+  props: {
+    columnTitle: null,
+    policyInfo: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+p {
+  padding: 0;
+  margin: 0;
+}
+.info {
+  min-height: 800px;
+  padding: 0 20px;
+  background-color: #fff;
+}
+.topInfo {
+  height: 60px;
+  line-height: 60px;
+  font-size: 22px;
+}
+.infoMess .title {
+  line-height: 30px;
+  text-align: center;
+  font-size: 16px;
+  font-weight: bold;
+  color: #000000;
+  margin: 0 0 20px 0;
+}
+.infoDate {
+  height: 36px;
+  line-height: 36px;
+}
+.infoDate p {
+  width: 700px;
+  background: #eeeeee;
+  margin: 0 105px;
+}
+.infoDate p span {
+  font-size: 14px;
+  color: #000;
+  padding: 0 0 0 80px;
+}
+.infoMess .image {
+  text-align: center;
+  margin: 20px 0 0 0;
+}
+.content {
+  padding: 0px 0 20px 0;
+}
+</style>

+ 157 - 0
src/layout/government/rightcont.vue

@@ -0,0 +1,157 @@
+<template>
+  <div id="rightcont">
+    <el-row>
+      <el-col class="zhengce">
+        <el-col :span="24" class="topTitle">
+          {{ columnName }}
+        </el-col>
+        <el-col :span="24" class="info">
+          <ul>
+            <li v-for="(item, index) in contentList" :key="index" @click="$emit('fetch', item.id)">
+              <el-col :span="21" class="title textOver">{{ item.title }}</el-col>
+              <el-col :span="3" class="date">
+                {{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}
+              </el-col>
+            </li>
+          </ul>
+          <el-col class="page" :span="24">
+            <el-pagination
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              layout="total,  prev, pager, next, jumper"
+              :total="total"
+            >
+            </el-pagination>
+          </el-col>
+        </el-col>
+      </el-col>
+      <el-col :span="24" class="linkList">
+        <el-col :span="4" v-for="(item, index) in linkList" :key="index" class="listSize">
+          <el-link :underline="false" :href="item.url" target="_blank">
+            <el-image style="width:130px;height:160px;" :src="item.pic"></el-image>
+          </el-link>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'rightcont',
+  props: {
+    columnName: null,
+    contentList: null,
+    total: null,
+  },
+  components: {},
+  data: () => ({
+    currentPage: 1,
+    linkList: [
+      {
+        url: '',
+        pic: require('@/assets/dian1.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian2.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian3.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian4.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian5.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian6.jpg'),
+      },
+    ],
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`);
+    },
+    handleCurrentChange(val) {
+      console.log(`当前页: ${val}`);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+ul {
+  margin: 0;
+}
+li {
+  padding: 0;
+  margin: 0;
+  color: #a8abb7;
+}
+.zhengce {
+  height: 620px;
+  padding: 20px 20px 0 20px;
+  background-color: #fff;
+  margin: 0 0 20px 0;
+}
+.topTitle {
+  font-size: 22px;
+  color: #22529a;
+  margin: 0 0 20px 0;
+}
+.info {
+  height: 550px;
+  overflow: hidden;
+}
+.info ul {
+  height: 498px;
+  overflow: hidden;
+  padding: 0 0 0 20px;
+}
+.info ul li {
+  float: left;
+  width: 100%;
+  padding: 0 0 13px 0;
+}
+.info ul li .title {
+  font-size: 16px;
+  color: #60636d;
+}
+.info ul li .date {
+  font-size: 16px;
+  color: #a8abb7;
+  text-align: right;
+}
+.info ul li:hover {
+  cursor: pointer;
+}
+.info ul li:hover .title {
+  color: #22529a;
+}
+.info ul li:hover .date {
+  color: #22529a;
+}
+.page {
+  padding: 11px 0;
+  text-align: center;
+}
+.linkList {
+  height: 160px;
+  overflow: hidden;
+  background-color: #fff;
+}
+.listSize {
+  width: 130px;
+  height: 160px;
+  margin: 0 14px;
+}
+</style>

+ 7 - 0
src/router/index.js

@@ -15,6 +15,13 @@ const routes = [
     name: 'government',
     component: () => import('../views/government/government.vue'),
   },
+  // 科技政务-列表
+  {
+    path: '/government/governmentList',
+    name: 'governmentList',
+    component: () => import('../views/government/governmentList.vue'),
+  },
+
   // 科技政务-详情
   {
     path: '/government/governmentDetail',

+ 1 - 5
src/views/government/governmentDetail.vue

@@ -18,11 +18,7 @@ export default {
   },
   data: () => ({
     info: {},
-    nativeList: [
-      {
-        name: '通知公告',
-      },
-    ],
+    nativeList: [],
     columnTitle: '',
     governmentDetail: {},
   }),

+ 105 - 0
src/views/government/governmentList.vue

@@ -0,0 +1,105 @@
+<template>
+  <div id="governmentList">
+    <governmentLists-layout
+      :info="info"
+      :nativeList="nativeList"
+      :display="display"
+      :columnName="columnName"
+      :contentList="contentList"
+      :total="total"
+      :columnTitle="columnTitle"
+      :policyInfo="policyInfo"
+      @clickLists="submit"
+      @fetch="fetchInfo"
+    ></governmentLists-layout>
+  </div>
+</template>
+
+<script>
+import governmentListsLayout from '@/components/government/governmentList.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+import _ from 'loadsh';
+const { mapActions: mapSite } = createNamespacedHelpers('site');
+const { mapActions: mapColumn } = createNamespacedHelpers('affairsColumn');
+const { mapActions: mapNews } = createNamespacedHelpers('affairsNews');
+
+export default {
+  name: 'governmentList',
+  props: {},
+  components: {
+    governmentListsLayout,
+  },
+  data: () => ({
+    info: {},
+    nativeList: [],
+    display: 'list',
+    columnName: '',
+    contentList: [],
+    total: 1,
+    leftId: '',
+    columnTitle: '',
+    policyInfo: {},
+  }),
+  async created() {
+    this.searchSite();
+    await this.searchColumn();
+    await this.defaultColumn();
+  },
+  computed: {},
+  methods: {
+    ...mapSite(['showInfo']),
+    ...mapColumn({ columnList: 'query', columnInfo: 'fetch' }),
+    ...mapNews({ policyNew: 'query', newsFetch: 'fetch' }),
+    // 查询站点信息
+    async searchSite() {
+      let res = await this.showInfo();
+      let object = JSON.parse(JSON.stringify(res.data));
+      if (object) {
+        this.$set(this, `info`, res.data);
+      } else {
+        this.$message.error(res.errmsg ? res.errmsg : 'error');
+      }
+    },
+    // 查询科技政务栏目
+    async searchColumn({ ...info } = {}) {
+      const res = await this.columnList({ ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `nativeList`, res.data);
+      }
+    },
+    submit({ id }) {
+      this.$set(this, `leftId`, id);
+      this.display = 'list';
+      this.searchRight();
+    },
+    async searchRight({ skip = 0, limit = 10, column_id } = {}) {
+      const res = await this.policyNew({ skip, limit, column_id: this.leftId });
+      for (const val of res.data) {
+        const result = await this.columnInfo(val.column_id);
+        val.column_name = result.data.name;
+      }
+      this.$set(this, `contentList`, res.data);
+      this.$set(this, `total`, res.data.length);
+      for (const val of res.data) {
+        this.$set(this, `columnName`, val.column_name);
+      }
+    },
+    async defaultColumn() {
+      if (!(this.nativeList.length > 0)) return;
+      let id = _.get(this.nativeList[0], 'id', false);
+      if (!id) return;
+      this.submit({ id });
+    },
+    async fetchInfo(id) {
+      this.display = 'detail';
+      const res = await this.newsFetch(id);
+      const result = await this.columnInfo(res.data.column_id);
+      this.$set(this, `columnTitle`, result.data.name);
+      this.$set(this, `policyInfo`, res.data);
+      // 查询详情,赋值
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 0 - 1
src/views/policy/policy.vue

@@ -25,7 +25,6 @@ const { mapActions: mappolicyNews } = createNamespacedHelpers('policyNews');
 export default {
   name: 'policy',
   props: {},
-
   components: {
     policyDetail,
   },