Commit e7e48c89 authored by wty's avatar wty

dev阿波罗实例对接

parent cfd32603
{ {
"files": { "files": {
"main.css": "/static/css/main.63c35fee.chunk.css", "main.css": "/static/css/main.63c35fee.chunk.css",
"main.js": "/static/js/main.7d258f7c.chunk.js", "main.js": "/static/js/main.b9736c6f.chunk.js",
"main.js.map": "/static/js/main.7d258f7c.chunk.js.map", "main.js.map": "/static/js/main.b9736c6f.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.4628cb4f.js", "runtime-main.js": "/static/js/runtime-main.4628cb4f.js",
"runtime-main.js.map": "/static/js/runtime-main.4628cb4f.js.map", "runtime-main.js.map": "/static/js/runtime-main.4628cb4f.js.map",
"static/css/2.1f1ea42e.chunk.css": "/static/css/2.1f1ea42e.chunk.css", "static/css/2.1f1ea42e.chunk.css": "/static/css/2.1f1ea42e.chunk.css",
...@@ -24,6 +24,6 @@ ...@@ -24,6 +24,6 @@
"static/css/2.1f1ea42e.chunk.css", "static/css/2.1f1ea42e.chunk.css",
"static/js/2.44df36db.chunk.js", "static/js/2.44df36db.chunk.js",
"static/css/main.63c35fee.chunk.css", "static/css/main.63c35fee.chunk.css",
"static/js/main.7d258f7c.chunk.js" "static/js/main.b9736c6f.chunk.js"
] ]
} }
\ No newline at end of file
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><link href="/static/css/2.1f1ea42e.chunk.css" rel="stylesheet"><link href="/static/css/main.63c35fee.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"4971491c"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpdui123=this.webpackJsonpdui123||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([])</script><script src="/static/js/2.44df36db.chunk.js"></script><script src="/static/js/main.7d258f7c.chunk.js"></script></body></html> <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><link href="/static/css/2.1f1ea42e.chunk.css" rel="stylesheet"><link href="/static/css/main.63c35fee.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"4971491c"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpdui123=this.webpackJsonpdui123||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([])</script><script src="/static/js/2.44df36db.chunk.js"></script><script src="/static/js/main.b9736c6f.chunk.js"></script></body></html>
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
This diff is collapsed.
{
"PORT": "3000",
"API_HOST": "//dui123.duibadev.com.cn",
"PROJECTX_HOST": "http://activity.m.duibadev.com.cn",
"SSO": {
"ssourl": "http://sso.duibadev.com.cn",
"systemId": 249,
"systemName": "dui123",
"appSecret": "98e72000586f43e3b55da663c9f8af72",
"profiles": "dev"
},
"RES_MYSQL_ID": "duiba_spark8",
"remote_config_url": "http://configserver.dui88.com/dui123/dev"
}
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
"web-vitals": "^1.0.1" "web-vitals": "^1.0.1"
}, },
"scripts": { "scripts": {
"dev": "react-scripts start",
"start": "node server/bin/www", "start": "node server/bin/www",
"build": "sh build.sh", "build": "sh build.sh",
"buildWeb": "react-scripts build", "buildWeb": "react-scripts build",
......
const MYSQL = require('mysql') const MYSQL = require('mysql')
const Mysql = MYSQL.createPool({ const config = require('../config/dev.json')
'host': '127.0.0.1', const request = require('request')
'port': '3306',
'user': 'wty', request(config['remote_config_url'],{},(error, request, body)=>{
'password': 'wty990215', const data = JSON.parse(body)
'database': 'dui123', const source = data['propertySources'][0]['source']
'connectionLimit': 1000 const username = source['apollo.mysql.duiba_web_tool.username']
const password = source['apollo.mysql.duiba_web_tool.password']
const database = source['apollo.mysql.duiba_web_tool.database']
const host = source['apollo.mysql.duiba_web_tool.url'].split(':')[0]
const port = source['apollo.mysql.duiba_web_tool.url'].split(':')[1]
const Mysql = MYSQL.createPool({
'host': host,
'port': port,
'user': username,
'password': password,
'database': database,
'connectionLimit': 1000
})
module.exports = Mysql
}) })
module.exports = Mysql
...@@ -30,10 +30,11 @@ router.get('/getUser', function (req, res, next) { ...@@ -30,10 +30,11 @@ router.get('/getUser', function (req, res, next) {
}) })
return return
} }
console.log(result)
const _result = result.slice() const _result = result.slice()
_result[0].follow = JSON.parse(_result[0].follow) _result[0].follow = JSON.parse(_result[0].follow)
// console.log(JSON.parse(_result[0]))
res.send({ res.send({
......
...@@ -4,8 +4,18 @@ import IndexAdmin from "./page/indexAdmin"; ...@@ -4,8 +4,18 @@ import IndexAdmin from "./page/indexAdmin";
import Index from "./page/index"; import Index from "./page/index";
import Login from "./page/login/login"; import Login from "./page/login/login";
import {HashRouter as Router, Route, Switch} from "react-router-dom"; import {HashRouter as Router, Route, Switch} from "react-router-dom";
import {useEffect} from "react";
function App() { function App() {
useEffect(() => {
console.log("%c+",
`font-size: 1px;
padding: 122px 217px;
background-image: url(https://yun.duiba.com.cn/spark/assets/cc8da992b527b3cd24da7df9a5be8b2361c2e549.jpg);
background-size: contain;
background-repeat: no-repeat;
color: transparent;`);
}, [])
return ( return (
<Router> <Router>
<DataCenter> <DataCenter>
......
...@@ -9,11 +9,11 @@ function Content(props) { ...@@ -9,11 +9,11 @@ function Content(props) {
<div className="content"> <div className="content">
{ {
dataCenter.toolBox?.length ? dataCenter?.toolBox?.filter(v => { dataCenter.toolBox?.length ? dataCenter?.toolBox?.filter(v => {
if (dataCenter.childTypeId === 'all') return true if (dataCenter.child_type_id === 'all') return true
else return v.childTypeId === dataCenter.childTypeId else return v.child_type_id === dataCenter.child_type_id
}).map(v => { }).map(v => {
return ( return (
<ContentItem key={v['toolBoxId']} value={v}/> <ContentItem key={v['toolbox_id']} value={v}/>
) )
}) })
: :
......
...@@ -6,27 +6,27 @@ import {Root} from "../../dataCenter/Root"; ...@@ -6,27 +6,27 @@ import {Root} from "../../dataCenter/Root";
function ContentItem(props) { function ContentItem(props) {
const {dataCenter, fetchData} = useContext(Root) const {dataCenter, fetchData} = useContext(Root)
const {toolBoxIcon, toolBoxName, toolBoxDesc, toolBoxUrl, toolBoxId} = props.value const {toolbox_icon, toolbox_name, toolbox_desc, toolbox_url, toolbox_id} = props.value
const [isFollow, setIsFollow] = useState(false) const [isFollow, setIsFollow] = useState(false)
const [itemIcon, setItemIcon] = useState(toolBoxIcon) const [itemIcon, setItemIcon] = useState(toolbox_icon)
const jumpUrl = url => window.location.href = url const jumpUrl = url => window.location.href = url
const follow = () => { const follow = () => {
const _follow = dataCenter.userInfo.follow.slice() const _follow = dataCenter.userInfo.follow.slice()
if (!isFollow) { if (!isFollow) {
_follow.push(toolBoxId) _follow.push(toolbox_id)
} else { } else {
const index = _follow.indexOf(toolBoxId) const index = _follow.indexOf(toolbox_id)
_follow.splice(index, 1) _follow.splice(index, 1)
} }
console.log( {follow: JSON.stringify(_follow), userId: dataCenter.userInfo.uid}) console.log( {follow: JSON.stringify(_follow), uid: dataCenter.userInfo.uid})
fetchData('/users/follow', {follow: JSON.stringify(_follow), userId: dataCenter.userInfo.uid}) fetchData('/users/follow', {follow: JSON.stringify(_follow), uid: dataCenter.userInfo.uid})
.then(() => fetchData('/users/getUser', {userId: 100001}, 'userInfo')) .then(() => fetchData('/users/getUser', {uid: 100001}, 'userInfo'))
} }
useEffect(() => { useEffect(() => {
if (dataCenter.userInfo?.follow.includes(toolBoxId)) { if (dataCenter.userInfo?.follow.includes(toolbox_id)) {
setIsFollow(true) setIsFollow(true)
} else { } else {
setIsFollow(false) setIsFollow(false)
...@@ -35,18 +35,18 @@ function ContentItem(props) { ...@@ -35,18 +35,18 @@ function ContentItem(props) {
return ( return (
<div className="content-item"> <div className="content-item">
<div className="item-icon" onClick={() => jumpUrl(toolBoxUrl)}> <div className="item-icon" onClick={() => jumpUrl(toolbox_url)}>
{ {
!itemIcon && <div className="defaultIcon">{toolBoxName[0]}</div> !itemIcon && <div className="defaultIcon">{toolbox_name[0]}</div>
} }
{ {
itemIcon && <img src={itemIcon} alt='' onError={e => setItemIcon(null)}/> itemIcon && <img src={itemIcon} alt='' onError={e => setItemIcon(null)}/>
} }
</div> </div>
<div className="item-name" onClick={() => jumpUrl(toolBoxUrl)}>{toolBoxName}</div> <div className="item-name" onClick={() => jumpUrl(toolbox_url)}>{toolbox_name}</div>
<div className="item-desc">{toolBoxDesc}</div> <div className="item-desc">{toolbox_desc}</div>
<a className='item-url' href={toolBoxUrl}>{toolBoxUrl}</a> <a className='item-url' href={toolbox_url}>{toolbox_url}</a>
<div className="follow"> <div className="follow">
<img className='icon-follow' src={isFollow ? followed : notFollow} alt="" onClick={() => follow()}/> <img className='icon-follow' src={isFollow ? followed : notFollow} alt="" onClick={() => follow()}/>
收藏 收藏
......
...@@ -11,11 +11,11 @@ function Content(props) { ...@@ -11,11 +11,11 @@ function Content(props) {
<div className="content"> <div className="content">
{ {
dataCenter.toolBox?.length ? dataCenter?.toolBox?.filter(v => { dataCenter.toolBox?.length ? dataCenter?.toolBox?.filter(v => {
if (dataCenter.childTypeId === 'all') return true if (dataCenter.child_type_id === 'all') return true
else return v.childTypeId === dataCenter.childTypeId else return v.child_type_id === dataCenter.child_type_id
}).map(v => { }).map(v => {
return ( return (
<ContentItemAdmin key={v['toolBoxId']} value={v}/> <ContentItemAdmin key={v['toolbox_id']} value={v}/>
) )
}) })
: :
......
...@@ -14,15 +14,15 @@ function ContentItemAdmin(props) { ...@@ -14,15 +14,15 @@ function ContentItemAdmin(props) {
const {fetchData} = useContext(Root) const {fetchData} = useContext(Root)
const {showPop} = useContext(PopContext) const {showPop} = useContext(PopContext)
const {toolBoxIcon, toolBoxName, toolBoxDesc, toolBoxUrl, follow, toolBoxId} = props.value const {toolbox_icon, toolbox_name, toolbox_desc, toolbox_url, follow, toolbox_id} = props.value
const [itemIcon, setItemIcon] = useState(toolBoxIcon) const [itemIcon, setItemIcon] = useState(toolbox_icon)
const jumpUrl = url => { const jumpUrl = url => {
window.location.href = url window.location.href = url
} }
const deleteItem = toolBoxId => { const deleteItem = toolbox_id => {
fetchData('/delete/deleteToolBoxById', {toolBoxId}) fetchData('/delete/deleteToolBoxById', {toolbox_id})
} }
return ( return (
...@@ -30,19 +30,19 @@ function ContentItemAdmin(props) { ...@@ -30,19 +30,19 @@ function ContentItemAdmin(props) {
<div className="content-adminTool"> <div className="content-adminTool">
<img src={dragIcon} alt=""/> <img src={dragIcon} alt=""/>
<img src={setting} alt="" onClick={() => setVisible(true)}/> <img src={setting} alt="" onClick={() => setVisible(true)}/>
<img src={trash} alt="" onClick={() => deleteItem(toolBoxId)}/> <img src={trash} alt="" onClick={() => deleteItem(toolbox_id)}/>
</div> </div>
<div className="item-icon" onClick={() => jumpUrl(toolBoxUrl)}> <div className="item-icon" onClick={() => jumpUrl(toolbox_url)}>
{ {
!itemIcon && <div className="defaultIcon">{toolBoxName[0]}</div> !itemIcon && <div className="defaultIcon">{toolbox_name[0]}</div>
} }
{ {
itemIcon && <img src={itemIcon} alt='' onError={e => setItemIcon(null)}/> itemIcon && <img src={itemIcon} alt='' onError={e => setItemIcon(null)}/>
} }
</div> </div>
<div className="item-name" onClick={() => jumpUrl(toolBoxUrl)}>{toolBoxName}</div> <div className="item-name" onClick={() => jumpUrl(toolbox_url)}>{toolbox_name}</div>
<div className="item-desc">{toolBoxDesc}</div> <div className="item-desc">{toolbox_desc}</div>
<a className='item-url' href={toolBoxUrl}>{toolBoxUrl}</a> <a className='item-url' href={toolbox_url}>{toolbox_url}</a>
<div className="follow"> <div className="follow">
<img className='icon-follow' src={follow ? followed : notFollow} alt=""/> <img className='icon-follow' src={follow ? followed : notFollow} alt=""/>
收藏 收藏
......
...@@ -4,46 +4,46 @@ import {useFormState} from "../../utils/hook"; ...@@ -4,46 +4,46 @@ import {useFormState} from "../../utils/hook";
import PopContainer from "../PopContainer/PopContainer"; import PopContainer from "../PopContainer/PopContainer";
function Pop_toolBoxConfig(props) { function Pop_toolBoxConfig(props) {
const {toolBoxName, toolBoxIcon, toolBoxDesc, toolBoxUrl, toolBoxId} = props.value const {toolbox_name, toolbox_icon, toolbox_desc, toolbox_url, toolbox_id} = props.value
const {fetchData, updateIndex} = useContext(Root) const {fetchData, updateIndex} = useContext(Root)
const [input, setInput] = useFormState({ const [input, setInput] = useFormState({
toolBoxName, toolbox_name,
toolBoxIcon, toolbox_icon,
toolBoxDesc, toolbox_desc,
toolBoxUrl toolbox_url
}) })
const updateToolBox = () => { const updateToolBox = () => {
fetchData('/update/updateToolBox', Object.assign({}, input, {toolBoxId})) fetchData('/update/updateToolBox', Object.assign({}, input, {toolbox_id}))
.then(() => updateIndex()) .then(() => updateIndex())
} }
return ( return (
<PopContainer> <PopContainer>
<h2 className='Pop-title'>{toolBoxName}</h2> <h2 className='Pop-title'>{toolbox_name}</h2>
<div className="formArea"> <div className="formArea">
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxName', e.target.value)} <input type="text" onChange={e => setInput('toolbox_name', e.target.value)}
defaultValue={input?.['toolBoxName']} defaultValue={input?.['toolbox_name']}
min={1} required/> min={1} required/>
<span> 名称</span> <span> 名称</span>
</div> </div>
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxIcon', e.target.value)} <input type="text" onChange={e => setInput('toolbox_icon', e.target.value)}
defaultValue={input?.['toolBoxIcon']} defaultValue={input?.['toolbox_icon']}
min={1} required/> min={1} required/>
<span> 图标</span> <span> 图标</span>
</div> </div>
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxDesc', e.target.value)} <input type="text" onChange={e => setInput('toolbox_desc', e.target.value)}
defaultValue={input?.['toolBoxDesc']} defaultValue={input?.['toolbox_desc']}
min={1} required/> min={1} required/>
<span> 描述</span> <span> 描述</span>
</div> </div>
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxUrl', e.target.value)} <input type="text" onChange={e => setInput('toolbox_url', e.target.value)}
defaultValue={input?.['toolBoxUrl']} min={1} defaultValue={input?.['toolbox_url']} min={1}
required/> required/>
<span> 链接</span> <span> 链接</span>
</div> </div>
......
...@@ -18,35 +18,35 @@ function Pop_addToolBox() { ...@@ -18,35 +18,35 @@ function Pop_addToolBox() {
<h2 className='Pop-title'>新建工具盒</h2> <h2 className='Pop-title'>新建工具盒</h2>
<div className="formArea"> <div className="formArea">
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxName', e.target.value)} <input type="text" onChange={e => setInput('toolbox_name', e.target.value)}
defaultValue={input?.['toolBoxName']} defaultValue={input?.['toolbox_name']}
min={1} required/> min={1} required/>
<span> 名称</span> <span> 名称</span>
</div> </div>
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxIcon', e.target.value)} <input type="text" onChange={e => setInput('toolbox_icon', e.target.value)}
defaultValue={input?.['toolBoxIcon']} defaultValue={input?.['toolbox_icon']}
min={1} required/> min={1} required/>
<span> 图标</span> <span> 图标</span>
</div> </div>
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxDesc', e.target.value)} <input type="text" onChange={e => setInput('toolbox_desc', e.target.value)}
defaultValue={input?.['toolBoxDesc']} defaultValue={input?.['toolbox_desc']}
min={1} required/> min={1} required/>
<span> 描述</span> <span> 描述</span>
</div> </div>
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('toolBoxUrl', e.target.value)} <input type="text" onChange={e => setInput('toolbox_url', e.target.value)}
defaultValue={input?.['toolBoxUrl']} min={1} defaultValue={input?.['toolbox_url']} min={1}
required/> required/>
<span> 链接</span> <span> 链接</span>
</div> </div>
<div className="input-group "> <div className="input-group ">
<select onChange={(e)=> setInput('typeId',e.target.value)}> <select onChange={(e)=> setInput('type_id',e.target.value)}>
{ {
dataCenter?.type?.length && dataCenter?.type.map(v=>{ dataCenter?.type?.length && dataCenter?.type.map(v=>{
return ( return (
<option key={v.typeId} value={v.typeId}>{v.typeName}</option> <option key={v.type_id} value={v.type_id}>{v.type_name}</option>
) )
}) })
} }
......
...@@ -20,8 +20,8 @@ function Pop_addType(props) { ...@@ -20,8 +20,8 @@ function Pop_addType(props) {
<h2 className='Pop-title'>新建类型</h2> <h2 className='Pop-title'>新建类型</h2>
<div className="formArea"> <div className="formArea">
<div className="input-group "> <div className="input-group ">
<input type="text" onChange={e => setInput('typeName', e.target.value)} <input type="text" onChange={e => setInput('type_name', e.target.value)}
defaultValue={input?.typeName} defaultValue={input?.type_name}
min={1} required/> min={1} required/>
<span> 类型名称</span> <span> 类型名称</span>
</div> </div>
......
...@@ -5,17 +5,17 @@ import {CHANGE_CHILD_TYPE, CHANGE_TYPE} from "../../dataCenter/action"; ...@@ -5,17 +5,17 @@ import {CHANGE_CHILD_TYPE, CHANGE_TYPE} from "../../dataCenter/action";
const ChildTypeItem = props => { const ChildTypeItem = props => {
const {dataCenter, dispatch} = useContext(Root) const {dataCenter, dispatch} = useContext(Root)
const {childTypeId, childTypeName} = props const {child_type_id, child_type_name} = props
const classNameArr = ['child-type-item'] const classNameArr = ['child-type-item']
if (childTypeId === dataCenter.childTypeId) { if (child_type_id === dataCenter.child_type_id) {
classNameArr.push('child-type-item-selected') classNameArr.push('child-type-item-selected')
} }
const handleClick = () => { const handleClick = () => {
console.log(childTypeId) console.log(child_type_id)
dispatch(CHANGE_CHILD_TYPE(childTypeId)) dispatch(CHANGE_CHILD_TYPE(child_type_id))
} }
return ( return (
<div className={classNameArr.join(' ')} onClick={handleClick}>{childTypeName}</div> <div className={classNameArr.join(' ')} onClick={handleClick}>{child_type_name}</div>
) )
} }
...@@ -25,27 +25,27 @@ function ToolType(props) { ...@@ -25,27 +25,27 @@ function ToolType(props) {
return ( return (
<> <>
<div className="tab-tool-type"> <div className="tab-tool-type">
<div className={dataCenter.typeId === 'follow' ? 'item-tool-type item-tool-type-selected' : 'item-tool-type'} <div className={dataCenter.type_id === 'follow' ? 'item-tool-type item-tool-type-selected' : 'item-tool-type'}
onClick={() => dispatch(CHANGE_TYPE('follow'))}>我的收藏 onClick={() => dispatch(CHANGE_TYPE('follow'))}>我的收藏
</div> </div>
{ {
dataCenter?.type?.length > 0 && dataCenter.type.map(v => { dataCenter?.type?.length > 0 && dataCenter.type.map(v => {
const classNameArr = ['item-tool-type '] const classNameArr = ['item-tool-type ']
if (v["typeId"] === dataCenter.typeId) classNameArr.push('item-tool-type-selected') if (v["type_id"] === dataCenter.type_id) classNameArr.push('item-tool-type-selected')
return ( return (
<div key={v["typeId"]} className={classNameArr.join('')} <div key={v["type_id"]} className={classNameArr.join('')}
onClick={() => dispatch(CHANGE_TYPE( v["typeId"]))}>{v.typeName}</div> onClick={() => dispatch(CHANGE_TYPE( v["type_id"]))}>{v.type_name}</div>
) )
}) })
} }
</div> </div>
<div className="child-type"> <div className="child-type">
<ChildTypeItem key={'all'} childTypeId={'all'} childTypeName={'全部'}/> <ChildTypeItem key={'all'} child_type_id={'all'} child_type_name={'全部'}/>
{ {
dataCenter?.childType?.length > 0 && dataCenter?.childType.map(v => { dataCenter?.childType?.length > 0 && dataCenter?.childType.map(v => {
return ( return (
<ChildTypeItem key={v.childTypeId} childTypeId={v.childTypeId} <ChildTypeItem key={v.child_type_id} child_type_id={v.child_type_id}
childTypeName={v.childTypeName}/> child_type_name={v.child_type_name}/>
) )
}) })
} }
......
const apiConfig = { const apiConfig = {
domain: 'http://' + window.location.hostname + ':3000', // domain: 'http://' + window.location.hostname + ':3000',
domain: 'http://127.0.0.1:3001',
} }
export default apiConfig export default apiConfig
const UPDATE_DATA = data => ({type: 'UPDATE_DATA', data: {...data}}) const UPDATE_DATA = data => ({type: 'UPDATE_DATA', data: {...data}})
const NEED_UPDATE_INDEX = () => ({type: 'NEED_UPDATE_INDEX'}) const NEED_UPDATE_INDEX = () => ({type: 'NEED_UPDATE_INDEX'})
const CHANGE_TYPE = typeId => ({type: 'CHANGE_TYPE', typeId: typeId}) const CHANGE_TYPE = type_id => ({type: 'CHANGE_TYPE', type_id: type_id})
const CHANGE_CHILD_TYPE = childTypeId => ({type: 'CHANGE_CHILD_TYPE', childTypeId: childTypeId}) const CHANGE_CHILD_TYPE = child_type_id => ({type: 'CHANGE_CHILD_TYPE', child_type_id: child_type_id})
export { export {
UPDATE_DATA, UPDATE_DATA,
......
...@@ -4,8 +4,8 @@ const initDataCenter = { ...@@ -4,8 +4,8 @@ const initDataCenter = {
childType: null, childType: null,
userInfo: null, userInfo: null,
needUpdateIndex: false, needUpdateIndex: false,
typeId: 'follow', type_id: 'follow',
childTypeId: 'all' child_type_id: 'all'
} }
/** /**
...@@ -44,9 +44,9 @@ const dataReducer = (state, action) => { ...@@ -44,9 +44,9 @@ const dataReducer = (state, action) => {
case 'NEED_UPDATE_INDEX': case 'NEED_UPDATE_INDEX':
return Object.assign({}, state, {needUpdateIndex: !state.needUpdateIndex}) return Object.assign({}, state, {needUpdateIndex: !state.needUpdateIndex})
case 'CHANGE_TYPE': case 'CHANGE_TYPE':
return Object.assign({}, state, {typeId: action.typeId}) return Object.assign({}, state, {type_id: action.type_id})
case 'CHANGE_CHILD_TYPE': case 'CHANGE_CHILD_TYPE':
return Object.assign({}, state, {childTypeId: action.childTypeId}) return Object.assign({}, state, {child_type_id: action.child_type_id})
default: default:
return state return state
} }
......
...@@ -24,13 +24,13 @@ function PageModal({ visible, onCancel, onPublish }) { ...@@ -24,13 +24,13 @@ function PageModal({ visible, onCancel, onPublish }) {
const columns = [ const columns = [
{ {
title: '页面Id', title: '页面Id',
dataIndex: 'pageId', dataIndex: 'page_id',
width: 150, width: 150,
align: 'center' align: 'center'
}, },
{ {
title: '页面名称', title: '页面名称',
dataIndex: 'pageName', dataIndex: 'page_name',
width: 200, width: 200,
align: 'center' align: 'center'
}, },
......
...@@ -23,14 +23,14 @@ const { Option } = Select; ...@@ -23,14 +23,14 @@ const { Option } = Select;
const PublishModal = ({ visible, onCancel, data }) => { const PublishModal = ({ visible, onCancel, data }) => {
const [code, setcode] = useState('') const [code, setcode] = useState('')
const [pageName, setPageName] = useState('') const [page_name, setPageName] = useState('')
const [oldCode, setoldCode] = useState('') const [oldCode, setoldCode] = useState('')
const { fetchData, dataCenter } = useContext(Root) const { fetchData, dataCenter } = useContext(Root)
console.log(data); console.log(data);
const onCreate = (values) => { const onCreate = (values) => {
console.log(code); console.log(code);
if (!code || !pageName) { if (!code || !page_name) {
message.error('请补全信息!') message.error('请补全信息!')
return return
} }
...@@ -41,8 +41,8 @@ const PublishModal = ({ visible, onCancel, data }) => { ...@@ -41,8 +41,8 @@ const PublishModal = ({ visible, onCancel, data }) => {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
pageId: data.pageId, page_id: data.page_id,
pageName: pageName, page_name: page_name,
code: code code: code
}) })
}) })
...@@ -66,7 +66,7 @@ const PublishModal = ({ visible, onCancel, data }) => { ...@@ -66,7 +66,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
pageName: pageName, page_name: page_name,
code: code code: code
}) })
}) })
...@@ -87,7 +87,7 @@ const PublishModal = ({ visible, onCancel, data }) => { ...@@ -87,7 +87,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
}; };
useEffect(() => { useEffect(() => {
data&&setPageName(data.pageName) data&&setPageName(data.page_name)
}, [data]) }, [data])
return ( return (
...@@ -101,7 +101,7 @@ const PublishModal = ({ visible, onCancel, data }) => { ...@@ -101,7 +101,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
width='1000px' width='1000px'
> >
<Form.Item <Form.Item
name="pageName" name="page_name"
label="页面名称" label="页面名称"
rules={[ rules={[
{ {
...@@ -110,7 +110,7 @@ const PublishModal = ({ visible, onCancel, data }) => { ...@@ -110,7 +110,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
}, },
]} ]}
> >
<Input placeholder="请输入页面名称" defaultValue={data?.pageName ? data.pageName : pageName} onChange={(e) => { setPageName(e.target.value) }} /> <Input placeholder="请输入页面名称" defaultValue={data?.page_name ? data.page_name : page_name} onChange={(e) => { setPageName(e.target.value) }} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="type" name="type"
......
...@@ -28,16 +28,16 @@ function RemoveType({ visible, onCancel }) { ...@@ -28,16 +28,16 @@ function RemoveType({ visible, onCancel }) {
const res = cb(item); const res = cb(item);
if (item.children) res.children = changeData(item.children, item => ({ if (item.children) res.children = changeData(item.children, item => ({
isRemove: true, isRemove: true,
key: item.childTypeId, key: item.child_type_id,
typeId: item.childTypeId, type_id: item.child_type_id,
typeName: item.childTypeName, type_name: item.child_type_name,
})); }));
return res; return res;
}) })
} }
const removeType = (data) => { const removeType = (data) => {
fetchData('/typeManage/deleteChildType', { childTypeId: data.typeId }) fetchData('/typeManage/deleteChildType', { child_type_id: data.type_id })
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
message.success('刪除成功') message.success('刪除成功')
...@@ -55,9 +55,9 @@ function RemoveType({ visible, onCancel }) { ...@@ -55,9 +55,9 @@ function RemoveType({ visible, onCancel }) {
.then((res) => { .then((res) => {
// console.log(res.data); // console.log(res.data);
const newData = changeData(res.data, item => ({ const newData = changeData(res.data, item => ({
key: item.typeId, key: item.type_id,
typeId: item.typeId, type_id: item.type_id,
typeName: item.typeName, type_name: item.type_name,
})); }));
// console.log(newData); // console.log(newData);
settypeData(newData) settypeData(newData)
...@@ -69,8 +69,8 @@ function RemoveType({ visible, onCancel }) { ...@@ -69,8 +69,8 @@ function RemoveType({ visible, onCancel }) {
}, []) }, [])
const columns = [ const columns = [
{ title: '类型名', width: 100, dataIndex: 'typeName', key: 'typeName' }, { title: '类型名', width: 100, dataIndex: 'type_name', key: 'type_name' },
{ title: 'Id', width: 100, dataIndex: 'typeId', align: 'center', key: 'typeId' }, { title: 'Id', width: 100, dataIndex: 'type_id', align: 'center', key: 'type_id' },
{ {
title: '操作', width: 100, key: 'operation', align: 'center', title: '操作', width: 100, key: 'operation', align: 'center',
render: (text, record) => ( render: (text, record) => (
......
...@@ -12,17 +12,17 @@ const ToolModal = ({ visible, onCancel, data }) => { ...@@ -12,17 +12,17 @@ const ToolModal = ({ visible, onCancel, data }) => {
}; };
const onCreate = (values) => { const onCreate = (values) => {
let input = { let input = {
toolBoxName: values.name, toolbox_name: values.name,
toolBoxIcon: values.icon, toolbox_icon: values.icon,
toolBoxDesc: values.depict, toolbox_desc: values.depict,
toolBoxUrl: values.url, toolbox_url: values.url,
} }
if (!data) { if (!data) {
input = { input = {
...input, ...input,
typeId: values.type, type_id: values.type,
childTypeId: values.childType child_type_id: values.childType
} }
console.log(input); console.log(input);
fetchData('/add/addToolBox', input) fetchData('/add/addToolBox', input)
...@@ -54,7 +54,7 @@ const ToolModal = ({ visible, onCancel, data }) => { ...@@ -54,7 +54,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
form.setFieldsValue({ form.setFieldsValue({
type: value, type: value,
}); });
fetchData('/query/queryChildType', { typeId: value }, 'childType') fetchData('/query/queryChildType', { type_id: value }, 'childType')
.then((res) => { .then((res) => {
console.log(res); console.log(res);
...@@ -68,7 +68,7 @@ const ToolModal = ({ visible, onCancel, data }) => { ...@@ -68,7 +68,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
}; };
useEffect(() => { useEffect(() => {
dataCenter?.type && fetchData('/query/queryChildType', { typeId: dataCenter?.type[0]?.typeId }, 'childType') dataCenter?.type && fetchData('/query/queryChildType', { type_id: dataCenter?.type[0]?.type_id }, 'childType')
.then((res) => { .then((res) => {
console.log(res); console.log(res);
...@@ -100,11 +100,11 @@ const ToolModal = ({ visible, onCancel, data }) => { ...@@ -100,11 +100,11 @@ const ToolModal = ({ visible, onCancel, data }) => {
{...formItemLayout} {...formItemLayout}
name="form_in_modal" name="form_in_modal"
initialValues={data ? { initialValues={data ? {
name: data.toolBoxName, name: data.toolbox_name,
icon: data.toolBoxIcon, icon: data.toolbox_icon,
url: data.toolBoxUrl, url: data.toolbox_url,
depict: data.toolBoxDesc, depict: data.toolbox_desc,
} : { type: dataCenter?.type && dataCenter?.type[0]?.typeId }} } : { type: dataCenter?.type && dataCenter?.type[0]?.type_id }}
> >
<Form.Item <Form.Item
name="name" name="name"
...@@ -171,7 +171,7 @@ const ToolModal = ({ visible, onCancel, data }) => { ...@@ -171,7 +171,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
{ {
dataCenter?.type?.length && dataCenter?.type.map(v => { dataCenter?.type?.length && dataCenter?.type.map(v => {
return ( return (
<Option key={v.typeId} value={v.typeId}>{v.typeName}</Option> <Option key={v.type_id} value={v.type_id}>{v.type_name}</Option>
) )
}) })
} }
...@@ -190,7 +190,7 @@ const ToolModal = ({ visible, onCancel, data }) => { ...@@ -190,7 +190,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
{ {
dataCenter?.childType?.length && dataCenter?.childType.map(v => { dataCenter?.childType?.length && dataCenter?.childType.map(v => {
return ( return (
<Option key={v.childTypeId} value={v.childTypeId}>{v.childTypeName}</Option> <Option key={v.child_type_id} value={v.child_type_id}>{v.child_type_name}</Option>
) )
}) })
} }
......
...@@ -10,7 +10,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => { ...@@ -10,7 +10,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
if (data) { if (data) {
form.setFieldsValue({ form.setFieldsValue({
typeName: data.typeName, type_name: data.type_name,
}); });
} }
const formItemLayout = { const formItemLayout = {
...@@ -27,18 +27,18 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => { ...@@ -27,18 +27,18 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => {
console.log(data); console.log(data);
let input = { let input = {
typeId: '', type_id: '',
typeName: '' type_name: ''
} }
if (!data.isRemove) { if (!data.isRemove) {
input = { input = {
typeId: data.typeId, type_id: data.type_id,
typeName: values.typeName type_name: values.type_name
} }
} else { } else {
input = { input = {
childTypeId: data.typeId, child_type_id: data.type_id,
childTypeName: values.typeName child_type_name: values.type_name
} }
} }
fetchData('/typeManage/updateType', input) fetchData('/typeManage/updateType', input)
...@@ -74,7 +74,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => { ...@@ -74,7 +74,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => {
const onGenderChange = (value) => { const onGenderChange = (value) => {
form.setFieldsValue({ form.setFieldsValue({
typeId: value, type_id: value,
}); });
}; };
...@@ -115,7 +115,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => { ...@@ -115,7 +115,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => {
</Radio.Group> </Radio.Group>
</Form.Item>} </Form.Item>}
{value === 1 || data ? <Form.Item {value === 1 || data ? <Form.Item
name="typeName" name="type_name"
label={`${data ? '' : '父'}类型`} label={`${data ? '' : '父'}类型`}
rules={[ rules={[
{ {
...@@ -128,7 +128,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => { ...@@ -128,7 +128,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => {
</Form.Item> : </Form.Item> :
<> <>
<Form.Item <Form.Item
name="typeId" name="type_id"
label="父类型" label="父类型"
hasFeedback hasFeedback
rules={[{ required: true, message: '请选择父类型!' }]} rules={[{ required: true, message: '请选择父类型!' }]}
...@@ -141,7 +141,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => { ...@@ -141,7 +141,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => {
{ {
dataCenter?.type?.length && dataCenter?.type.map(v => { dataCenter?.type?.length && dataCenter?.type.map(v => {
return ( return (
<Option key={v.typeId} value={v.typeId}>{v.typeName}</Option> <Option key={v.type_id} value={v.type_id}>{v.type_name}</Option>
) )
}) })
} }
...@@ -149,7 +149,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => { ...@@ -149,7 +149,7 @@ const TypeModal = ({ visible, onCancel, queryData, data }) => {
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="childTypeName" name="child_type_name"
label="子类型" label="子类型"
rules={[ rules={[
{ {
......
...@@ -9,22 +9,22 @@ import {NEED_UPDATE_INDEX} from "../../dataCenter/action"; ...@@ -9,22 +9,22 @@ import {NEED_UPDATE_INDEX} from "../../dataCenter/action";
function Index() { function Index() {
const {fetchData, dataCenter, dispatch} = useContext(Root) const {fetchData, dataCenter, dispatch} = useContext(Root)
const getUser = () => { const getUser = () => {
fetchData('/users/getUser', {userId: '100001'}, 'userInfo') fetchData('/users/getUser', {uid: '100001'}, 'userInfo')
.catch(res => .catch(res =>
res.code === 70001 && (window.location.href = '/login') res.code === 70001 && (window.location.href = '/login')
) )
} }
useEffect(() => { useEffect(() => {
fetchData('/query/queryType', {}, 'type') fetchData('/query/queryType', {}, 'type')
.then(() => fetchData('/query/queryChildType', {typeId: dataCenter.typeId}, 'childType')) .then(() => fetchData('/query/queryChildType', {type_id: dataCenter.type_id}, 'childType'))
.then(() => dispatch(NEED_UPDATE_INDEX())) .then(() => dispatch(NEED_UPDATE_INDEX()))
}, [dataCenter.typeId]) }, [dataCenter.type_id])
useEffect(() => { useEffect(() => {
if (dataCenter.needUpdateIndex) { if (dataCenter.needUpdateIndex) {
const _typeId = dataCenter.typeId === 'follow' ? { const _typeId = dataCenter.type_id === 'follow' ? {
isFollow: true, isFollow: true,
typeId: JSON.stringify(dataCenter.userInfo.follow) type_id: JSON.stringify(dataCenter.userInfo.follow)
} : {typeId: dataCenter.typeId} } : {type_id: dataCenter.type_id}
fetchData('/query/queryToolBox', _typeId, 'toolBox').then(() => dispatch(NEED_UPDATE_INDEX())) fetchData('/query/queryToolBox', _typeId, 'toolBox').then(() => dispatch(NEED_UPDATE_INDEX()))
} }
}, [dataCenter.needUpdateIndex]) }, [dataCenter.needUpdateIndex])
......
...@@ -14,7 +14,7 @@ function Index() { ...@@ -14,7 +14,7 @@ function Index() {
setPop(popComponent) setPop(popComponent)
} }
const getUser = () => { const getUser = () => {
fetchData('/users/getUser', {userId: '100001'}, 'userInfo') fetchData('/users/getUser', {uid: '100001'}, 'userInfo')
.catch(res => .catch(res =>
res.code === 70001 && (window.location.href = '/login') res.code === 70001 && (window.location.href = '/login')
) )
...@@ -22,16 +22,16 @@ function Index() { ...@@ -22,16 +22,16 @@ function Index() {
useEffect(() => { useEffect(() => {
fetchData('/query/queryType', {}, 'type') fetchData('/query/queryType', {}, 'type')
.then(()=> fetchData('/query/queryChildType',{typeId: dataCenter.typeId},'childType')) .then(()=> fetchData('/query/queryChildType',{type_id: dataCenter.type_id},'childType'))
.then(() => dispatch(NEED_UPDATE_INDEX())) .then(() => dispatch(NEED_UPDATE_INDEX()))
}, [dataCenter.typeId]) }, [dataCenter.type_id])
useEffect(() => { useEffect(() => {
if (dataCenter.needUpdateIndex) { if (dataCenter.needUpdateIndex) {
const _typeId = dataCenter.typeId === 'all' ? {} : dataCenter.typeId === 'follow' ? { const _typeId = dataCenter.type_id === 'all' ? {} : dataCenter.type_id === 'follow' ? {
isFollow: true, isFollow: true,
typeId: JSON.stringify(dataCenter.userInfo.follow) type_id: JSON.stringify(dataCenter.userInfo.follow)
} : {typeId: dataCenter.typeId} } : {type_id: dataCenter.type_id}
fetchData('/query/queryToolBox', _typeId, 'toolBox').then(() => dispatch(NEED_UPDATE_INDEX())) fetchData('/query/queryToolBox', _typeId, 'toolBox').then(() => dispatch(NEED_UPDATE_INDEX()))
} }
}, [dataCenter.needUpdateIndex]) }, [dataCenter.needUpdateIndex])
......
...@@ -8,7 +8,7 @@ function Login(props) { ...@@ -8,7 +8,7 @@ function Login(props) {
const [needLogin,setNeedLogin] = useState(false) const [needLogin,setNeedLogin] = useState(false)
const [input, setInput] = useFormState() const [input, setInput] = useFormState()
const getUser = ()=>{ const getUser = ()=>{
fetchData('/users/getUser', {userId:'100001'}, 'userInfo') fetchData('/users/getUser', {uid:'100001'}, 'userInfo')
.then(res => res.data.uid && (window.location.href = '/index')) .then(res => res.data.uid && (window.location.href = '/index'))
.catch(res => .catch(res =>
res.code === 70001 && setNeedLogin(true) res.code === 70001 && setNeedLogin(true)
...@@ -16,7 +16,7 @@ function Login(props) { ...@@ -16,7 +16,7 @@ function Login(props) {
} }
const doLogin = () => { const doLogin = () => {
if (needLogin){ if (needLogin){
fetchData('/users/login',{userId: '100001'}) fetchData('/users/login',{uid: '100001'})
.then(()=>{ .then(()=>{
getUser() getUser()
}) })
...@@ -37,7 +37,7 @@ function Login(props) { ...@@ -37,7 +37,7 @@ function Login(props) {
<div className="login"> <div className="login">
<div className='loginDiv'> <div className='loginDiv'>
{ {
needLogin && <input type="text" onChange={e => setInput('userId',e.target.value)} defaultValue={input.userId}/> needLogin && <input type="text" onChange={e => setInput('uid',e.target.value)} defaultValue={input.uid}/>
} }
<button className='btn-login' onClick={() => doLogin()}>登录</button> <button className='btn-login' onClick={() => doLogin()}>登录</button>
</div> </div>
......
...@@ -4,23 +4,23 @@ ...@@ -4,23 +4,23 @@
/query/queryType GET /query/queryType GET
### getUser 获取用户信息 ### getUser 获取用户信息
参数:(cookie userId) 参数:(cookie uid)
/users/getUser GET /users/getUser GET
### queryToolBox 获取工具箱信息 ### queryToolBox 获取工具箱信息
参数: typeId (childTypeId) 参数: type_id (child_type_id)
/query/queryToolBox GET /query/queryToolBox GET
### queryChildType 查询子类型信息 ### queryChildType 查询子类型信息
参数: typeId 参数: type_id
/query/queryChildType GET /query/queryChildType GET
### addToolBox ### addToolBox
参数: toolBoxName: 123 参数: toolbox_name: 123
toolBoxIcon: 123132 toolbox_icon: 123132
toolBoxDesc: 213312 toolbox_desc: 213312
toolBoxUrl: qweqwe toolbox_url: qweqwe
typeId: 2 type_id: 2
childType: 1 childType: 1
/add/addToolBoxId GET /add/addToolBoxId GET
...@@ -33,7 +33,7 @@ childType: 1 ...@@ -33,7 +33,7 @@ childType: 1
### addPage 发布页面 ### addPage 发布页面
参数: code pageName POST 参数: code page_name POST
/page/addPage /page/addPage
### queryPage 查询自定义页面信息 ### queryPage 查询自定义页面信息
......
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