|
@@ -1,19 +1,27 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
<index-detail
|
|
|
- :info="info"
|
|
|
- :imglist="imglist"
|
|
|
+ :info="site"
|
|
|
+ :newsList="newsList"
|
|
|
:noticeList="noticeList"
|
|
|
- :recruitList="recruitList"
|
|
|
- :companyList="companyList"
|
|
|
- :nativeList="nativeList"
|
|
|
+ :recruitList="jobinfoList"
|
|
|
+ :companyList="corpList"
|
|
|
+ :nativeList="linkList"
|
|
|
+ :menuList="menu"
|
|
|
></index-detail>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import indexDetail from '@/components/index.vue';
|
|
|
+import { mapActions, mapState } from 'vuex';
|
|
|
+import _ from 'lodash';
|
|
|
export default {
|
|
|
+ metaInfo() {
|
|
|
+ return {
|
|
|
+ title: this.siteTitle ? this.siteTitle : '就业信息网',
|
|
|
+ };
|
|
|
+ },
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
components: {
|
|
@@ -31,47 +39,192 @@ export default {
|
|
|
date: '办公时间:周一至周五,法定假日不对外办公。',
|
|
|
footTitle: '吉ICP备09006292号-1 Copyright 2013 版权所有 吉林省高等学校毕业生就业指导中心 All Rights Reserved',
|
|
|
},
|
|
|
- imglist: [
|
|
|
- {
|
|
|
- url: require('@/assets/news.png'),
|
|
|
- title: '省成功举办全国高校就业指导人员培训',
|
|
|
- time: '2019-12-2',
|
|
|
- content: '省成功举办全国高校就业指导人员培训省成功举办全国高校就业指导人员培训',
|
|
|
- },
|
|
|
- ],
|
|
|
- noticeList: [
|
|
|
- {
|
|
|
- title: '省成功举办全国高校就业指导人员培训省成功举办全国高校就业指导人员培训',
|
|
|
- },
|
|
|
- ],
|
|
|
- recruitList: [
|
|
|
- {
|
|
|
- title: '辽源市百康药业有限责任公司',
|
|
|
- jobs: '招聘化学和药学相关专业',
|
|
|
- date: '2019-12-02',
|
|
|
- },
|
|
|
- ],
|
|
|
- companyList: [
|
|
|
- {
|
|
|
- title: '[广西] 中国建筑材料工业地质勘查中心广西总队',
|
|
|
- time: '(10-15)',
|
|
|
- },
|
|
|
- ],
|
|
|
- nativeList: [
|
|
|
- {
|
|
|
- title: '网站导航',
|
|
|
- children: [
|
|
|
- {
|
|
|
- title: '长春工业大学就业信息网',
|
|
|
- url: 'http://99991.smart.cc-lotus.info/www/',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
+ site: {}, //站点信息
|
|
|
+ siteTitle: {}, //站点标题
|
|
|
+ menu: [], //菜单
|
|
|
+ modules: [], //模块
|
|
|
+ newsList: [], //新闻模块
|
|
|
+ noticeList: [], //公告模块
|
|
|
+ self1List: [], //自定义模块现在没用
|
|
|
+ self2List: [], //自定义模块现在没用
|
|
|
+ jobinfoList: [], //招聘信息
|
|
|
+ linkList: [], //网站导航
|
|
|
+ corpList: [], //招聘企业
|
|
|
}),
|
|
|
- created() {},
|
|
|
+ async created() {
|
|
|
+ await this.toGetSite(); //获取主站信息
|
|
|
+ this.loadMenu(); //获取菜单信息
|
|
|
+ this.toGetModule(); //获取模块信息
|
|
|
+ this.toGetJobInfo(); //获取招聘信息
|
|
|
+ this.toGetLinks(); //招聘信息+网站链接
|
|
|
+ },
|
|
|
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.getfloating(item);
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ // this.getfloating(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //菜单
|
|
|
+ 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 = `/info/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 = `/info/detail?id=${col.content_id}`;
|
|
|
+ } else if (col.type !== 'url') {
|
|
|
+ col.path = `/info/list/${col.id}`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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 = `/info/list/${col.content_id}`;
|
|
|
+ col.children = await this.completeColumn(col);
|
|
|
+ } else if (col.type === `column`) {
|
|
|
+ col.path = `/info/list/${col.id}`;
|
|
|
+ col.children = await this.completeColumn(col);
|
|
|
+ } else if (col.type === `content`) {
|
|
|
+ col.path = `/info/detail?id=${col.content_id}`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return columns;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async completeColumn(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;
|
|
|
+ },
|
|
|
+ //招聘单位+网站链接
|
|
|
+ async toGetLinks() {
|
|
|
+ let { links = [], corps = [] } = await this.getLink();
|
|
|
+ this.$set(this, `linkList`, links);
|
|
|
+ this.$set(this, `corpList`, corps);
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|