-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* server: 增加删除方法 * web: 增加删除事件 * chore: 移除路由遗留方法 * pref: 删除后更新状态 * chore: 移除菜单中的修改,在详情中已实现 * pref: 删除时修改主页状态 & 重新生成 mapping.json
- Loading branch information
Showing
16 changed files
with
107 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0"><link rel="shortcut icon" href="dist/assets/favicon.ico" type="image/x-icon"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>*{margin:0;padding:0}</style></head><body><div id="root"></div><script type="text/javascript" src="/dist/ninoninoni.js?0d1b443654a083ee76e2"></script></body></html> | ||
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0"><link rel="shortcut icon" href="dist/assets/favicon.ico" type="image/x-icon"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>*{margin:0;padding:0}</style></head><body><div id="root"></div><script type="text/javascript" src="/dist/ninoninoni.js?7f36b9af4bafbac9a95c"></script></body></html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"id":"122a14c4ab646d5a612d74ceaddd20a0","title":"test1","thumbnailUrl":"dist/assets/5795774_0.jpg","hoverText":"测试 layout-122a14c4ab646d5a612d74ceaddd20a0.json","createTime":1548761194017,"modifyTime":1548761194017},{"id":"1a79a4d60de6718e8e5b326e338ae533","title":"test1","thumbnailUrl":"dist/assets/5795774_0.jpg","hoverText":"测试 layout-1a79a4d60de6718e8e5b326e338ae533.json","createTime":1548761194017,"modifyTime":1548761194017}] | ||
[] |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/bin/bash | ||
|
||
npm run generate & | ||
npm run dev & | ||
npm run server & | ||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const generate = require('../generateMapping'); | ||
|
||
const del = async ctx => { | ||
const body = ctx.request.body; | ||
const id = body.id; | ||
const writeFiles = [`src/layout/${id}.json`, `dist/layout/${id}.json`]; | ||
try { | ||
for (let item of writeFiles) { | ||
if (fs.existsSync(item)) { | ||
fs.unlinkSync(path.join(process.cwd(), item)); | ||
} else { | ||
// eslint-disable-next-line | ||
throw Error("file doesn't exist."); | ||
} | ||
} | ||
generate(); | ||
ctx.response.body = true; | ||
} catch (error) { | ||
ctx.response.body = false; | ||
} | ||
}; | ||
|
||
module.exports = { | ||
'DELETE /del': del, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const cwd = process.cwd(); | ||
|
||
module.exports = function() { | ||
const files = fs.readdirSync(path.join(cwd, 'src/layout')); | ||
const layoutFiles = files.filter(file => { | ||
return file.endsWith('.json'); | ||
}); | ||
|
||
let layouts = []; | ||
for (let fileName of layoutFiles) { | ||
layouts.push({ | ||
id: fileName.replace('.json', ''), | ||
title: 'test1', | ||
thumbnailUrl: 'dist/assets/5795774_0.jpg', | ||
hoverText: '测试 layout-' + fileName, | ||
createTime: new Date().getTime(), | ||
modifyTime: new Date().getTime(), | ||
}); | ||
} | ||
|
||
const writeFiles = ['src/mapping.json', 'dist/mapping.json']; | ||
try { | ||
for (let item of writeFiles) { | ||
fs.writeFileSync(path.join(process.cwd(), item), JSON.stringify(layouts)); | ||
} | ||
// eslint-disable-next-line | ||
console.log('generate completed.'); | ||
} catch (error) { | ||
throw Error('generate failed.'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.