31 lines
954 B
JavaScript
31 lines
954 B
JavaScript
const got = require('@/utils/got');
|
|
const { parseDate } = require('@/utils/parse-date');
|
|
|
|
module.exports = async (ctx) => {
|
|
const rootUrl = 'https://rszhaopin.bit.edu.cn';
|
|
const apiUrl = `${rootUrl}/ajax/ajaxService`;
|
|
const currentUrl = `${rootUrl}/zp.html#/notices/0`;
|
|
|
|
const response = await got({
|
|
method: 'post',
|
|
url: apiUrl,
|
|
form: {
|
|
__xml: 'A2GgW6kPrLjaqavT0I8o9cOIXCYxazGialM66OpRk0MhwwOeUI1mF8yRBJHzicA9uL8Y9gYrXjdMocslRUopTMDJSRAykGXsjUoPibT4uK8Rz8Zj7U00coBCcJibpVwRZzFk',
|
|
__type: 'extTrans',
|
|
},
|
|
});
|
|
|
|
const items = response.data.return_data.list.map((item) => ({
|
|
title: item.title,
|
|
description: item.content,
|
|
pubDate: parseDate(item.createtime),
|
|
link: `${rootUrl}/zp.html#/notice/${item.id}`,
|
|
}));
|
|
|
|
ctx.state.data = {
|
|
title: '人才招聘 - 北京理工大学',
|
|
link: currentUrl,
|
|
item: items,
|
|
};
|
|
};
|