提交 0d9e986a authored 作者: 吴强's avatar 吴强

人口上传头像,有点问题,就是无法改名字

上级 3b113569
差异被折叠。
import React, { Component } from 'react';
import PhotoBrowser from 'react-native-photo-browser';
export default class HomeScreen extends Component {
static navigationOptions = {
header: null,
};
// onSelectionChanged = (media, index, selected) => {
// console.info(`${media.photo} selection status: ${selected}`);
// };
// onActionButton = (media, index) => {
// if (Platform.OS === 'ios') {
// ActionSheetIOS.showShareActionSheetWithOptions(
// {
// url: media.photo,
// message: media.caption,
// },
// () => {},
// () => {},
// );
// } else {
// console.info(`handle sharing on android for ${media.photo}, index: ${index}`);
// }
// };
render() {
const {
media,
initialIndex,
displayNavArrows,
displayActionButton,
displaySelectionButtons,
startOnGrid,
enableGrid,
alwaysDisplayStatusBar,
} = this.props.navigation.state.params.example;
return (
<PhotoBrowser
onBack={this.props.navigation.pop}
mediaList={media}
initialIndex={initialIndex}
displayNavArrows={displayNavArrows}
displaySelectionButtons={displaySelectionButtons}
displayActionButton={displayActionButton}
startOnGrid={startOnGrid}
enableGrid={enableGrid}
useCircleProgress
onSelectionChanged={this.onSelectionChanged}
onActionButton={this.onActionButton}
alwaysDisplayStatusBar={alwaysDisplayStatusBar}
customTitle={(index, rowCount) => `${index} sur ${rowCount}`}
/>
);
}
}
import React, { Component } from 'react';
import {
Platform,
ActionSheetIOS,
} from 'react-native';
import PhotoBrowser from 'react-native-photo-browser';
export default class HomeScreen extends Component {
static navigationOptions = {
header: null,
};
onSelectionChanged = (media, index, selected) => {
console.info(`${media.photo} selection status: ${selected}`);
};
onActionButton = (media, index) => {
if (Platform.OS === 'ios') {
ActionSheetIOS.showShareActionSheetWithOptions(
{
url: media.photo,
message: media.caption,
},
() => {},
() => {},
);
} else {
console.info(`handle sharing on android for ${media.photo}, index: ${index}`);
}
};
render() {
const {
media,
initialIndex,
displayNavArrows,
displayActionButton,
displaySelectionButtons,
startOnGrid,
enableGrid,
alwaysDisplayStatusBar,
} = this.props.navigation.state.params.example;
return (
<PhotoBrowser
onBack={this.props.navigation.pop}
mediaList={media}
initialIndex={initialIndex}
displayNavArrows={displayNavArrows}
displaySelectionButtons={displaySelectionButtons}
displayActionButton={displayActionButton}
startOnGrid={startOnGrid}
enableGrid={enableGrid}
useCircleProgress
onSelectionChanged={this.onSelectionChanged}
onActionButton={this.onActionButton}
alwaysDisplayStatusBar={alwaysDisplayStatusBar}
customTitle={(index, rowCount) => `${index} sur ${rowCount}`}
/>
);
}
}
import React, { PureComponent } from 'react';
import {
View,
StyleSheet,
Text,
TouchableOpacity,
Image,
Platform,
ScrollView,
} from 'react-native';
import TagInput from 'react-native-tag-input';
import { InputItem } from 'antd-mobile';
import { createOperations, editResource, uploadResource } from '../services/resource';
const styles = StyleSheet.create({
container: {
flex: 1,
},
view_header_container: {
height: 56,
backgroundColor: 'white',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-around',
},
text_right_title: {
color: '#000',
},
text_left_title: {
color: '#000',
},
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 {
constructor(props) {
super(props);
const { imageURI, tableName, pID } = this.props.navigation.state.params;
this.state = {
imageURI,
tableName,
pID,
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 = () => {
this.props.onCancel();
};
onUploadPhoto = () => {
uploadResource(
this.state.imageURI,
(uploadId, arg) => {
editResource(arg, createOperations().setName(this.state.imageName).setTags(this.state.tags).use(`rel://path/${this.state.tableName}/${this.state.pID}`)).then().catch(err => console.info(`上传后改名字改tag:${err}`));
console.info('跳转');
this.props.navigation.navigate('DSRInfoDetail', this.props.navigation.state.params.pID);
},
(uploadId, arg) => console.info(arg),
)
.then(uploadId => console.log(`start task ${uploadId}`))
.catch(err => console.log(`上传失败:${err}`));
};
setImageName = (val) => {
console.info(`val:${val}`);
this.setState({ imageName: val });
}
labelExtractor = tag => tag;
renderHeaderMenu = () => {
return (
<View style={[styles.view_header_container, { backgroundColor: 'lightgray' }]}>
<TouchableOpacity
onPress={this.onCancel}
>
<Text style={[styles.text_left_title, { color: '#2196F3' }]}>取消</Text>
</TouchableOpacity>
<Text style={styles.text_title}>传照片</Text>
<TouchableOpacity
onPress={this.onUploadPhoto}
>
<Text style={[styles.text_right_title, { color: '#2196F3' }]}>
上传
</Text>
</TouchableOpacity>
</View>
);
}
render() {
return (
<View style={styles.container}>
{this.renderHeaderMenu()}
<ScrollView>
<Image
style={{ height: 80, width: 80 }}
source={{ uri: this.state.imageURI, isStatic: true }}
/>
<InputItem
placeholder="如:张三"
data-seed="logId"
onChange={this.setImageName}
>照片名称
</InputItem>
<View style={{ flexDirection: 'row', alignItems: 'center', backgroundColor: 'lightgray' }}>
<Text>类型</Text>
<TagInput
value={this.state.tags}
onChange={this.onChangeTags}
labelExtractor={this.labelExtractor}
text={this.state.text}
onChangeText={this.onChangeText}
tagColor="blue"
tagTextColor="white"
inputProps={inputProps}
maxHeight={75}
/>
</View>
</ScrollView>
</View>
);
}
}
export default UploadPageComponent;
import React, { PureComponent } from 'react';
import {
View,
StyleSheet,
Text,
TouchableOpacity,
Image,
Platform,
ScrollView,
} from 'react-native';
import TagInput from 'react-native-tag-input';
import { InputItem } from 'antd-mobile';
import { createOperations, editResource, uploadResource } from '../services/resource';
import { currentDomain } from '../services/domain';
const styles = StyleSheet.create({
container: {
flex: 1,
},
view_header_container: {
height: 56,
backgroundColor: 'white',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-around',
},
text_right_title: {
color: '#000',
},
text_left_title: {
color: '#000',
},
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 {
constructor(props) {
super(props);
const { imageURI, tableName, pID } = this.props.navigation.state.params;
this.state = {
imageURI,
tableName,
pID,
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 = () => {
this.props.onCancel();
};
onUploadPhoto = () => {
uploadResource(
this.state.imageURI,
(uploadId, arg) => console.info(arg),
(uploadId, arg) => {
currentDomain()
.then((result) => {
editResource(arg, createOperations().setName(this.state.imageName).setTags(this.state.tags).use(`rel://${result.path}/${this.state.tableName}/${this.state.pID}`)).then(cc => console.info(cc)).catch(err => console.info(`上传后改名字改tag:${err}`));
console.info('跳转');
this.props.navigation.navigate('DSRInfoDetail', { id: this.props.navigation.state.params.pID });
})
.catch(err => console.info(err));
},
)
.then(uploadId => console.log(`start task ${uploadId}`))
.catch(err => console.log(`上传失败:${err}`));
};
setImageName = (val) => {
console.info(`val:${val}`);
this.setState({ imageName: val });
}
labelExtractor = tag => tag;
renderHeaderMenu = () => {
return (
<View style={[styles.view_header_container, { backgroundColor: 'lightgray' }]}>
<TouchableOpacity
onPress={this.onCancel}
>
<Text style={[styles.text_left_title, { color: '#2196F3' }]}>取消</Text>
</TouchableOpacity>
<Text style={styles.text_title}>传照片</Text>
<TouchableOpacity
onPress={this.onUploadPhoto}
>
<Text style={[styles.text_right_title, { color: '#2196F3' }]}>
上传
</Text>
</TouchableOpacity>
</View>
);
}
render() {
return (
<View style={styles.container}>
{this.renderHeaderMenu()}
<ScrollView>
<Image
style={{ height: 80, width: 80 }}
source={{ uri: this.state.imageURI, isStatic: true }}
/>
<InputItem
placeholder="如:张三"
data-seed="logId"
onChange={this.setImageName}
>照片名称
</InputItem>
<View style={{ flexDirection: 'row', alignItems: 'center', backgroundColor: 'lightgray' }}>
<Text>类型</Text>
<TagInput
value={this.state.tags}
onChange={this.onChangeTags}
labelExtractor={this.labelExtractor}
text={this.state.text}
onChangeText={this.onChangeText}
tagColor="blue"
tagTextColor="white"
inputProps={inputProps}
maxHeight={75}
/>
</View>
</ScrollView>
</View>
);
}
}
export default UploadPageComponent;
import { NavigationActions } from 'react-navigation';
import { login, userInfo } from '../services/login';
import { errors } from '../utils/error';
import { setToken, setUser } from '../utils/auth';
export default {
namespace: 'login',
state: {},
reducers: {
},
effects: {
*login({ payload }, { call, put }) { // 这里的put 代表 跟dispatch一样的功能,只是在effects中叫做put
const payloads = { ...payload, type: 'userName', authType: 'password' };
console.info(payloads);
const result = yield call(login, payloads);
const { tokenId, authResponse, remainedAuthRequirements } = result;
if (authResponse.status !== 'authed' && authResponse.status !== 'skipped') {
throw errors.wrongPassword();
}
console.log(authResponse);
const { requirements } = remainedAuthRequirements;
if (requirements.length > 0) {
throw errors.unsupportedAuthType(requirements);
}
console.log(requirements);
yield call(setToken, tokenId);// 这里的yield ,跟C#中的await一样
const uInfo = yield call(userInfo);
console.log(uInfo);
yield call(setUser, uInfo.id, uInfo.name); // 保存用户名密码
yield put(NavigationActions.navigate({
routeName: 'Main',
}));
},
},
subscriptions: {},
};
import { NavigationActions } from 'react-navigation';
import { login, userInfo } from '../services/login';
import { errors } from '../utils/error';
import { setToken, setUser } from '../utils/auth';
export default {
namespace: 'login',
state: {},
reducers: {
},
effects: {
*login({ payload }, { call, put }) { // 这里的put 代表 跟dispatch一样的功能,只是在effects中叫做put
const payloads = { ...payload, type: 'userName', authType: 'password' };
const result = yield call(login, payloads);
const { tokenId, authResponse, remainedAuthRequirements } = result;
if (authResponse.status !== 'authed' && authResponse.status !== 'skipped') {
throw errors.wrongPassword();
}
const { requirements } = remainedAuthRequirements;
if (requirements.length > 0) {
throw errors.unsupportedAuthType(requirements);
}
yield call(setToken, tokenId);// 这里的yield ,跟C#中的await一样
const uInfo = yield call(userInfo);
yield call(setUser, uInfo.id, uInfo.name); // 保存用户名密码
yield put(NavigationActions.navigate({
routeName: 'Main',
}));
},
},
subscriptions: {},
};
import { AsyncStorage } from 'react-native';
import { NavigationActions } from 'react-navigation';
// import codePush from 'react-native-code-push';
import { checkUpdate } from '../services/update';
import { update } from '../native/Updater';
import config from '../utils/config';
import { encrypt } from '../utils/helper';
import app from '../index';
export default {
namespace: 'welcome',
state: {
percent: 0,
},
reducers: {
setPercent(state, { payload }) {
return {
...state,
percent: payload.progress,
};
},
},
effects: {
*init(ignored, { put, call }) {
try {
// yield call(codePush.sync);
// const result = yield call(checkUpdate);
// const { action, deploymentInfo, tokenId } = result;
// if (action === 'update') {
// const token = encrypt(tokenId);
// // console.info(`${config.updateContextPath}/resource/${token}/${encodeURIComponent(deploymentInfo.uri)}`);
// console.log('开始');
// yield call(
// update, `${config.updateContextPath}/resource/${token}/${encodeURIComponent(deploymentInfo.uri)}`,
// (event) => {
// app.getStore().dispatch({ type: 'welcome/setPercent', payload: { progress: event.progress } });
// },
// );
// console.log('结束结束结束结束结束结束结束结束结束结束');
// }
} catch (e) {
console.log(e); // eslint-disable-line no-console
}
const token = yield call(AsyncStorage.getItem, 'token');
if (!token) {
yield put(NavigationActions.navigate({
routeName: 'Login',
}));
} else {
yield put(NavigationActions.navigate({
routeName: 'Main',
}));
}
},
},
};
import { AsyncStorage } from 'react-native';
import { NavigationActions } from 'react-navigation';
// import codePush from 'react-native-code-push';
import { checkUpdate } from '../services/update';
import { update } from '../native/Updater';
import config from '../utils/config';
import { encrypt } from '../utils/helper';
import app from '../index';
export default {
namespace: 'welcome',
state: {
percent: 0,
promptText: '',
},
reducers: {
setPercent(state, { payload }) {
return {
...state,
percent: payload.progress,
};
},
setPromptText(state, { payload }) {
return {
...state,
promptText: payload.promptText,
};
},
},
effects: {
*init(ignored, { put, call }) {
try {
// yield call(codePush.sync);
const result = yield call(checkUpdate);
console.info(result);
const { action, deploymentInfo, tokenId } = result;
if (action === 'update' || action === 'rollback') {
yield put({ type: 'setPromptText', payload: { promptText: `${action === 'update' ? '更新中...' : '回滚中'}` } });
const token = encrypt(tokenId);
yield call(
update, `${config.updateContextPath}/resource/${token}/${encodeURIComponent(deploymentInfo.uri)}`,
(event) => {
app.getStore().dispatch({ type: 'welcome/setPercent', payload: { progress: event.progress } });
},
);
}
} catch (e) {
console.log(e); // eslint-disable-line no-console
}
const token = yield call(AsyncStorage.getItem, 'token');
if (!token) {
yield put(NavigationActions.navigate({
routeName: 'Login',
}));
} else {
yield put(NavigationActions.navigate({
routeName: 'Main',
}));
}
},
},
};
/** @module native/Updater */
import { NativeModules, DeviceEventEmitter } from 'react-native';
const { Updater } = NativeModules;
/**
* @typedef {Object} UpdateEvent 下载事件
* @property {string} status 事件类型,downloading或downloaded
* @property {number} progress 下载进度,0到100的整数
* @property {number} current 已下载字节数
* @property {number} all 总字节数
*/
/**
* @callback UpdateCallback 下载回调
* @param {UpdateEvent} event 下载事件
*/
/**
* 下载更新包并自动安装, 下载过程中会发送Updater/downloading事件,下载完成时会发送Updater/downloaded事件
* @param {string} url 更新地址
* @param {UpdateCallback} cb 下载回调
* @returns {Promise.<void>}
*/
export const update = async (url, cb) => {
let handle1;
let handle2;
if (cb) {
handle1 = DeviceEventEmitter.addListener('Updater/downloading', (event) => {
cb({
...event,
status: 'downloading',
});
});
handle2 = DeviceEventEmitter.addListener('Updater/downloaded', (event) => {
cb({
...event,
status: 'downloaded',
});
});
}
await Updater.update(url);
if (handle1) {
handle1.remove();
}
if (handle2) {
handle2.remove();
}
};
/**
* 取消当前更新进程
* @returns {Promise.<void>}
*/
export const cancel = async () => {
return Updater.cancel();
};
/** @module native/Updater */
import { NativeModules, DeviceEventEmitter } from 'react-native';
const { Updater } = NativeModules;
/**
* @typedef {Object} UpdateEvent 下载事件
* @property {string} status 事件类型,downloading或downloaded
* @property {number} progress 下载进度,0到100的整数
* @property {number} current 已下载字节数
* @property {number} all 总字节数
*/
/**
* @callback UpdateCallback 下载回调
* @param {UpdateEvent} event 下载事件
*/
/**
* 下载更新包并自动安装, 下载过程中会发送Updater/downloading事件,下载完成时会发送Updater/downloaded事件
* @param {string} url 更新地址
* @param {UpdateCallback} cb 下载回调
* @returns {Promise.<void>}
*/
export const update = async (url, cb) => {
let handle1;
let handle2;
if (cb) {
handle1 = DeviceEventEmitter.addListener('Updater/downloading', (event) => {
cb({
...event,
status: 'downloading',
});
});
handle2 = DeviceEventEmitter.addListener('Updater/downloaded', (event) => {
cb({
...event,
status: 'downloaded',
});
});
}
console.info(Updater);
await Updater.update(url);
if (handle1) {
handle1.remove();
}
if (handle2) {
handle2.remove();
}
};
/**
* 取消当前更新进程
* @returns {Promise.<void>}
*/
export const cancel = async () => {
return Updater.cancel();
};
/**
* Created by zhouhuan on 2017/11/3.
*/
import { StackNavigator } from 'react-navigation';
import PeopleInfo from './peopelInfo';
import PeopleDetailInfo from './peopleDetailInfo';
import AddPeopleInfo from './addPeopleInfo';
import peopleDetailEditScreen from "./peopleDetailEditScreen";
const peopleInfoErJiScreen = StackNavigator(
{
peopleInfoList: {
screen: PeopleInfo,
},
peopleInfoDetail: {
screen: PeopleDetailInfo,
},
addPeoppleInfo: {
screen: AddPeopleInfo,
},
peopleInfoDetailEdit: {
screen: peopleDetailEditScreen,
},
},
{
headerMode: 'none',
navigationOptions: {
gesturesEnabled: false,
},
},
);
export default peopleInfoErJiScreen;
/**
* Created by zhouhuan on 2017/11/3.
*/
import { StackNavigator } from 'react-navigation';
import PeopleInfo from './peopelInfo';
import PeopleDetailInfo from './peopleDetailInfo';
import AddPeopleInfo from './addPeopleInfo';
import peopleDetailEditScreen from './peopleDetailEditScreen';
import FileViewList from '../dangshireninfo/fileViewList';
const peopleInfoErJiScreen = StackNavigator(
{
peopleInfoList: {
screen: PeopleInfo,
},
peopleInfoDetail: {
screen: PeopleDetailInfo,
},
addPeoppleInfo: {
screen: AddPeopleInfo,
},
peopleInfoDetailEdit: {
screen: peopleDetailEditScreen,
},
peopleInfoFileView: {
screen: FileViewList,
},
},
{
headerMode: 'none',
navigationOptions: {
gesturesEnabled: false,
},
},
);
export default peopleInfoErJiScreen;
/**
* Created by zhouhuan on 2017/11/2.
*/
import React from 'react';
import { View, ScrollView } from 'react-native';
import { List, InputItem, WhiteSpace, WingBlank } from 'antd-mobile';
import { connect } from 'react-redux';
import Icon from 'react-native-vector-icons/FontAwesome';
import { createAction } from '../../../utils';
@connect(({ peopleInfo }) => ({ peopleInfo }))
class PeopleDetailInfo extends React.Component {
componentDidMount() {
const { id } = this.props.navigation.state.params;
this.props.dispatch(createAction('peopleInfo/getPeopleDetail')(id));
}
onEdit =() => {
const { id } = this.props.navigation.state.params;
this.props.dispatch(createAction('peopleInfo/GoToPeopleDetailEditScreen')(id));
};
render() {
const { detailData, metas } = this.props.peopleInfo;
return (
<ScrollView>
<WhiteSpace />
<WhiteSpace />
<WingBlank>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
{/* <Icon.Button
name="edit"
backgroundColor="#08BBF9"
onPress={this.onEdit}
>
编辑
</Icon.Button> */}
</View>
<WhiteSpace />
<List>
{
metas.map((m) => {
return (
<List.Item
key={m.key}
extra={detailData[m.key]}
wrap
>
{m.label}
</List.Item>
);
})
}
</List>
</WingBlank>
</ScrollView>
);
}
}
export default PeopleDetailInfo;
/**
* Created by zhouhuan on 2017/11/2.
*/
import React from 'react';
import { View, ScrollView } from 'react-native';
import { List, WhiteSpace, WingBlank } from 'antd-mobile';
import { connect } from 'react-redux';
import Icon from 'react-native-vector-icons/FontAwesome';
import { createAction } from '../../../utils';
import { currentDomain } from '../../../services/domain';
@connect(({ peopleInfo }) => ({ peopleInfo }))
class PeopleDetailInfo extends React.Component {
componentDidMount() {
const { id } = this.props.navigation.state.params;
this.props.dispatch(createAction('peopleInfo/getPeopleDetail')(id));
}
onEdit =() => {
const { id } = this.props.navigation.state.params;
this.props.dispatch(createAction('peopleInfo/GoToPeopleDetailEditScreen')(id));
};
goToViewPage =() => {
currentDomain()
.then((result) => {
this.props.navigation.navigate('peopleInfoFileView', { usage: `rel://${result.path}/DangShiRenRenKouXinXi/${this.props.navigation.state.params.id}` });
})
.catch(err => console.info(err));
// this.props.dispatch(createAction('DSRInfoDetail/setEnable')(true));
};
render() {
const { detailData, metas } = this.props.peopleInfo;
return (
<ScrollView>
<WhiteSpace />
<WhiteSpace />
<WingBlank>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
<Icon.Button
name="eye"
backgroundColor="#08BBF9"
onPress={this.goToViewPage}
>
资料查看
</Icon.Button>
</View>
<WhiteSpace />
<List>
{
metas.map((m) => {
return (
<List.Item
key={m.key}
extra={detailData[m.key]}
wrap
>
{m.label}
</List.Item>
);
})
}
</List>
</WingBlank>
</ScrollView>
);
}
}
export default PeopleDetailInfo;
import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { connect } from 'react-redux';
import SplashScreen from 'react-native-splash-screen';
import { createAction } from '../utils/index';
import PercentageCircle from '../components/roundProgressBarComponent';
@connect(({ welcome }) => ({ welcome }))
class WelcomeScreen extends Component {
componentDidMount() {
const { dispatch } = this.props;
dispatch(createAction('welcome/init')());
SplashScreen.hide();// 隐藏启动平
}
// 待改进,改成启动页,目前因为时间和技术的问题,搁置。wq write
render() {
return (
<View style={styles.container}>
<Text>wlecome</Text>
<View>
<PercentageCircle radius={60} percent={this.props.welcome.percent} color="#3498db" />
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#ffffff',
},
img: {
flex: 1,
width: 400,
height: 200,
resizeMode: 'contain',
},
});
export default WelcomeScreen;
import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { connect } from 'react-redux';
import SplashScreen from 'react-native-splash-screen';
import { createAction } from '../utils/index';
import PercentageCircle from '../components/roundProgressBarComponent';
@connect(({ welcome }) => ({ welcome }))
class WelcomeScreen extends Component {
componentDidMount() {
const { dispatch } = this.props;
dispatch(createAction('welcome/init')());
SplashScreen.hide();// 隐藏启动平
}
IsUpdate = () => {
if (this.props.welcome.promptText !== '') {
return <PercentageCircle radius={60} percent={this.props.welcome.percent} color="#3498db" />;
}
};
// 待改进,改成启动页,目前因为时间和技术的问题,搁置。wq write
render() {
return (
<View style={styles.container}>
<Text>{this.props.welcome.promptText === '' ? 'welcome' : this.props.welcome.promptText}</Text>
<View>
{
this.IsUpdate()
}
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#ffffff',
},
img: {
flex: 1,
width: 400,
height: 200,
resizeMode: 'contain',
},
});
export default WelcomeScreen;
/* eslint-disable no-undef */
/**
* Created by yaohx_169 on 2017/6/6.
*/
export const cookie = {
token: 'token',
userId: 'userId',
userName: 'userName',
domainPath: 'domainPath',
domainName: 'domainName',
};
export const errors = {
exception: 0x00010000,
no_such_user: 0x00010001,
invalid_token: 0x00010003,
// client error:
token_missing: 0x00000001,
wrong_password: 0x00000002,
unsupported_auth_type: 0x00000003,
};
const defaultDateFormat = 'YYYY-MM-DD';
const defaultTimeFormat = 'HH:mm:ss';
const defaultDateTimeFormat = `${defaultDateFormat} ${defaultTimeFormat}`;
const config = {
name: 'Jbpm Demo',
productId: 'manager-app-sz',
footerText: '上海铂蓝信息科技有限公司',
contextPath: '',
updateContextPath: 'http://192.168.1.22:8080/app',
// apiContextPath: 'http://14.21.68.149:9089/test',
apiContextPath: 'http://192.168.1.22:8080/sz',
defaultDateFormat,
defaultTimeFormat,
defaultDateTimeFormat,
pubKey: '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+/Rs6dYmdtETjHCZq4LF3QjLM/DocRAXrqtMULZf+579dAn+CiM8noLplZT/DRwvfK822eq8sypH+a4NqP7942pPVjOudVvKfiJvmm2TOQHvQ7vi3iyZVdlsxX72JNFo1Ocqwj48aIC/OJ4bMf/VyCKrmKrU2iXND+I4BN8cfhwIDAQAB-----END PUBLIC KEY-----',
};
export default config;
/* eslint-disable no-undef */
/**
* Created by yaohx_169 on 2017/6/6.
*/
export const cookie = {
token: 'token',
userId: 'userId',
userName: 'userName',
domainPath: 'domainPath',
domainName: 'domainName',
};
export const errors = {
exception: 0x00010000,
no_such_user: 0x00010001,
invalid_token: 0x00010003,
// client error:
token_missing: 0x00000001,
wrong_password: 0x00000002,
unsupported_auth_type: 0x00000003,
};
const defaultDateFormat = 'YYYY-MM-DD';
const defaultTimeFormat = 'HH:mm:ss';
const defaultDateTimeFormat = `${defaultDateFormat} ${defaultTimeFormat}`;
const config = {
name: 'Jbpm Demo',
productId: 'manager-app-sz',
footerText: '上海铂蓝信息科技有限公司',
contextPath: '',
updateContextPath: 'http://14.21.68.149:9088/app',
apiContextPath: 'http://14.21.68.149:9087/sz01',
// updateContextPath: 'http://192.168.1.22:8080/app',
// apiContextPath: 'http://192.168.1.22:8080/sz',
defaultDateFormat,
defaultTimeFormat,
defaultDateTimeFormat,
pubKey: '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+/Rs6dYmdtETjHCZq4LF3QjLM/DocRAXrqtMULZf+579dAn+CiM8noLplZT/DRwvfK822eq8sypH+a4NqP7942pPVjOudVvKfiJvmm2TOQHvQ7vi3iyZVdlsxX72JNFo1Ocqwj48aIC/OJ4bMf/VyCKrmKrU2iXND+I4BN8cfhwIDAQAB-----END PUBLIC KEY-----',
};
export default config;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论