|
@@ -1,7 +1,6 @@
|
|
|
<template>
|
|
|
<div id="request">
|
|
|
<el-row>
|
|
|
- <!-- v-if="user !== 'master'" -->
|
|
|
<pages-one
|
|
|
v-if="!loading"
|
|
|
:topInfo="site"
|
|
@@ -25,39 +24,6 @@
|
|
|
</template>
|
|
|
</pages-one>
|
|
|
</el-row>
|
|
|
- <!-- <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"
|
|
|
- :companylist="corpList"
|
|
|
- :unittop="master.unittop"
|
|
|
- :unitlist="coopList"
|
|
|
- :footinfo="site"
|
|
|
- :floating="floating"
|
|
|
- :rilitop="master.rilitop"
|
|
|
- :rightInfo="master.rightInfo"
|
|
|
- >
|
|
|
- <template #rili>
|
|
|
- <self-calendars></self-calendars>
|
|
|
- </template>
|
|
|
- </master>
|
|
|
- </el-row> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -69,8 +35,6 @@ import topMenu from '@/layout/layout-part/top-menu.vue';
|
|
|
import selfCalendar from '@/components/self-calendar.vue';
|
|
|
import selfCalendars from '@/components/self-calendars.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',
|
|
@@ -80,7 +44,6 @@ export default {
|
|
|
topMenu,
|
|
|
selfCalendar,
|
|
|
// selfCalendars,
|
|
|
- // master,
|
|
|
},
|
|
|
data: () => ({
|
|
|
user: 'master',
|
|
@@ -90,7 +53,6 @@ export default {
|
|
|
jobs: jobMenu,
|
|
|
loading: true,
|
|
|
limit: 4,
|
|
|
- newList: [],
|
|
|
talksList: [],
|
|
|
jobfairList: [],
|
|
|
talksOutList: [],
|
|
@@ -103,10 +65,9 @@ export default {
|
|
|
self2List: [],
|
|
|
coopList: [],
|
|
|
linkList: [],
|
|
|
- //master数据
|
|
|
- master: { ...masterInfo },
|
|
|
- corpList: [],
|
|
|
siteTitle: '',
|
|
|
+ // 重写逻辑
|
|
|
+ modules: [],
|
|
|
}),
|
|
|
metaInfo() {
|
|
|
return {
|
|
@@ -117,10 +78,9 @@ export default {
|
|
|
await this.checkUser();
|
|
|
await this.getSite();
|
|
|
this.search();
|
|
|
- this.getModule();
|
|
|
this.getLink();
|
|
|
- if (this.user === 'master') this.masterData();
|
|
|
await this.getMenu();
|
|
|
+ this.loadModule();
|
|
|
this.$set(this, `loading`, false);
|
|
|
},
|
|
|
computed: {},
|
|
@@ -135,7 +95,8 @@ export default {
|
|
|
'columnOperation',
|
|
|
'linkOperation',
|
|
|
'menuOperation',
|
|
|
- 'corpListOperation',
|
|
|
+ 'getAllColumn',
|
|
|
+ 'getAllNews',
|
|
|
]),
|
|
|
//检查用户身份
|
|
|
checkUser() {
|
|
@@ -165,7 +126,6 @@ export default {
|
|
|
this.$set(this, `siteTitle`, this.site.name);
|
|
|
}
|
|
|
} else {
|
|
|
- console.log(JSON.parse(site));
|
|
|
this.$set(this, `site`, JSON.parse(site));
|
|
|
this.$set(this, `siteTitle`, this.site.name);
|
|
|
let arr = this.site;
|
|
@@ -215,92 +175,6 @@ export default {
|
|
|
this.$message.error(result.errmsg ? result.errmsg : 'error');
|
|
|
}
|
|
|
},
|
|
|
- //获取固定的4个模块
|
|
|
- async getModule() {
|
|
|
- //获取分站所有模块 TODO:site=>_tenant
|
|
|
- let result = await this.moduleOperation({ type: 'list' });
|
|
|
- if (`${result.errcode}` === '0') {
|
|
|
- let moduleList = result.data;
|
|
|
- for (let item of moduleList) {
|
|
|
- //item为模块信息,拿着模块信息去查该模块下有什么栏目
|
|
|
- if (`${item.is_use}` === '0') {
|
|
|
- item = await this.getColumn(item);
|
|
|
- await this.makeList(item);
|
|
|
- } // console.log(item);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- //根据条件获取栏目
|
|
|
- async getColumn(item) {
|
|
|
- let res = await this.columnOperation({ type: 'list', data: { parent_id: item.id } });
|
|
|
- //查詢模块下所有的栏目(因为修改关联方是:抓取栏目和正常栏目关联,栏目类型(type)为bugList.所以bugList需要用content_id再去查下面关联的信息
|
|
|
- if (`${res.errcode}` === '0') {
|
|
|
- for (const col of res.data) {
|
|
|
- if (col.type === 'bugList') {
|
|
|
- col.path = `/info/list/${col.content_id}`;
|
|
|
- col.children = await this.getNewsList(col, '0');
|
|
|
- } else if (col.type === 'column') {
|
|
|
- col.path = `/info/list/${col.id}`;
|
|
|
- col.children = await this.getNewsList(col, '1');
|
|
|
- } else if (col.type === 'content') {
|
|
|
- col.path = `/info/detail?id=${col.content_id}`;
|
|
|
- }
|
|
|
- }
|
|
|
- item.children = res.data;
|
|
|
- }
|
|
|
- return item;
|
|
|
- },
|
|
|
- //根据条件获取信息
|
|
|
- async getNewsList(item, news_type) {
|
|
|
- let data = { skip: 0, limit: 6, news_type: news_type };
|
|
|
- data.parent_id = item.type === 'bugList' ? item.content_id : item.id;
|
|
|
- let res = await this.newsOperation({ type: 'list', data: data });
|
|
|
- if (`${res.errcode}` === '0') {
|
|
|
- for (const val of res.data) {
|
|
|
- let result = await this.newsOperation({ type: 'search', data: { id: val.id } });
|
|
|
- if (`${result.errcode}` === '0') {
|
|
|
- val.content = result.data.content;
|
|
|
- } else {
|
|
|
- this.$message.error(result.errmsg ? result.errmsg : 'error');
|
|
|
- }
|
|
|
- }
|
|
|
- return res.data;
|
|
|
- } else {
|
|
|
- this.$message.error(res.errmsg ? res.errmsg : 'error');
|
|
|
- }
|
|
|
- },
|
|
|
- //组合数据
|
|
|
- makeList(item) {
|
|
|
- if (!item) return;
|
|
|
- if (item.category === 'news') {
|
|
|
- let arr = [];
|
|
|
- let colObject = {};
|
|
|
- for (const col of item.children) {
|
|
|
- if (!colObject.id) colObject = col;
|
|
|
- for (const news of col.children) {
|
|
|
- arr.push(news);
|
|
|
- }
|
|
|
- }
|
|
|
- let object = { ...JSON.parse(JSON.stringify(item)), infoList: arr, column: colObject };
|
|
|
- this.$set(this, `news`, object);
|
|
|
- } else if (item.category === 'notice') {
|
|
|
- let arr = [];
|
|
|
- let colObject = {};
|
|
|
- for (const col of item.children) {
|
|
|
- if (!colObject.id) colObject = col;
|
|
|
- for (const news of col.children) {
|
|
|
- arr.push(news);
|
|
|
- }
|
|
|
- }
|
|
|
- let object = { ...JSON.parse(JSON.stringify(item)), infoList: arr, column: colObject };
|
|
|
- // console.log(object);
|
|
|
- this.$set(this, `notice`, object);
|
|
|
- } else if (item.category === 'self1') {
|
|
|
- this.$set(this, `self1List`, item.children);
|
|
|
- } else if (item.category === 'self2') {
|
|
|
- this.$set(this, `self2List`, item.children);
|
|
|
- }
|
|
|
- },
|
|
|
//友情链接/合作单位
|
|
|
async getLink() {
|
|
|
//合作单位
|
|
@@ -314,6 +188,7 @@ export default {
|
|
|
this.$set(this, `linkList`, link.data);
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
//检查+读取菜单
|
|
|
async loadMenu() {
|
|
|
let menu = sessionStorage.getItem('menu');
|
|
@@ -364,14 +239,94 @@ export default {
|
|
|
return res.data;
|
|
|
}
|
|
|
},
|
|
|
- //主站信息组合
|
|
|
- async masterData() {
|
|
|
- this.$set(this.master, `bannerinfo`, { banner: this.site.banner });
|
|
|
- //获取入驻企业
|
|
|
- let result = await this.corpListOperation();
|
|
|
- // console.log(result);
|
|
|
- if (`${result.errcode}` === '0') {
|
|
|
- this.$set(this, `corpList`, result.data);
|
|
|
+
|
|
|
+ //模块
|
|
|
+ async loadModule() {
|
|
|
+ let modules = sessionStorage.getItem('modules');
|
|
|
+ if (modules) this.finishedModule(JSON.parse(modules));
|
|
|
+ else this.toGetModule();
|
|
|
+ },
|
|
|
+ async toGetModule() {
|
|
|
+ let result = await this.moduleOperation({ type: `list` });
|
|
|
+ if (result.errcode === 0) {
|
|
|
+ sessionStorage.setItem('modules', JSON.stringify(result.data));
|
|
|
+ this.finishedModule(result.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async finishedModule(mods) {
|
|
|
+ let modules = JSON.parse(JSON.stringify(mods));
|
|
|
+ //获取了所有栏目
|
|
|
+ let res = await this.completeAllModules(modules);
|
|
|
+ },
|
|
|
+ //合并请求模块
|
|
|
+ async completeAllModules(modules) {
|
|
|
+ let ids = modules.map(item => item.id);
|
|
|
+ let result = await this.getAllColumn(ids);
|
|
|
+ if (result.length > 0) {
|
|
|
+ //整理栏目
|
|
|
+ result = result.map(item => {
|
|
|
+ if (item.type === 'column') item.path = `/info/list/${item.id}`;
|
|
|
+ else if (item.type === 'bugList') {
|
|
|
+ item.path = `/info/list/${item.content_id}`;
|
|
|
+ } else if (item.type === 'content') {
|
|
|
+ item.path = `/info/detail?id=${item.content_id}`;
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ //请求信息
|
|
|
+ let res = await this.getAllNews(result);
|
|
|
+ //合并栏目和信息
|
|
|
+ result = result.map(item => {
|
|
|
+ let newsList = res.filter(fil => {
|
|
|
+ let fid = item.type === 'bugList' ? item.content_id : item.id;
|
|
|
+ return fil.parent_id === fid;
|
|
|
+ });
|
|
|
+ item.children = newsList;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ modules = modules.map(item => {
|
|
|
+ let children = result.filter(fil => fil.parent_id === item.id);
|
|
|
+ item.children = children;
|
|
|
+ for (const sc of item.children) {
|
|
|
+ let schildren = _.get(sc, `children`, []);
|
|
|
+ sc.children = _.sortBy(schildren, i => {
|
|
|
+ return new Date(_.get(i, `meta.createdA`)).getTime();
|
|
|
+ });
|
|
|
+ sc.children = sc.children.filter(f => f.is_use === '0');
|
|
|
+ }
|
|
|
+ this.makeList(item);
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ makeList(mod) {
|
|
|
+ console.log(mod);
|
|
|
+ if (mod.category === 'news') {
|
|
|
+ let arr = [];
|
|
|
+ let colObject = {};
|
|
|
+ for (const col of mod.children) {
|
|
|
+ if (!colObject.id) colObject = col;
|
|
|
+ for (const news of col.children) {
|
|
|
+ arr.push(news);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let object = { ...JSON.parse(JSON.stringify(mod)), infoList: arr, column: colObject };
|
|
|
+ this.$set(this, `news`, object);
|
|
|
+ } else if (mod.category === 'notice') {
|
|
|
+ let arr = [];
|
|
|
+ let colObject = {};
|
|
|
+ for (const col of mod.children) {
|
|
|
+ if (!colObject.id) colObject = col;
|
|
|
+ for (const news of col.children) {
|
|
|
+ arr.push(news);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let object = { ...JSON.parse(JSON.stringify(mod)), infoList: arr, column: colObject };
|
|
|
+ this.$set(this, `notice`, object);
|
|
|
+ } else if (mod.category === 'self1') {
|
|
|
+ this.$set(this, `self1List`, mod.children);
|
|
|
+ } else if (mod.category === 'self2') {
|
|
|
+ this.$set(this, `self2List`, mod.children);
|
|
|
}
|
|
|
},
|
|
|
},
|