Commit c4440684 by Denglingling

完善【器械消耗】主页面大致布局;

parent f73732bb
...@@ -10,10 +10,10 @@ import { Text, TextInput } from 'react-native'; ...@@ -10,10 +10,10 @@ import { Text, TextInput } from 'react-native';
import {Provider} from 'react-redux'; import {Provider} from 'react-redux';
import configureStore from './app/store/configureStore'; import configureStore from './app/store/configureStore';
import Router from './app/Router'; import Router from './app/Router';
import { fetch as fetchPolyfill } from 'whatwg-fetch' // import { fetch as fetchPolyfill } from 'whatwg-fetch'
const store = configureStore(); const store = configureStore();
global.fetch = fetchPolyfill // global.fetch = fetchPolyfill
// 字体不随系统字体变化 // 字体不随系统字体变化
Text.defaultProps = Object.assign({}, Text.defaultProps, { allowFontScaling: false }) Text.defaultProps = Object.assign({}, Text.defaultProps, { allowFontScaling: false })
......
...@@ -9,8 +9,6 @@ import { ...@@ -9,8 +9,6 @@ import {
QUICK_SUBMIT_SUCCESS, QUICK_SUBMIT_SUCCESS,
QUICK_SUBMIT_FAILURE QUICK_SUBMIT_FAILURE
} from '../base/ActionTypes'; } from '../base/ActionTypes';
import RNFetchBlob from 'react-native-fetch-blob'
import RNFS from 'react-native-fs';
// 获取组织 params={access_token:''} // 获取组织 params={access_token:''}
export function requestQuickOrganizations(params) { export function requestQuickOrganizations(params) {
...@@ -152,55 +150,18 @@ export function requestQuickAudio(params) { ...@@ -152,55 +150,18 @@ export function requestQuickAudio(params) {
let formData = new FormData() let formData = new FormData()
let soundPath = `file://${path}` let soundPath = `file://${path}`
let tempPath = 'file:///storage/emulated/0/Pictures/image.jpg' // 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 fileName = path.substring(path.lastIndexOf('/') + 1, path.length)
let fileType = path.split('.')[1] let fileType = path.split('.')[1]
// let file = { uri: soundPath, type: 'ogg', name: fileName } // 类型和名字固定??? let file = { uri: soundPath, type: "multipart/form-data", name: fileName} // 类型和名字固定???
let file = { uri: tempPath, type: 'multipart/form-data', name: 'image.jpg' } // 类型和名字固定??? // let file = { uri: tempPath, type: 'multipart/form-data', name: fileName } // 类型和名字固定???
formData.append('file', file) formData.append('file', file)
console.log('----file====================', file, soundPath, formData) console.log('----file====================', file, soundPath, formData)
// // 这里需要将'///'处理掉,因为使用wrap的时候,会再包裹一层
// // 本文的fetch-blob使用的是0.10.4版本,据说其他版本不用添加下面的代码。
// // let PATH = iOS?path.replace('file:///',''):path;
// // 创建上传的请求头,使用fetch-blob必须要遵循name,data的格式,要不然就不成功。
// let body = [{
// name: 'file',
// filename: fileName || 'file',
// data: RNFetchBlob.wrap(path)
// }];
// RNFetchBlob
// .fetch('POST',getUrlParams('/dingding/upload_media', { access_token }),{
// // 上传图片要设置Header
// 'Content-Type' : 'multipart/form-data',
// },body)
// .uploadProgress((written, total) => {
// // 本地查找进度
// console.log(written, total);
// })
// .progress((received, total) => {
// let perent = received / total;
// // 上传进度打印
// console.log(perent);
// })
// .then((response)=> response.json())
// .then((response)=> {
// // 上传信息返回
// console.log(response);
// })
// .catch((error)=>{
// // 错误信息
// console.log(error);
// });
dispatch(requestSubmitOrganizationsing()); dispatch(requestSubmitOrganizationsing());
// /system/attachment/create // /system/attachment/create
// /dingding/upload_media // /dingding/upload_media
...@@ -220,7 +181,7 @@ export function requestQuickAudio(params) { ...@@ -220,7 +181,7 @@ export function requestQuickAudio(params) {
} }
}) })
.catch(err => { .catch(err => {
// console.log('------err--====requestQuickAudio----', Object.keys(err)) console.log('------err--====requestQuickAudio----', Object.keys(err), err)
show(err.error); show(err.error);
}) })
} }
......
...@@ -410,7 +410,7 @@ class EquipConsuPage extends Component { ...@@ -410,7 +410,7 @@ class EquipConsuPage extends Component {
SampleRate: 44100.0, //采样率 SampleRate: 44100.0, //采样率
Channels: 2, //通道 Channels: 2, //通道
AudioQuality: 'High', //音质 AudioQuality: 'High', //音质
AudioEncoding: 'aac', //音频编码 AudioEncoding: 'ogg', //音频编码 aac
OutputFormat: 'mpeg_4', //输出格式 OutputFormat: 'mpeg_4', //输出格式
MeteringEnabled: false, //是否计量 MeteringEnabled: false, //是否计量
MeasurementMode: false, //测量模式 MeasurementMode: false, //测量模式
...@@ -1068,13 +1068,13 @@ class EquipConsuPage extends Component { ...@@ -1068,13 +1068,13 @@ class EquipConsuPage extends Component {
this.changeCanSub(true) this.changeCanSub(true)
let { state, props } = this let { state, props } = this
// // // 测试 -- 录音 // // 测试 -- 录音
// // let params = { // let params = {
// // access_token: props.token, // access_token: props.token,
// // path: state.audioPath // path: state.audioPath
// // } // }
// // console.log('---handleSubmit--',params) // console.log('---handleSubmit--',params)
// // props.requestQuickAudio(params) // props.requestQuickAudio(params)
// // // 测试 -- 图片上传 // // // 测试 -- 图片上传
// // this.addPhotoAction() // // this.addPhotoAction()
......
...@@ -529,14 +529,14 @@ class EquipConsuPage extends Component { ...@@ -529,14 +529,14 @@ class EquipConsuPage extends Component {
{ {
state.listOptionData[6].isShowSub ? state.listOptionData[6].isShowSub ?
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.detail_icon} style={styles.detail_icon}
onPress={() => this.handleDetailBtmCheck()} onPress={() => this.handleDetailBtmCheck()}
> >
<Image style={[icon_style, styles.detail_top_icon]} source={require('../../images/arr_btm.png')} /> <Image style={[icon_style, styles.detail_top_icon]} source={require('../../images/arr_btm.png')} />
</TouchableOpacity> : </TouchableOpacity> :
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={[styles.detail_icon, styles.detail_icon_rig]} style={[styles.detail_icon, styles.detail_icon_rig]}
onPress={() => this.handleDetailRigCheck()} onPress={() => this.handleDetailRigCheck()}
> >
...@@ -567,7 +567,7 @@ class EquipConsuPage extends Component { ...@@ -567,7 +567,7 @@ class EquipConsuPage extends Component {
<View style={styles.detail_footer}> <View style={styles.detail_footer}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.detail_btn_box} style={styles.detail_btn_box}
onPress = {() => this.handleConsumDetailCheck()} onPress = {() => this.handleConsumDetailCheck()}
> >
...@@ -594,7 +594,7 @@ class EquipConsuPage extends Component { ...@@ -594,7 +594,7 @@ class EquipConsuPage extends Component {
} }
// 返回添加图片 // 返回添加图片
renderAddPictures() { renderAddPicturesItem() {
let { state } = this let { state } = this
return ( return (
<CellTextStyle style={styles.consu_addpic}> <CellTextStyle style={styles.consu_addpic}>
...@@ -602,7 +602,7 @@ class EquipConsuPage extends Component { ...@@ -602,7 +602,7 @@ class EquipConsuPage extends Component {
<Text style={styles.addpic_tit}>添加图片</Text> <Text style={styles.addpic_tit}>添加图片</Text>
<View style={styles.addpic_cont}> <View style={styles.addpic_cont}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.addpic_img_btn} style={styles.addpic_img_btn}
onPress={() => this.handleAddPicCheck()} onPress={() => this.handleAddPicCheck()}
> >
...@@ -610,7 +610,7 @@ class EquipConsuPage extends Component { ...@@ -610,7 +610,7 @@ class EquipConsuPage extends Component {
</TouchableOpacity> </TouchableOpacity>
{/* <TouchableOpacity {/* <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.addpic_img_btn}> style={styles.addpic_img_btn}>
<Image style={icon_style} source={require('../../images/add_icon_large.png')} /> <Image style={icon_style} source={require('../../images/add_icon_large.png')} />
</TouchableOpacity> */} </TouchableOpacity> */}
...@@ -655,7 +655,7 @@ class EquipConsuPage extends Component { ...@@ -655,7 +655,7 @@ class EquipConsuPage extends Component {
{this.renderConsumablesDetailsItem()} {this.renderConsumablesDetailsItem()}
{this.renderAddPictures()} {this.renderAddPicturesItem()}
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
......
...@@ -105,7 +105,7 @@ class TransSearchPage extends Component { ...@@ -105,7 +105,7 @@ class TransSearchPage extends Component {
</View> </View>
<View style={[styles.item_container, styles.item_btn_cont]}> <View style={[styles.item_container, styles.item_btn_cont]}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.search_btn_box} style={styles.search_btn_box}
onPress={() => console.log('查询')} onPress={() => console.log('查询')}
> >
...@@ -125,7 +125,7 @@ class TransSearchPage extends Component { ...@@ -125,7 +125,7 @@ class TransSearchPage extends Component {
当前查询(5)数据 当前查询(5)数据
</Text> </Text>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.tit_btn_box} style={styles.tit_btn_box}
onPress={() => console.log('全选,取消全选')} onPress={() => console.log('全选,取消全选')}
> >
...@@ -136,7 +136,7 @@ class TransSearchPage extends Component { ...@@ -136,7 +136,7 @@ class TransSearchPage extends Component {
<View style={styles.cont_list_item}> <View style={styles.cont_list_item}>
<View style={styles.list_left}> <View style={styles.list_left}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.btn_single_box} style={styles.btn_single_box}
onPress={() => console.log('单选!!!')} onPress={() => console.log('单选!!!')}
> >
...@@ -155,7 +155,7 @@ class TransSearchPage extends Component { ...@@ -155,7 +155,7 @@ class TransSearchPage extends Component {
<View style={styles.cont_list_item}> <View style={styles.cont_list_item}>
<View style={styles.list_left}> <View style={styles.list_left}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.btn_single_box} style={styles.btn_single_box}
onPress={() => console.log('单选!!!')} onPress={() => console.log('单选!!!')}
> >
...@@ -174,7 +174,7 @@ class TransSearchPage extends Component { ...@@ -174,7 +174,7 @@ class TransSearchPage extends Component {
<View style={styles.cont_list_item}> <View style={styles.cont_list_item}>
<View style={styles.list_left}> <View style={styles.list_left}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.btn_single_box} style={styles.btn_single_box}
onPress={() => console.log('单选!!!')} onPress={() => console.log('单选!!!')}
> >
...@@ -193,7 +193,7 @@ class TransSearchPage extends Component { ...@@ -193,7 +193,7 @@ class TransSearchPage extends Component {
<View style={styles.cont_list_item}> <View style={styles.cont_list_item}>
<View style={styles.list_left}> <View style={styles.list_left}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.7} activeOpacity={.8}
style={styles.btn_single_box} style={styles.btn_single_box}
onPress={() => console.log('单选!!!')} onPress={() => console.log('单选!!!')}
> >
......
...@@ -55,16 +55,12 @@ export const UploadRequest = (url,datas) => { ...@@ -55,16 +55,12 @@ export const UploadRequest = (url,datas) => {
method: 'POST', method: 'POST',
body: datas, body: datas,
// headers: { // headers: {
// // 'Accept': 'application/json',
// // 'Content-Type': 'application/json'
// 'Content-Type': 'multipart/form-data' // '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 => {
......
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