feat: 添加华水的学校新闻、学校文件及学术动态 (#3663)

This commit is contained in:
vuhe
2020-01-03 11:31:59 +08:00
committed by DIYgod
parent d3f69f86bb
commit 8d583cf3ae
6 changed files with 121 additions and 8 deletions

View File

@@ -392,7 +392,13 @@ category 列表:
### 学校通知
<Route author="vuhe" example="/ncwu/notice" path="/universities/ncwu/notice" />
<Route author="vuhe" example="/ncwu/notice" path="/universities/ncwu/:category" :paramsDesc="['分类']" >
| 学校新闻 | 学校通知 | 学校文件 | 学术动态 |
| -------- | -------- | -------- | ----------- |
| news | notice | file | scholarship |
</Route>
## 华南理工大学

View File

@@ -724,7 +724,10 @@ router.get('/upc/main/:type?', require('./routes/universities/upc/main'));
router.get('/upc/jsj/:type?', require('./routes/universities/upc/jsj'));
// 华北水利水电大学
router.get('/ncwu/file', require('./routes/universities/ncwu/file'));
router.get('/ncwu/news', require('./routes/universities/ncwu/news'));
router.get('/ncwu/notice', require('./routes/universities/ncwu/notice'));
router.get('/ncwu/scholarship', require('./routes/universities/ncwu/scholarship'));
// ifanr
router.get('/ifanr/:channel?', require('./routes/ifanr/index'));

View File

@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const date = require('@/utils/date');
const cheerio = require('cheerio');
const baseUrl = 'https://www5.ncwu.edu.cn/channels/58.html';
module.exports = async (ctx) => {
const response = await got.get(baseUrl);
const $ = cheerio.load(response.data);
const list = $('div.xinxilist>ul>li');
ctx.state.data = {
title: '华水-学校文件',
link: baseUrl,
item:
list &&
list
.map((index, item) => ({
title: $(item)
.find('span')
.text(),
description: `文件下载请转跳详情页`,
pubDate: date(
$(item)
.find('i')
.text()
),
link: $(item)
.find('a')
.attr('href'),
}))
.get(),
};
};

View File

@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const date = require('@/utils/date');
const cheerio = require('cheerio');
const baseUrl = 'https://www5.ncwu.edu.cn/channels/4.html';
module.exports = async (ctx) => {
const response = await got.get(baseUrl);
const $ = cheerio.load(response.data);
const list = $('div.xinxilist>ul>li');
ctx.state.data = {
title: '华水-学校新闻',
link: baseUrl,
item:
list &&
list
.map((index, item) => ({
title: $(item)
.find('span')
.text(),
description: `详情请点击查看`,
pubDate: date(
$(item)
.find('i')
.text()
),
link: $(item)
.find('a')
.attr('href'),
}))
.get(),
};
};

View File

@@ -20,20 +20,22 @@ module.exports = async (ctx) => {
.find('span')
.text(),
description:
`自「` +
`自「` +
$(item)
.find('a.dw')
.text() +
``,
`` +
$(item)
.find('i')
.text(),
pubDate: date(
$(item)
.find('i')
.text()
),
link:
baseUrl +
$(item)
.find('a[target=_blank]')
link: $(item)
.find('a.dw')
.next()
.attr('href'),
}))
.get(),

View File

@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const date = require('@/utils/date');
const cheerio = require('cheerio');
const baseUrl = 'https://www5.ncwu.edu.cn/channels/2766.html';
module.exports = async (ctx) => {
const response = await got.get(baseUrl);
const $ = cheerio.load(response.data);
const list = $('div.xinxilist>ul>li');
ctx.state.data = {
title: '华水-学术动态',
link: baseUrl,
item:
list &&
list
.map((index, item) => ({
title: $(item)
.find('span')
.text(),
description: `详情请点击查看`,
pubDate: date(
$(item)
.find('i')
.text()
),
link: $(item)
.find('a')
.attr('href'),
}))
.get(),
};
};