Commit 6cdad966 authored by wty's avatar wty

首页接口初始化完成

parent 8922365d
...@@ -23,3 +23,4 @@ yarn-debug.log* ...@@ -23,3 +23,4 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
/expressServer/node_modules/ /expressServer/node_modules/
/expressServer/.idea/ /expressServer/.idea/
/.idea
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<excludeFolder url="file://$MODULE_DIR$/tmp" /> <excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build" /> <excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/expressServer/.idea" /> <excludeFolder url="file://$MODULE_DIR$/expressServer/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.idea/inspectionProfiles" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
......
...@@ -8,6 +8,7 @@ const usersRouter = require('./routes/users'); ...@@ -8,6 +8,7 @@ const usersRouter = require('./routes/users');
const databaseRouter = require('./routes/dataBase/dataBase') const databaseRouter = require('./routes/dataBase/dataBase')
const app = express(); const app = express();
global.domain = 'http://127.0.0.1:3001'
// app.all('', function (req, res, next) { // app.all('', function (req, res, next) {
// res.header('Access-Control-Allow-Origin', 'http://127.0.0.1:3000'); // res.header('Access-Control-Allow-Origin', 'http://127.0.0.1:3000');
...@@ -17,6 +18,7 @@ const app = express(); ...@@ -17,6 +18,7 @@ const app = express();
// res.header('Content-Type', 'application/json;charset=utf-8'); // res.header('Content-Type', 'application/json;charset=utf-8');
// next(); // next();
// }); // });
app.use((req, res, next) => { app.use((req, res, next) => {
//设置请求头 //设置请求头
res.set({ res.set({
...@@ -28,7 +30,6 @@ app.use((req, res, next) => { ...@@ -28,7 +30,6 @@ app.use((req, res, next) => {
}) })
req.method === 'OPTIONS' ? res.status(204).end() : next() req.method === 'OPTIONS' ? res.status(204).end() : next()
}) })
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 }));
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"debug": "~2.6.9", "debug": "~2.6.9",
"express": "~4.16.1", "express": "~4.16.1",
"morgan": "~1.9.1", "morgan": "~1.9.1",
"nodemon": "^2.0.12" "nodemon": "^2.0.12",
"request": "^2.88.2"
} }
} }
const express = require('express') const express = require('express')
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const toolBox = path.join(__dirname, './toolBox.json')
const router = express.Router() const router = express.Router()
const add = (addData) => { const tablePath = {
fs.readFile(toolBox, (err, data) => { toolBox: path.join(__dirname, './toolBox.json'),
type: path.join(__dirname, './type.json')
}
const add = (tableName,addData) => {
fs.readFile(tablePath[tableName], (err, data) => {
if (err) { if (err) {
console.error(err) console.error(err)
return err throw err
} }
const _data = JSON.parse(data.toString()) const _data = JSON.parse(data.toString())
_data.type.push(addData) const lastId = _data[_data.length - 1]?.id || 0
fs.writeFile(toolBox, JSON.stringify(_data), (err) => { _data.push(Object.assign({id: lastId + 1},addData))
fs.writeFile(tablePath[tableName], JSON.stringify(_data), (err) => {
if (err) { if (err) {
console.error(err) console.error(err)
return err return err
...@@ -24,30 +28,42 @@ const add = (addData) => { ...@@ -24,30 +28,42 @@ const add = (addData) => {
}) })
} }
const test = () => { const queryTable = (tableName) => {
const data = fs.readFileSync(toolBox, {encoding: 'utf-8'}) const data = fs.readFileSync(tablePath[tableName], {encoding: 'utf-8'})
return JSON.parse(data) return JSON.parse(data)
} }
router.get('/', (req, res) => { router.get('/queryTable', (req, res) => {
const data = test().type const {tableName} = req.query
console.log('查询:',tableName)
const data = queryTable(tableName)
if (data){ if (data){
res.send({ res.send({
success: true, data
message: 'ok',
data: data
}) })
}else { }else {
res.send({ res.send({
success: false, Error: data
message: '查询接口日志',
data: data
}) })
} }
}) })
router.get('/addType', (req, res) => { router.get('/addData', (req, res) => {
res.send({data: 'add'}) const {tableName,data} = req.query
const _data = JSON.parse(data)
try{
add(tableName,_data)
res.send({
data:'通了'
})
}catch (e){
console.log(e)
res.send({
message: e
})
}
}) })
......
{ [{"id":1,"name":"星速台","icon":"http://yun.dui88.com/polaris/favicon1.ico","desc":"项目发布,运营等功能","url":"http://yun.dui88.com/polaris/favicon1.ico"}]
"type": [ \ No newline at end of file
{
"id": 1,
"typeName": "我的"
}
]
}
let express = require('express'); let express = require('express');
const request = require('request')
let router = express.Router(); let router = express.Router();
/* GET home page. */ /* GET home page. */
router.get('/', function(req, res) { router.get('/queryType', (req, res) => {
res.send('cool~') request(`${domain}/database/queryTable?tableName=type`, {}, (err, response, body) => {
if (!err && response.statusCode === 200) {
const data = JSON.parse(body)
res.send({
success: true,
data: data.data
})
} else {
res.send({
error: err
})
}
})
}); });
router.get('/queryToolBox', (req, res) => {
request(`${domain}/database/queryTable?tableName=toolBox`, {}, (err, response, body) => {
if (!err && response.statusCode === 200) {
const data = JSON.parse(body)
res.send({
success: true,
data: data.data
})
} else {
res.send({
error: err
})
}
})
});
router.get('/addToolBox', (req, res) => {
request(`${domain}/database/queryTable?tableName=toolBox`, {}, (err, response, body) => {
if (!err && response.statusCode === 200) {
const data = JSON.parse(body)
res.send({
success: true,
data: data.data
})
} else {
res.send({
error: err
})
}
})
})
module.exports = router; module.exports = router;
...@@ -89,6 +89,16 @@ accepts@~1.3.5: ...@@ -89,6 +89,16 @@ accepts@~1.3.5:
mime-types "~2.1.24" mime-types "~2.1.24"
negotiator "0.6.2" negotiator "0.6.2"
ajv@^6.12.3:
version "6.12.6"
resolved "http://npm.dui88.com:80/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
integrity sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=
dependencies:
fast-deep-equal "^3.1.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ansi-align@^3.0.0: ansi-align@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "http://npm.dui88.com:80/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb" resolved "http://npm.dui88.com:80/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb"
...@@ -126,6 +136,33 @@ array-flatten@1.1.1: ...@@ -126,6 +136,33 @@ array-flatten@1.1.1:
resolved "http://npm.dui88.com:80/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" resolved "http://npm.dui88.com:80/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=
asn1@~0.2.3:
version "0.2.4"
resolved "http://npm.dui88.com:80/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
integrity sha1-jSR136tVO7M+d7VOWeiAu4ziMTY=
dependencies:
safer-buffer "~2.1.0"
assert-plus@1.0.0, assert-plus@^1.0.0:
version "1.0.0"
resolved "http://npm.dui88.com:80/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=
asynckit@^0.4.0:
version "0.4.0"
resolved "http://npm.dui88.com:80/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
aws-sign2@~0.7.0:
version "0.7.0"
resolved "http://npm.dui88.com:80/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=
aws4@^1.8.0:
version "1.11.0"
resolved "http://npm.dui88.com:80/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha1-1h9G2DslGSUOJ4Ta9bCUeai0HFk=
balanced-match@^1.0.0: balanced-match@^1.0.0:
version "1.0.2" version "1.0.2"
resolved "http://npm.dui88.com:80/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" resolved "http://npm.dui88.com:80/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
...@@ -138,6 +175,13 @@ basic-auth@~2.0.0: ...@@ -138,6 +175,13 @@ basic-auth@~2.0.0:
dependencies: dependencies:
safe-buffer "5.1.2" safe-buffer "5.1.2"
bcrypt-pbkdf@^1.0.0:
version "1.0.2"
resolved "http://npm.dui88.com:80/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=
dependencies:
tweetnacl "^0.14.3"
binary-extensions@^2.0.0: binary-extensions@^2.0.0:
version "2.2.0" version "2.2.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"
...@@ -211,6 +255,11 @@ camelcase@^5.3.1: ...@@ -211,6 +255,11 @@ camelcase@^5.3.1:
resolved "http://npm.dui88.com:80/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" resolved "http://npm.dui88.com:80/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA= integrity sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA=
caseless@~0.12.0:
version "0.12.0"
resolved "http://npm.dui88.com:80/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
chalk@^3.0.0: chalk@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "http://npm.dui88.com:80/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" resolved "http://npm.dui88.com:80/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
...@@ -263,6 +312,13 @@ color-name@~1.1.4: ...@@ -263,6 +312,13 @@ color-name@~1.1.4:
resolved "http://npm.dui88.com:80/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" resolved "http://npm.dui88.com:80/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha1-wqCah6y95pVD3m9j+jmVyCbFNqI= integrity sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=
combined-stream@^1.0.6, combined-stream@~1.0.6:
version "1.0.8"
resolved "http://npm.dui88.com:80/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha1-w9RaizT9cwYxoRCoolIGgrMdWn8=
dependencies:
delayed-stream "~1.0.0"
concat-map@0.0.1: concat-map@0.0.1:
version "0.0.1" version "0.0.1"
resolved "http://npm.dui88.com:80/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" resolved "http://npm.dui88.com:80/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
...@@ -313,11 +369,23 @@ cookie@0.4.0: ...@@ -313,11 +369,23 @@ cookie@0.4.0:
resolved "http://npm.dui88.com:80/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" resolved "http://npm.dui88.com:80/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
integrity sha1-vrQ35wIrO21JAZ0IhmUwPr6cFLo= integrity sha1-vrQ35wIrO21JAZ0IhmUwPr6cFLo=
core-util-is@1.0.2:
version "1.0.2"
resolved "http://npm.dui88.com:80/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
crypto-random-string@^2.0.0: crypto-random-string@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "http://npm.dui88.com:80/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5" resolved "http://npm.dui88.com:80/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5"
integrity sha1-7yp6lm7BEIM4g2m6oC6+rSKbMNU= integrity sha1-7yp6lm7BEIM4g2m6oC6+rSKbMNU=
dashdash@^1.12.0:
version "1.14.1"
resolved "http://npm.dui88.com:80/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=
dependencies:
assert-plus "^1.0.0"
debug@2.6.9, debug@^2.2.0, debug@~2.6.9: debug@2.6.9, debug@^2.2.0, debug@~2.6.9:
version "2.6.9" version "2.6.9"
resolved "http://npm.dui88.com:80/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" resolved "http://npm.dui88.com:80/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
...@@ -349,6 +417,11 @@ defer-to-connect@^1.0.1: ...@@ -349,6 +417,11 @@ defer-to-connect@^1.0.1:
resolved "http://npm.dui88.com:80/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591" resolved "http://npm.dui88.com:80/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591"
integrity sha1-MxrgUMCNz3ifjIOnuB8O2U9KxZE= integrity sha1-MxrgUMCNz3ifjIOnuB8O2U9KxZE=
delayed-stream@~1.0.0:
version "1.0.0"
resolved "http://npm.dui88.com:80/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=
depd@~1.1.2: depd@~1.1.2:
version "1.1.2" version "1.1.2"
resolved "http://npm.dui88.com:80/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" resolved "http://npm.dui88.com:80/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
...@@ -371,6 +444,14 @@ duplexer3@^0.1.4: ...@@ -371,6 +444,14 @@ duplexer3@^0.1.4:
resolved "http://npm.dui88.com:80/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" resolved "http://npm.dui88.com:80/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "http://npm.dui88.com:80/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=
dependencies:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
ee-first@1.1.1: ee-first@1.1.1:
version "1.1.1" version "1.1.1"
resolved "http://npm.dui88.com:80/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" resolved "http://npm.dui88.com:80/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
...@@ -449,6 +530,31 @@ express@~4.16.1: ...@@ -449,6 +530,31 @@ express@~4.16.1:
utils-merge "1.0.1" utils-merge "1.0.1"
vary "~1.1.2" vary "~1.1.2"
extend@~3.0.2:
version "3.0.2"
resolved "http://npm.dui88.com:80/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
integrity sha1-+LETa0Bx+9jrFAr/hYsQGewpFfo=
extsprintf@1.3.0:
version "1.3.0"
resolved "http://npm.dui88.com:80/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"
integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=
extsprintf@^1.2.0:
version "1.4.0"
resolved "http://npm.dui88.com:80/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
fast-deep-equal@^3.1.1:
version "3.1.3"
resolved "http://npm.dui88.com:80/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=
fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "http://npm.dui88.com:80/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
integrity sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=
fill-range@^7.0.1: fill-range@^7.0.1:
version "7.0.1" version "7.0.1"
resolved "http://npm.dui88.com:80/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" resolved "http://npm.dui88.com:80/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
...@@ -469,6 +575,20 @@ finalhandler@1.1.1: ...@@ -469,6 +575,20 @@ finalhandler@1.1.1:
statuses "~1.4.0" statuses "~1.4.0"
unpipe "~1.0.0" unpipe "~1.0.0"
forever-agent@~0.6.1:
version "0.6.1"
resolved "http://npm.dui88.com:80/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
form-data@~2.3.2:
version "2.3.3"
resolved "http://npm.dui88.com:80/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
integrity sha1-3M5SwF9kTymManq5Nr1yTO/786Y=
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.6"
mime-types "^2.1.12"
forwarded@0.2.0: forwarded@0.2.0:
version "0.2.0" version "0.2.0"
resolved "http://npm.dui88.com:80/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" resolved "http://npm.dui88.com:80/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
...@@ -498,6 +618,13 @@ get-stream@^5.1.0: ...@@ -498,6 +618,13 @@ get-stream@^5.1.0:
dependencies: dependencies:
pump "^3.0.0" pump "^3.0.0"
getpass@^0.1.1:
version "0.1.7"
resolved "http://npm.dui88.com:80/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=
dependencies:
assert-plus "^1.0.0"
glob-parent@~5.1.2: glob-parent@~5.1.2:
version "5.1.2" version "5.1.2"
resolved "http://npm.dui88.com:80/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" resolved "http://npm.dui88.com:80/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
...@@ -534,6 +661,19 @@ graceful-fs@^4.1.2: ...@@ -534,6 +661,19 @@ graceful-fs@^4.1.2:
resolved "http://npm.dui88.com:80/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" resolved "http://npm.dui88.com:80/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a"
integrity sha1-5BK40z9eAGWTy9PO5t+fLOu+gCo= integrity sha1-5BK40z9eAGWTy9PO5t+fLOu+gCo=
har-schema@^2.0.0:
version "2.0.0"
resolved "http://npm.dui88.com:80/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=
har-validator@~5.1.3:
version "5.1.5"
resolved "http://npm.dui88.com:80/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd"
integrity sha1-HwgDufjLIMD6E4It8ezds2veHv0=
dependencies:
ajv "^6.12.3"
har-schema "^2.0.0"
has-flag@^3.0.0: has-flag@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "http://npm.dui88.com:80/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" resolved "http://npm.dui88.com:80/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
...@@ -564,6 +704,15 @@ http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3: ...@@ -564,6 +704,15 @@ 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-signature@~1.2.0:
version "1.2.0"
resolved "http://npm.dui88.com:80/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=
dependencies:
assert-plus "^1.0.0"
jsprim "^1.2.2"
sshpk "^1.7.0"
iconv-lite@0.4.23: iconv-lite@0.4.23:
version "0.4.23" version "0.4.23"
resolved "http://npm.dui88.com:80/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" resolved "http://npm.dui88.com:80/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63"
...@@ -670,7 +819,7 @@ is-path-inside@^3.0.1: ...@@ -670,7 +819,7 @@ is-path-inside@^3.0.1:
resolved "http://npm.dui88.com:80/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" resolved "http://npm.dui88.com:80/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
integrity sha1-0jE2LlOgf/Kw4Op/7QSRYf/RYoM= integrity sha1-0jE2LlOgf/Kw4Op/7QSRYf/RYoM=
is-typedarray@^1.0.0: is-typedarray@^1.0.0, is-typedarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "http://npm.dui88.com:80/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" resolved "http://npm.dui88.com:80/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
...@@ -680,11 +829,46 @@ is-yarn-global@^0.3.0: ...@@ -680,11 +829,46 @@ is-yarn-global@^0.3.0:
resolved "http://npm.dui88.com:80/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232" resolved "http://npm.dui88.com:80/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232"
integrity sha1-1QLTOCWQ6jAEiTdGdUyJE5lz4jI= integrity sha1-1QLTOCWQ6jAEiTdGdUyJE5lz4jI=
isstream@~0.1.2:
version "0.1.2"
resolved "http://npm.dui88.com:80/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
jsbn@~0.1.0:
version "0.1.1"
resolved "http://npm.dui88.com:80/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM=
json-buffer@3.0.0: json-buffer@3.0.0:
version "3.0.0" version "3.0.0"
resolved "http://npm.dui88.com:80/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" resolved "http://npm.dui88.com:80/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898"
integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "http://npm.dui88.com:80/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
integrity sha1-afaofZUTq4u4/mO9sJecRI5oRmA=
json-schema@0.2.3:
version "0.2.3"
resolved "http://npm.dui88.com:80/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=
json-stringify-safe@~5.0.1:
version "5.0.1"
resolved "http://npm.dui88.com:80/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
jsprim@^1.2.2:
version "1.4.1"
resolved "http://npm.dui88.com:80/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=
dependencies:
assert-plus "1.0.0"
extsprintf "1.3.0"
json-schema "0.2.3"
verror "1.10.0"
keyv@^3.0.0: keyv@^3.0.0:
version "3.1.0" version "3.1.0"
resolved "http://npm.dui88.com:80/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" resolved "http://npm.dui88.com:80/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9"
...@@ -736,7 +920,7 @@ mime-db@1.49.0: ...@@ -736,7 +920,7 @@ mime-db@1.49.0:
resolved "http://npm.dui88.com:80/mime-db/-/mime-db-1.49.0.tgz#f3dfde60c99e9cf3bc9701d687778f537001cbed" resolved "http://npm.dui88.com:80/mime-db/-/mime-db-1.49.0.tgz#f3dfde60c99e9cf3bc9701d687778f537001cbed"
integrity sha1-89/eYMmenPO8lwHWh3ePU3ABy+0= integrity sha1-89/eYMmenPO8lwHWh3ePU3ABy+0=
mime-types@~2.1.24: mime-types@^2.1.12, mime-types@~2.1.19, mime-types@~2.1.24:
version "2.1.32" version "2.1.32"
resolved "http://npm.dui88.com:80/mime-types/-/mime-types-2.1.32.tgz#1d00e89e7de7fe02008db61001d9e02852670fd5" resolved "http://npm.dui88.com:80/mime-types/-/mime-types-2.1.32.tgz#1d00e89e7de7fe02008db61001d9e02852670fd5"
integrity sha1-HQDonn3n/gIAjbYQAdngKFJnD9U= integrity sha1-HQDonn3n/gIAjbYQAdngKFJnD9U=
...@@ -824,6 +1008,11 @@ normalize-url@^4.1.0: ...@@ -824,6 +1008,11 @@ normalize-url@^4.1.0:
resolved "http://npm.dui88.com:80/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a" resolved "http://npm.dui88.com:80/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a"
integrity sha1-DdkM8SiO4dExO4cIHJpZMu5IUYo= integrity sha1-DdkM8SiO4dExO4cIHJpZMu5IUYo=
oauth-sign@~0.9.0:
version "0.9.0"
resolved "http://npm.dui88.com:80/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
integrity sha1-R6ewFrqmi1+g7PPe4IqFxnmsZFU=
on-finished@~2.3.0: on-finished@~2.3.0:
version "2.3.0" version "2.3.0"
resolved "http://npm.dui88.com:80/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" resolved "http://npm.dui88.com:80/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
...@@ -868,6 +1057,11 @@ path-to-regexp@0.1.7: ...@@ -868,6 +1057,11 @@ path-to-regexp@0.1.7:
resolved "http://npm.dui88.com:80/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" resolved "http://npm.dui88.com:80/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=
performance-now@^2.1.0:
version "2.1.0"
resolved "http://npm.dui88.com:80/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
picomatch@^2.0.4, picomatch@^2.2.1: picomatch@^2.0.4, picomatch@^2.2.1:
version "2.3.0" version "2.3.0"
resolved "http://npm.dui88.com:80/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" resolved "http://npm.dui88.com:80/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
...@@ -886,6 +1080,11 @@ proxy-addr@~2.0.4: ...@@ -886,6 +1080,11 @@ proxy-addr@~2.0.4:
forwarded "0.2.0" forwarded "0.2.0"
ipaddr.js "1.9.1" ipaddr.js "1.9.1"
psl@^1.1.28:
version "1.8.0"
resolved "http://npm.dui88.com:80/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24"
integrity sha1-kyb4vPsBOtzABf3/BWrM4CDlHCQ=
pstree.remy@^1.1.7: pstree.remy@^1.1.7:
version "1.1.8" version "1.1.8"
resolved "http://npm.dui88.com:80/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a" resolved "http://npm.dui88.com:80/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a"
...@@ -899,6 +1098,11 @@ pump@^3.0.0: ...@@ -899,6 +1098,11 @@ pump@^3.0.0:
end-of-stream "^1.1.0" end-of-stream "^1.1.0"
once "^1.3.1" once "^1.3.1"
punycode@^2.1.0, punycode@^2.1.1:
version "2.1.1"
resolved "http://npm.dui88.com:80/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha1-tYsBCsQMIsVldhbI0sLALHv0eew=
pupa@^2.0.1: pupa@^2.0.1:
version "2.1.1" version "2.1.1"
resolved "http://npm.dui88.com:80/pupa/-/pupa-2.1.1.tgz#f5e8fd4afc2c5d97828faa523549ed8744a20d62" resolved "http://npm.dui88.com:80/pupa/-/pupa-2.1.1.tgz#f5e8fd4afc2c5d97828faa523549ed8744a20d62"
...@@ -906,7 +1110,7 @@ pupa@^2.0.1: ...@@ -906,7 +1110,7 @@ pupa@^2.0.1:
dependencies: dependencies:
escape-goat "^2.0.0" escape-goat "^2.0.0"
qs@6.5.2: qs@6.5.2, qs@~6.5.2:
version "6.5.2" version "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=
...@@ -957,6 +1161,32 @@ registry-url@^5.0.0: ...@@ -957,6 +1161,32 @@ registry-url@^5.0.0:
dependencies: dependencies:
rc "^1.2.8" rc "^1.2.8"
request@^2.88.2:
version "2.88.2"
resolved "http://npm.dui88.com:80/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3"
integrity sha1-1zyRhzHLWofaBH4gcjQUb2ZNErM=
dependencies:
aws-sign2 "~0.7.0"
aws4 "^1.8.0"
caseless "~0.12.0"
combined-stream "~1.0.6"
extend "~3.0.2"
forever-agent "~0.6.1"
form-data "~2.3.2"
har-validator "~5.1.3"
http-signature "~1.2.0"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.19"
oauth-sign "~0.9.0"
performance-now "^2.1.0"
qs "~6.5.2"
safe-buffer "^5.1.2"
tough-cookie "~2.5.0"
tunnel-agent "^0.6.0"
uuid "^3.3.2"
responselike@^1.0.2: responselike@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "http://npm.dui88.com:80/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" resolved "http://npm.dui88.com:80/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7"
...@@ -969,7 +1199,12 @@ safe-buffer@5.1.2: ...@@ -969,7 +1199,12 @@ safe-buffer@5.1.2:
resolved "http://npm.dui88.com:80/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" resolved "http://npm.dui88.com:80/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha1-mR7GnSluAxN0fVm9/St0XDX4go0= integrity sha1-mR7GnSluAxN0fVm9/St0XDX4go0=
"safer-buffer@>= 2.1.2 < 3": safe-buffer@^5.0.1, safe-buffer@^5.1.2:
version "5.2.1"
resolved "http://npm.dui88.com:80/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=
"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2" version "2.1.2"
resolved "http://npm.dui88.com:80/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" resolved "http://npm.dui88.com:80/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo= integrity sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=
...@@ -1030,6 +1265,21 @@ signal-exit@^3.0.2: ...@@ -1030,6 +1265,21 @@ signal-exit@^3.0.2:
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"
integrity sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw= integrity sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=
sshpk@^1.7.0:
version "1.16.1"
resolved "http://npm.dui88.com:80/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877"
integrity sha1-+2YcC+8ps520B2nuOfpwCT1vaHc=
dependencies:
asn1 "~0.2.3"
assert-plus "^1.0.0"
bcrypt-pbkdf "^1.0.0"
dashdash "^1.12.0"
ecc-jsbn "~0.1.1"
getpass "^0.1.1"
jsbn "~0.1.0"
safer-buffer "^2.0.2"
tweetnacl "~0.14.0"
"statuses@>= 1.4.0 < 2": "statuses@>= 1.4.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"
...@@ -1115,6 +1365,26 @@ touch@^3.1.0: ...@@ -1115,6 +1365,26 @@ touch@^3.1.0:
dependencies: dependencies:
nopt "~1.0.10" nopt "~1.0.10"
tough-cookie@~2.5.0:
version "2.5.0"
resolved "http://npm.dui88.com:80/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2"
integrity sha1-zZ+yoKodWhK0c72fuW+j3P9lreI=
dependencies:
psl "^1.1.28"
punycode "^2.1.1"
tunnel-agent@^0.6.0:
version "0.6.0"
resolved "http://npm.dui88.com:80/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=
dependencies:
safe-buffer "^5.0.1"
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "http://npm.dui88.com:80/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
type-fest@^0.8.1: type-fest@^0.8.1:
version "0.8.1" version "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"
...@@ -1173,6 +1443,13 @@ update-notifier@^4.1.0: ...@@ -1173,6 +1443,13 @@ update-notifier@^4.1.0:
semver-diff "^3.1.1" semver-diff "^3.1.1"
xdg-basedir "^4.0.0" xdg-basedir "^4.0.0"
uri-js@^4.2.2:
version "4.4.1"
resolved "http://npm.dui88.com:80/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
integrity sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=
dependencies:
punycode "^2.1.0"
url-parse-lax@^3.0.0: url-parse-lax@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "http://npm.dui88.com:80/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c" resolved "http://npm.dui88.com:80/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c"
...@@ -1185,11 +1462,25 @@ utils-merge@1.0.1: ...@@ -1185,11 +1462,25 @@ utils-merge@1.0.1:
resolved "http://npm.dui88.com:80/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" resolved "http://npm.dui88.com:80/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
uuid@^3.3.2:
version "3.4.0"
resolved "http://npm.dui88.com:80/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=
vary@~1.1.2: vary@~1.1.2:
version "1.1.2" version "1.1.2"
resolved "http://npm.dui88.com:80/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" resolved "http://npm.dui88.com:80/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
verror@1.10.0:
version "1.10.0"
resolved "http://npm.dui88.com:80/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=
dependencies:
assert-plus "^1.0.0"
core-util-is "1.0.2"
extsprintf "^1.2.0"
widest-line@^3.1.0: widest-line@^3.1.0:
version "3.1.0" version "3.1.0"
resolved "http://npm.dui88.com:80/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" resolved "http://npm.dui88.com:80/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca"
......
import { render, screen } from '@testing-library/react'; import {render, screen} from '@testing-library/react';
import App from './App'; import App from './App';
test('renders learn react link', () => { test('renders learn react link', () => {
......
import './Content.scss' import './Content.scss'
import ContentItem from "./ContentItem"; import ContentItem from "./ContentItem";
import data from "../../data";
import {useContext} from "react"; import {useContext} from "react";
import {Root} from "../../dataCenter/Root"; import {Root} from "../../dataCenter/Root";
...@@ -9,7 +8,7 @@ function Content(props) { ...@@ -9,7 +8,7 @@ function Content(props) {
return ( return (
<div className="content"> <div className="content">
{ {
dataCenter.index.content.map(v => { dataCenter?.toolBox?.length && dataCenter.toolBox.map(v => {
return ( return (
<ContentItem key={v.id} value={v}/> <ContentItem key={v.id} value={v}/>
) )
......
import './Pop_addToolBox.scss'
import {useContext} from "react";
import {PopContext, Root} from "../../dataCenter/Root";
import {useFormState} from "../../utils/hook";
import closeIcon from '../../static/cancel.png'
function Pop_addToolBox () {
const {fetchData} = useContext(Root)
const {hidePop} = useContext(PopContext)
const [input, setInput] = useFormState()
const addToolBox = ()=>{
fetchData('/addToolBox',input)
}
return (
<div className="Pop-container">
<div className="Pop-tool">
<button className="close" onClick={()=> hidePop()}>X</button>
</div>
<h2 className='Pop-title'>新建工具盒</h2>
<div className="formArea">
<div className="item-addToolBox">
<label> 名称:</label> <input type="text" onChange={e => setInput('name',e.target.value)}/>
</div>
<div className="item-addToolBox">
<label> 图标:</label> <input type="text" onChange={e => setInput('icon',e.target.value)}/>
</div>
<div className="item-addToolBox">
<label> 描述:</label> <input type="text" onChange={e => setInput('desc',e.target.value)}/>
</div>
<div className="item-addToolBox">
<label> 链接:</label> <input type="text" onChange={e => setInput('url',e.target.value)}/>
</div>
</div>
<button className='btn-submit-addToolBox'>提交</button>
</div>
)
}
export default Pop_addToolBox
.Pop-container {
width: 300px;
height: 600px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(219, 220, 224, 0.7);
border-radius: 5px;
border: 2px solid #DBDCE0;
.Pop-tool{
height: 24px;
background: rgba(0, 0, 0, 0.7);
.close{
width: 23px;
height: 23px;
font-size: 18px;
color: #ffffff;
background: rgba(0, 0, 0,0.9);
}
}
}
import data from "../../data";
import './ToolType.scss' import './ToolType.scss'
import {useContext, useState} from "react"; import {useContext, useState} from "react";
import {Root} from "../../dataCenter/Root"; import {Root} from "../../dataCenter/Root";
...@@ -13,7 +12,7 @@ function ToolType (props) { ...@@ -13,7 +12,7 @@ function ToolType (props) {
const classNameArr = ['item-tool-type '] const classNameArr = ['item-tool-type ']
if (v.id === typeId) classNameArr.push('item-tool-type-selected') if (v.id === typeId) classNameArr.push('item-tool-type-selected')
return ( return (
<div key={v.id} className={classNameArr.join('')} onClick={()=>setTypeId(v.id)}>{v.type}</div> <div key={v.id} className={classNameArr.join('')} onClick={()=>setTypeId(v.id)}>{v.typeName}</div>
) )
}) })
} }
......
...@@ -18,7 +18,6 @@ const data = { ...@@ -18,7 +18,6 @@ const data = {
icon: null, icon: null,
desc: '你看看现在哪有瓜啊,都是大棚的瓜,你嫌贵我还嫌贵呢!', desc: '你看看现在哪有瓜啊,都是大棚的瓜,你嫌贵我还嫌贵呢!',
url: 'https://www.bilibili.com', url: 'https://www.bilibili.com',
follow: true
} }
}) })
......
...@@ -4,18 +4,18 @@ import apiConfig from "../config/apiConfig"; ...@@ -4,18 +4,18 @@ import apiConfig from "../config/apiConfig";
import {UPDATE_DATA} from "./action"; import {UPDATE_DATA} from "./action";
const Root = createContext({}) const Root = createContext({})
const PopContext = createContext({})
function DataCenter(props) { function DataCenter(props) {
const [dataCenter, dispatch] = useReducer(dataReducer, initDataCenter, () => { const [dataCenter, dispatch] = useReducer(dataReducer, initDataCenter, () => {
return initDataCenter return initDataCenter
}) })
const generateUrl = (path, requestData) => {
const domain = apiConfig.domain if (requestData) {
return apiConfig.domain + path + `?${requestData}`
}
const generateUrl = (path) => { return apiConfig.domain + path
return domain + path
} }
/** /**
...@@ -25,12 +25,12 @@ function DataCenter(props) { ...@@ -25,12 +25,12 @@ function DataCenter(props) {
* @param requestData * @param requestData
* @returns {Promise<T>} * @returns {Promise<T>}
*/ */
const fetchData = (path,dataName,requestData) => const fetchData = (path,requestData,dataName) =>
fetch(generateUrl(path), {credentials: 'include'}) fetch(generateUrl(path,requestData), {credentials: 'include'})
.then(res => res.json()) .then(res => res.json())
.then(res => { .then(res => {
if (res.success){ if (res.success){
dispatch(UPDATE_DATA({[dataName]: res.data})) !!dataName && dispatch(UPDATE_DATA({[dataName]: res.data}))
}else { }else {
throw res throw res
} }
...@@ -51,7 +51,8 @@ function DataCenter(props) { ...@@ -51,7 +51,8 @@ function DataCenter(props) {
} }
export { export {
Root Root,
PopContext
} }
export default DataCenter export default DataCenter
import data from "../data";
const initDataCenter = { const initDataCenter = {
...data
} }
/** /**
......
import './index.scss' import './index.scss'
import ToolType from "../component/ToolType/ToolType"; import ToolType from "../component/ToolType/ToolType";
import Content from "../component/Content/Content"; import Content from "../component/Content/Content";
import {useContext, useEffect} from "react"; import {useContext, useEffect, useState} from "react";
import {Root} from "../dataCenter/Root"; import Pop_addToolBox from "../component/Pop_addToolBox/Pop_addToolBox";
import {PopContext, Root} from "../dataCenter/Root";
function Index() { function Index() {
const {fetchData} = useContext(Root) const {fetchData} = useContext(Root)
const getIndex = () => fetchData('/database','type') const [pop, setPop] = useState('')
console.log(JSON.stringify({name:1,icon:1,desc:1,url:'https://www.baidu.com'}))
const getIndex = () => fetchData('/queryType',{}, 'type')
.then(() => fetchData('/queryToolBox',{}, 'toolBox'))
useEffect(()=>{ useEffect(() => {
getIndex() getIndex()
},[]) }, [])
return ( return (
<div className="index"> <div className="index">
<div className="nav"> <div className="nav">
<div className="nav-title">Dui123</div> <div className="nav-title">Dui123</div>
</div> </div>
<div className="adminTool">
<button className='btn-admin' onClick={() => setPop('addToolBox')}>新建工具盒</button>
</div>
<div className="tool-nav"> <div className="tool-nav">
<ToolType/> <ToolType/>
</div> </div>
...@@ -25,6 +31,11 @@ function Index() { ...@@ -25,6 +31,11 @@ function Index() {
<div className="container"> <div className="container">
<Content/> <Content/>
</div> </div>
<PopContext.Provider value={{hidePop: () => setPop('')}}>
{
pop === 'addToolBox' && <Pop_addToolBox/>
}
</PopContext.Provider>
</div> </div>
) )
} }
......
...@@ -7,6 +7,17 @@ body { ...@@ -7,6 +7,17 @@ body {
height: 100%; height: 100%;
color: $fontColor; color: $fontColor;
.adminTool{
position: absolute;
width: 160px;
text-align: center;
top: 60px;
.btn-admin{
width: 120px;
height: 35px;
}
}
.nav { .nav {
width: 100%; width: 100%;
......
import {useCallback, useState} from "react";
const useFormState = (initialValues = {}) => {
const [input, setInput] = useState(initialValues)
const setInputData = useCallback((name, value) => {
setInput(() => Object.assign({}, {...input}, {[name]: value}))
}, [input])
return [input, setInputData]
}
export {
useFormState
}
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