比較提交

...

4 次程式碼提交

作者 SHA1 備註 日期
dfc08cbe75 update README 2021-08-02 21:43:32 +08:00
656427e444 alter section display 2021-08-02 21:38:23 +08:00
225cfdbc54 update README 2021-08-02 21:21:08 +08:00
670b4b5faa 添加README、编译脚本 2021-08-02 21:01:02 +08:00
共有 7 個檔案被更改,包括 45 行新增11 行删除

查看文件

@@ -1,3 +1,35 @@
# slader-legacy
Slader遗产
Slader遗产
Demo:<https://slader-legacy.skyju.cc/>
```bash
git clone https://git.sduonline.cn/juzheng/slader-legacy.git && cd slader-legacy/
# 安装全局依赖
npm i typescript pnpm -g
# 启动后端
cd slader-legacy-backend/
# 下载 https://xinanwork.cowtransfer.com/s/1d682c4ca99640 的 slader.db 放在这个目录下
cp .env.example .env
vim .env # 编辑配置
pnpm i
pnpm run build
pnpm start
# 启动前端
cd slader-legacy-frontend/
cp .env.example .env
vim .env # 编辑配置
pnpm i
pnpm run build
mv dist/* /path/to/your/www/
# nginx 路由配置示例
location / {
try_files $uri $uri/ /index.html;
}
```

查看文件

@@ -0,0 +1 @@
SL_PORT=9696

查看文件

@@ -4,7 +4,9 @@
"description": "",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"start": "node build/index.js"
},
"author": "",
"license": "ISC",

查看文件

@@ -2,7 +2,7 @@ import {IExercise, ITextbook, IToc} from "./types"
export function fillIToc(single: any) {
return <IToc>{
section: single.section,
section: single.section.replace(/\//g,'-'),
count: single.count,
pageBegin: single.pageBegin,
pageEnd: single.pageEnd
@@ -19,7 +19,7 @@ export function fillITextbook(single: any) {
export function fillIExercise(single: any) {
return <IExercise>{
exercise: single.exercise,
section: single.section,
section: single.section.replace(/\//g,'-'),
part: single.part,
page: single.page,
html: single.html

查看文件

@@ -24,13 +24,13 @@ textbookRouter.get('/:textbook/:section?/:exercise?',
}),
query('page').optional().isInt({min: 1}),
param('section').optional().notEmpty().bail().custom((input, {req}) => {
if (!textbookModel.existSection(req.params!.textbook, input)) {
if (!textbookModel.existSection(req.params!.textbook, input.replace(/-/g, '/'))) {
throw new Error('section not exist')
}
return true
}),
param('exercise').optional().notEmpty().bail().custom((input, {req}) => {
if (!textbookModel.existExercise(req.params!.textbook, req.params!.section, input)) {
if (!textbookModel.existExercise(req.params!.textbook, req.params!.section.replace(/-/g, '/'), input)) {
throw new Error('exercise not exist')
}
return true
@@ -40,9 +40,9 @@ textbookRouter.get('/:textbook/:section?/:exercise?',
if (req.query.page) {
res.json(await textbookService.getPage(req.params.textbook, Number(req.query.page)))
} else if (req.params.exercise) {
res.json(await textbookService.getExercise(req.params.textbook, req.params.section, req.params.exercise))
res.json(await textbookService.getExercise(req.params.textbook, req.params.section.replace(/-/g, '/'), req.params.exercise))
} else if (req.params.section) {
res.json(await textbookService.getSection(req.params.textbook, req.params.section))
res.json(await textbookService.getSection(req.params.textbook, req.params.section.replace(/-/g, '/')))
} else {
res.json(await textbookService.getTextbook(req.params.textbook))
}

查看文件

@@ -0,0 +1 @@
VUE_APP_BASE_URL=http://localhost:9696/

查看文件

@@ -3,9 +3,7 @@ node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*