Commit ce8571b3 by Denglingling

完善【自助下单】模块的 配台模版、订单类型、录音、提交接口,录音上传还需要修改

parent 1798ebee
...@@ -3,10 +3,21 @@ ...@@ -3,10 +3,21 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<!-- add --> <!-- add -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> -->
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application <application
android:name=".MainApplication" android:name=".MainApplication"
android:label="@string/app_name" android:label="@string/app_name"
......
import { PostRequest, GetRequest } from '../network/RequestUtils'; import { PostRequest, GetRequest, UploadRequest } from '../network/RequestUtils';
import { show, getUrlParams } from '../utils/Utils'; import { show, getUrlParams } from '../utils/Utils';
import { exitLoginStatus } from './LoginAction'; import { exitLoginStatus } from './LoginAction';
import { QUICK_ORDER_LIST_DOING, QUICK_ORDER_LIST_SUCCESS, QUICK_ORDER_LIST_FAILURE } from '../base/ActionTypes'; import {
QUICK_ORDER_LIST_DOING,
QUICK_ORDER_LIST_SUCCESS,
QUICK_ORDER_LIST_FAILURE,
QUICK_SUBMIT_DOING,
QUICK_SUBMIT_SUCCESS,
QUICK_SUBMIT_FAILURE
} from '../base/ActionTypes';
import RNFetchBlob from 'react-native-fetch-blob'
// 获取组织 params={access_token:''} // 获取组织 params={access_token:''}
// export const requestQuickOrganizations = async (params) => { // export const requestQuickOrganizations = async (params) => {
...@@ -9,14 +17,14 @@ import { QUICK_ORDER_LIST_DOING, QUICK_ORDER_LIST_SUCCESS, QUICK_ORDER_LIST_FAIL ...@@ -9,14 +17,14 @@ import { QUICK_ORDER_LIST_DOING, QUICK_ORDER_LIST_SUCCESS, QUICK_ORDER_LIST_FAIL
// } // }
export function requestQuickOrganizations(params) { export function requestQuickOrganizations(params) {
return dispatch => { return dispatch => {
console.warn('----requestQuickOrganizations====================') // console.warn('----requestQuickOrganizations====================')
dispatch(requestOrganizationsing()); dispatch(requestOrganizationsing());
// GetRequest(`/authorized_inventory/search?access_token=${access_token}`) // GetRequest(`/authorized_inventory/search?access_token=${access_token}`)
GetRequest(getUrlParams('/authorized_inventory/search', params)) GetRequest(getUrlParams('/authorized_inventory/search', params))
.then(res => { .then(res => {
console.warn('res=====', Object.keys(res), res.error, res.message); // console.warn('res=====', Object.keys(res), res.error, res.message);
if(res.error_code == 0) { if(res.error_code == 0) {
console.warn('res====organizations==========', res.data.organizations); // console.warn('res====organizations==========', res.data.organizations);
let { data: { organizations } } = res let { data: { organizations } } = res
dispatch(requestOrganizationsSuccess(organizations)); dispatch(requestOrganizationsSuccess(organizations));
} else if(res.error_code === 41006) { } else if(res.error_code === 41006) {
...@@ -29,7 +37,7 @@ export function requestQuickOrganizations(params) { ...@@ -29,7 +37,7 @@ export function requestQuickOrganizations(params) {
} }
}) })
.catch(err => { .catch(err => {
console.log('------err--====organizations----', Object.keys(err), err.error, err.message) // console.log('------err--====organizations----', Object.keys(err), err.error, err.message)
show(err.error); show(err.error);
}) })
} }
...@@ -42,11 +50,9 @@ export function requestQuickSurgeryHospital(params) { ...@@ -42,11 +50,9 @@ export function requestQuickSurgeryHospital(params) {
dispatch(requestOrganizationsing()); dispatch(requestOrganizationsing());
GetRequest(getUrlParams('/sale/seller_customer/search', params)) GetRequest(getUrlParams('/sale/seller_customer/search', params))
// GetRequest('/sale/seller_customer/search?access_token=20200512140017932dcdff2129a5f4201900f116c819e74865T473Ma2PGh16ek&org_code=A02&seller_code=shi.ming') // GetRequest('/sale/seller_customer/search?access_token=20200512140017932dcdff2129a5f4201900f116c819e74865T473Ma2PGh16ek&org_code=A02&seller_code=shi.ming')
.then(res => { .then(res => {
console.warn('res===!!==', Object.keys(res), res.error, res.message); // console.warn('res===!!==', Object.keys(res));
if(res.error_code == 0) { if(res.error_code == 0) {
console.warn('res====requestQuickSurgeryHospital==========', res.data.organizations);
let { data: { customers } } = res let { data: { customers } } = res
dispatch(requestOrganizationsSuccess(customers)); dispatch(requestOrganizationsSuccess(customers));
} else if(res.error_code === 41006) { } else if(res.error_code === 41006) {
...@@ -59,12 +65,65 @@ export function requestQuickSurgeryHospital(params) { ...@@ -59,12 +65,65 @@ export function requestQuickSurgeryHospital(params) {
} }
}) })
.catch(err => { .catch(err => {
console.log('------err--====requestQuickSurgeryHospital----', Object.keys(err)) // console.log('------err--====requestQuickSurgeryHospital----', Object.keys(err))
show(err.error); show(err.error);
}) })
} }
} }
// 获取订单类型 params={access_token:'', value_set_code:'SUR_ORDER_TYPE'}
export function requestQuickOrderType(params) {
return dispatch => {
console.warn('----requestQuickOrderType====================', params)
dispatch(requestOrganizationsing());
GetRequest(getUrlParams('/system/value_set/search', params))
.then(res => {
console.warn('res===!!==', Object.keys(res));
if(res.error_code == 0) {
let { data: { sys_values } } = res
dispatch(requestOrganizationsSuccess(sys_values));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestOrganizationsFail());
}
})
.catch(err => {
// console.log('------err--====requestQuickSurgeryHospital----', Object.keys(err))
show(err.error);
})
}
}
// 获取配台模版 params={access_token:'', org_code:'', seller_code: 'shi.ming', customer_code: '', surgery_type: '', doctor_name: ''}
export function requestQuickTemplateCollect(params) {
return dispatch => {
console.warn('----requestQuickTemplateCollect====================', params)
dispatch(requestOrganizationsing());
GetRequest(getUrlParams('/surgery/template_header/search', params))
.then(res => {
console.warn('res===!!==', Object.keys(res));
if(res.error_code == 0) {
let { data: { surgery_template_headers } } = res
dispatch(requestOrganizationsSuccess(surgery_template_headers));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestOrganizationsFail());
}
})
.catch(err => {
// console.log('------err--====requestQuickTemplateCollect----', Object.keys(err))
show(err.error);
})
}
}
function requestOrganizationsing() { function requestOrganizationsing() {
return { return {
...@@ -84,3 +143,99 @@ function requestOrganizationsFail() { ...@@ -84,3 +143,99 @@ function requestOrganizationsFail() {
type: QUICK_ORDER_LIST_FAILURE type: QUICK_ORDER_LIST_FAILURE
} }
} }
// 上传语音 params={ access_token:'', path='录音地址' }
export function requestQuickAudio(params) {
return dispatch => {
let { access_token, path } = params
// 临时
// access_token = "201904091445193616b5e3d3a777848dda1de1a8123d0fdf9xw7t566c1S92U88"
let formData = new FormData()
let soundPath = `file://${path}`
let fileName = path.substring(path.lastIndexOf('/') + 1, path.length)
// let file = { uri: soundPath, type: 'ogg', name: fileName } // 类型和名字固定???
let file = { uri: soundPath, type: 'multipart/form-data', name: fileName } // 类型和名字固定???
formData.append('file', file)
console.log('----file====================', file, soundPath, formData)
// /system/attachment/create
// /dingding/upload_media
dispatch(requestSubmitOrganizationsing());
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(requestSubmitOrganizationsSuccess(url));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestSubmitOrganizationsFail());
}
})
.catch(err => {
// console.log('------err--====requestQuickAudio----', Object.keys(err))
show(err.error);
})
}
}
//上传头像
export const uploadAttachment = async (token,datas) => {
return await UploadRequest('/system/attachment/create' + '?access_token=' + token,datas)
};
// 提交数据
export function requestQuickSumbit({access_token, ...params}) {
return dispatch => {
console.warn('----requestQuickSumbit====================', access_token, params)
dispatch(requestSubmitOrganizationsing());
PostRequest(getUrlParams('/surgery/consume_order/create', {access_token: access_token}), params)
.then(res => {
console.warn('res=====', Object.keys(res));
if(res.error_code == 0) {
console.warn('res====requestQuickSumbit==========', res.data);
let { data: { data } } = res
dispatch(requestSubmitOrganizationsSuccess(data));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestSubmitOrganizationsFail());
}
})
.catch(err => {
// console.log('------err--====requestQuickSumbit----', Object.keys(err), err.error, err.message)
show(err.error);
})
}
}
function requestSubmitOrganizationsing() {
return {
type: QUICK_SUBMIT_DOING
}
}
function requestSubmitOrganizationsSuccess(data) {
return {
type: QUICK_SUBMIT_SUCCESS,
rawData: data
}
}
function requestSubmitOrganizationsFail() {
return {
type: QUICK_SUBMIT_FAILURE
}
}
\ No newline at end of file
export const BaseUrl = "https://obs.uat.sfrx.guke.tech"; export const BaseUrl = "http://192.168.10.188:8200"; // https://obs.uat.sfrx.guke.tech https://sob-os.uat.sfrx.guke.tech
export const BaseUrlOther = "https://sob-os.uat.sfrx.guke.tech"; export const BaseUrlOther = "http://192.168.10.188:8200"; //http://192.168.10.188:8200/v1/dingding/upload_media
export const VERSION = '/api/latest'; export const VERSION = '/v1'; // /api/latest
export const ACCESS_TOKEN = '201904091445193616b5e3d3a777848dda1de1a8123d0fdf9xw7t566c1S92U88';//未获取到access_token时使用 export const ACCESS_TOKEN = '201904091445193616b5e3d3a777848dda1de1a8123d0fdf9xw7t566c1S92U88';//未获取到access_token时使用
...@@ -78,7 +78,7 @@ const styles = StyleSheet.create({ ...@@ -78,7 +78,7 @@ const styles = StyleSheet.create({
paddingLeft: 20 paddingLeft: 20
}, },
text_input: { text_input: {
height: 38, // height: 38,
paddingRight: 20 paddingRight: 20
}, },
image_box: { image_box: {
......
...@@ -772,6 +772,7 @@ class SelfOrderPage extends Component { ...@@ -772,6 +772,7 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '手术类时间') { if(item.title === '手术类时间') {
item.name = date
item.value = date item.value = date
item.dateValue = formatStrForDate(date) item.dateValue = formatStrForDate(date)
} }
......
...@@ -55,13 +55,21 @@ export const UploadRequest = (url,datas) => { ...@@ -55,13 +55,21 @@ export const UploadRequest = (url,datas) => {
const opts = { const opts = {
method: 'POST', method: 'POST',
body: datas, body: datas,
// headers: {
// // 'Accept': 'application/json',
// // 'Content-Type': 'application/json'
// 'Content-Type': 'multipart/form-data'
// // 'Content-Type': 'multipart/form-data;charset=utf-8'
// },
timeout: 20000 //20s超时 timeout: 20000 //20s超时
}; };
return fetch(`${BaseUrl}${VERSION}${url}`, opts) // return fetch(`${BaseUrl}${VERSION}${url}`, opts)
return fetch(`${BaseUrlOther}${VERSION}${url}`, opts)
.then(response => response.json()) .then(response => response.json())
.then(data => data) .then(data => data)
.catch(error => { .catch(error => {
return {flag: -3, error_msg:'请求异常,请重试'} console.log('error--------------------',error, Object.keys(error))
return {error_code: -3, error_msg:'请求异常,请重试'}
}) })
}; };
\ No newline at end of file
...@@ -39,7 +39,8 @@ export default self = (state = defaultState, action) => { ...@@ -39,7 +39,8 @@ export default self = (state = defaultState, action) => {
case QUICK_SUBMIT_SUCCESS: case QUICK_SUBMIT_SUCCESS:
return Object.assign({}, state, { return Object.assign({}, state, {
submit_quick_order_status: QUICK_SUBMIT_SUCCESS, submit_quick_order_status: QUICK_SUBMIT_SUCCESS,
quickOrderOption: {} // 清空当前临时数据 quickOrderOption: action.rawData
// quickOrderOption: {} // 清空当前临时数据
}) })
case QUICK_SUBMIT_FAILURE: case QUICK_SUBMIT_FAILURE:
return Object.assign({}, state, { return Object.assign({}, state, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment