lrf402788946 5 anni fa
parent
commit
d450e2c070

+ 57 - 0
src/config/master-info.js

@@ -0,0 +1,57 @@
+export const masterInfo = {
+  noticeinfo: {
+    english: 'announcement',
+    title: '最新公告',
+  },
+  jobsinfo: {
+    english: 'School activities',
+    title: '学校活动',
+  },
+  fasttop: {
+    english: 'Fast track',
+    title: '快速通道',
+  },
+  fastlist: [
+    {
+      url: require('@/assets/master/zhiye.png'),
+      title: '职业测评',
+      link: 'http://ccut.51langtu.com/improperBrowser.htm',
+      content: '职业测评是心理测验的一个分支,在学术上被广泛认可的心理测验职业测评是心理测验的一个分支,在学术上被广泛认可的心理测验',
+    },
+    {
+      url: require('@/assets/master/jiuye.png'),
+      title: '就业心理咨询',
+      link: 'http://xlzx.zt.ccut.edu.cn/',
+      content: '心理咨询是指运用心理学的方法,对心理适应方面出现问题并企求解决问题',
+    },
+    {
+      url: require('@/assets/master/xinli.png'),
+      title: '就业信息网',
+      link: 'http://www.jilinjobs.cn/',
+      content: '吉林省高等学校毕业生就业信息网',
+    },
+    {
+      url: require('@/assets/master/yingzheng.png'),
+      title: '应征入伍',
+      link: 'http://wzb.dept.ccut.edu.cn/',
+      content: '应征入伍是指从2010年开始部队每年从应届高校毕业生中征收义务兵。',
+    },
+  ],
+  companytop: {
+    english: 'recruiters',
+    title: '招聘企业',
+  },
+  unittop: {
+    logoBei: require('@/assets/master/hezuobei.png'),
+    english: 'cooperation unit',
+    title: '合作单位',
+  },
+  contactinfo: {
+    english: 'Contact us',
+    title: '联系我们',
+  },
+  rilitop: {
+    english: 'job fair',
+    title: '招聘会',
+  },
+};

+ 2 - 2
src/plugins/var.js

@@ -7,8 +7,8 @@ const getSiteId = () => {
   let arr = host.split('.');
   if (arr.length > 0) {
     schId = arr[0];
-    `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? (schId = 'master') : '';
-    sessionStorage.setItem('schId', `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? 'master' : schId);
+    `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? (schId = '99991') : '';
+    sessionStorage.setItem('schId', `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? '99991' : schId);
   }
   return schId;
 };

+ 9 - 19
src/router.js

@@ -91,45 +91,35 @@ const router = new Router({
       component: () => import('@/views/master/index/index.vue'),
     },
     {
-      path: '/masterstudent',
+      path: '/masterstudent', //学生登录
       name: 'student',
       component: () => import('@/views/master/login/student.vue'),
     },
     {
-      path: '/mastercompany',
+      path: '/mastercompany', //企业登录1
       name: 'company',
       component: () => import('@/views/master/login/company.vue'),
     },
     {
-      path: '/mastercompanys',
+      path: '/mastercompanys', //企业登录2
       name: 'companys',
       component: () => import('@/views/master/login/companys.vue'),
     },
     {
-      path: '/masternews',
-      name: 'list',
+      path: '/master/jobs/:type', //新闻类列表
+      name: 'master_jobs_list',
       component: () => import('@/views/master/news/list.vue'),
     },
     {
-      path: '/masternewsdetail',
-      name: 'detail',
+      path: '/master/detail/:type/:id', //新闻类详情
+      name: 'master_detail',
       component: () => import('@/views/master/news/detail.vue'),
     },
     {
-      path: '/masternotice',
-      name: 'masterlists',
+      path: '/master/notice/:parent_id',
+      name: 'master_notice',
       component: () => import('@/views/master/notice/list.vue'),
     },
-    {
-      path: '/masternoticedetail',
-      name: 'masterdetails',
-      component: () => import('@/views/master/notice/detail.vue'),
-    },
-    {
-      path: '/style',
-      name: 'masterdetails',
-      component: () => import('@/views/master/style.vue'),
-    },
   ],
 });
 router.afterEach((to, from, next) => {

+ 45 - 38
src/views/index/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="request">
-    <el-row v-if="!checkUser()">
+    <el-row v-if="user !== 'master'">
       <pages-one
         v-if="!loading"
         :topInfo="site"
@@ -23,38 +23,33 @@
         </template>
       </pages-one>
     </el-row>
-    <master
-      :topinfo="topinfo"
-      :menulist="menulist"
-      :bannerinfo="bannerinfo"
-      :newsList="newsList"
-      :noticeinfo="noticeinfo"
-      :noticelist="noticelist"
-      :huodonginfo="huodonginfo"
-      :talksList="talksList"
-      :fairsList="fairsList"
-      :talksoutList="talksoutList"
-      :infoList="infoList"
-      :shiyelist="shiyelist"
-      :teacherlist="teacherlist"
-      :danweilist="danweilist"
-      :gongwulist="gongwulist"
-      :xuantiaolist="xuantiaolist"
-      :xibulist="xibulist"
-      :teganglist="teganglist"
-      :sanzhilist="sanzhilist"
-      :cunguanlist="cunguanlist"
-      :rilitop="rilitop"
-      :fasttop="fasttop"
-      :fastlist="fastlist"
-      :contactinfo="contactinfo"
-      :companytop="companytop"
-      :companylist="companylist"
-      :unittop="unittop"
-      :unitlist="unitlist"
-      :footinfo="footinfo"
-      v-else
-    ></master>
+    <el-row v-else>
+      <master
+        v-if="!loading"
+        :topinfo="site"
+        :menulist="menu"
+        :bannerinfo="master.bannerinfo"
+        :newsList="news.infoList"
+        :noticeinfo="master.noticeinfo"
+        :noticelist="notice.infoList"
+        :huodonginfo="master.jobsinfo"
+        :fairsList="jobfairList"
+        :talksList="talksOutList"
+        :infoList="jobinfoList"
+        :recruitList="self1List"
+        :otherList="self2List"
+        :fasttop="master.fasttop"
+        :fastlist="master.fastlist"
+        :contactinfo="master.contactinfo"
+        :content="site.content"
+        :companytop="master.companytop"
+        :unittop="master.unittop"
+        :unitlist="coopList"
+        :footinfo="site"
+        :rilitop="master.rilitop"
+      ></master>
+      <!--  :companylist="companylist" -->
+    </el-row>
   </div>
 </template>
 
@@ -65,6 +60,8 @@ import master from '@publics/src/views/master/index/index.vue';
 import topMenu from '@/layout/layout-part/top-menu.vue';
 import selfCalendar from '@/components/self-calendar.vue';
 import pagesOne from '@publics/src/views/index.vue';
+//master部分
+import { masterInfo } from '@/config/master-info';
 import { mapActions, mapState } from 'vuex';
 export default {
   name: 'request',
@@ -76,6 +73,7 @@ export default {
     master,
   },
   data: () => ({
+    user: 'master',
     //menu部分
     activeIndex: '1',
     menu: [],
@@ -94,12 +92,16 @@ export default {
     self2List: [],
     coopList: [],
     linkList: [],
+    //master数据
+    master: { ...masterInfo },
   }),
   async created() {
+    await this.checkUser();
     await this.getSite();
     this.search();
     this.getModule();
     this.getLink();
+    if (this.user === 'master') this.masterData();
     await this.getMenu();
     this.$set(this, `loading`, false);
   },
@@ -119,8 +121,9 @@ export default {
     //检查用户身份
     checkUser() {
       let schId = sessionStorage.getItem('schId');
-      if (schId === 'master') return false;
-      else return true;
+      if (schId === 'master') {
+        this.$set(this, `user`, schId);
+      }
     },
     //获取站点信息
     async getSite() {
@@ -138,14 +141,14 @@ export default {
     //查询招聘类信息
     async search() {
       // 1直接拿着参数发送请求
-      let result = await this.postTalksInfo({ type: 'list', data: { schid: this.$site } });
+      let result = await this.postTalksInfo({ type: 'list', data: { schid: this.user === 'master' ? null : this.$site } });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
         this.$set(this, `talksList`, result.data);
       } else {
         this.$message.error(result.errmsg ? result.errmsg : 'error');
       }
-      result = await this.jobfairOperation({ type: 'list', data: { schid: this.$site } });
+      result = await this.jobfairOperation({ type: 'list', data: { schid: this.user === 'master' ? null : this.$site } });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
         this.$set(this, `jobfairList`, result.data);
@@ -214,7 +217,7 @@ export default {
     //根据条件获取信息
     async getNews(item, news_type) {
       //这个item是栏目列表,循环查每个栏目6条信息
-      let res = await this.newsOperation({ type: 'list', data: { parent_id: item.id, skip: 0, limit: 6 } });
+      let res = await this.newsOperation({ type: 'list', data: { parent_id: item.id, skip: 0, limit: 4, news_type: news_type } });
       if (`${res.errcode}` === '0') {
         return res.data;
       }
@@ -302,6 +305,10 @@ export default {
         return res.data;
       }
     },
+    //主站信息组合
+    masterData() {
+      this.$set(this.master, `bannerinfo`, { banner: this.site.banner });
+    },
   },
 };
 </script>

+ 4 - 1
src/views/info/list.vue

@@ -53,6 +53,9 @@ export default {
     parent_id() {
       return this.$route.params.parent_id;
     },
+    news_type() {
+      return this.$route.query.news_type;
+    },
   },
   watch: {
     parent_id: 'search',
@@ -64,7 +67,7 @@ export default {
       if (page) {
         skip = (page - 1) * this.$limit;
       }
-      let newData = { skip: skip, limit: this.$limit, ...this.searchInfo, parent_id: this.parent_id };
+      let newData = { skip: skip, limit: this.$limit, ...this.searchInfo, parent_id: this.parent_id, news_type: this.news_type };
       let result = await this.newsOperation({ type: 'list', data: { site: this.$site, ...newData } });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值

+ 114 - 44
src/views/master/news/detail.vue

@@ -1,65 +1,135 @@
 <template>
   <div id="detail">
-    <login-Detail
-      :topinfo="topinfo"
-      :menulist="menulist"
-      :bannerinfo="bannerinfo"
-      :noticedetail="noticedetail"
-      :leftmenu="leftmenu"
-      :footinfo="footinfo"
-    ></login-Detail>
+    <login-Detail :topinfo="site" :menulist="menu" :bannerinfo="master.bannerinfo" :noticedetail="info" :footinfo="site"></login-Detail>
   </div>
 </template>
 
 <script>
 import loginDetail from '@publics/src/views/master/news/detail.vue';
+import { mapActions, mapState } from 'vuex';
+import { masterInfo } from '@/config/master-info';
+import _ from 'lodash';
+
 export default {
   name: 'detail',
   props: {},
   components: {
     loginDetail,
   },
+  async created() {
+    await this.getSite();
+    await this.getMenu();
+    this.masterData();
+    await this.search();
+  },
   data: () => ({
-    topinfo: {
-      logo: require('@/assets/master/logo.jpg'),
-      title: '长春工业大学就业信息网',
+    site: {},
+    master: { ...masterInfo },
+    info: {},
+    menu: [],
+    jobList: [],
+  }),
+  computed: {
+    type() {
+      return this.$route.params.type;
     },
-    menulist: [{ title: '首页' }, { title: '就业新闻' }, { title: '最新公告' }],
-    bannerinfo: {
-      banner: require('@/assets/master/masterbanner.png'),
+    id() {
+      return this.$route.params.id;
     },
-    leftmenu: [
-      {
-        title: '就业新闻',
-      },
-      {
-        title: '学校动态',
-      },
-      {
-        title: '文化活动',
-      },
-      {
-        title: '招生动态',
-      },
-      {
-        title: '考试动态',
-      },
-    ],
-    noticedetail: {
-      title: '我省成功举办全国高校就业培训',
-      time: '2019-10-31',
-      url: require('@/assets/master/newsdetail.png'),
-      content: '我省成功举办全国高校就业培训',
+  },
+
+  methods: {
+    ...mapActions([
+      'siteOperation',
+      'columnOperation ',
+      'newsOperation',
+      'menuOperation',
+      'jobfairOperation',
+      'jobinfoOperation',
+      'postTalksInfo',
+      'postOperation',
+    ]),
+    //获取站点信息
+    async getSite() {
+      let site = sessionStorage.getItem('site');
+      if (!site) {
+        let result = await this.siteOperation({ type: 'search', data: { site: this.$site } });
+        if (`${result.errcode}` === `0`) {
+          sessionStorage.setItem('site', JSON.stringify(result.data));
+          this.$set(this, `site`, result.data);
+        }
+      } else {
+        this.$set(this, `site`, JSON.parse(site));
+      }
     },
-    footinfo: {
-      title: '长春工业大学|域名备案信息:HTTP://99991.SMART.CC-LOYUS.INFO/WWW/',
-      jishu: '技术支持:吉林省就业信息网1',
+    //获取菜单
+    async getMenu() {
+      if (sessionStorage.getItem('menu')) {
+        this.$set(this, `menu`, JSON.parse(sessionStorage.getItem('menu')));
+        return;
+      }
+      //获取菜单
+      let result = await this.menuOperation({ type: 'list', data: { site: this.site } });
+      if (`${result.errcode}` === '0') {
+        //获取菜单的栏目
+        let allMenu = result.data;
+        for (let item of allMenu) {
+          if (item.type === 'content') {
+            item.path = `/info/detail?id=${item.content_id}`;
+          } else if (item.type !== 'url') {
+            let res = await this.completeMenu(item);
+            item.children = res;
+          }
+        }
+        sessionStorage.setItem('menu', JSON.stringify(allMenu));
+        this.$set(this, `menu`, allMenu);
+      }
     },
-  }),
-  created() {},
-  computed: {},
-
-  methods: {},
+    //将菜单完善至栏目级别
+    async completeMenu(item) {
+      let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id, site: item.site } });
+      if (`${res.errcode}` === '0') {
+        //组合path:res.data内容都为栏目.所以,点击这些栏目显示的列表应该是信息列表,需要用栏目的id作为查询信息的parten_id查出不同栏目的信息
+        for (const col of res.data) {
+          if (col.type === 'content') col.path = `/info/detail?id=${col.content_id}`;
+          else if (col.type !== 'url') col.path = `/info/list/${col.id}`;
+        }
+        return res.data;
+      }
+    },
+    //主站信息组合
+    masterData() {
+      this.$set(this.master, `bannerinfo`, { banner: this.site.banner });
+    },
+    async search() {
+      if (this.type === 'jobinfo') this.getJobInfo();
+    },
+    //jobinfo部分
+    async getJobInfo() {
+      //1直接拿着参数发送请求
+      let result = await this.jobinfoOperation({ type: 'search', data: { id: this.id } });
+      if (`${result.errcode}` === '0') {
+        //给this=>vue的实例下在中的list属性,赋予result.data的值
+        this.$set(this, `info`, result.data);
+        // this.searchCorpInfo();
+        this.searchJobs();
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
+    },
+    async searchJobs() {
+      let result;
+      let jobIds = this.info.jobs.length > 0 ? this.info.jobs : [];
+      let jobList = [];
+      for (const item of jobIds) {
+        result = await this.postOperation({ type: 'search', data: { id: item } });
+        if (`${result.errcode}` === '0') {
+          jobList.push(result.data);
+        }
+      }
+      this.$set(this, `jobList`, jobList);
+    },
+  },
 };
 </script>
 

+ 117 - 42
src/views/master/news/list.vue

@@ -1,72 +1,147 @@
 <template>
   <div id="list">
     <login-Detail
-      :topinfo="topinfo"
-      :menulist="menulist"
-      :bannerinfo="bannerinfo"
-      :newsrightinfo="newsrightinfo"
+      :topinfo="site"
+      :menulist="menu"
+      :bannerinfo="master.bannerinfo"
+      :newsrightinfo="titleInfo"
       :leftmenu="leftmenu"
-      :newsrightlist="newsrightlist"
-      :footinfo="footinfo"
+      :newsrightlist="list"
+      :footinfo="site"
+      :totalRow="totalRow"
+      :type="type"
+      @search="search"
     ></login-Detail>
   </div>
 </template>
 
 <script>
 import loginDetail from '@publics/src/views/master/news/list.vue';
+import { mapActions, mapState } from 'vuex';
+import { masterInfo } from '@/config/master-info';
+import _ from 'lodash';
 export default {
   name: 'list',
   props: {},
   components: {
     loginDetail,
   },
+  async created() {
+    await this.getSite();
+    await this.getMenu();
+    this.masterData();
+    await this.search();
+  },
   data: () => ({
-    topinfo: {
-      logo: require('@/assets/master/logo.jpg'),
-      title: '长春工业大学就业信息网',
-    },
-    menulist: [{ title: '首页' }, { title: '就业新闻' }, { title: '最新公告' }],
-    bannerinfo: {
-      banner: require('@/assets/master/masterbanner.png'),
-    },
+    site: {},
+    master: { ...masterInfo },
+    menu: [],
+    list: [],
+    totalRow: 0,
     leftmenu: [
       {
-        title: '就业新闻',
+        title: '招聘会',
+        path: `/master/jobs/jobfair`,
       },
       {
-        title: '学校动态',
+        title: '宣讲会',
+        path: `/master/jobs/talk`,
       },
       {
-        title: '文化活动',
-      },
-      {
-        title: '招生动态',
-      },
-      {
-        title: '考试动态',
+        title: '招聘信息',
+        path: `/master/jobs/jobinfo`,
       },
     ],
-    newsrightinfo: {
-      english: 'Enjoy the investment',
-      title: '新闻',
+  }),
+  computed: {
+    type() {
+      return this.$route.params.type;
     },
-    newsrightlist: [
-      {
-        url: require('@/assets/master/list.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2019-10-31',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-      },
-    ],
-    footinfo: {
-      title: '长春工业大学|域名备案信息:HTTP://99991.SMART.CC-LOYUS.INFO/WWW/',
-      jishu: '技术支持:吉林省就业信息网1',
+    titleInfo() {
+      let object = {};
+      if (this.$route.params.type === 'jobfair') {
+        object = { title: '招聘会', english: 'JOBFAIR' };
+      } else if (this.$route.params.type === 'talk') {
+        object = { title: '宣讲会', english: 'CAMPUS' };
+      } else {
+        object = { title: '招聘信息', english: 'JOBINFO' };
+      }
+      return object;
     },
-  }),
-  created() {},
-  computed: {},
-
-  methods: {},
+  },
+  watch: {
+    type: 'search',
+  },
+  methods: {
+    ...mapActions(['siteOperation', 'columnOperation', 'menuOperation', 'jobfairOperation', 'jobinfoOperation', 'postTalksInfo']),
+    //获取站点信息
+    async getSite() {
+      let site = sessionStorage.getItem('site');
+      if (!site) {
+        let result = await this.siteOperation({ type: 'search', data: { site: this.$site } });
+        if (`${result.errcode}` === `0`) {
+          sessionStorage.setItem('site', JSON.stringify(result.data));
+          this.$set(this, `site`, result.data);
+        }
+      } else {
+        this.$set(this, `site`, JSON.parse(site));
+      }
+    },
+    //获取菜单
+    async getMenu() {
+      //获取菜单
+      let result = await this.menuOperation({ type: 'list', data: { site: this.$site } });
+      if (`${result.errcode}` === '0') {
+        //获取菜单的栏目
+        let allMenu = result.data;
+        for (let item of allMenu) {
+          if (item.type === 'content') {
+            item.path = `/info/detail?id=${item.content_id}`;
+          } else if (item.type !== 'url') {
+            let res = await this.completeMenu(item);
+            item.children = res;
+          }
+        }
+        sessionStorage.setItem('menu', JSON.stringify(allMenu));
+        this.$set(this, `menu`, allMenu);
+      }
+    },
+    //将菜单完善至栏目级别
+    async completeMenu(item) {
+      let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id, site: item.site } });
+      if (`${res.errcode}` === '0') {
+        //组合path:res.data内容都为栏目.所以,点击这些栏目显示的列表应该是信息列表,需要用栏目的id作为查询信息的parten_id查出不同栏目的信息
+        for (const col of res.data) {
+          if (col.type === 'content') col.path = `/info/detail?id=${col.content_id}`;
+          else if (col.type !== 'url') col.path = `/info/list/${col.id}`;
+        }
+        return res.data;
+      }
+    },
+    //主站信息组合
+    masterData() {
+      this.$set(this.master, `bannerinfo`, { banner: this.site.banner });
+    },
+    async search(page) {
+      let skip = 0;
+      if (page && _.isNumber(page)) {
+        skip = (page - 1) * 4;
+      }
+      let newData = { skip: skip, limit: 4, ...this.searchInfo };
+      let result;
+      if (this.type === 'jobfair') result = await this.jobfairOperation({ type: 'list', data: newData });
+      else if (this.type === 'talk') result = await this.postTalksInfo({ type: 'list', data: newData });
+      else result = await this.jobinfoOperation({ type: 'list', data: newData });
+      if (`${result.errcode}` === '0') {
+        //给this=>vue的实例下在中的list属性,赋予result。data的值
+        this.$set(this, 'list', result.data);
+        this.$set(this, `totalRow`, result.total);
+        window.location.hash = '#list_top';
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
+    },
+  },
 };
 </script>
 

+ 0 - 53
src/views/master/notice/detail.vue

@@ -1,53 +0,0 @@
-<template>
-  <div id="detail">
-    <infoDetail
-      :topinfo="topinfo"
-      :menulist="menulist"
-      :bannerinfo="bannerinfo"
-      :leftmenu="leftmenu"
-      :noticedetail="noticedetail"
-      :footinfo="footinfo"
-    ></infoDetail>
-  </div>
-</template>
-
-<script>
-import infoDetail from '@publics/src/views/master/notice/detail.vue';
-export default {
-  name: 'detail',
-  props: {},
-  components: {
-    infoDetail,
-  },
-  data: () => ({
-    topinfo: {
-      logo: require('@/assets/master/masterlogo.png'),
-      title: '长春工业大学就业信息网',
-    },
-    menulist: [{ title: '首页' }, { title: '就业新闻' }, { title: '最新公告' }],
-    bannerinfo: {
-      banner: require('@/assets/master/masterbanner.png'),
-    },
-    leftmenu: [
-      {
-        title: '最新公告',
-      },
-    ],
-    noticedetail: {
-      title: '我省成功举办全国高校就业培训',
-      time: '2019-11-1',
-      url: require('@/assets/master/newsdetail.png'),
-      content: '我省成功举办全国高校就业培训',
-    },
-    footinfo: {
-      title: '长春工业大学|域名备案信息:http://99991.smart.cc-lotus.info/www/',
-      jishu: '技术支持:吉林省就业信息网',
-    },
-  }),
-  created() {},
-  computed: {},
-  methods: {},
-};
-</script>
-
-<style lang="scss" scoped></style>

+ 104 - 64
src/views/master/notice/list.vue

@@ -1,84 +1,124 @@
 <template>
   <div id="list">
-    <listDetail :topinfo="topinfo" :menulist="menulist" :bannerinfo="bannerinfo" :noticelist="noticelist" :footinfo="footinfo"></listDetail>
+    <listDetail
+      :title="title"
+      :topinfo="site"
+      :menulist="menu"
+      :bannerinfo="master.bannerinfo"
+      :noticelist="list"
+      :footinfo="site"
+      :totalRow="totalRow"
+      @search="search"
+    ></listDetail>
   </div>
 </template>
 
 <script>
 import listDetail from '@publics/src/views/master/notice/list.vue';
+import { mapActions, mapState } from 'vuex';
+import { masterInfo } from '@/config/master-info';
+
 export default {
   name: 'list',
   props: {},
   components: {
     listDetail,
   },
+  async created() {
+    await this.getSite();
+    await this.getMenu();
+    this.masterData();
+    await this.search();
+  },
   data: () => ({
-    topinfo: {
-      logo: require('@/assets/master/masterlogo.png'),
-      title: '长春工业大学就业信息网',
+    site: {},
+    master: { ...masterInfo },
+    menu: [],
+    list: [],
+    totalRow: 0,
+  }),
+  computed: {
+    parent_id() {
+      return this.$route.params.parent_id;
     },
-    menulist: [{ title: '首页' }, { title: '就业新闻' }, { title: '最新公告' }],
-    bannerinfo: {
-      banner: require('@/assets/master/masterbanner.png'),
+    news_type() {
+      return this.$route.query.news_type;
     },
-    noticelist: [
-      {
-        image: require('@/assets/master/notice1.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-      {
-        image: require('@/assets/master/notice2.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-      {
-        image: require('@/assets/master/notice1.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-      {
-        image: require('@/assets/master/notice2.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-      {
-        image: require('@/assets/master/notice1.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-      {
-        image: require('@/assets/master/notice2.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-      {
-        image: require('@/assets/master/notice1.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-      {
-        image: require('@/assets/master/notice2.png'),
-        title: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        content: '我省成功举办全国高校就业我省成功举办全国高校就业',
-        time: '2020-06-03',
-      },
-    ],
-    footinfo: {
-      title: '长春工业大学|域名备案信息:http://99991.smart.cc-lotus.info/www/',
-      jishu: '技术支持:吉林省就业信息网',
+    title() {
+      return this.$route.query.title;
     },
-  }),
-  created() {},
-  computed: {},
-  methods: {},
+  },
+  watch: {
+    parent_id: 'search',
+  },
+  methods: {
+    ...mapActions(['newsOperation', 'siteOperation', 'moduleOperation', 'columnOperation', 'menuOperation']),
+    //获取站点信息
+    async getSite() {
+      let site = sessionStorage.getItem('site');
+      if (!site) {
+        let result = await this.siteOperation({ type: 'search', data: { site: this.$site } });
+        if (`${result.errcode}` === `0`) {
+          sessionStorage.setItem('site', JSON.stringify(result.data));
+          this.$set(this, `site`, result.data);
+        }
+      } else {
+        this.$set(this, `site`, JSON.parse(site));
+      }
+    },
+    //获取菜单
+    async getMenu() {
+      //获取菜单
+      let result = await this.menuOperation({ type: 'list', data: { site: this.$site } });
+      if (`${result.errcode}` === '0') {
+        //获取菜单的栏目
+        let allMenu = result.data;
+        for (let item of allMenu) {
+          if (item.type === 'content') {
+            item.path = `/info/detail?id=${item.content_id}`;
+          } else if (item.type !== 'url') {
+            let res = await this.completeMenu(item);
+            item.children = res;
+          }
+        }
+        sessionStorage.setItem('menu', JSON.stringify(allMenu));
+        this.$set(this, `menu`, allMenu);
+      }
+    },
+    //将菜单完善至栏目级别
+    async completeMenu(item) {
+      let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id, site: item.site } });
+      if (`${res.errcode}` === '0') {
+        //组合path:res.data内容都为栏目.所以,点击这些栏目显示的列表应该是信息列表,需要用栏目的id作为查询信息的parten_id查出不同栏目的信息
+        for (const col of res.data) {
+          if (col.type === 'content') col.path = `/info/detail?id=${col.content_id}`;
+          else if (col.type !== 'url') col.path = `/info/list/${col.id}`;
+        }
+        return res.data;
+      }
+    },
+    //主站信息组合
+    masterData() {
+      this.$set(this.master, `bannerinfo`, { banner: this.site.banner });
+    },
+    //查询新闻信息
+    async search(page) {
+      let skip = 0;
+      if (page) {
+        skip = (page - 1) * 8;
+      }
+      let newData = { skip: skip, limit: 8, ...this.searchInfo, parent_id: this.parent_id, news_type: this.news_type };
+      let result = await this.newsOperation({ type: 'list', data: { ...newData } });
+      if (`${result.errcode}` === '0') {
+        //给this=>vue的实例下在中的list属性,赋予result。data的值
+        this.$set(this, 'list', result.data);
+        this.$set(this, `totalRow`, result.total);
+        window.location.hash = '#list_top';
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
+    },
+  },
 };
 </script>