Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangzhonghua
/
BoneHouse_Business_APP
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7f3db4af
authored
May 22, 2020
by
Denglingling
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
删除测试代码
parent
df0b2c36
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
161 deletions
app/action/LoginAction.js
app/action/QuickAction.js
app/containers/quickOrder/QuickOrderPage.js
app/utils/Utils.js
app/action/LoginAction.js
View file @
7f3db4af
...
...
@@ -7,14 +7,14 @@ export function requestLogin(params) {
dispatch
(
logining
());
PostRequest
(
'/access_token/password/search?app_code=PDA'
,
params
).
then
((
res
)
=>
{
if
(
res
.
error_code
===
0
){
show
(
'登录成功'
,
'success'
);
show
(
'登录成功'
);
dispatch
(
loginSuccess
(
res
,
params
.
data
.
user_name
,
params
.
data
.
user_password
));
}
else
{
show
(
res
.
error_msg
,
'error'
);
show
(
res
.
error_msg
);
dispatch
(
loginFailure
())
}
}).
catch
((
err
)
=>
{
show
(
err
.
error
,
'error'
);
show
(
err
.
error
);
})
}
}
...
...
app/action/QuickAction.js
View file @
7f3db4af
...
...
@@ -139,59 +139,6 @@ function requestListDataFail() {
}
}
// 上传语音 params={ access_token:'', path='录音地址' } -- 待修改
export
function
requestQuickAudio_222
(
params
)
{
return
dispatch
=>
{
let
{
access_token
,
path
}
=
params
// 临时
// access_token = "201904091445193616b5e3d3a777848dda1de1a8123d0fdf9xw7t566c1S92U88"
let
formData
=
new
FormData
()
let
soundPath
=
`file://
${
path
}
`
// soundPath = "file:///Users/wwt/Library/Developer/CoreSimulator/Devices/65EAD11E-A398-499D-916C-B346552EFF59/data/Containers/Data/Application/3B458954-880D-4001-AC47-C85F2C97B471/Documents/quickAudio243.ogg"
// let tempPath = 'file:///storage/emulated/0/Pictures/image.jpg'
let
fileName
=
path
.
substring
(
path
.
lastIndexOf
(
'/'
)
+
1
,
path
.
length
)
let
fileType
=
path
.
split
(
'.'
)[
1
]
let
file
=
{
uri
:
soundPath
,
type
:
"multipart/form-data"
,
name
:
fileName
}
// 类型和名字固定???
// let file = { uri: tempPath, type: 'multipart/form-data', name: fileName } // 类型和名字固定???
formData
.
append
(
'file'
,
file
)
console
.
log
(
'----file===================='
,
file
,
soundPath
,
formData
)
dispatch
(
requestSubmiting
());
// /system/attachment/create
// /dingding/upload_media
UploadRequest
(
getUrlParams
(
'/dingding/upload_media'
,
{
access_token
}),
formData
)
.
then
(
res
=>
{
console
.
log
(
'res===!!=='
,
Object
.
keys
(
res
),
res
);
if
(
res
.
error_code
==
0
)
{
let
{
data
:
{
url
}
}
=
res
dispatch
(
requestSubmitSuccess
(
url
));
}
else
if
(
res
.
error_code
===
41006
)
{
show
(
'登录过期,请重新登录'
);
dispatch
(
exitLoginStatus
());
}
else
{
let
error_msg
=
res
.
error_msg
||
res
.
message
show
(
error_msg
);
dispatch
(
requestSubmitFail
());
}
})
.
catch
(
err
=>
{
console
.
log
(
'------err--====requestQuickAudio----'
,
Object
.
keys
(
err
),
err
)
show
(
err
.
error
);
})
}
}
//上传头像 -- 测试
export
const
uploadAttachment
=
async
(
token
,
datas
)
=>
{
return
await
UploadRequest
(
'/dingding/upload_media'
+
'?access_token='
+
token
,
datas
)
};
// 上传语音
export
const
requestQuickAudio
=
async
(
params
)
=>
{
let
{
access_token
,
path
}
=
params
...
...
app/containers/quickOrder/QuickOrderPage.js
View file @
7f3db4af
...
...
@@ -45,7 +45,6 @@ import {
requestQuickTemplateCollect
,
requestQuickAudio
,
requestQuickSumbit
,
uploadAttachment
,
setQuickInitData
}
from
'../../action/QuickAction'
;
import
{
exitLoginStatus
}
from
'../../action/LoginAction'
;
...
...
@@ -251,110 +250,6 @@ class EquipConsuPage extends Component {
this
.
getAudioAuthorize
()
}
// 测试 -- 拍照上传
addPhotoAction
(){
// const {headerData,itemData} = this.props.navigation.state.params;
// const {photos} = this.state;
const
options
=
{
title
:
'选择图片'
,
cancelButtonTitle
:
'取消'
,
takePhotoButtonTitle
:
'拍照'
,
chooseFromLibraryButtonTitle
:
'相册'
,
cameraType
:
'back'
,
mediaType
:
'photo'
,
videoQuality
:
'high'
,
durationLimit
:
10
,
maxWidth
:
720
,
maxHeight
:
1280
,
aspectX
:
2
,
aspectY
:
1
,
quality
:
1
,
angle
:
0
,
allowsEditing
:
false
,
noData
:
false
,
storageOptions
:
{
skipBackup
:
true
,
path
:
'images'
}
};
ImagePicker
.
showImagePicker
(
options
,(
res
)
=>
{
if
(
res
.
didCancel
)
{
console
.
log
(
'User cancelled photo picker'
);
}
else
if
(
res
.
error
)
{
console
.
log
(
'ImagePicker Error: '
,
res
.
error
);
if
(
res
.
error
.
indexOf
(
'Camera permissions not granted'
)
>
-
1
){
Alert
.
alert
((
'提示信息'
,
'APP需要使用相机,请打开相机权限允许APP使用'
),
[{
text
:
'设置'
,
onPress
:
()
=>
{
Linking
.
openURL
(
'app-settings:'
)
.
catch
(
err
=>
console
.
log
(
'error'
,
err
))
}
},{
text
:
'取消'
}])
}
if
(
res
.
error
.
indexOf
(
'Photo library permissions not granted'
)
>
-
1
){
Alert
.
alert
(
'提示信息'
,
'APP需要使用相册,请打开相册权限允许APP使用'
,
[{
text
:
'设置'
,
onPress
:
()
=>
{
Linking
.
openURL
(
'app-settings:'
)
.
catch
(
err
=>
console
.
log
(
'error'
,
err
))
}
},{
text
:
'取消'
}]);
}
}
else
if
(
res
.
customButton
)
{
console
.
log
(
'User tapped custom button: '
,
res
.
customButton
);
}
else
{
show
(
'上传中...'
)
let
source
;
//保存选中的图片
if
(
Platform
.
OS
===
'android'
)
{
source
=
res
.
uri
;
}
else
{
source
=
res
.
uri
.
replace
(
'file://'
,
''
);
}
// let date = itemData.receipt_date;
// if(date && date.length > 0){
// date = date.replace('T',' ')
// }
// let watermark = itemData.receipt_number + ' ' + date + ' ' + this.props.userInfo.person_name + ' ' + itemData.inv_name + ' ' + itemData.party_name
const
formData
=
new
FormData
();
let
file
=
{
uri
:
source
,
type
:
'multipart/form-data'
,
name
:
res
.
fileName
};
formData
.
append
(
'file'
,
file
);
formData
.
append
(
'destination'
,
'ALL'
);
formData
.
append
(
'attachment_name'
,
res
.
fileName
);
formData
.
append
(
'source_header_table'
,
'rcv_receipt_header'
);
// formData.append('source_header_number',headerData.receipt_number);
formData
.
append
(
'source_line_table'
,
'rcv_receipt_line'
);
console
.
log
(
'formData112==='
,
formData
)
// formData.append('source_line_number',itemData.source_line_number);
// formData.append('watermark',watermark);
//上传附近接口 destination: 'ALL',attachment_name:res.fileName, 'source_header_table':'rcv_receipt_header'
//uploadAttachment(this.props.token,{file: file,destination: 'ALL',attachment_name:res.fileName, 'source_header_table':'rcv_receipt_header' })
uploadAttachment
(
this
.
props
.
token
,
formData
)
.
then
((
response
)
=>
{
if
(
response
.
error_code
===
0
)
{
show
(
'上传成功'
);
// photos.push(source);
// this.setState({photos});
}
else
if
(
response
.
error_code
===
41006
){
show
(
'登录过期,请重新登录'
);
// this.props.exitLoginStatus()
}
else
{
show
(
response
.
error_msg
)
}
})
}
})
}
// 赋值销售员 初始化数据
getSellerName
()
{
let
{
state
,
props
}
=
this
...
...
app/utils/Utils.js
View file @
7f3db4af
import
Toast
from
'react-native-root-toast'
;
import
{
Dimensions
,
Platform
,
PixelRatio
,
Text
}
from
"react-native"
;
/**
* 提示框
* @param {*} data 提示内容
* @param {*} type 提示类型
*/
export
const
show
=
(
data
,
type
)
=>
{
// default
let
text_color
=
'#fafafa'
...
...
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