提交 06aa4d7b authored 作者: 吴强's avatar 吴强

Merge branch 'master' of ssh://192.168.1.116:29418/bolan-root/frontend/manager-app-sz into wq

# Conflicts: # android/app/src/main/java/com/bolanmanagerapp/MainApplication.java # src/utils/config.js
上级 65b5e517
...@@ -43,8 +43,7 @@ public class MainApplication extends Application implements ReactApplication { ...@@ -43,8 +43,7 @@ public class MainApplication extends Application implements ReactApplication {
new CodePush(BuildConfig.CODEPUSH_KEY, getApplicationContext(), BuildConfig.DEBUG, "http://192.168.1.2:3000"), new CodePush(BuildConfig.CODEPUSH_KEY, getApplicationContext(), BuildConfig.DEBUG, "http://192.168.1.2:3000"),
new RNDeviceInfo(), new RNDeviceInfo(),
new IDCardReactPackage(), new IDCardReactPackage(),
new UpdaterReactPackage() //new UpdaterReactPackage(),
new IDCardReactPackage(),
new VectorIconsPackage(), new VectorIconsPackage(),
new SplashScreenReactPackage() new SplashScreenReactPackage()
); );
......
...@@ -8,6 +8,11 @@ import { ...@@ -8,6 +8,11 @@ import {
} from 'react-native'; } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons'; import Icon from 'react-native-vector-icons/MaterialIcons';
import Camera from 'react-native-camera'; import Camera from 'react-native-camera';
import { getToken } from '../utils/auth';
import { errors } from '../utils/error';
import { encrypt } from '../utils/helper';
import config from '../utils/config';
import { futch } from '../utils/polyfill';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
...@@ -51,7 +56,6 @@ const styles = StyleSheet.create({ ...@@ -51,7 +56,6 @@ const styles = StyleSheet.create({
padding: 5, padding: 5,
}, },
}); });
class CameraComponent extends React.Component { class CameraComponent extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -69,6 +73,8 @@ class CameraComponent extends React.Component { ...@@ -69,6 +73,8 @@ class CameraComponent extends React.Component {
this.switchCam = this.switchCam.bind(this); this.switchCam = this.switchCam.bind(this);
this.recording = this.recording.bind(this); this.recording = this.recording.bind(this);
this.takePicture = this.takePicture.bind(this); this.takePicture = this.takePicture.bind(this);
this.uploadImage = this.uploadImage.bind(this);
this.clear = this.clear.bind(this);
} }
typeIcon= () => { typeIcon= () => {
const { back, front } = Camera.constants.Type; const { back, front } = Camera.constants.Type;
...@@ -78,7 +84,7 @@ class CameraComponent extends React.Component { ...@@ -78,7 +84,7 @@ class CameraComponent extends React.Component {
} else if (this.state.camera.type === front) { } else if (this.state.camera.type === front) {
return 'camera-rear'; return 'camera-rear';
} }
} };
camButton= () => { camButton= () => {
if (!this.state.isRecording) { if (!this.state.isRecording) {
...@@ -86,7 +92,7 @@ class CameraComponent extends React.Component { ...@@ -86,7 +92,7 @@ class CameraComponent extends React.Component {
} else { } else {
return 'stop'; return 'stop';
} }
} };
switchCam() { switchCam() {
let newType; let newType;
const { back, front } = Camera.constants.Type; const { back, front } = Camera.constants.Type;
...@@ -129,6 +135,46 @@ class CameraComponent extends React.Component { ...@@ -129,6 +135,46 @@ class CameraComponent extends React.Component {
.then((data) => { console.log(data); this.setState({ imageURI: data.path }); }) .then((data) => { console.log(data); this.setState({ imageURI: data.path }); })
.catch(err => console.error(err)); .catch(err => console.error(err));
} }
uploadImage() {
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: 'tupian.jpg' };
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) {
// 这里需要调用接口,对图片数据进行绑定,等待完善
// 页面跳转,跳转到前面的详情的页面
console.info('跳转');
this.props.navigation.navigate('DSRInfoDetail', this.props.navigation.state.params.pID);
}
})
.catch((error) => {
console.info(error);
});
});
}
clear() {
this.setState({ imageURI: '' });
}
render() { render() {
if (this.state.imageURI === '') { if (this.state.imageURI === '') {
...@@ -148,7 +194,6 @@ class CameraComponent extends React.Component { ...@@ -148,7 +194,6 @@ class CameraComponent extends React.Component {
/> />
<View style={[styles.overlay, styles.topOverlay]}> <View style={[styles.overlay, styles.topOverlay]}>
<Icon.Button name={this.typeIcon()} size={36} backgroundColor="transparent" onPress={this.switchCam} /> <Icon.Button name={this.typeIcon()} size={36} backgroundColor="transparent" onPress={this.switchCam} />
<Icon.Button name={this.typeIcon()} size={36} backgroundColor="transparent" onPress={this.switchCam} />
</View> </View>
<View style={[styles.overlay, styles.bottomOverlay]}> <View style={[styles.overlay, styles.bottomOverlay]}>
<Icon.Button name="photo-camera" size={48} backgroundColor="transparent" onPress={this.takePicture} /> <Icon.Button name="photo-camera" size={48} backgroundColor="transparent" onPress={this.takePicture} />
...@@ -158,10 +203,16 @@ class CameraComponent extends React.Component { ...@@ -158,10 +203,16 @@ class CameraComponent extends React.Component {
); );
} else { } else {
return ( return (
<Image <View style={styles.container}>
style={{ height: Dimensions.get('window').height, width: Dimensions.get('window').width }} <Image
source={{ uri: this.state.imageURI, isStatic: true }} style={{ height: Dimensions.get('window').height, width: Dimensions.get('window').width }}
/> source={{ uri: this.state.imageURI, isStatic: true }}
/>
<View style={[styles.overlay, styles.bottomOverlay]}>
<Icon.Button name="clear" size={48} backgroundColor="transparent" onPress={this.clear} />
<Icon.Button name="done" size={48} backgroundColor="transparent" onPress={this.uploadImage} />
</View>
</View>
); );
} }
} }
......
...@@ -25,7 +25,7 @@ class PickerComponent extends PureComponent { ...@@ -25,7 +25,7 @@ class PickerComponent extends PureComponent {
onPickerChange={this.onPickerChange} onPickerChange={this.onPickerChange}
onOk={this.onOkButton} onOk={this.onOkButton}
> >
<List.Item arrow="horizontal" onClick={this.onClick}>当前基地</List.Item> <List.Item arrow="horizontal" onClick={this.onClick}>{this.props.title}</List.Item>
</Picker> </Picker>
</List> </List>
</View> </View>
......
...@@ -70,6 +70,7 @@ export default { ...@@ -70,6 +70,7 @@ export default {
arrayPath: [], arrayPath: [],
cols: 1, cols: 1,
userInfo: '', userInfo: '',
currentJiDiName: undefined,
}, },
subscriptions: { subscriptions: {
...@@ -87,6 +88,7 @@ export default { ...@@ -87,6 +88,7 @@ export default {
datas.push({ label: name, value: path, children: [] }); datas.push({ label: name, value: path, children: [] });
return datas; return datas;
}); });
yield put({ type: 'setCols', payload: 1 });
yield put({ type: 'queryInit', payload: init }); yield put({ type: 'queryInit', payload: init });
yield put({ type: 'queryArryPath', payload: ['/'] }); yield put({ type: 'queryArryPath', payload: ['/'] });
yield put({ type: 'queryList', payload: datas }); yield put({ type: 'queryList', payload: datas });
...@@ -113,6 +115,8 @@ export default { ...@@ -113,6 +115,8 @@ export default {
const { path, name } = yield call(currentDomain); const { path, name } = yield call(currentDomain);
yield call(setDomain, name, path); yield call(setDomain, name, path);
yield put({ type: 'queryInit', payload: path }); yield put({ type: 'queryInit', payload: path });
const currentJiDiName = name;
yield put({ type: 'setCurrentJiDiName', payload: currentJiDiName });
}, },
*logout(ignored, { put, call }) { *logout(ignored, { put, call }) {
yield call(logout); yield call(logout);
...@@ -126,9 +130,9 @@ export default { ...@@ -126,9 +130,9 @@ export default {
*getUserInfo(ignored, { put, call }) { *getUserInfo(ignored, { put, call }) {
const userInfo = yield call(getUser); const userInfo = yield call(getUser);
const domain = yield call(getDomain); const domain = yield call(getDomain);
console.info(domain.path);
const list = yield call(fetchDomains, domain.path, true); const list = yield call(fetchDomains, domain.path, true);
console.info(list[0].name); const currentJiDiName = list[0].name;
yield put({ type: 'setCurrentJiDiName', payload: currentJiDiName });
yield put({ type: 'queryUserInfo', payload: userInfo }); yield put({ type: 'queryUserInfo', payload: userInfo });
}, },
}, },
...@@ -170,6 +174,12 @@ export default { ...@@ -170,6 +174,12 @@ export default {
cols, cols,
}; };
}, },
setCurrentJiDiName(state, { payload: currentJiDiName }) {
return {
...state,
currentJiDiName,
};
},
}, },
}; };
...@@ -7,7 +7,7 @@ import DSRInfo from './dangshireninfo/dsrinfo'; ...@@ -7,7 +7,7 @@ import DSRInfo from './dangshireninfo/dsrinfo';
import DSRInfoDetail from './dangshireninfo/dsrinfodetail'; import DSRInfoDetail from './dangshireninfo/dsrinfodetail';
import peopleInfo from './peopleInfo/peopleInfo'; import peopleInfo from './peopleInfo/peopleInfo';
import domain from './domain'; import domain from './domain';
import userInfo from './userinfo/userinfo'; import userInfomation from './userinfo/userinfo';
import QSInfo from './quanshuInfo/qsinfo'; import QSInfo from './quanshuInfo/qsinfo';
import QSInfoDetail from './quanshuInfo/qsinfodetail'; import QSInfoDetail from './quanshuInfo/qsinfodetail';
import FWQuanShu from './houseinfo/fwquanshuDetail'; import FWQuanShu from './houseinfo/fwquanshuDetail';
...@@ -22,7 +22,7 @@ export default [ ...@@ -22,7 +22,7 @@ export default [
DSRInfo, DSRInfo,
DSRInfoDetail, DSRInfoDetail,
peopleInfo, peopleInfo,
userInfo, userInfomation,
QSInfo, QSInfo,
QSInfoDetail, QSInfoDetail,
FWQuanShu, FWQuanShu,
......
export default { export default {
namespace: 'userInfo', namespace: 'userInfomation',
state: { state: {
userName: undefined, userName: undefined,
currentJiDiName: undefined, currentJiDiName: undefined,
jidiList: [], currentJiDiPath: undefined,
}, },
subscriptions: { subscriptions: {
setup({ dispatch }) { // eslint-disable-line setup({ dispatch }) { // eslint-disable-line
...@@ -18,13 +18,7 @@ export default { ...@@ -18,13 +18,7 @@ export default {
userName, userName,
}; };
}, },
setJiDiList(state, { payload: jidiList }) { setCurrentJiDiName(state, { payload: currentJiDiName }) {
return {
...state,
jidiList,
};
},
setCurrentJiDi(state, { payload: currentJiDiName }) {
return { return {
...state, ...state,
currentJiDiName, currentJiDiName,
......
import { AsyncStorage } from 'react-native'; import { AsyncStorage } from 'react-native';
import { NavigationActions } from 'react-navigation'; import { NavigationActions } from 'react-navigation';
import codePush from 'react-native-code-push'; // import codePush from 'react-native-code-push';
import { checkUpdate } from '../services/update';
export default { export default {
namespace: 'welcome', namespace: 'welcome',
...@@ -9,7 +10,9 @@ export default { ...@@ -9,7 +10,9 @@ export default {
effects: { effects: {
*init(ignored, { put, call }) { *init(ignored, { put, call }) {
try { try {
yield call(codePush.sync); // yield call(codePush.sync);
// const promise = yield call(checkUpdate);
// console.info(promise);
} catch (e) { } catch (e) {
console.log(e); // eslint-disable-line no-console console.log(e); // eslint-disable-line no-console
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import React from 'react'; import React from 'react';
import { createForm } from 'rc-form'; import { createForm } from 'rc-form';
import { View, ScrollView } from 'react-native'; import { View, ScrollView } from 'react-native';
import { List, InputItem, Toast, WhiteSpace, WingBlank, TextareaItem } from 'antd-mobile'; import { List, InputItem, Toast, WhiteSpace, WingBlank } from 'antd-mobile';
import Icon from 'react-native-vector-icons/FontAwesome'; import Icon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createAction } from '../../../utils'; import { createAction } from '../../../utils';
...@@ -17,7 +17,7 @@ class DSRInfoDetailScreen extends React.Component { ...@@ -17,7 +17,7 @@ class DSRInfoDetailScreen extends React.Component {
} }
onEdit =() => { onEdit =() => {
// this.props.dispatch(createAction('DSRInfoDetail/setEnable')(true)); // this.props.dispatch(createAction('DSRInfoDetail/setEnable')(true));
this.props.navigation.navigate('CameraPhoto'); this.props.navigation.navigate('CameraPhoto', { pID: this.props.navigation.state.params });
}; };
onSubmit = () => { onSubmit = () => {
this.props.form.validateFields({ force: true }, (error, value) => { this.props.form.validateFields({ force: true }, (error, value) => {
...@@ -121,13 +121,13 @@ class DSRInfoDetailScreen extends React.Component { ...@@ -121,13 +121,13 @@ class DSRInfoDetailScreen extends React.Component {
<WhiteSpace /> <WhiteSpace />
<WingBlank> <WingBlank>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}> <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
{/* <Icon.Button <Icon.Button
name="edit" name="edit"
backgroundColor="#08BBF9" backgroundColor="#08BBF9"
onPress={this.onEdit} onPress={this.onEdit}
> >
编辑 资料上传
</Icon.Button> */} </Icon.Button>
</View> </View>
<WhiteSpace /> <WhiteSpace />
<List> <List>
......
...@@ -8,7 +8,7 @@ import PickerComponent from '../../../components/pickerComponent'; ...@@ -8,7 +8,7 @@ import PickerComponent from '../../../components/pickerComponent';
import { createAction } from '../../../utils/index'; import { createAction } from '../../../utils/index';
// create a component // create a component
@connect(({ userInfo, domain }) => ({ userInfo, domain })) @connect(({ userInfomation, domain }) => ({ userInfomation, domain }))
class UserInfoHomeScreen extends PureComponent { class UserInfoHomeScreen extends PureComponent {
componentDidMount() { componentDidMount() {
this.props.dispatch(createAction('domain/getUserInfo')()); this.props.dispatch(createAction('domain/getUserInfo')());
...@@ -31,7 +31,7 @@ class UserInfoHomeScreen extends PureComponent { ...@@ -31,7 +31,7 @@ class UserInfoHomeScreen extends PureComponent {
Toast.offline('功能正在完善中...', 2); Toast.offline('功能正在完善中...', 2);
}; };
render() { render() {
const { list, listChildren, arrayPath, cols, userInfo } = this.props.domain; const { list, listChildren, arrayPath, cols, userInfo, currentJiDiName } = this.props.domain;
let datas = []; let datas = [];
if (listChildren.length === 0) { if (listChildren.length === 0) {
datas = list; datas = list;
...@@ -70,7 +70,8 @@ class UserInfoHomeScreen extends PureComponent { ...@@ -70,7 +70,8 @@ class UserInfoHomeScreen extends PureComponent {
</View> </View>
<WingBlank> <WingBlank>
<View style={styles.pickerCom}> <View style={styles.pickerCom}>
<PickerComponent onClick={this.onClick} onPickerChange={this.onPickerChange} onOkButton={this.onOkButton} data={datas} pathVal={arrayPath} cols={cols} /> <List.Item extra={currentJiDiName} wrap>当前基地</List.Item>
<PickerComponent onClick={this.onClick} onPickerChange={this.onPickerChange} onOkButton={this.onOkButton} data={datas} pathVal={arrayPath} cols={cols} title="切换基地" />
</View> </View>
</WingBlank> </WingBlank>
</View> </View>
......
...@@ -9,6 +9,7 @@ class WelcomeScreen extends Component { ...@@ -9,6 +9,7 @@ class WelcomeScreen extends Component {
componentDidMount() { componentDidMount() {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch(createAction('welcome/init')()); dispatch(createAction('welcome/init')());
SplashScreen.hide();// 隐藏启动平 SplashScreen.hide();// 隐藏启动平
} }
// 待改进,改成启动页,目前因为时间和技术的问题,搁置。wq write // 待改进,改成启动页,目前因为时间和技术的问题,搁置。wq write
......
...@@ -21,7 +21,7 @@ import config from '../utils/config'; ...@@ -21,7 +21,7 @@ import config from '../utils/config';
/** /**
* 升级检查 * 升级检查
* @returns {Promise.<RestResponse<VersionCheck>>} * @returns {Promise.<VersionCheck>}
*/ */
export const checkUpdate = async () => { export const checkUpdate = async () => {
return post(`${config.updateContextPath}/api/app/user/apps/check`, { name: config.productId, version: DeviceInfo.getVersion() }); return post(`${config.updateContextPath}/api/app/user/apps/check`, { name: config.productId, version: DeviceInfo.getVersion() });
......
...@@ -30,7 +30,7 @@ const config = { ...@@ -30,7 +30,7 @@ const config = {
productId: 'manager-app-sz', productId: 'manager-app-sz',
footerText: '上海铂蓝信息科技有限公司', footerText: '上海铂蓝信息科技有限公司',
contextPath: '', contextPath: '',
updateContextPath: 'http://192.168.1.22/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/bm',
defaultDateFormat, defaultDateFormat,
......
// eslint-disable-next-line global-require // eslint-disable-next-line global-require
export const fetch = require('react-native-fetch-polyfill').default; export const fetch = require('react-native-fetch-polyfill').default;
export const futch = (url, opts = {}, onProgress) => {
return new Promise((res, rej) => {
const xhr = new global.XMLHttpRequest();
xhr.open(opts.method || 'get', url);
Object.keys(opts.headers).forEach((k) => {
xhr.setRequestHeader(k, opts.headers[k]);
});
// for (var k in opts.headers || {}) {
// console.info('*');
// xhr.setRequestHeader(k, opts.headers[k]);
// }
xhr.onload = e => res(e.target);
xhr.onerror = rej;
if (xhr.upload && onProgress) {
xhr.upload.onprogress = onProgress; // event.loaded / event.total * 100 ; //event.lengthComputable
}
xhr.send(opts.body);
});
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论