Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Dui123
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
王天宇
Dui123
Commits
f4818142
Commit
f4818142
authored
Dec 02, 2021
by
wty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
70432763
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
16 deletions
+47
-16
getConfig.js
config/getConfig.js
+1
-1
App.js
src/App.js
+3
-3
apiConfig.js
src/config/apiConfig.js
+1
-1
DataCollection.jsx
src/page/DataCollection/DataCollection.jsx
+33
-0
DataCollection.scss
src/page/DataCollection/DataCollection.scss
+0
-0
index.jsx
src/page/indexAdmin/index.jsx
+9
-11
No files found.
config/getConfig.js
View file @
f4818142
const
env
=
'
prod
'
const
env
=
'
local
'
const
getConfig
=
()
=>
{
switch
(
env
){
...
...
src/App.js
View file @
f4818142
...
...
@@ -2,9 +2,8 @@ import './App.css';
import
DataCenter
from
"./dataCenter/Root"
;
import
IndexAdmin
from
"./page/indexAdmin"
;
import
Index
from
"./page/index"
;
import
Login
from
"./page/login/logi
n"
;
import
DataCollection
from
"./page/DataCollection/DataCollectio
n"
;
import
{
HashRouter
as
Router
,
Redirect
,
Route
,
Switch
}
from
"react-router-dom"
;
import
{
useEffect
}
from
"react"
;
function
App
()
{
...
...
@@ -12,9 +11,10 @@ function App() {
<
Router
>
<
DataCenter
>
<
Switch
>
<
Route
exact
path
=
'/'
render
=
{()
=>
(
<
Redirect
to
=
{
'/index'
}
/>
)
}/
>
<
Route
exact
path
=
'/'
render
=
{()
=>
(
<
Redirect
to
=
{
'/index'
}
/>
)
}/
>
<
Route
exact
path
=
'/index'
component
=
{
Index
}
/
>
<
Route
exact
path
=
'/admin'
component
=
{
IndexAdmin
}
/
>
<
Route
exact
path
=
'/dataCollection'
component
=
{
DataCollection
}
/
>
<
/Switch
>
<
/DataCenter
>
<
/Router
>
...
...
src/config/apiConfig.js
View file @
f4818142
const
env
=
'
prod
'
const
env
=
'
local
'
const
apiConfig
=
{
domain
:
(()
=>
{
...
...
src/page/DataCollection/DataCollection.jsx
0 → 100644
View file @
f4818142
import
React
,
{
useContext
,
useEffect
}
from
"react"
;
import
'./DataCollection.scss'
import
gotoLogin
from
"../../utils/gotoLogin"
;
import
{
useHistory
}
from
"react-router-dom"
;
import
{
Root
}
from
"../../dataCenter/Root"
;
function
DataCollection
()
{
const
history
=
useHistory
()
const
{
fetchData
,
dataCenter
,
dispatch
}
=
useContext
(
Root
)
const
getUser
=
()
=>
{
fetchData
(
'/users/getUser'
,
{},
'userInfo'
)
.
then
(
res
=>
{
if
(
+
res
?.
data
?.
admin
!==
1
)
{
history
.
push
(
'/'
)
}
})
.
catch
(
res
=>
+
res
.
code
===
70001
&&
(
gotoLogin
())
)
}
useEffect
(
async
()
=>
{
await
getUser
()
},
[])
return
(
<
div
className=
'data-collotion'
>
</
div
>
)
}
export
default
DataCollection
src/page/DataCollection/DataCollection.scss
0 → 100644
View file @
f4818142
src/page/indexAdmin/index.jsx
View file @
f4818142
import
logo
from
"../../static/logo.png"
;
import
'./index.scss'
import
ToolType
from
"../../component/ToolType/ToolType"
;
import
Content
from
'../../component/ContentAdmin/Content'
import
{
PopContext
,
Root
}
from
"../../dataCenter/Root"
;
import
{
useContext
,
useEffect
,
useState
}
from
"react"
;
import
{
useContext
,
useEffect
}
from
"react"
;
import
{
NEED_UPDATE_INDEX
}
from
"../../dataCenter/action"
;
import
AdminIndex
from
"../../component/AdminIndex/AdminIndex"
;
import
{
useHistory
}
from
"react-router-dom"
;
import
gotoLogin
from
"../../utils/gotoLogin"
;
import
IndexContent
from
"../../component/IndexContent/IndexContent"
;
import
IndexContentAdmin
from
"../../component/IndexContent/IndexContentAdmin"
;
function
Index
()
{
const
history
=
useHistory
()
const
{
fetchData
,
dataCenter
,
dispatch
}
=
useContext
(
Root
)
const
showPop
=
popComponent
=>
{}
const
showPop
=
popComponent
=>
{
}
const
getUser
=
()
=>
{
fetchData
(
'/users/getUser'
,
{},
'userInfo'
)
.
then
(
res
=>
{
if
(
+
res
?.
data
?.
admin
!==
1
){
if
(
+
res
?.
data
?.
admin
!==
1
)
{
history
.
push
(
'/'
)
}
})
...
...
@@ -36,13 +34,13 @@ function Index() {
useEffect
(()
=>
{
if
(
dataCenter
.
needUpdateIndex
)
{
fetchData
(
'/query/queryToolBox'
,
{},
'toolBox'
)
.
then
(()
=>
fetchData
(
'/typeManage/queryTypeForManage'
,
{},
'type'
))
.
then
(()
=>
fetchData
(
'/typeManage/queryTypeForManage'
,
{},
'type'
))
.
then
(()
=>
dispatch
(
NEED_UPDATE_INDEX
()))
}
},
[
dataCenter
.
needUpdateIndex
])
useEffect
(()
=>
{
getUser
()
useEffect
(
async
()
=>
{
await
getUser
()
dispatch
(
NEED_UPDATE_INDEX
())
},
[])
...
...
@@ -64,11 +62,11 @@ function Index() {
src=
"https://i.tianqi.com/?c=code&a=getcode&id=40&icon=1"
/>
</
div
>
</
div
>
<
IndexContentAdmin
typeData=
{
[
{
type_id
:
'follow'
,
type_name
:
'我的收藏'
}]
}
/>
<
IndexContentAdmin
typeData=
{
[{
type_id
:
'follow'
,
type_name
:
'我的收藏'
}]
}
/>
{
Array
.
isArray
(
dataCenter
?.
type
)
&&
dataCenter
?.
type
?.
map
(
v
=>
(
<
div
key=
{
v
.
type_id
}
>
<
IndexContentAdmin
typeData=
{
[
v
]
}
/>
<
IndexContentAdmin
typeData=
{
[
v
]
}
/>
</
div
>
))
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment