|
@@ -108,6 +108,7 @@ export default {
|
|
|
this.toGetModule(); //获取模块信息
|
|
|
this.toGetJobInfo(); //获取招聘信息
|
|
|
this.getAdv();
|
|
|
+ this.setJSONConfig(); //设置JSON格式配置
|
|
|
// this.toGetLinks(); //招聘信息+网站链接
|
|
|
// this.self();
|
|
|
},
|
|
@@ -286,23 +287,36 @@ export default {
|
|
|
this.$router.push({ path: '/quiet', query: { title: title } });
|
|
|
}
|
|
|
},
|
|
|
+ //处理JSON设置
|
|
|
+ setJSONConfig() {
|
|
|
+ let configs = _.get(this.site, 'configs');
|
|
|
+ if (_.isString(configs)) {
|
|
|
+ let con = JSON.parse(configs);
|
|
|
+ let adv = con.advert;
|
|
|
+ if (_.isArray(adv)) {
|
|
|
+ adv.map(i => {
|
|
|
+ this.$set(this.adv, `adv${i}_use`, true);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
//请求广告列表
|
|
|
async getAdv() {
|
|
|
- let res = await this.advQuery({ skip: 0, limit: 2 });
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- let adv1 = res.data[0];
|
|
|
- let adv2 = res.data[1];
|
|
|
- if (adv1 && adv1.type == '0') {
|
|
|
- let Obj = JSON.parse(adv1.url);
|
|
|
- adv1.url = `/newsList/module/${Obj.id}?title=${Obj.title}`;
|
|
|
- }
|
|
|
- this.$set(this, `adv`, { ...this.adv, adv1 });
|
|
|
- if (adv2 && adv2.type == '0') {
|
|
|
- let Obj = JSON.parse(adv2.url);
|
|
|
- adv2.url = `/newsList/module/${Obj.id}?title=${Obj.title}`;
|
|
|
+ let res1 = await this.advQuery({ skip: 0, limit: 1, is_use: '0', type: '1' });
|
|
|
+ let res0 = await this.advQuery({ skip: 0, limit: 1, is_use: '0', type: '0' });
|
|
|
+ let method = (res, index) => {
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let adv = res.data[0];
|
|
|
+ if (adv && adv.type == '0') {
|
|
|
+ let Obj = JSON.parse(adv.url);
|
|
|
+ adv.url = `/newsList/module/${Obj.id}?title=${Obj.title}`;
|
|
|
+ }
|
|
|
+ if (index == '1') this.$set(this, `adv`, { ...this.adv, adv1: adv });
|
|
|
+ else this.$set(this, `adv`, { ...this.adv, adv2: adv });
|
|
|
}
|
|
|
- this.$set(this, `adv`, { ...this.adv, adv2 });
|
|
|
- }
|
|
|
+ };
|
|
|
+ method(res1, 1);
|
|
|
+ method(res0, 0);
|
|
|
},
|
|
|
},
|
|
|
};
|