Skip to content

Commit

Permalink
feat(route): 添加 上海交通大学教务处 面向学生的通知 路由 (DIYgod#17823)
Browse files Browse the repository at this point in the history
* feat(route): add `sjtu/jwc/students`

* feat(route/sjtu/jwc): add description for /sjtu/jwc/students
  • Loading branch information
pangbo13 authored Dec 7, 2024
1 parent 0d07768 commit 5c3d6fa
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions lib/routes/sjtu/jwc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';

const urlRoot = 'https://jwc.sjtu.edu.cn/xwtg';
const urlRoot = 'https://jwc.sjtu.edu.cn';

async function getFullArticle(link) {
const response = await got(link).catch(() => null);
Expand Down Expand Up @@ -46,58 +46,62 @@ export const route: Route = {
name: '教务处通知公告',
maintainers: ['SeanChao'],
handler,
description: `| 新闻中心 | 通知通告 | 教学运行 | 注册学务 | 研究办 | 教改办 | 综合办 | 语言文字 | 工会与支部 | 通识教育 |
description: `| 新闻中心 | 通知通告 | 教学运行 | 注册学务 | 研究办 | 教改办 | 综合办 | 语言文字 | 工会与支部 | 通识教育 | 面向学生的通知 |
| -------- | -------- | --------- | -------- | ------ | ------ | ------ | -------- | ---------- | -------- |
| news | notice | operation | affairs | yjb | jgb | zhb | language | party | ge |`,
| news | notice | operation | affairs | yjb | jgb | zhb | language | party | ge | students |`,
};

async function handler(ctx) {
const type = ctx.req.param('type') ?? 'notice';
const config = {
all: {
section: '通知通告',
link: '/tztg.htm',
link: '/xwtg/tztg.htm',
},
news: {
link: '/xwzx.htm',
link: '/xwtg/xwzx.htm',
section: '新闻中心',
},
notice: {
link: '/tztg.htm',
link: '/xwtg/tztg.htm',
section: '通知通告',
},
operation: {
link: '/jxyx.htm',
link: '/xwtg/jxyx.htm',
section: '教学运行',
},
affairs: {
link: '/zcxw.htm',
link: '/xwtg/zcxw.htm',
section: '注册学务',
},
yjb: {
link: '/yjb.htm',
link: '/xwtg/yjb.htm',
section: '研究办',
},
jgb: {
link: '/jgb.htm',
link: '/xwtg/jgb.htm',
section: '教改办',
},
zhb: {
link: '/zhb.htm',
link: '/xwtg/zhb.htm',
section: '综合办',
},
language: {
link: '/yywz.htm',
link: '/xwtg/yywz.htm',
section: '语言文字',
},
party: {
link: '/ghyzb.htm',
link: '/xwtg/ghyzb.htm',
section: '工会与支部',
},
ge: {
link: '/tsjy.htm',
link: '/xwtg/tsjy.htm',
section: '通识教育',
},
students: {
link: '/index/mxxsdtz.htm',
section: '面向学生的通知',
},
};

const sectionLink = urlRoot + config[type].link;
Expand Down

0 comments on commit 5c3d6fa

Please sign in to comment.