Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
frontend
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Schedules
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
h5-communicate
frontend
Commits
3c1eb4ed
Commit
3c1eb4ed
authored
Jul 22, 2020
by
熊成伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
8b58f3d1
Pipeline
#16414
failed with stages
in 34 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
Work.jsx
src/pages/Work/Work.jsx
+11
-3
instance.js
src/utils/instance.js
+1
-2
request.js
src/utils/request.js
+2
-0
No files found.
src/pages/Work/Work.jsx
View file @
3c1eb4ed
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
WhiteSpace
,
WingBlank
}
from
"antd-mobile"
;
import
{
Toast
,
WhiteSpace
,
WingBlank
}
from
"antd-mobile"
;
// import axiosRequest from '../../utils/request';
import
TopSearch
from
'../../components/TopSearch'
import
WorkCard
from
'../../components/Card/WorkCard'
;
import
Skeleton
from
'../../components/Skeleton'
import
Document
from
'react-document-title'
import
Empty
from
'../Empty'
import
queryString
from
"query-string"
;
const
Work
=
(
props
)
=>
{
const
[
start
,
setStart
]
=
useState
(
true
);
...
...
@@ -15,14 +16,21 @@ const Work = (props) => {
const
[
data
,
setData
]
=
useState
([])
useEffect
(()
=>
{
loadOperates
();
new
Promise
((
resolve
=>
{
const
query
=
queryString
.
parse
(
props
.
location
.
search
);
const
keys
=
Object
.
keys
(
query
);
keys
.
length
>
0
&&
query
.
token
&&
localStorage
.
setItem
(
'token'
,
query
.
token
);
resolve
()
})).
then
(()
=>
{
loadOperates
();
})
},
[]);
const
loadOperates
=
()
=>
{
setLoading
(
true
);
setTimeout
(()
=>
{
setLoading
(
false
)
},
1000
)
},
1000
)
;
const
res
=
localStorage
.
getItem
(
"menu"
);
setStart
(
false
);
const
result
=
JSON
.
parse
(
res
)
...
...
src/utils/instance.js
View file @
3c1eb4ed
...
...
@@ -31,9 +31,8 @@ export const createAPI = (baseURL) => {
return
(
conf
=
{})
=>
{
let
opts
=
conf
.
opts
||
{};
let
urlParams
=
''
;
// console.log(conf);
let
headers
=
{
...
defaultHeaders
,
...
opts
.
headers
};
let
headers
=
{
...
defaultHeaders
,
...
opts
.
headers
,
token
:
conf
.
token
};
if
(
conf
.
opts
)
{
urlParams
=
"?"
;
urlParams
+=
qs
.
stringify
(
conf
.
opts
)
...
...
src/utils/request.js
View file @
3c1eb4ed
...
...
@@ -27,11 +27,13 @@ const loadingCounter = () => {
let
loadingCount
=
loadingCounter
();
async
function
axiosRequest
(
option
=
{})
{
const
token
=
localStorage
.
getItem
(
"token"
);
loadingCount
.
startLoading
();
const
res
=
await
instance
({
method
:
option
.
method
||
'get'
,
url
:
option
.
url
,
opts
:
option
.
body
||
null
,
token
:
token
});
loadingCount
.
endLoading
();
return
res
;
...
...
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