Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
manager-app-sz
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
ReactNative
manager-app-sz
Commits
90163681
提交
90163681
authored
12月 07, 2017
作者:
吴强
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
上传界面
上级
804c9bd7
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
188 行增加
和
54 行删除
+188
-54
package-lock.json
package-lock.json
+5
-0
cameraComponent.js
src/components/cameraComponent.js
+14
-2
uploadPageComponent.js
src/components/uploadPageComponent.js
+164
-51
index.js
src/routes/main/dangshireninfo/index.js
+4
-0
config.js
src/utils/config.js
+1
-1
没有找到文件。
package-lock.json
浏览文件 @
90163681
...
@@ -7258,6 +7258,11 @@
...
@@ -7258,6 +7258,11 @@
}
}
}
}
},
},
"react-native-background-upload"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"http://registry.npm.taobao.org/react-native-background-upload/download/react-native-background-upload-4.1.0.tgz"
,
"integrity"
:
"sha1-EAZmWc1miVxHrBGXiahtai1zALo="
},
"react-native-camera"
:
{
"react-native-camera"
:
{
"version"
:
"0.12.0"
,
"version"
:
"0.12.0"
,
"resolved"
:
"http://registry.npm.taobao.org/react-native-camera/download/react-native-camera-0.12.0.tgz"
,
"resolved"
:
"http://registry.npm.taobao.org/react-native-camera/download/react-native-camera-0.12.0.tgz"
,
...
...
src/components/cameraComponent.js
浏览文件 @
90163681
...
@@ -14,6 +14,7 @@ import { encrypt } from '../utils/helper';
...
@@ -14,6 +14,7 @@ import { encrypt } from '../utils/helper';
import
config
from
'../utils/config'
;
import
config
from
'../utils/config'
;
import
{
futch
}
from
'../utils/polyfill'
;
import
{
futch
}
from
'../utils/polyfill'
;
import
{
userApi
}
from
'../services/interfaces'
;
import
{
userApi
}
from
'../services/interfaces'
;
import
{
uploadResource
}
from
'../services/resource'
;
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:
{
container
:
{
...
@@ -76,6 +77,7 @@ class CameraComponent extends React.Component {
...
@@ -76,6 +77,7 @@ class CameraComponent extends React.Component {
this
.
takePicture
=
this
.
takePicture
.
bind
(
this
);
this
.
takePicture
=
this
.
takePicture
.
bind
(
this
);
this
.
uploadImage
=
this
.
uploadImage
.
bind
(
this
);
this
.
uploadImage
=
this
.
uploadImage
.
bind
(
this
);
this
.
clear
=
this
.
clear
.
bind
(
this
);
this
.
clear
=
this
.
clear
.
bind
(
this
);
this
.
goToUpload
=
this
.
goToUpload
.
bind
(
this
);
}
}
typeIcon
=
()
=>
{
typeIcon
=
()
=>
{
const
{
back
,
front
}
=
Camera
.
constants
.
Type
;
const
{
back
,
front
}
=
Camera
.
constants
.
Type
;
...
@@ -127,7 +129,7 @@ class CameraComponent extends React.Component {
...
@@ -127,7 +129,7 @@ class CameraComponent extends React.Component {
this
.
camera
.
stopCapture
();
this
.
camera
.
stopCapture
();
this
.
setState
({
isRecording
:
false
});
this
.
setState
({
isRecording
:
false
});
}
}
console
.
log
(
'stopped
'
);
console
.
log
(
'stopped'
);
}
}
}
}
takePicture
()
{
takePicture
()
{
...
@@ -192,6 +194,16 @@ class CameraComponent extends React.Component {
...
@@ -192,6 +194,16 @@ class CameraComponent extends React.Component {
clear
()
{
clear
()
{
this
.
setState
({
imageURI
:
''
});
this
.
setState
({
imageURI
:
''
});
}
}
uploadImage2
=
()
=>
{
console
.
info
(
'输出上传'
);
console
.
info
(
this
.
state
);
uploadResource
(
this
.
state
.
imageURI
,
(
uploadId
,
arg
)
=>
console
.
info
(
arg
),
(
uploadId
,
arg
)
=>
console
.
info
(
`陈宫
${
arg
}
`
),
(
uploadId
,
arg
)
=>
console
.
info
(
arg
))
.
then
(
uploadId
=>
console
.
log
(
`start task
${
uploadId
}
`
))
.
catch
(
err
=>
console
.
log
(
err
));
}
goToUpload
()
{
this
.
props
.
navigation
.
navigate
(
'DSRInfoTuPian'
,
{
imageURI
:
this
.
state
.
imageURI
});
}
render
()
{
render
()
{
if
(
this
.
state
.
imageURI
===
''
)
{
if
(
this
.
state
.
imageURI
===
''
)
{
...
@@ -227,7 +239,7 @@ class CameraComponent extends React.Component {
...
@@ -227,7 +239,7 @@ class CameraComponent extends React.Component {
/
>
/
>
<
View
style
=
{[
styles
.
overlay
,
styles
.
bottomOverlay
]}
>
<
View
style
=
{[
styles
.
overlay
,
styles
.
bottomOverlay
]}
>
<
Icon
.
Button
name
=
"clear"
size
=
{
48
}
backgroundColor
=
"transparent"
onPress
=
{
this
.
clear
}
/
>
<
Icon
.
Button
name
=
"clear"
size
=
{
48
}
backgroundColor
=
"transparent"
onPress
=
{
this
.
clear
}
/
>
<
Icon
.
Button
name
=
"done"
size
=
{
48
}
backgroundColor
=
"transparent"
onPress
=
{
this
.
uploadImage
}
/
>
<
Icon
.
Button
name
=
"done"
size
=
{
48
}
backgroundColor
=
"transparent"
onPress
=
{
this
.
uploadImage
2
}
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
);
);
...
...
src/components/uploadPageComponent.js
浏览文件 @
90163681
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
{
import
{
View
,
View
,
Style
s
heet
,
Style
S
heet
,
Text
,
Text
,
TouchableOpacity
,
TouchableOpacity
,
Dimensions
,
Dimensions
,
Image
,
Image
,
Platform
,
ScrollView
,
}
from
'react-native'
;
}
from
'react-native'
;
import
TagInput
from
'react-native-tag-input'
;
import
TagInput
from
'react-native-tag-input'
;
import
{
InputItem
}
from
'antd-mobile'
;
import
{
InputItem
}
from
'antd-mobile'
;
import
{
futch
}
from
'../utils/polyfill'
;
import
{
getToken
}
from
'../utils/auth'
;
import
{
encrypt
}
from
'../utils/helper'
;
import
config
from
'../utils/config'
;
import
{
userApi
}
from
'../services/interfaces'
;
import
{
errors
}
from
'../utils/error'
;
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
},
view_header_container
:
{
height
:
56
,
backgroundColor
:
'white'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
},
text_right_title
:
{
color
:
'#000'
,
position
:
'absolute'
,
right
:
16
,
},
text_left_title
:
{
color
:
'#000'
,
position
:
'absolute'
,
left
:
16
,
},
text_title
:
{
color
:
'#000'
,
fontSize
:
18
,
},
// uploadImage: {
// height: Dimensions.get('window').height,
// width: Dimensions.get('window').width,
// },
});
const
inputProps
=
{
keyboardType
:
'default'
,
placeholder
:
'如:身份证'
,
autoFocus
:
true
,
style
:
{
fontSize
:
14
,
marginVertical
:
Platform
.
OS
===
'ios'
?
10
:
-
2
,
},
};
class
UploadPageComponent
extends
PureComponent
{
class
UploadPageComponent
extends
PureComponent
{
constructor
(
props
)
{
console
.
info
(
'未过滤之前'
);
console
.
info
(
props
);
super
(
props
);
console
.
info
(
'过滤之后'
);
console
.
info
(
props
);
const
{
imageURI
}
=
this
.
props
.
navigation
.
state
.
params
;
this
.
state
=
{
imageURI
,
tags
:
[
'身份证'
,
'红本'
,
'绿本'
],
text
:
''
,
imageName
:
''
,
};
}
onChangeTags
=
(
tags
)
=>
{
this
.
setState
({
tags
});
};
onChangeText
=
(
text
)
=>
{
this
.
setState
({
text
});
const
lastTyped
=
text
.
charAt
(
text
.
length
-
1
);
const
parseWhen
=
[
','
,
' '
,
';'
,
'
\
n'
];
if
(
parseWhen
.
indexOf
(
lastTyped
)
>
-
1
)
{
this
.
setState
({
tags
:
[...
this
.
state
.
tags
,
this
.
state
.
text
],
text
:
''
,
});
}
};
onCancel
=
()
=>
{
onCancel
=
()
=>
{
this
.
props
.
onCancel
();
this
.
props
.
onCancel
();
};
};
onUploadPhoto
=
()
=>
{
onUploadPhoto
=
()
=>
{
this
.
props
.
onUploadPhoto
();
let
token
;
getToken
().
then
((
Apptoken
)
=>
{
if
(
!
Apptoken
)
{
return
Promise
.
reject
(
errors
.
tokenMissing
());
}
token
=
encrypt
(
Apptoken
);
const
uri
=
`
${
config
.
apiContextPath
}
/resource/
${
token
}
`
;
const
formData
=
new
global
.
FormData
();
const
file
=
{
uri
:
this
.
state
.
imageURI
,
type
:
'image/jpg'
,
name
:
this
.
state
.
imageName
!==
''
?
this
.
state
.
imageName
:
this
.
state
.
imageURI
.
split
(
'/'
)[
this
.
state
.
imageURI
.
split
(
'/'
).
length
-
1
]
};
formData
.
append
(
'file'
,
file
);
console
.
info
(
formData
);
futch
(
uri
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'multipart/form-data'
,
},
body
:
formData
,
},
(
progressEvent
)
=>
{
const
progress
=
progressEvent
.
loaded
/
progressEvent
.
total
;
})
.
then
(
request
=>
request
.
responseText
)
// response.text())
.
then
((
responseData
)
=>
{
const
response
=
JSON
.
parse
(
responseData
);
if
(
response
.
errorCode
===
0
)
{
const
name
=
'addTags'
;
// 添加标签
const
PicUri
=
`
${
config
.
apiContextPath
}
/api/interface/user/
${
name
}
/invoke`
;
console
.
info
(
PicUri
);
const
postjson
=
{
uri
:
response
.
data
[
0
],
tags
:
[
'当事人信息'
,
'当事人信息'
]
};
console
.
info
(
JSON
.
stringify
(
postjson
));
userApi
.
invokeInterface
(
name
,
postjson
)
// futch(PicUri, {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// },
// body: JSON.stringify(postjson),
// }, (progressEvent) => {
// console.info(progressEvent);
// })
.
then
(
request
=>
console
.
info
(
request
));
// response.text())
// 这里需要调用接口,对图片数据进行绑定,等待完善
// 页面跳转,跳转到前面的详情的页面
console
.
info
(
'跳转'
);
this
.
props
.
navigation
.
navigate
(
'DSRInfoDetail'
,
this
.
props
.
navigation
.
state
.
params
.
pID
);
}
})
.
catch
((
error
)
=>
{
console
.
info
(
error
);
});
});
};
};
setImageName
=
(
val
)
=>
{
this
.
setState
({
imageName
:
val
});
}
labelExtractor
=
tag
=>
tag
;
renderHeaderMenu
()
{
renderHeaderMenu
()
{
return
(
return
(
<
View
style
=
{[
styles
.
view_header_container
,
{
backgroundColor
:
this
.
props
.
bgColor
}]}
>
<
View
style
=
{[
styles
.
view_header_container
,
{
backgroundColor
:
'lightgray'
}]}
>
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{
this
.
onCancel
()
}
onPress
=
{
this
.
onCancel
}
>
>
<
Text
style
=
{[
styles
.
text_title
,
{
color
:
this
.
props
.
titleColor
}]}
>
取消
<
/Text
>
<
Text
style
=
{[
styles
.
text_title
,
{
color
:
this
.
props
.
titleColor
}]}
>
取消
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
Text
style
=
{[
styles
.
text_title
,
{
color
:
this
.
props
.
titleColor
}]}
>
传照片
<
/Text
>
<
Text
style
=
{[
styles
.
text_title
,
{
color
:
this
.
props
.
titleColor
}]}
>
传照片
<
/Text
>
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{
this
.
onUploadPhoto
()
}
onPress
=
{
this
.
onUploadPhoto
}
>
>
<
Text
style
=
{
styles
.
text_right_title
}
>
<
Text
style
=
{
styles
.
text_right_title
}
>
上传
上传
...
@@ -37,59 +169,40 @@ class UploadPageComponent extends PureComponent {
...
@@ -37,59 +169,40 @@ class UploadPageComponent extends PureComponent {
);
);
}
}
render
()
{
render
()
{
const
{
getFieldProps
,
getFieldError
}
=
this
.
props
.
form
;
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
{
this
.
renderHeaderMenu
()}
{
this
.
renderHeaderMenu
()}
<
Image
<
ScrollView
>
style
=
{{
height
:
Dimensions
.
get
(
'window'
).
height
,
width
:
Dimensions
.
get
(
'window'
).
width
}}
<
Image
source
=
{{
uri
:
this
.
props
.
imageURI
,
isStatic
:
true
}}
style
=
{{
height
:
80
,
width
:
80
}}
/
>
source
=
{{
uri
:
this
.
state
.
imageURI
,
isStatic
:
true
}}
<
InputItem
/
>
{...
getFieldProps
(
'account'
,
{
<
InputItem
initialValue
:
'little ant'
,
placeholder
=
"如:张三"
rules
:
[
data
-
seed
=
"logId"
{
required
:
true
,
message
:
'名称不能为空'
},
onChange
=
{
this
.
setImageName
}
],
>
照片名称
})}
<
/InputItem
>
clear
<
View
style
=
{{
flexDirection
:
'row'
,
alignItems
:
'center'
,
backgroundColor
:
'lightgray'
}}
>
error
=
{
!!
getFieldError
(
'account'
)}
<
Text
>
类型
<
/Text
>
placeholder
=
"请输入名字"
<
TagInput
>
照片名称
value
=
{
this
.
state
.
tags
}
<
/InputItem
>
onChange
=
{
this
.
onChangeTags
}
labelExtractor
=
{
this
.
labelExtractor
}
text
=
{
this
.
state
.
text
}
onChangeText
=
{
this
.
onChangeText
}
tagColor
=
"blue"
tagTextColor
=
"white"
inputProps
=
{
inputProps
}
maxHeight
=
{
75
}
/
>
<
/View
>
<
/ScrollView
>
<
/View
>
<
/View
>
);
);
}
}
}
}
const
styles
=
Stylesheet
.
create
({
container
:
{
flex
:
1
,
},
view_header_container
:
{
height
:
56
,
backgroundColor
:
'white'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
},
text_right_title
:
{
color
:
'#000'
,
position
:
'absolute'
,
right
:
16
,
},
text_left_title
:
{
color
:
'#000'
,
position
:
'absolute'
,
left
:
16
,
},
text_title
:
{
color
:
'#000'
,
fontSize
:
18
,
},
uploadImage
:
{
height
:
Dimensions
.
get
(
'window'
).
height
,
width
:
Dimensions
.
get
(
'window'
).
width
,
},
});
export
default
UploadPageComponent
;
export
default
UploadPageComponent
;
src/routes/main/dangshireninfo/index.js
浏览文件 @
90163681
...
@@ -2,6 +2,7 @@ import { StackNavigator } from 'react-navigation';
...
@@ -2,6 +2,7 @@ import { StackNavigator } from 'react-navigation';
import
DSRInfoScreen
from
'./DSRInfoScreeen'
;
import
DSRInfoScreen
from
'./DSRInfoScreeen'
;
import
DSRInfoDetailScreen
from
'./DSRInfoDetailScreen'
;
import
DSRInfoDetailScreen
from
'./DSRInfoDetailScreen'
;
import
FileViewList
from
'./fileViewList'
;
import
FileViewList
from
'./fileViewList'
;
import
UploadPageComponent
from
'../../../components/uploadPageComponent'
;
const
DSRErJiScreen
=
StackNavigator
(
const
DSRErJiScreen
=
StackNavigator
(
{
{
...
@@ -14,6 +15,9 @@ const DSRErJiScreen = StackNavigator(
...
@@ -14,6 +15,9 @@ const DSRErJiScreen = StackNavigator(
DSRInfoFileView
:
{
DSRInfoFileView
:
{
screen
:
FileViewList
,
screen
:
FileViewList
,
},
},
DSRInfoTuPian
:
{
screen
:
UploadPageComponent
,
},
},
},
{
{
headerMode
:
'none'
,
headerMode
:
'none'
,
...
...
src/utils/config.js
浏览文件 @
90163681
...
@@ -32,7 +32,7 @@ const config = {
...
@@ -32,7 +32,7 @@ const config = {
contextPath
:
''
,
contextPath
:
''
,
updateContextPath
:
'http://192.168.1.22:8080/app'
,
updateContextPath
:
'http://192.168.1.22:8080/app'
,
// apiContextPath: 'http://14.21.68.149:9089/test',
// apiContextPath: 'http://14.21.68.149:9089/test',
apiContextPath
:
'http://192.168.1.22:8080/
bm
'
,
apiContextPath
:
'http://192.168.1.22:8080/
sz
'
,
defaultDateFormat
,
defaultDateFormat
,
defaultTimeFormat
,
defaultTimeFormat
,
defaultDateTimeFormat
,
defaultDateTimeFormat
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论