Quellcode durchsuchen

首页接口完成

guhongwei vor 5 Jahren
Ursprung
Commit
e85645b994

+ 2 - 1
src/components/index.vue

@@ -8,7 +8,7 @@
         <banner :info="info"></banner>
       </el-col>
       <el-col :sapn="24" class="menu">
-        <menuInfo></menuInfo>
+        <menuInfo :menuList="menuList" :backColor="backColor"></menuInfo>
       </el-col>
       <el-col :sapn="24" class="main">
         <div class="w_1270">
@@ -91,6 +91,7 @@ export default {
   props: {
     backColor: null, //背景颜色
     info: null, //站点信息
+    menuList: null, //菜单
     carouselList: null, //輪播圖
     noticeNewsList: null, //通知公告+就業動態
     zhidaoList: null, //就業指導

+ 59 - 0
src/config/jobs-menu.js

@@ -0,0 +1,59 @@
+export const jobMenu = {
+  title: '招聘相关',
+  children: [
+    {
+      title: '校内宣讲会',
+      path: `/talk/list/in`,
+    },
+    {
+      title: '校外宣讲会',
+      path: `/talk/list/out`,
+    },
+    {
+      title: '校内招聘会',
+      path: `/jobfair/list/in`,
+    },
+    {
+      title: '校外招聘会',
+      path: `/jobfair/list/out`,
+    },
+    {
+      title: '招聘信息',
+      path: `/jobinfo/list`,
+    },
+    {
+      title: '正式岗位',
+      path: `/jobs/list/official`,
+    },
+    {
+      title: '实习岗位',
+      path: `/jobs/list/internship`,
+    },
+  ],
+};
+
+export const masterMenu = {
+  title: '招聘相关',
+  children: [
+    {
+      title: '宣讲会',
+      path: `/list/talk/out`,
+    },
+    {
+      title: '招聘会',
+      path: `/list/jobfair/out`,
+    },
+    {
+      title: '招聘信息',
+      path: `/list/jobinfo`,
+    },
+    {
+      title: '正式岗位',
+      path: `/list/jobs/official`,
+    },
+    {
+      title: '实习岗位',
+      path: `/list/jobs/internship`,
+    },
+  ],
+};

+ 2 - 3
src/layout/index/banner.vue

@@ -8,9 +8,8 @@
             <el-col :span="2">
               <el-image style="width:112px;height:112px;" :src="info.logo"></el-image>
             </el-col>
-            <el-col :span="22" style="padding:18px 10px;">
-              <p class="title">{{ info.title }}</p>
-              <p class="english">{{ info.english }}</p>
+            <el-col :span="22" style="padding:30px 10px;">
+              <p class="title">{{ info.name }}</p>
             </el-col>
           </el-col>
         </div>

+ 42 - 5
src/layout/index/huji.vue

@@ -3,19 +3,21 @@
     <el-row>
       <el-col :span="24" class="top">
         <el-col :span="20" class="topTit">
-          <span>{{ title }}</span>
+          <span>{{ hujiList.title || title }}</span>
         </el-col>
         <el-col :span="4" class="topLink">
-          <el-link :underline="false">more<i class="el-icon-d-arrow-right"></i></el-link>
+          <el-link :underline="false" @click="$router.push({ path: path, query: { title: hujiList.title } })"
+            >more<i class="el-icon-d-arrow-right"></i
+          ></el-link>
         </el-col>
       </el-col>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" v-for="(item, index) in hujiList" :key="index">
+        <el-col :span="24" class="list" v-for="(item, index) in infoList" :key="index" @click.native="$router.push({ path: `/detail?id=${item.id}` })">
           <el-col :span="19" class="title">
             <p class="textOver"><i class="el-icon-caret-right icon"></i>{{ item.title }}</p>
           </el-col>
           <el-col :span="5" class="date">
-            {{ item.date }}
+            {{ item.meta | getDate }}
           </el-col>
         </el-col>
       </el-col>
@@ -24,6 +26,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'huji',
   props: {
@@ -32,10 +35,44 @@ export default {
   components: {},
   data: () => ({
     title: '户籍管理',
+    loading: true,
+    infoList: [],
+    path: undefined,
   }),
+  watch: {
+    hujiList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+  },
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      let notice = [];
+      for (const item of columns) {
+        if (!this.path) this.path = item.path;
+        let hujiList = _.get(item, `children`);
+        if (hujiList) {
+          notice = notice.concat(notice, hujiList);
+        }
+      }
+      this.$set(this, `infoList`, notice);
+      this.loading = false;
+    },
+  },
+  filters: {
+    getDate(meta) {
+      let createdAt = _.get(meta, `createdAt`);
+      let date = new Date(createdAt)
+        .toLocaleDateString()
+        .replace('/', '-')
+        .replace('/', '-');
+      return date;
+    },
+  },
 };
 </script>
 

+ 40 - 5
src/layout/index/law.vue

@@ -3,19 +3,19 @@
     <el-row>
       <el-col :span="24" class="top">
         <el-col :span="20" class="topTit">
-          <span>{{ title }}</span>
+          <span> {{ lawList.title || title }}</span>
         </el-col>
         <el-col :span="4" class="topLink">
-          <el-link :underline="false">more<i class="el-icon-d-arrow-right"></i></el-link>
+          <el-link :underline="false" @click="$router.push({ path: path, query: { title: lawList.title } })">more<i class="el-icon-d-arrow-right"></i></el-link>
         </el-col>
       </el-col>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" v-for="(item, index) in lawList" :key="index">
+        <el-col :span="24" class="list" v-for="(item, index) in infoList" :key="index" @click.native="$router.push({ path: `/detail?id=${item.id}` })">
           <el-col :span="19" class="title">
             <p class="textOver"><i class="el-icon-caret-right icon"></i>{{ item.title }}</p>
           </el-col>
           <el-col :span="5" class="date">
-            {{ item.date }}
+            {{ item.meta | getDate }}
           </el-col>
         </el-col>
       </el-col>
@@ -24,6 +24,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'law',
   props: {
@@ -32,10 +33,44 @@ export default {
   components: {},
   data: () => ({
     title: '政策法规',
+    loading: true,
+    infoList: [],
+    path: undefined,
   }),
+  watch: {
+    lawList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+  },
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      let notice = [];
+      for (const item of columns) {
+        if (!this.path) this.path = item.path;
+        let lawList = _.get(item, `children`);
+        if (lawList) {
+          notice = notice.concat(notice, lawList);
+        }
+      }
+      this.$set(this, `infoList`, notice);
+      this.loading = false;
+    },
+  },
+  filters: {
+    getDate(meta) {
+      let createdAt = _.get(meta, `createdAt`);
+      let date = new Date(createdAt)
+        .toLocaleDateString()
+        .replace('/', '-')
+        .replace('/', '-');
+      return date;
+    },
+  },
 };
 </script>
 

+ 28 - 4
src/layout/index/lunbo.vue

@@ -4,8 +4,8 @@
       <el-col :span="24">
         <div class="block">
           <el-carousel height="304px">
-            <el-carousel-item class="list" v-for="(item, index) in carouselList" :key="index">
-              <el-image style="width:540px;height:304px;" :src="item.url"></el-image>
+            <el-carousel-item class="list" v-for="(item, index) in infoList" :key="index">
+              <el-image style="width:540px;height:304px;" :src="item.pic"></el-image>
               <span class="title textOver">{{ item.title }}</span>
             </el-carousel-item>
           </el-carousel>
@@ -16,16 +16,40 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'lunbo',
   props: {
     carouselList: null,
   },
   components: {},
-  data: () => ({}),
+  data: () => ({
+    infoList: [],
+  }),
+  watch: {
+    carouselList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+  },
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      let news = [];
+      for (const item of columns) {
+        if (!this.path) this.path = item.path;
+        let carouselList = _.get(item, `children`);
+        if (carouselList) {
+          news = news.concat(news, carouselList);
+        }
+      }
+      this.$set(this, `infoList`, news);
+      this.loading = false;
+    },
+  },
 };
 </script>
 

+ 37 - 24
src/layout/index/menuInfo.vue

@@ -1,25 +1,39 @@
 <template>
   <div id="menuInfo">
     <el-row>
-      <el-col :sapn="24" class="menu">
-        <div class="w_1270">
+      <el-col :span="24" :style="`background-color:${backColor}`">
+        <div class="w_1200">
           <el-menu
-            :default-active="activeIndex"
+            :default-active="activeIndex1"
             class="el-menu-demo"
             mode="horizontal"
-            @select="handleSelect"
             background-color="#0457c7"
             text-color="#fff"
             active-text-color="#fff"
+            :router="true"
           >
-            <el-menu-item index="1">网站首页</el-menu-item>
-            <el-menu-item index="2">政策法规</el-menu-item>
-            <el-menu-item index="3">网上大厅</el-menu-item>
-            <el-menu-item index="4">招聘信息</el-menu-item>
-            <el-menu-item index="5">就业指导</el-menu-item>
-            <el-menu-item index="6">党员之家</el-menu-item>
-            <el-menu-item index="7">调查问卷</el-menu-item>
-            <el-menu-item index="8">关于我们</el-menu-item>
+            <el-menu-item index="/">网站首页</el-menu-item>
+            <template>
+              <el-submenu index="/jobs">
+                <template slot="title">
+                  {{ jobsMenu.title }}
+                </template>
+                <el-menu-item v-for="(sub, subIndex) in jobsMenu.children" :key="subIndex" :index="sub.path">{{ sub.title }}</el-menu-item>
+              </el-submenu>
+            </template>
+            <template v-for="(item, index) in menuList">
+              <el-submenu :index="`${index}`" :key="index" v-if="item.type !== 'url' && item.type !== 'content'">
+                <template slot="title">
+                  {{ item.title }}
+                </template>
+                <template v-for="(sub, subIndex) in item.children">
+                  <el-menu-item :index="sub.path" :key="subIndex" v-if="sub.type !== 'url'">{{ sub.title }}</el-menu-item>
+                  <el-menu-item :index="``" :key="subIndex" @click="turnTo(sub.url)" v-else> {{ sub.title }}</el-menu-item>
+                </template>
+              </el-submenu>
+              <el-menu-item v-else-if="item.type === 'content'" :index="item.path" :key="index">{{ item.title }}</el-menu-item>
+              <el-menu-item v-else :index="``" :key="index" @click="turnTo(item.url)">{{ item.title }}</el-menu-item>
+            </template>
           </el-menu>
         </div>
       </el-col>
@@ -28,34 +42,33 @@
 </template>
 
 <script>
+import { masterMenu } from '@/config/jobs-menu';
 export default {
   name: 'menuInfo',
-  props: {},
+  props: {
+    menuList: null,
+    backColor: null,
+  },
   components: {},
   data: () => ({
-    activeIndex: '1',
+    activeIndex1: '1',
+    jobsMenu: masterMenu,
   }),
   created() {},
   computed: {},
   methods: {
-    handleSelect(key, keyPath) {
-      // eslint-disable-next-line no-console
-      console.log(key, keyPath);
+    turnTo(url) {
+      window.open(url);
     },
   },
 };
 </script>
 
 <style lang="less" scoped>
-.w_1270 {
-  width: 1270px;
+.w_1200 {
+  width: 1200px;
   margin: 0 auto;
 }
-.menu {
-  height: 50px;
-  line-height: 50px;
-  background: #0457c7;
-}
 /deep/.el-menu--horizontal > .el-menu-item {
   height: 50px;
   line-height: 50px;

+ 34 - 2
src/layout/index/noticeNews.vue

@@ -3,14 +3,14 @@
     <el-row>
       <el-col :span="24">
         <el-tabs v-model="activeName" type="card" :before-leave="handleClick">
-          <el-tab-pane v-for="(item, index) in noticeNewsList" :key="index">
+          <el-tab-pane v-for="(item, index) in infoList" :key="index">
             <span slot="label">{{ item.title }}</span>
             <el-col :span="24" v-for="(tag, index) in item.children" :key="index" class="list">
               <el-col :span="18" class="title">
                 <i class="el-icon-caret-right icon"></i>
                 <p class="textOver">{{ tag.title }}</p>
               </el-col>
-              <el-col :span="5" class="date">{{ tag.date }}</el-col>
+              <el-col :span="5" class="date">{{ tag.meta | getDate }}</el-col>
             </el-col>
           </el-tab-pane>
         </el-tabs>
@@ -20,6 +20,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'noticeNews',
   props: {
@@ -28,7 +29,15 @@ export default {
   components: {},
   data: () => ({
     activeName: '',
+    infoList: [],
   }),
+  watch: {
+    noticeNewsList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+  },
   created() {},
   computed: {},
   methods: {
@@ -36,6 +45,29 @@ export default {
       // eslint-disable-next-line no-console
       console.log(tab, event);
     },
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      // let notice = [];
+      // for (const item of columns) {
+      //   if (!this.path) this.path = item.path;
+      //   let noticeNewsList = _.get(item, `children`);
+      //   if (noticeNewsList) {
+      //     notice = notice.concat(notice, noticeNewsList);
+      //   }
+      // }
+      this.$set(this, `infoList`, columns);
+      this.loading = false;
+    },
+  },
+  filters: {
+    getDate(meta) {
+      let createdAt = _.get(meta, `createdAt`);
+      let date = new Date(createdAt)
+        .toLocaleDateString()
+        .replace('/', '-')
+        .replace('/', '-');
+      return date;
+    },
   },
 };
 </script>

+ 71 - 9
src/layout/index/recruit.vue

@@ -28,30 +28,41 @@
                 </el-col>
                 <el-col :span="24" class="recruitList" v-for="(item, index) in recruitList" :key="index">
                   <el-col :span="6" class="jobs">
-                    <p class="textOver">{{ item.jobs }}</p>
+                    <p class="textOver">{{ item.jobs | getJobs }}</p>
                   </el-col>
-                  <el-col :span="10" class="company">
-                    <p class="textOver">{{ item.company }}</p>
+                  <el-col :span="10" class="company" v-if="item.corpid">
+                    <p class="textOver" @click="$router.push({ path: '/corp', query: { id: item.corpid } })">{{ item.title }}</p>
+                  </el-col>
+                  <el-col :span="10" class="company" v-else>
+                    <p class="textOver">{{ item.title }}</p>
                   </el-col>
                   <el-col :span="4" class="btn">
-                    <el-button>[在线投递简历]</el-button>
+                    <el-button @click="$router.push({ path: '/jobinfoDetail', query: { id: item.id } })">[在线投递简历]</el-button>
                   </el-col>
                   <el-col :span="4" class="date">
-                    {{ item.date }}
+                    {{ item.meta | getDate }}
                   </el-col>
                 </el-col>
               </el-col>
               <el-col :span="4" class="rightList">
                 <el-col :span="24" class="rightTop">
                   <el-col :span="16" class="rightTopTit">
-                    <span>{{ zixunTitle }}</span>
+                    <span>{{ zixunList.title || title }}</span>
                   </el-col>
                   <el-col :span="8" class="rightTopLink">
-                    <el-link :underline="false">more<i class="el-icon-d-arrow-right"></i></el-link>
+                    <el-link :underline="false" @click="$router.push({ path: path, query: { title: zixunList.title } })"
+                      >more<i class="el-icon-d-arrow-right"></i
+                    ></el-link>
                   </el-col>
                 </el-col>
                 <el-col :span="24">
-                  <el-col :span="24" class="zixunList" v-for="(item, index) in zixunList" :key="index">
+                  <el-col
+                    :span="24"
+                    class="zixunList"
+                    v-for="(item, index) in infoList"
+                    :key="index"
+                    @click.native="$router.push({ path: `/detail?id=${item.id}` })"
+                  >
                     <p class="title textOver">{{ item.title }}</p>
                   </el-col>
                 </el-col>
@@ -65,6 +76,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'recruit',
   props: {
@@ -76,10 +88,60 @@ export default {
     url: require('@/assets/zhaopin.jpg'),
     title: '最新招聘',
     zixunTitle: '就业咨询',
+    loading: true,
+    infoList: [],
+    path: undefined,
   }),
+  watch: {
+    zixunList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+    recruitList: {
+      handler(val) {
+        if (val) this.loading = false;
+      },
+    },
+  },
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      let notice = [];
+      for (const item of columns) {
+        if (!this.path) this.path = item.path;
+        let zixunList = _.get(item, `children`);
+        if (zixunList) {
+          notice = notice.concat(notice, zixunList);
+        }
+      }
+      this.$set(this, `infoList`, notice);
+      this.loading = false;
+    },
+  },
+  filters: {
+    getJobs(jobs) {
+      let returns = null;
+      if (jobs.length > 0) {
+        for (const item of jobs) {
+          returns = returns === null ? `${item.job_name}` : `${returns};${item.job_name}`;
+        }
+      } else {
+        returns = '无招聘职位';
+      }
+      return returns;
+    },
+    getDate(meta) {
+      let createdAt = _.get(meta, `createdAt`);
+      let date = new Date(createdAt)
+        .toLocaleDateString()
+        .replace('/', '-')
+        .replace('/', '-');
+      return date;
+    },
+  },
 };
 </script>
 

+ 42 - 5
src/layout/index/service.vue

@@ -3,19 +3,21 @@
     <el-row>
       <el-col :span="24" class="top">
         <el-col :span="20" class="topTit">
-          <span>{{ title }}</span>
+          <span> {{ serviceList.title || title }}</span>
         </el-col>
         <el-col :span="4" class="topLink">
-          <el-link :underline="false">more<i class="el-icon-d-arrow-right"></i></el-link>
+          <el-link :underline="false" @click="$router.push({ path: path, query: { title: serviceList.title } })"
+            >more<i class="el-icon-d-arrow-right"></i
+          ></el-link>
         </el-col>
       </el-col>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" v-for="(item, index) in serviceList" :key="index">
+        <el-col :span="24" class="list" v-for="(item, index) in infoList" :key="index" @click.native="$router.push({ path: `/detail?id=${item.id}` })">
           <el-col :span="19" class="title">
             <p class="textOver"><i class="el-icon-caret-right icon"></i>{{ item.title }}</p>
           </el-col>
           <el-col :span="5" class="date">
-            {{ item.date }}
+            {{ item.meta | getDate }}
           </el-col>
         </el-col>
       </el-col>
@@ -24,6 +26,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'service',
   props: {
@@ -32,10 +35,44 @@ export default {
   components: {},
   data: () => ({
     title: '档案服务',
+    loading: true,
+    infoList: [],
+    path: undefined,
   }),
+  watch: {
+    serviceList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+  },
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      let notice = [];
+      for (const item of columns) {
+        if (!this.path) this.path = item.path;
+        let serviceList = _.get(item, `children`);
+        if (serviceList) {
+          notice = notice.concat(notice, serviceList);
+        }
+      }
+      this.$set(this, `infoList`, notice);
+      this.loading = false;
+    },
+  },
+  filters: {
+    getDate(meta) {
+      let createdAt = _.get(meta, `createdAt`);
+      let date = new Date(createdAt)
+        .toLocaleDateString()
+        .replace('/', '-')
+        .replace('/', '-');
+      return date;
+    },
+  },
 };
 </script>
 

+ 1 - 1
src/layout/index/top.vue

@@ -3,7 +3,7 @@
     <el-row>
       <el-col :span="24" class="top">
         <div class="w_1270">
-          <el-col :span="19" class="title"> 您好,欢迎访问{{ info.title }}! </el-col>
+          <el-col :span="19" class="title"> 您好,欢迎访问{{ info.name }}! </el-col>
           <!-- <el-col :span="4" class="fenxiang">
             <el-col :span="12" class="weibo">
               <el-link :underline="false">

+ 31 - 4
src/layout/index/xiazai.vue

@@ -3,14 +3,16 @@
     <el-row>
       <el-col :span="24" class="top">
         <el-col :span="16" class="topTit">
-          <span>{{ title }}</span>
+          <span>{{ xiazaiList.title || title }}</span>
         </el-col>
         <el-col :span="8" class="topLink">
-          <el-link :underline="false">more<i class="el-icon-d-arrow-right"></i></el-link>
+          <el-link :underline="false" @click="$router.push({ path: path, query: { title: xiazaiList.title } })"
+            >more<i class="el-icon-d-arrow-right"></i
+          ></el-link>
         </el-col>
       </el-col>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" v-for="(item, index) in xiazaiList" :key="index">
+        <el-col :span="24" class="list" v-for="(item, index) in infoList" :key="index" @click.native="$router.push({ path: `/detail?id=${item.id}` })">
           <p class="title textOver">{{ item.title }}</p>
         </el-col>
       </el-col>
@@ -19,6 +21,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'xiazai',
   props: {
@@ -27,10 +30,34 @@ export default {
   components: {},
   data: () => ({
     title: '下载专区',
+    loading: true,
+    infoList: [],
+    path: undefined,
   }),
+  watch: {
+    xiazaiList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+  },
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      let notice = [];
+      for (const item of columns) {
+        if (!this.path) this.path = item.path;
+        let xiazaiList = _.get(item, `children`);
+        if (xiazaiList) {
+          notice = notice.concat(notice, xiazaiList);
+        }
+      }
+      this.$set(this, `infoList`, notice);
+      this.loading = false;
+    },
+  },
 };
 </script>
 

+ 42 - 5
src/layout/index/zhidao.vue

@@ -3,19 +3,21 @@
     <el-row>
       <el-col :span="24" class="top">
         <el-col :span="20" class="topTit">
-          <span>{{ title }}</span>
+          <span> {{ zhidaoList.title || title }}</span>
         </el-col>
         <el-col :span="4" class="topLink">
-          <el-link :underline="false">more<i class="el-icon-d-arrow-right"></i></el-link>
+          <el-link :underline="false" @click="$router.push({ path: path, query: { title: zhidaoList.title } })"
+            >more<i class="el-icon-d-arrow-right"></i
+          ></el-link>
         </el-col>
       </el-col>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" v-for="(item, index) in zhidaoList" :key="index">
+        <el-col :span="24" class="list" v-for="(item, index) in infoList" :key="index" @click.native="$router.push({ path: `/detail?id=${item.id}` })">
           <el-col :span="19" class="title">
             <p class="textOver"><i class="el-icon-caret-right icon"></i>{{ item.title }}</p>
           </el-col>
           <el-col :span="5" class="date">
-            {{ item.date }}
+            {{ item.meta | getDate }}
           </el-col>
         </el-col>
       </el-col>
@@ -24,6 +26,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'zhidao',
   props: {
@@ -31,11 +34,45 @@ export default {
   },
   components: {},
   data: () => ({
+    loading: true,
     title: '就业指导',
+    infoList: [],
+    path: undefined,
   }),
+  watch: {
+    zhidaoList: {
+      handler(val) {
+        if (val) this.assignData(val);
+      },
+    },
+  },
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    assignData(data) {
+      let columns = _.get(data, 'children');
+      let notice = [];
+      for (const item of columns) {
+        if (!this.path) this.path = item.path;
+        let zhidaoList = _.get(item, `children`);
+        if (zhidaoList) {
+          notice = notice.concat(notice, zhidaoList);
+        }
+      }
+      this.$set(this, `infoList`, notice);
+      this.loading = false;
+    },
+  },
+  filters: {
+    getDate(meta) {
+      let createdAt = _.get(meta, `createdAt`);
+      let date = new Date(createdAt)
+        .toLocaleDateString()
+        .replace('/', '-')
+        .replace('/', '-');
+      return date;
+    },
+  },
 };
 </script>
 

+ 23 - 0
src/store/column.js

@@ -0,0 +1,23 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/cms/column/list`,
+  fetch: id => `/api/cms/column/fetch/${id}`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getColumn({ commit }, { type, data }) {
+    let result;
+    if (type === `list`) {
+      result = await this.$axios.$get(api.list, data);
+    } else {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+
+    return result;
+  },
+};

+ 31 - 0
src/store/corp.js

@@ -0,0 +1,31 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  corpBase: corpid => `/api/corp/corps/${corpid}`,
+  corpInfo: corpid => `/api/corp/corps/${corpid}/info`,
+  corpIdentity: corpid => `/api/corp/corps/${corpid}/identity`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getCorp({ state }, { type, data }) {
+    let result;
+    if (type === 'search') {
+      let { corpid } = data;
+      result = await this.$axios.$get(api.corpInfo(corpid));
+    }
+    if (type === 'component') {
+      let { corpid } = data;
+      let base = await this.$axios.$get(api.corpBase(corpid));
+      let info = await this.$axios.$get(api.corpInfo(corpid));
+      let identity = await this.$axios.$get(api.corpIdentity(corpid));
+      result = {
+        data: { ...info.data, ...identity.data, ...base.data },
+        errcode: `${info.errcode}` === '0' && `${identity.errcode}` === '0' && `${base.errcode}` === '0' ? '0' : '1',
+      };
+    }
+    return result;
+  },
+};

+ 24 - 1
src/store/index.js

@@ -1,5 +1,16 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
+import * as site from './site';
+import * as menu from './menu';
+import * as modules from './module';
+import * as column from './column';
+import * as news from './news';
+import * as jobinfo from './jobinfo';
+import * as posts from './posts';
+import * as linkCor from './link-cor';
+import * as jobfair from './jobfair';
+import * as talk from './talk';
+import * as corp from './corp';
 
 Vue.use(Vuex);
 
@@ -7,5 +18,17 @@ export default new Vuex.Store({
   state: {},
   mutations: {},
   actions: {},
-  modules: {},
+  modules: {
+    site: site,
+    menu: menu,
+    modules: modules,
+    column: column,
+    news: news,
+    jobinfo: jobinfo,
+    posts: posts,
+    linkCor: linkCor,
+    jobfair: jobfair,
+    talk: talk,
+    corp: corp,
+  },
 });

+ 50 - 0
src/store/jobfair.js

@@ -0,0 +1,50 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  range: `/api/jobs/fairs/date`,
+  list: `/api/jobs/fairs`,
+  fetch: id => `/api/jobs/fairs/${id}`,
+  //双选会企业信息
+  fairCorp: '/api/jobs/faircorps',
+  fairJobs: id => `/api/jobs/faircorps/${id}/jobs`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getJobfair({ state }, { type, data }) {
+    let { skip = 0, limit } = data;
+    let result;
+    if (type !== 'fetch') {
+      let { schid, date, ...searchInfo } = data;
+      result = await this.$axios.$get(_.get(api, type), {
+        schid: schid,
+        skip: skip,
+        limit: limit,
+        date: date,
+        status: '1',
+        ...searchInfo,
+      });
+    }
+    if (type === 'fetch') {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+    return result;
+  },
+  //招聘会企业信息
+  async fairInfoOperation({ state }, { type, data }) {
+    let result;
+    let { skip, limit } = data;
+    if (type === 'searchCorp') {
+      let { schid, fairid, corpid, status } = data;
+      result = this.$axios.$get(api.fairCorp, { schid: schid, fairid: fairid, corpid: corpid, status: status, skip: skip, limit: limit });
+    }
+    if (type === 'searchJobs') {
+      let { id } = data;
+      result = this.$axios.$get(api.fairJobs(id), { skip: skip, limit: limit });
+    }
+    return result;
+  },
+};

+ 37 - 0
src/store/jobinfo.js

@@ -0,0 +1,37 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/jobs/infos`,
+  fetch: id => `/api/jobs/infos/${id}`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  //在线招聘
+  async getJobInfo({ state }, { type, data }) {
+    let { skip = 0, limit } = data;
+    let result;
+    if (type === 'list') {
+      let { schid, is_practice, ...searchInfo } = data;
+      result = await this.$axios.$get(
+        api.list,
+        {},
+        {
+          schid: schid,
+          is_practice: is_practice,
+          skip: skip,
+          limit: limit,
+          status: 1,
+          ...searchInfo,
+        }
+      );
+    }
+    if (type === 'search') {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+    return result;
+  },
+};

+ 21 - 0
src/store/link-cor.js

@@ -0,0 +1,21 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/cms/img/list`,
+  fetch: id => `/api/cms/img/list/${id}`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  //在线招聘
+  async getLink({ state }) {
+    let result = {};
+    let corps = await this.$axios.$get(api.list, { type: 'cooperation', is_use: '0' });
+    if (corps.errcode === 0) result.corps = corps.data;
+    let links = await this.$axios.$get(api.list, { type: 'link', is_use: '0' });
+    if (links.errcode === 0) result.links = links.data;
+    return result;
+  },
+};

+ 22 - 0
src/store/menu.js

@@ -0,0 +1,22 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/cms/menu/list`,
+  fetch: id => `/api/cms/menu/fetch/${id}`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getMenu({ commit }, { type, data }) {
+    let result;
+    if (type === `list`) {
+      result = await this.$axios.$get(api.list, data);
+    } else {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+    return result;
+  },
+};

+ 15 - 0
src/store/module.js

@@ -0,0 +1,15 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/cms/modules/list`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getModule({ commit }, { type, data }) {
+    let result = await this.$axios.$get(_.get(api, type), data);
+    return result;
+  },
+};

+ 24 - 0
src/store/news.js

@@ -0,0 +1,24 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/cms/news/list`,
+  fetch: id => `/api/cms/news/fetch/${id}`,
+  bugList: `/api/cms/newscreeper/list`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getNews({ commit }, { type, data }) {
+    let result;
+    if (type !== 'fetch') {
+      result = await this.$axios.$get(api.bugList, data);
+    } else {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+
+    return result;
+  },
+};

+ 34 - 0
src/store/posts.js

@@ -0,0 +1,34 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/jobs/posts`,
+  fetch: id => `/api/jobs/posts/${id}`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  //在线招聘
+  async getPosts({ state }, { type, data }) {
+    let { skip = 0, limit } = data;
+    let result;
+    if (type === 'list') {
+      let { schid, corpid, is_practice, is_publish, ...searchInfo } = data;
+      result = await this.$axios.$get(api.list, {
+        schid: schid,
+        corpid: corpid,
+        is_practice: is_practice,
+        skip: skip,
+        limit: limit,
+        is_publish: is_publish,
+        ...searchInfo,
+      });
+    }
+    if (type === 'fetch') {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+    return result;
+  },
+};

+ 21 - 0
src/store/site.js

@@ -0,0 +1,21 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  query: `/api/cms/site/query`,
+  fetch: `/api/cms/site/config`,
+  content: `/api/cms/site/content`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getSite({ commit }, { type, data }) {
+    let content = await this.$axios.$get(api.content, {});
+    let result = await this.$axios.$get(_.get(api, `fetch`));
+    if (content.data && `${content.errcode}` === '0') {
+      result.data.content = content && content.data ? content.data : '';
+    }
+    return result;
+  },
+};

+ 32 - 0
src/store/talk.js

@@ -0,0 +1,32 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  list: `/api/jobs/talks`,
+  fetch: id => `/api/jobs/talks/${id}`,
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async getTalk({ state }, { type, data }) {
+    let { skip = 0, limit } = data;
+    let result;
+    if (type !== 'fetch') {
+      let { schid, date, ...searchInfo } = data;
+      result = await this.$axios.$get(_.get(api, type), {
+        schid: schid,
+        skip: skip,
+        limit: limit,
+        date: date,
+        status: '1',
+        ...searchInfo,
+      });
+    }
+    if (type === 'fetch') {
+      let { id } = data;
+      result = await this.$axios.$get(api.fetch(id));
+    }
+    return result;
+  },
+};

+ 1 - 1
src/util/axios-wrapper.js

@@ -83,7 +83,7 @@ export default class AxiosWrapper {
       }
       // unwrap data
       if (this.unwrap) {
-        res = _.omit(res, ['errcode', 'errmsg', 'details']);
+        res = _.omit(res, ['errmsg', 'details']);
         const keys = Object.keys(res);
         if (keys.length === 1 && keys.includes('data')) {
           res = res.data;

+ 198 - 75
src/views/index.vue

@@ -1,18 +1,19 @@
 <template>
   <div id="index">
     <index-detail
-      :backColor="backColor"
-      :info="info"
+      :info="site"
+      :menuList="menu"
       :carouselList="carouselList"
-      :noticeNewsList="noticeNewsList"
+      :noticeNewsList="noticeList"
       :zhidaoList="zhidaoList"
       :lawList="lawList"
       :serviceList="serviceList"
       :hujiList="hujiList"
       :xiazaiList="xiazaiList"
-      :recruitList="recruitList"
+      :recruitList="jobinfoList"
       :zixunList="zixunList"
       :nativeList="nativeList"
+      :backColor="backColor"
     ></index-detail>
   </div>
 </template>
@@ -20,14 +21,20 @@
 <script>
 import indexDetail from '@/components/index.vue';
 import { urlList } from '@/config/url';
+import { mapActions, mapState } from 'vuex';
+import _ from 'lodash';
 export default {
+  metaInfo() {
+    return {
+      title: this.siteTitle ? this.siteTitle : '就业信息网',
+    };
+  },
   name: 'index',
   props: {},
   components: {
     indexDetail,
   },
   data: () => ({
-    backColor: '#0457c7',
     info: {
       title: '吉林省高等学校毕业生就业信息网',
       english: 'Jilin University Graduate Employment Guidance Center',
@@ -35,78 +42,194 @@ export default {
       logo: require('@/assets/logo.png'),
       copyright: '吉ICP备09006292号-1 Copyright 2019 版权所有 吉林省高等学校毕业生就业指导中心 All Rights Reserved',
     },
-    carouselList: [
-      {
-        url: require('@/assets/news.jpg'),
-        title: '标题',
-      },
-    ],
-    noticeNewsList: [
-      {
-        title: '通知公告',
-        children: [
-          {
-            title: '通知公告信息',
-            date: '2019-12-10',
-          },
-        ],
-      },
-      {
-        title: '就业动态',
-        children: [
-          {
-            title: '就业动态信息',
-            date: '2019-12-10',
-          },
-        ],
-      },
-    ],
-    zhidaoList: [
-      {
-        title: '標題',
-        date: '2019-12-10',
-      },
-    ],
-    lawList: [
-      {
-        title: '標題',
-        date: '2019-12-10',
-      },
-    ],
-    serviceList: [
-      {
-        title: '標題',
-        date: '2019-12-10',
-      },
-    ],
-    hujiList: [
-      {
-        title: '標題',
-        date: '2019-12-10',
-      },
-    ],
-    xiazaiList: [
-      {
-        title: '标题',
-      },
-    ],
-    recruitList: [
-      {
-        jobs: 'web工程师',
-        company: '长春福瑞科技有限公司',
-        date: '2019-12-10',
-      },
-    ],
-    zixunList: [
-      {
-        title: '标题',
-      },
-    ],
-    nativeList: urlList,
+    site: {}, //站点信息
+    siteTitle: {}, //站点标题
+    menu: [], //菜单
+    modules: [], //模块
+    carouselList: [], //图片新闻
+    noticeList: [], //通知公告+就业动态
+    zhidaoList: [], //就业指导
+    lawList: [], //政策法规
+    serviceList: [], //档案服务
+    hujiList: [], //户籍管理
+    xiazaiList: [], //下载专区
+    recruitList: [], //招聘信息
+    zixunList: [], //就业咨询
+    jobinfoList: [], //招聘信息
+    nativeList: urlList, //网站导航
+    backColor: '#0457c7',
   }),
-  created() {},
+  async created() {
+    await this.toGetSite(); //获取主站信息
+    this.loadMenu(); //获取菜单信息
+    this.toGetModule(); //获取模块信息
+    this.toGetJobInfo(); //获取招聘信息
+    // this.toGetLinks(); //招聘信息+网站链接
+    // this.self();
+  },
   computed: {},
-  methods: {},
+  methods: {
+    ...mapActions(['getSite', `getMenu`, 'getColumn', 'getModule', 'getNews', 'getJobInfo', 'getPosts', 'getLink']),
+    //站点信息
+    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));
+        this.finishedMenu();
+        return;
+      } else this.toGetMenu();
+    },
+    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?id=${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;
+      }
+    },
+    //模块
+    async loadModule() {
+      let modules = sessionStorage.getItem('modules');
+      if (modules) {
+        this.$set(this, `modules`, JSON.parse(modules));
+        return;
+      }
+      this.toGetMenu();
+    },
+    async toGetModule() {
+      let result = await this.getModule({ type: `list` });
+      if (result.errcode === 0) {
+        sessionStorage.setItem('modules', JSON.stringify(result.data));
+        this.$set(this, `modules`, result.data);
+        this.finishedModule();
+      }
+    },
+    async finishedModule() {
+      let modules = JSON.parse(JSON.stringify(this.modules));
+      for (const item of modules) {
+        if (`${item.is_use}` === `0`) {
+          let res = await this.completeModules(item);
+          item.children = res;
+        }
+      }
+      for (const item of modules) {
+        this.$set(this, `${item.category}List`, item);
+      }
+      this.$set(this, `modules`, modules);
+    },
+    async completeModules(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 === `bugList`) {
+            col.path = `/list/module/${col.content_id}`;
+            col.children = await this.completeColumn(col);
+          } else if (col.type === `column`) {
+            col.path = `/list/module/${col.id}`;
+            col.children = await this.completeColumn(col);
+          } else if (col.type === `content`) {
+            col.path = `/detail/${col.content_id}`;
+          }
+        }
+        return columns;
+      }
+    },
+    async completeColumn(item) {
+      console.log(item);
+      let data = { skip: 0, limit: 8 };
+      if (item.type === `bugList`) {
+        data.news_type = `0`;
+        data.parent_id = item.content_id;
+      } else {
+        data.news_type = `1`;
+        data.parent_id = item.id;
+      }
+      let result = await this.getNews({ type: 'bugList', data: data });
+      if (result.errcode === 0) {
+        return result.data;
+      }
+    },
+    //获取招聘信息
+    async toGetJobInfo() {
+      let result = await this.getJobInfo({ type: 'list', data: { limit: 8 } });
+      if (`${result.errcode}` === '0') {
+        for (const item of result.data) {
+          if (!item.jobs || !(item.jobs.length > 0)) continue;
+          let jobs = [];
+          for (let job of item.jobs) {
+            let jobInfo = await this.toGetPosts(job);
+            jobs.push(jobInfo);
+          }
+          item.jobs = jobs;
+        }
+        this.$set(this, 'jobinfoList', result.data);
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
+    },
+    async toGetPosts(id) {
+      let result = await this.getPosts({ type: 'fetch', data: { id: id } });
+      if (result.errcode === 0) return result.data;
+    },
+  },
 };
 </script>