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
c8f1122a
Commit
c8f1122a
authored
Jun 12, 2020
by
熊成伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
76d1c057
Pipeline
#15336
passed with stages
in 55 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
67 deletions
+66
-67
CardItem.jsx
src/components/WorkCard/CardItem.jsx
+1
-1
WorkDetail.jsx
src/pages/Work/WorkDetail.jsx
+63
-64
router.js
src/router.js
+1
-1
instance.js
src/utils/instance.js
+1
-1
No files found.
src/components/WorkCard/CardItem.jsx
View file @
c8f1122a
...
...
@@ -10,7 +10,7 @@ const CardItem = (props) => {
},
[
addStatus
])
const
contentCLick
=
()
=>
{
!
status
&&
!
data
.
iconAdd
&&
data
.
text
&&
workUrl
(
'/blank/work/1'
)
!
status
&&
!
data
.
iconAdd
&&
data
.
text
&&
workUrl
(
`/blank/work/
${
data
.
type
}
`
)
data
.
iconAdd
&&
addCommon
()
};
const
iconClick
=
()
=>
{
...
...
src/pages/Work/WorkDetail.jsx
View file @
c8f1122a
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
ActivityIndicator
,
Toast
,
WhiteSpace
,
WingBlank
}
from
'antd-mobile'
import
{
WhiteSpace
,
WingBlank
}
from
'antd-mobile'
import
TodoCard
from
'../../components/LogCard'
import
TopNotice
from
'../../components/NoticeTab'
import
axiosRequest
from
'../../utils/request'
;
import
'./index.less'
import
Skeleton
from
'../../components/Skeleton'
import
Document
from
'react-document-title'
import
Empty
from
'../Empty'
// import useDebounce from '../../useHooks/useDebounce'
import
Loading
from
"../../components/Loading"
;
const
WorkDetail
=
(
props
)
=>
{
const
Notice
=
(
props
)
=>
{
const
[
start
,
setStart
]
=
useState
(
true
);
useEffect
(()
=>
{
setLoading
(
true
)
axiosRequest
({
method
:
'post'
,
url
:
'/idtAppServiceV6/oApp/getUnDone'
,
body
:
{
nowPage
:
1
,
pageSize
:
10
},
}).
then
(
res
=>
{
setLoading
(
false
);
setStart
(
false
)
let
result
=
end
&&
res
.
rows
?
data
.
concat
(
res
.
rows
)
:
data
;
res
.
rows
&&
res
.
rows
.
length
>=
10
&&
setCurrent
(
1
);
setEnd
(
res
.
rows
&&
res
.
rows
.
length
>=
10
)
setData
(
result
);
});
},
[])
const
[
end
,
setEnd
]
=
useState
(
true
)
const
[
current
,
setCurrent
]
=
useState
(
0
);
const
[
searchWord
,
setSearchWord
]
=
useState
();
...
...
@@ -31,31 +19,36 @@ const WorkDetail = (props) => {
const
[
data
,
setData
]
=
useState
([]);
const
getData
=
()
=>
{
const
pageMap
=
{
searchWord
,
nowPage
:
current
+
1
,
pageSize
:
10
};
setLoading
(
true
)
const
getData
=
(
scroll
)
=>
{
const
{
type
}
=
props
.
match
.
params
const
pageMap
=
{
searchWord
,
nowPage
:
current
+
1
,
pageSize
:
10
,
FLAG
:
tab
,
bllx
:
type
};
setLoading
(
true
);
scroll
&&
current
>
0
&&
window
.
scrollTo
(
0
,
document
.
body
.
scrollHeight
)
axiosRequest
({
method
:
'post'
,
url
:
'/idtAppServiceV6/oApp/getUnDone'
,
body
:
pageMap
,
}).
then
(
res
=>
{
setLoading
(
false
);
let
result
=
end
&&
res
.
rows
?
data
.
concat
(
res
.
rows
)
:
data
;
res
.
rows
&&
res
.
rows
.
length
>=
10
?
setCurrent
(
current
+
1
)
:
Toast
.
info
(
'当前是最后一页'
,
1
);
setStart
(
false
);
setEnd
(
res
.
rows
&&
res
.
rows
.
length
>=
10
)
let
result
=
end
&&
res
.
rows
?
data
.
concat
(
res
.
rows
)
:
data
;
console
.
log
(
'end'
,
end
,
'result'
,
result
,
'res'
,
res
)
res
.
rows
&&
res
.
rows
.
length
>=
10
&&
setCurrent
(
1
);
setData
(
result
);
setLoading
(
false
);
});
};
//下拉加载
const
[
end
,
setEnd
]
=
useState
(
true
)
const
handleScroll
=
()
=>
{
let
scrollTop
=
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
;
let
clientHeight
=
document
.
documentElement
.
clientHeight
||
document
.
body
.
clientHeight
;
let
scrollHeight
=
document
.
documentElement
.
scrollHeight
||
document
.
body
.
scrollHeight
;
// alert(`${scrollTop} ${clientHeight} ${scrollHeight} ${scrollTop + clientHeight >= scrollHeight}`)
if
(
scrollHeight
>
clientHeight
&&
scrollTop
+
clientHeight
==
=
scrollHeight
)
{
getData
()
if
(
scrollHeight
>
clientHeight
&&
scrollTop
+
clientHeight
>
=
scrollHeight
)
{
getData
(
true
)
}
}
useEffect
(()
=>
{
...
...
@@ -63,67 +56,73 @@ const WorkDetail = (props) => {
return
()
=>
window
.
removeEventListener
(
'touchend'
,
handleScroll
,
true
);
},
[
data
]);
const
checkLog
=
()
=>
{
props
.
history
.
push
(
`/blank/info/
example/1
`
)
const
checkLog
=
(
OPERATEID
,
UUID
)
=>
{
props
.
history
.
push
(
`/blank/info/
${
OPERATEID
}
/
${
UUID
}
`
)
};
//回到顶部
useEffect
(()
=>
{
const
element
=
document
.
getElementById
(
'work-content'
)
element
.
scrollTo
(
0
,
0
)
window
.
scrollTo
(
0
,
0
)
},
[]);
//tab已读未读切换
const
[
tab
,
setTab
]
=
useState
(
'N'
);
const
tabData
=
()
=>
{
const
pageMap
=
{
searchWord
,
nowPage
:
current
+
1
,
pageSize
:
10
,
FLAG
:
tab
};
setLoading
(
true
)
axiosRequest
({
method
:
'post'
,
url
:
'/idtAppServiceV6/oApp/getUnDone'
,
body
:
pageMap
,
}).
then
(
res
=>
{
setLoading
(
false
);
let
result
=
end
&&
res
.
rows
?
[].
concat
(
res
.
rows
)
:
[];
res
.
rows
&&
res
.
rows
.
length
>=
10
?
setCurrent
(
current
+
1
)
:
Toast
.
info
(
'当前是最后一页'
,
1
);
setEnd
(
res
.
rows
&&
res
.
rows
.
length
>=
10
)
setData
(
result
);
});
};
const
tabChange
=
val
=>
{
setCurrent
(
0
);
setData
([]);
setTab
(
val
);
tabData
(
)
setEnd
(
true
)
};
const
tabSearch
=
val
=>
{
setCurrent
(
0
);
setData
([])
setSearchWord
(
val
)
setEnd
(
true
)
}
useEffect
(()
=>
{
//回到顶部
window
.
scrollTo
(
0
,
0
)
getData
()
},
[
searchWord
,
tab
])
},
[])
useEffect
(()
=>
{
setStart
(
true
);
getData
(
false
,
[])
},
[
searchWord
,
tab
]);
console
.
log
(
data
.
length
)
return
(
<
div
id=
"work-content"
className=
"work-content
"
>
<
Document
title=
"通知
"
>
<
WingBlank
>
<
ActivityIndicator
toast
text=
"加载中..."
animating=
{
loading
}
/>
<
WhiteSpace
/>
<
TopNotice
onSearch=
{
setSearchWord
}
tabChange=
{
tabChange
}
/>
{
!
start
&&
(
<
TopNotice
onSearch=
{
tabSearch
}
tabChange=
{
tabChange
}
/>
{
start
?
<
div
>
<
WhiteSpace
/><
Skeleton
/><
WhiteSpace
/><
Skeleton
/><
WhiteSpace
/><
Skeleton
/></
div
>
:
(
!
start
&&
(
data
.
length
>
0
?
data
.
map
((
item
,
index
)
=>
(
<
div
key=
{
index
}
>
<
WhiteSpace
/>
<
TodoCard
data=
{
item
}
onClick=
{
checkLog
}
/>
<
TodoCard
data=
{
item
}
onClick=
{
()
=>
checkLog
(
item
.
OPERATEID
,
item
.
UUID
)
}
/>
</
div
>
))
:
<
Empty
/>
)
))
}
<
WhiteSpace
/>
{
loading
&&
(
<
div
className=
"pos-line content-loading"
>
<
Loading
/>
<
WhiteSpace
/>
<
WhiteSpace
/>
</
div
>
)
}
{
!
loading
&&
!
end
&&
data
.
length
>
0
&&
(
<
div
className=
"content-end"
>
—————— 我是有底线的 ——————
</
div
>
)
}
}
</
WingBlank
>
</
div
>
</
Document
>
);
};
export
default
WorkDetail
;
export
default
Notice
;
src/router.js
View file @
c8f1122a
...
...
@@ -31,7 +31,7 @@ const ReactRouter = () => {
}
/
>
<
Route
path
=
"/blank"
component
=
{()
=>
<
BlankLayout
>
<
Route
path
=
"/blank/work/:
id
"
component
=
{
WorkDetail
}
/
>
<
Route
path
=
"/blank/work/:
type
"
component
=
{
WorkDetail
}
/
>
<
Route
path
=
"/blank/submit/:type"
component
=
{
SubmitDetail
}
/
>
<
Route
path
=
"/blank/info/:id/:uuid"
component
=
{
Process
}
/
>
<
/BlankLayout
>
...
...
src/utils/instance.js
View file @
c8f1122a
...
...
@@ -68,7 +68,7 @@ export const createAPI = (baseURL) => {
}
if
(
response
&&
response
.
data
&&
response
.
data
.
leftOperateBar
)
{
localStorage
.
removeItem
(
"menu"
);
const
menu
=
response
.
data
.
leftOperateBar
.
map
(
item
=>
({
icon
:
item
.
imgType
,
text
:
item
.
nodeName
}))
const
menu
=
response
.
data
.
leftOperateBar
.
map
(
item
=>
({
icon
:
item
.
imgType
,
text
:
item
.
nodeName
,
type
:
item
.
type
}))
menu
.
length
>
0
&&
localStorage
.
setItem
(
"menu"
,
JSON
.
stringify
(
menu
));
}
...
...
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