Commit abe5826f authored by rzf's avatar rzf

Merge branch 'dev' of gitlab2.dui88.com:wangtianyu1/dui123 into dev

parents dcca1194 2cf35b25
...@@ -2,6 +2,7 @@ const express = require('express'); ...@@ -2,6 +2,7 @@ const express = require('express');
const path = require('path'); const path = require('path');
const cookieParser = require('cookie-parser'); const cookieParser = require('cookie-parser');
const logger = require('morgan'); const logger = require('morgan');
const bodyParser = require('body-parser')
const indexRouter = require('./routes/index'); const indexRouter = require('./routes/index');
const usersRouter = require('./routes/users'); const usersRouter = require('./routes/users');
...@@ -9,6 +10,7 @@ const queryRouter = require('./routes/query') ...@@ -9,6 +10,7 @@ const queryRouter = require('./routes/query')
const addRouter = require('./routes/add') const addRouter = require('./routes/add')
const deleteRouter = require('./routes/delete') const deleteRouter = require('./routes/delete')
const updateRouter = require('./routes/update') const updateRouter = require('./routes/update')
const submitRouter = require('./routes/submit')
const app = express(); const app = express();
global.domain = 'http://127.0.0.1:3001' global.domain = 'http://127.0.0.1:3001'
...@@ -33,6 +35,9 @@ app.use((req, res, next) => { ...@@ -33,6 +35,9 @@ app.use((req, res, next) => {
}) })
req.method === 'OPTIONS' ? res.status(204).end() : next() req.method === 'OPTIONS' ? res.status(204).end() : next()
}) })
app.use(bodyParser.urlencoded({extended: false}))
app.use(bodyParser.json())
app.use(logger('dev')); app.use(logger('dev'));
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded({extended: false})); app.use(express.urlencoded({extended: false}));
...@@ -45,6 +50,7 @@ app.use('/query', queryRouter) ...@@ -45,6 +50,7 @@ app.use('/query', queryRouter)
app.use('/add', addRouter) app.use('/add', addRouter)
app.use('/delete',deleteRouter) app.use('/delete',deleteRouter)
app.use('/update', updateRouter) app.use('/update', updateRouter)
app.use('/submit', submitRouter)
module.exports = app; module.exports = app;
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
"dependencies": { "dependencies": {
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
"@types/mysql": "^2.15.19", "@types/mysql": "^2.15.19",
"body-parse": "^0.1.0",
"body-parser": "^1.19.0",
"cookie-parser": "~1.4.4", "cookie-parser": "~1.4.4",
"debug": "~2.6.9", "debug": "~2.6.9",
"express": "~4.16.1", "express": "~4.16.1",
......
<html>
<head>
<title>Tool1</title>
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body>
<h1>Tool1</h1>
<p>Tool1</p>
</body>
</html>
...@@ -20,15 +20,17 @@ router.get('/queryType', (req, res) => { ...@@ -20,15 +20,17 @@ router.get('/queryType', (req, res) => {
}); });
router.get('/queryToolBox', (req, res) => { router.get('/queryToolBox', (req, res) => {
let {isFollow, typeId} = req.query let {isFollow, typeId, childTypeId} = req.query
let SQL = `SELECT * FROM toolbox`; let SQL = `SELECT toolbox.* FROM type_childtype_toolbox INNER JOIN toolbox ON type_childtype_toolbox.toolBoxId = toolbox.toolBoxId INNER JOIN child_type ON type_childtype_toolbox.childTypeId = child_type.childTypeId INNER JOIN type ON type_childtype_toolbox.typeId = type.typeId WHERE type_childtype_toolbox.typeId = ?`
if (isFollow) { if (isFollow) {
typeId = JSON.parse(typeId) typeId = JSON.parse(typeId)
SQL = 'SELECT * FROM toolbox WHERE toolboxId IN (?)' SQL = 'SELECT * FROM toolbox WHERE toolboxId IN (?)'
} else if (typeId) { } else if (typeId) {
SQL = `SELECT toolbox.* FROM toolbox INNER JOIN toolbox_type ON toolbox.toolBoxId = toolbox_type.toolBoxId INNER JOIN type ON toolbox_type.typeId = type.typeId WHERE toolbox_type.typeId = ?` if (childTypeId){
SQL = SQL + ` AND child_type.childTypeId = ?`;
} }
Mysql.query(SQL, [typeId], (err, result) => { }
Mysql.query(SQL, [typeId, childTypeId], (err, result) => {
if (err) { if (err) {
res.send({ res.send({
success: false, success: false,
......
const express = require('express');
const Mysql = require('../SQLPool')
const router = express.Router();
router.get('/addPage', (req, res) => {
const {pageName} = req.query
const SQL = `INSERT INTO page (pageName) VALUES (?)`
Mysql.query(SQL, [pageName], (err, result) => {
if (err) {
res.send({
success: false,
err
})
}
res.send({
success: true,
data: result
})
})
})
router.get('/queryPage', (req, res) => {
const SQL = 'SELECT * FROM page'
Mysql.query(SQL, [], (err, result) => {
if (err) {
res.send({
success: false,
err
})
}
res.send({
success: true,
data: result
})
})
})
router.post('/release', (req, res) => {
console.log(req.body)
const {code} = req.body
console.log(code)
res.send({
success: true
})
})
module.exports = router
...@@ -51,5 +51,4 @@ router.get('/updateChildType', (req, res) => { ...@@ -51,5 +51,4 @@ router.get('/updateChildType', (req, res) => {
} }
}) })
module.exports = router module.exports = router
...@@ -12,7 +12,9 @@ router.get('/getUser', function (req, res, next) { ...@@ -12,7 +12,9 @@ router.get('/getUser', function (req, res, next) {
let {userId} = req.cookies let {userId} = req.cookies
console.log(req.cookies) console.log(req.cookies)
console.log('userId:',userId) console.log('userId:',userId)
if (!userId){
userId = req.query.userId userId = req.query.userId
}
// if (!userId) { // if (!userId) {
// res.send({ // res.send({
// success: false, // success: false,
......
...@@ -199,6 +199,11 @@ binary-extensions@^2.0.0: ...@@ -199,6 +199,11 @@ binary-extensions@^2.0.0:
resolved "http://npm.dui88.com:80/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" resolved "http://npm.dui88.com:80/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
integrity sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0= integrity sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0=
body-parse@^0.1.0:
version "0.1.0"
resolved "http://npm.dui88.com:80/body-parse/-/body-parse-0.1.0.tgz#cd1639d9ac0725be81db38e1ca4012476f7051a6"
integrity sha1-zRY52awHJb6B2zjhykASR29wUaY=
body-parser@1.18.3: body-parser@1.18.3:
version "1.18.3" version "1.18.3"
resolved "http://npm.dui88.com:80/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4" resolved "http://npm.dui88.com:80/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4"
...@@ -215,6 +220,22 @@ body-parser@1.18.3: ...@@ -215,6 +220,22 @@ body-parser@1.18.3:
raw-body "2.3.3" raw-body "2.3.3"
type-is "~1.6.16" type-is "~1.6.16"
body-parser@^1.19.0:
version "1.19.0"
resolved "http://npm.dui88.com:80/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a"
integrity sha1-lrJwnlfJxOCab9Zqj9l5hE9p8Io=
dependencies:
bytes "3.1.0"
content-type "~1.0.4"
debug "2.6.9"
depd "~1.1.2"
http-errors "1.7.2"
iconv-lite "0.4.24"
on-finished "~2.3.0"
qs "6.7.0"
raw-body "2.4.0"
type-is "~1.6.17"
boxen@^4.2.0: boxen@^4.2.0:
version "4.2.0" version "4.2.0"
resolved "http://npm.dui88.com:80/boxen/-/boxen-4.2.0.tgz#e411b62357d6d6d36587c8ac3d5d974daa070e64" resolved "http://npm.dui88.com:80/boxen/-/boxen-4.2.0.tgz#e411b62357d6d6d36587c8ac3d5d974daa070e64"
...@@ -249,6 +270,11 @@ bytes@3.0.0: ...@@ -249,6 +270,11 @@ bytes@3.0.0:
resolved "http://npm.dui88.com:80/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" resolved "http://npm.dui88.com:80/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=
bytes@3.1.0:
version "3.1.0"
resolved "http://npm.dui88.com:80/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
integrity sha1-9s95M6Ng4FiPqf3oVlHNx/gF0fY=
cacheable-request@^6.0.0: cacheable-request@^6.0.0:
version "6.1.0" version "6.1.0"
resolved "http://npm.dui88.com:80/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912" resolved "http://npm.dui88.com:80/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912"
...@@ -716,6 +742,17 @@ http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3: ...@@ -716,6 +742,17 @@ http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3:
setprototypeof "1.1.0" setprototypeof "1.1.0"
statuses ">= 1.4.0 < 2" statuses ">= 1.4.0 < 2"
http-errors@1.7.2:
version "1.7.2"
resolved "http://npm.dui88.com:80/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f"
integrity sha1-T1ApzxMjnzEDblsuVSkrz7zIXI8=
dependencies:
depd "~1.1.2"
inherits "2.0.3"
setprototypeof "1.1.1"
statuses ">= 1.5.0 < 2"
toidentifier "1.0.0"
http-signature@~1.2.0: http-signature@~1.2.0:
version "1.2.0" version "1.2.0"
resolved "http://npm.dui88.com:80/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" resolved "http://npm.dui88.com:80/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
...@@ -732,6 +769,13 @@ iconv-lite@0.4.23: ...@@ -732,6 +769,13 @@ iconv-lite@0.4.23:
dependencies: dependencies:
safer-buffer ">= 2.1.2 < 3" safer-buffer ">= 2.1.2 < 3"
iconv-lite@0.4.24:
version "0.4.24"
resolved "http://npm.dui88.com:80/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha1-ICK0sl+93CHS9SSXSkdKr+czkIs=
dependencies:
safer-buffer ">= 2.1.2 < 3"
ignore-by-default@^1.0.1: ignore-by-default@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "http://npm.dui88.com:80/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" resolved "http://npm.dui88.com:80/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
...@@ -1152,6 +1196,11 @@ qs@6.5.2, qs@~6.5.2: ...@@ -1152,6 +1196,11 @@ qs@6.5.2, qs@~6.5.2:
resolved "http://npm.dui88.com:80/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" resolved "http://npm.dui88.com:80/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha1-yzroBuh0BERYTvFUzo7pjUA/PjY= integrity sha1-yzroBuh0BERYTvFUzo7pjUA/PjY=
qs@6.7.0:
version "6.7.0"
resolved "http://npm.dui88.com:80/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
integrity sha1-QdwaAV49WB8WIXdr4xr7KHapsbw=
range-parser@~1.2.0: range-parser@~1.2.0:
version "1.2.1" version "1.2.1"
resolved "http://npm.dui88.com:80/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" resolved "http://npm.dui88.com:80/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
...@@ -1167,6 +1216,16 @@ raw-body@2.3.3: ...@@ -1167,6 +1216,16 @@ raw-body@2.3.3:
iconv-lite "0.4.23" iconv-lite "0.4.23"
unpipe "1.0.0" unpipe "1.0.0"
raw-body@2.4.0:
version "2.4.0"
resolved "http://npm.dui88.com:80/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332"
integrity sha1-oc5vucm8NWylLoklarWQWeE9AzI=
dependencies:
bytes "3.1.0"
http-errors "1.7.2"
iconv-lite "0.4.24"
unpipe "1.0.0"
rc@^1.2.8: rc@^1.2.8:
version "1.2.8" version "1.2.8"
resolved "http://npm.dui88.com:80/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" resolved "http://npm.dui88.com:80/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
...@@ -1310,6 +1369,11 @@ setprototypeof@1.1.0: ...@@ -1310,6 +1369,11 @@ setprototypeof@1.1.0:
resolved "http://npm.dui88.com:80/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" resolved "http://npm.dui88.com:80/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656"
integrity sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY= integrity sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY=
setprototypeof@1.1.1:
version "1.1.1"
resolved "http://npm.dui88.com:80/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683"
integrity sha1-fpWsskqpL1iF4KvvW6ExMw1K5oM=
signal-exit@^3.0.2: signal-exit@^3.0.2:
version "3.0.3" version "3.0.3"
resolved "http://npm.dui88.com:80/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" resolved "http://npm.dui88.com:80/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
...@@ -1335,7 +1399,7 @@ sshpk@^1.7.0: ...@@ -1335,7 +1399,7 @@ sshpk@^1.7.0:
safer-buffer "^2.0.2" safer-buffer "^2.0.2"
tweetnacl "~0.14.0" tweetnacl "~0.14.0"
"statuses@>= 1.4.0 < 2": "statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2":
version "1.5.0" version "1.5.0"
resolved "http://npm.dui88.com:80/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" resolved "http://npm.dui88.com:80/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=
...@@ -1420,6 +1484,11 @@ to-regex-range@^5.0.1: ...@@ -1420,6 +1484,11 @@ to-regex-range@^5.0.1:
dependencies: dependencies:
is-number "^7.0.0" is-number "^7.0.0"
toidentifier@1.0.0:
version "1.0.0"
resolved "http://npm.dui88.com:80/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
integrity sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM=
touch@^3.1.0: touch@^3.1.0:
version "3.1.0" version "3.1.0"
resolved "http://npm.dui88.com:80/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" resolved "http://npm.dui88.com:80/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b"
...@@ -1452,7 +1521,7 @@ type-fest@^0.8.1: ...@@ -1452,7 +1521,7 @@ type-fest@^0.8.1:
resolved "http://npm.dui88.com:80/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" resolved "http://npm.dui88.com:80/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha1-CeJJ696FHTseSNJ8EFREZn8XuD0= integrity sha1-CeJJ696FHTseSNJ8EFREZn8XuD0=
type-is@~1.6.16: type-is@~1.6.16, type-is@~1.6.17:
version "1.6.18" version "1.6.18"
resolved "http://npm.dui88.com:80/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" resolved "http://npm.dui88.com:80/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
integrity sha1-TlUs0F3wlGfcvE73Od6J8s83wTE= integrity sha1-TlUs0F3wlGfcvE73Od6J8s83wTE=
......
...@@ -43,5 +43,6 @@ ...@@ -43,5 +43,6 @@
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
} },
"types": "index.d.ts"
} }
{
"active": "dev",
"dev": {
"url": "127.0.0.1"
},
"test": {
},
"prod": {
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"sourceMap": true,
"removeComments": true,
"noEmitOnError":true,
"outDir":"dist",
/*"outFile": "./index.js",*/
"lib": [
"es5",
"dom",
"es2015.promise"
]
},
"exclude": [
"node_modules"
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment