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
239ecde8
Commit
239ecde8
authored
Jul 31, 2020
by
熊成伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
7b2f71fc
Pipeline
#16610
passed with stages
in 1 minute and 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
16 deletions
+38
-16
Receive.jsx
src/pages/Test/Receive.jsx
+19
-7
Send.jsx
src/pages/Test/Send.jsx
+19
-9
No files found.
src/pages/Test/Receive.jsx
View file @
239ecde8
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
WingBlank
,
List
,
InputItem
,
WhiteSpace
,
Picker
,
Toast
}
from
'antd-mobile'
import
{
WingBlank
,
List
,
InputItem
,
WhiteSpace
,
Picker
,
Toast
,
ActivityIndicator
}
from
'antd-mobile'
import
Document
from
'react-document-title'
;
import
Document
from
'react-document-title'
;
import
moment
from
'moment'
import
moment
from
'moment'
import
axios
from
'axios'
import
axios
from
'axios'
...
@@ -10,35 +10,40 @@ const Receive = (props) => {
...
@@ -10,35 +10,40 @@ const Receive = (props) => {
const
{
id
}
=
props
.
match
.
params
;
const
{
id
}
=
props
.
match
.
params
;
const
{
getFieldProps
}
=
props
.
form
;
const
{
getFieldProps
}
=
props
.
form
;
const
[
defaultV
,
setDefaultV
]
=
useState
({});
const
[
defaultV
,
setDefaultV
]
=
useState
({});
useEffect
(()
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
getListItem
=
()
=>
{
axios
({
axios
({
method
:
'get'
,
method
:
'get'
,
url
:
`/demo/leaveForm/
${
id
}
`
,
url
:
`/demo/leaveForm/
${
id
}
`
,
data
:
{},
data
:
{},
withCredentials
:
false
,
withCredentials
:
false
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
res
.
data
)
res
.
data
.
data
.
result
&&
setDefaultV
(
res
.
data
.
data
.
result
)
setDefaultV
(
res
.
data
.
data
.
result
)
})
})
};
useEffect
(()
=>
{
getListItem
()
},
[]);
},
[]);
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
props
.
form
.
validateFields
({
force
:
true
},
(
error
)
=>
{
props
.
form
.
validateFields
({
force
:
true
},
(
error
)
=>
{
const
values
=
props
.
form
.
getFieldsValue
();
const
values
=
props
.
form
.
getFieldsValue
();
if
(
!
error
)
{
if
(
!
error
)
{
console
.
log
(
values
);
setLoading
(
true
);
axios
({
axios
({
method
:
'patch'
,
method
:
'patch'
,
url
:
`/demo/reviewAndApproval`
,
url
:
`/demo/reviewAndApproval`
,
params
:
{
status
:
values
.
status
[
0
],
id
},
params
:
{
status
:
values
.
status
[
0
],
id
},
withCredentials
:
false
,
withCredentials
:
false
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
res
.
data
.
data
.
result
&&
Toast
.
success
(
'审核成功'
)
setLoading
(
false
);
res
.
data
.
data
.
result
&&
Toast
.
success
(
'审核成功'
,
1
,
()
=>
{
getListItem
()
})
})
})
}
}
});
});
};
};
console
.
log
(
defaultV
)
return
(
return
(
<
Document
title=
"请假审批"
>
<
Document
title=
"请假审批"
>
...
@@ -63,6 +68,13 @@ const Receive = (props) => {
...
@@ -63,6 +68,13 @@ const Receive = (props) => {
<
div
className=
"event-footer-button"
onClick=
{
onSubmit
}
>
提交
</
div
>
<
div
className=
"event-footer-button"
onClick=
{
onSubmit
}
>
提交
</
div
>
</
div
>
</
div
>
)
}
)
}
{
loading
&&
(
<
ActivityIndicator
toast
text=
"提交中..."
animating=
{
loading
}
/>
)
}
</
WingBlank
>
</
WingBlank
>
</
Document
>
</
Document
>
...
...
src/pages/Test/Send.jsx
View file @
239ecde8
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
WingBlank
,
List
,
InputItem
,
WhiteSpace
,
DatePicker
,
Toast
}
from
'antd-mobile'
import
{
WingBlank
,
List
,
InputItem
,
WhiteSpace
,
DatePicker
,
Toast
,
ActivityIndicator
}
from
'antd-mobile'
import
Document
from
'react-document-title'
;
import
Document
from
'react-document-title'
;
import
moment
from
'moment'
import
moment
from
'moment'
import
axios
from
'axios'
import
axios
from
'axios'
...
@@ -14,18 +14,20 @@ const Send = (props) => {
...
@@ -14,18 +14,20 @@ const Send = (props) => {
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
props
.
form
.
validateFields
({
force
:
true
},
(
error
)
=>
{
props
.
form
.
validateFields
({
force
:
true
},
(
error
)
=>
{
const
values
=
props
.
form
.
getFieldsValue
();
const
keys
=
Object
.
keys
(
values
);
keys
.
map
(
item
=>
{
!
values
[
item
]
&&
(
delete
values
[
item
]);
Array
.
isArray
(
values
[
item
])
&&
values
[
item
].
length
===
1
&&
(
values
[
item
]
=
values
[
item
][
0
]);
values
[
item
]
instanceof
Date
&&
(
values
[
item
]
=
moment
(
values
[
item
]).
valueOf
());
return
null
;
});
if
(
!
error
)
{
if
(
!
error
)
{
const
values
=
props
.
form
.
getFieldsValue
();
const
keys
=
Object
.
keys
(
values
);
keys
.
map
(
item
=>
{
!
values
[
item
]
&&
(
delete
values
[
item
]);
Array
.
isArray
(
values
[
item
])
&&
values
[
item
].
length
===
1
&&
(
values
[
item
]
=
values
[
item
][
0
]);
values
[
item
]
instanceof
Date
&&
(
values
[
item
]
=
moment
(
values
[
item
]).
valueOf
());
return
null
;
});
setLoading
(
true
);
values
.
toUid
=
sP
.
value
;
values
.
toUid
=
sP
.
value
;
values
.
uid
=
'cgcPcPoo'
;
values
.
uid
=
'cgcPcPoo'
;
axios
.
patch
(
'/demo/initiateApproval'
,
values
).
then
(
res
=>
{
axios
.
patch
(
'/demo/initiateApproval'
,
values
).
then
(
res
=>
{
setLoading
(
false
);
res
.
data
.
success
&&
Toast
.
success
(
'提交成功'
)
res
.
data
.
success
&&
Toast
.
success
(
'提交成功'
)
})
})
}
}
...
@@ -33,6 +35,7 @@ const Send = (props) => {
...
@@ -33,6 +35,7 @@ const Send = (props) => {
};
};
const
[
sP
,
setSP
]
=
useState
({});
const
[
sP
,
setSP
]
=
useState
({});
const
[
personVisible
,
setPersonVisible
]
=
useState
(
false
);
const
[
personVisible
,
setPersonVisible
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
return
(
return
(
<
Document
title=
"请假申请"
>
<
Document
title=
"请假申请"
>
<
WingBlank
>
<
WingBlank
>
...
@@ -65,6 +68,13 @@ const Send = (props) => {
...
@@ -65,6 +68,13 @@ const Send = (props) => {
<
div
className=
"event-footer"
>
<
div
className=
"event-footer"
>
<
div
className=
"event-footer-button"
onClick=
{
onSubmit
}
>
提交
</
div
>
<
div
className=
"event-footer-button"
onClick=
{
onSubmit
}
>
提交
</
div
>
</
div
>
</
div
>
{
loading
&&
(
<
ActivityIndicator
toast
text=
"提交中..."
animating=
{
loading
}
/>
)
}
</
WingBlank
>
</
WingBlank
>
</
Document
>
</
Document
>
);
);
...
...
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