Browse Source

更新党员之家

guhongwei 5 years ago
parent
commit
de7f30a858

+ 2 - 1
src/components/memberDetail.vue

@@ -5,7 +5,7 @@
         <top :info="info"></top>
       </el-col>
       <el-col :sapn="24" class="menu">
-        <menuInfos></menuInfos>
+        <menuInfos :menuList="menuList" :backColor="backColor"></menuInfos>
       </el-col>
       <el-col :sapn="24" class="main">
         <div class="w_1270">
@@ -32,6 +32,7 @@ export default {
     bordBottomColor: null, //border-bottom颜色
     color: null, //字体颜色
     contInfos: null, //信息详细
+    menuList: null, //菜单
     info: null, //站点信息
   },
   components: {

+ 8 - 2
src/layout/jobs-list/post.vue

@@ -4,7 +4,7 @@
       <el-col :span="20" class="title">
         <p class="textOver"><span class="dian"></span>{{ data.job_name }}</p>
         <p class="textOver"><span class="dian"></span>需求人数:{{ data.job_number }}</p>
-        <p class="textOver"><span class="dian"></span>薪资:{{ data.salary.text }}</p>
+        <p class="textOver"><span class="dian"></span>薪资:{{ data.salary | filterA('text') }}</p>
         <p class="textOver"><span class="dian"></span>福利待遇:{{ data.welfare }}</p>
         <p class="textOver"><span class="dian"></span>职位诱惑:{{ data.job_tag }}</p>
       </el-col>
@@ -23,7 +23,13 @@ export default {
   data: () => ({}),
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    filters: {
+      filterA: function(value, text) {
+        return value + '/' + text;
+      },
+    },
+  },
 };
 </script>
 

+ 22 - 3
src/layout/member/dangjian.vue

@@ -25,7 +25,13 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="infoLeftList">
-            <el-col :span="24" class="rencaiList" v-for="(item, index) in infoList" :key="index">
+            <el-col
+              :span="24"
+              class="rencaiList"
+              v-for="(item, index) in infoList"
+              :key="index"
+              @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+            >
               <el-col :span="16" class="title">
                 <p class="textOver"><i class="el-icon-s-flag icon"></i>{{ item.title }}</p>
               </el-col>
@@ -45,7 +51,13 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="infoCenterList">
-            <el-col :span="12" class="dangjianList" v-for="(item, index) in infosList" :key="index">
+            <el-col
+              :span="12"
+              class="dangjianList"
+              v-for="(item, index) in infosList"
+              :key="index"
+              @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+            >
               <el-col :span="24" class="imageTit">
                 <el-image style="width:180px;height:120px;" :src="item.pic"></el-image>
               </el-col>
@@ -67,7 +79,13 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="infoLeftList">
-            <el-col :span="24" class="rencaiList" v-for="(item, index) in infossList" :key="index">
+            <el-col
+              :span="24"
+              class="rencaiList"
+              v-for="(item, index) in infossList"
+              :key="index"
+              @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+            >
               <el-col :span="16" class="title">
                 <p class="textOver"><i class="el-icon-s-flag icon"></i>{{ item.title }}</p>
               </el-col>
@@ -254,6 +272,7 @@ p {
 }
 .dangjianList:hover .title {
   display: block;
+  cursor: pointer;
 }
 .dangjianList .title p {
   color: #fff;

+ 16 - 2
src/layout/member/gaoceng.vue

@@ -15,14 +15,25 @@
       <el-col :span="24" class="info">
         <el-col :span="12" class="carousel" v-loading="loading">
           <el-carousel height="400">
-            <el-carousel-item v-for="(item, index) in infoList" :key="index">
+            <el-carousel-item
+              class="infoList"
+              v-for="(item, index) in infoList"
+              :key="index"
+              @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+            >
               <el-image style="width:100%;height:400px;" :src="item.pic"></el-image>
               <span class="textOver">{{ item.title }}</span>
             </el-carousel-item>
           </el-carousel>
         </el-col>
         <el-col :span="12" style="height:400px;" v-loading="loading">
-          <el-col :span="24" class="newsList" v-for="(item, index) in infosList" :key="index">
+          <el-col
+            :span="24"
+            class="newsList"
+            v-for="(item, index) in infosList"
+            :key="index"
+            @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+          >
             <el-col :span="20" class="title">
               <p class="textOver">
                 <i class="el-icon-s-flag icon"></i><span>{{ item.title }}</span>
@@ -166,4 +177,7 @@ p {
 .newsList:hover .date {
   color: #bd010b;
 }
+.infoList:hover {
+  cursor: pointer;
+}
 </style>

+ 7 - 1
src/layout/member/photo.vue

@@ -14,7 +14,13 @@
       </el-col>
       <el-col :span="24" class="info">
         <el-col :span="24" class="list" v-loading="loading">
-          <el-col :span="6" class="tujiList" v-for="(item, index) in infoList" :key="index">
+          <el-col
+            :span="6"
+            class="tujiList"
+            v-for="(item, index) in infoList"
+            :key="index"
+            @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+          >
             <el-col :span="24" class="image">
               <el-image style="width:270px;height:180px;" :src="item.pic"></el-image>
             </el-col>

+ 15 - 3
src/layout/member/xuexi.vue

@@ -25,7 +25,13 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="infoLeftList">
-            <el-col :span="24" class="rencaiList" v-for="(item, index) in infoList" :key="index">
+            <el-col
+              :span="24"
+              class="rencaiList"
+              v-for="(item, index) in infoList"
+              :key="index"
+              @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+            >
               <el-col :span="24" class="title">
                 <p class="textOver"><i class="el-icon-s-flag icon"></i>{{ item.title }}</p>
               </el-col>
@@ -44,7 +50,13 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="infoLeftList">
-            <el-col :span="24" class="zhishiList" v-for="(item, index) in infosList" :key="index">
+            <el-col
+              :span="24"
+              class="zhishiList"
+              v-for="(item, index) in infosList"
+              :key="index"
+              @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })"
+            >
               <el-col :span="16" class="title">
                 <p class="textOver"><i class="el-icon-s-flag icon"></i>{{ item.title }}</p>
               </el-col>
@@ -59,7 +71,7 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="infoRightList">
-            <el-col :span="24" v-for="(item, index) in infossList" :key="index">
+            <el-col :span="24" v-for="(item, index) in infossList" :key="index" @click.native="$router.push({ path: `/memberDetail?id=${item.id}` })">
               <el-col :span="24">
                 <el-image style="width:400px;height:280px;" :src="item.pic"></el-image>
               </el-col>

+ 117 - 4
src/views/memberDetail.vue

@@ -5,15 +5,23 @@
       :bordColor="bordColor"
       :bordBottomColor="bordBottomColor"
       :color="color"
-      :info="info"
-      :contInfos="contInfos"
+      :menuList="menu"
+      :info="site"
+      :contInfos="detailInfo"
     ></member-info>
   </div>
 </template>
 
 <script>
 import memberInfo from '@/components/memberDetail.vue';
+import { mapActions, mapState } from 'vuex';
+import _ from 'lodash';
 export default {
+  metaInfo() {
+    return {
+      title: this.siteTitle ? this.siteTitle : '就业信息网',
+    };
+  },
   name: 'memberDetail',
   props: {},
   components: {
@@ -35,10 +43,115 @@ export default {
       url: require('@/assets/news.jpg'),
       content: '9月16日-20日,由全国高等学校学生信息咨询与就业指导中心主办。',
     },
+    menu: [], //菜单信息
+    site: {}, //站点信息
+    detailInfo: {}, //详情信息
   }),
-  created() {},
+  async created() {
+    await this.toGetSite(); //获取主站信息
+    await this.loadMenu(); //获取菜单信息
+    this.search();
+  },
   computed: {},
-  methods: {},
+  methods: {
+    ...mapActions(['getSite', 'getMenu', 'getColumn', 'getNews']),
+    async search() {
+      //1直接拿着参数发送请求
+      let result = await this.getNews({ type: 'fetch', data: { id: this.$route.query.id } });
+      if (`${result.errcode}` === '0') {
+        this.$set(this, `detailInfo`, result.data);
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
+    },
+    //站点信息
+    async toGetSite() {
+      let site = sessionStorage.getItem('site');
+      if (!site) {
+        let result = await this.getSite({ type: 'search' });
+        if (result.errcode === 0) {
+          sessionStorage.setItem('site', JSON.stringify(result.data));
+          if (_.get(result.data, `custom`)) {
+            let item = result.custom;
+          }
+          this.$set(this, `site`, result.data);
+          this.$set(this, `siteTitle`, this.site.name);
+        }
+      } else {
+        this.$set(this, `site`, JSON.parse(site));
+        this.$set(this, `siteTitle`, this.site.name);
+        let arr = this.site;
+        if (arr.custom) {
+          let item = arr.custom;
+        }
+      }
+    },
+    //菜单
+    async loadMenu() {
+      let menu = sessionStorage.getItem('menu');
+      if (menu) {
+        this.$set(this, `menu`, JSON.parse(menu));
+        await this.finishedMenu();
+      } else this.toGetMenu();
+      this.getSubMenu();
+    },
+    async toGetMenu() {
+      let result = await this.getMenu({ type: `list` });
+      if (result.errcode === 0) {
+        sessionStorage.setItem('menu', JSON.stringify(result.data));
+        this.$set(this, `menu`, result.data);
+        this.finishedMenu();
+      }
+    },
+    async finishedMenu() {
+      let menus = JSON.parse(JSON.stringify(this.menu));
+      for (const item of menus) {
+        if (item.type === 'content') {
+          item.path = `/detail/${item.content_id}`;
+        } else if (item.type !== 'url') {
+          let res = await this.completeMenu(item);
+          item.children = res;
+        }
+      }
+      this.$set(this, `menu`, menus);
+    },
+    async completeMenu(item) {
+      let result = await this.getColumn({
+        type: `list`,
+        data: { parent_id: item.id },
+      });
+      if (result.errcode === 0) {
+        let columns = result.data;
+        for (const col of columns) {
+          if (col.type === 'content') {
+            col.path = `/detail/${col.content_id}`;
+          } else if (col.type !== 'url') {
+            col.path = `/newsList/menu/${col.id}?title=${col.title}`;
+            if (col.parent.includes('党员')) {
+              col.path = `/memberList/menu/${col.id}?title=${col.title}`;
+            }
+          }
+        }
+        return columns;
+      }
+    },
+    //侧菜单
+    getSubMenu() {
+      let data;
+      if (this.type === `module`) {
+        data = sessionStorage.getItem(`modules`);
+        this.$set(this, `sideMenu`, []);
+      } else {
+        let res = this.menu.filter(fil => {
+          if (fil.children) {
+            let res = fil.children.filter(filc => filc.id === this.id);
+            return res.length > 0;
+          } else return false;
+        });
+        this.$set(this, `sideMenu`, res.length > 0 ? res[0].children : []);
+      }
+    },
+  },
 };
 </script>