feat: add xmind mindmap gallery (#5572)

Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
Ethan Shen 2020-09-06 03:49:57 +08:00 committed by GitHub
parent 9612f4fce0
commit 3c2bca45b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 0 deletions

View File

@ -48,6 +48,18 @@ pageClass: routes
| columns | columns=健康 | string / undefined |
| columns | columns=virus | string / undefined |
## XMind
### Mindmap Gallery
<RouteEn author="nczitzk" example="/xmind/mindmap" path="/xmind/mindmap/:lang?" :paramsDesc="['language code, all languages by default']">
| English | Español | Deutsch | Français | 中文 | 日本語 |
| ------- | ------- | ------- | -------- | ---- | ------ |
| en | es | de | fr | zh | jp |
</RouteEn>
## X-MOL
### News

View File

@ -102,6 +102,18 @@ pageClass: routes
| wsk | 全国外语水平考试 (WSK) |
| mets | 医护英语水平考试 (METS) |
## XMind
### Mindmap Gallery
<Route author="nczitzk" example="/xmind/mindmap" path="/xmind/mindmap/:lang?" :paramsDesc="['语言代码,见下表,默认为所有语言']">
| English | Español | Deutsch | Français | 中文 | 日本語 |
| ------- | ------- | ------- | -------- | ---- | ------ |
| en | es | de | fr | zh | jp |
</Route>
## X-MOL 平台
### 新闻

View File

@ -3138,6 +3138,9 @@ router.get('/fjnews/fz/30', require('./routes/fjnews/fznews'));
// 九江新闻jjnews
router.get('/fjnews/jjnews', require('./routes/fjnews/jjnews'));
// XMind
router.get('/xmind/mindmap/:lang?', require('./routes/xmind/mindmap'));
// 孔夫子旧书网
router.get('/kongfz/people/:id', require('./routes/kongfz/people'));

View File

@ -0,0 +1,23 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const rootUrl = `https://www.xmind.net/_api/share/featured-maps?limit=20&lang=${ctx.params.lang}`;
const response = await got({
method: 'get',
url: rootUrl,
});
const list = response.data.mapList.map((item) => ({
title: item.topic,
link: `https://www.xmind.net/${item.id}`,
description: `<img src="${item.previewUrl}">`,
pubDate: new Date(item.created).toUTCString(),
author: item.profileName,
}));
ctx.state.data = {
title: 'Mindmap Gallery - XMind',
link: 'https://www.xmind.net/share',
item: list,
};
};