wennjie пре 6 година
родитељ
комит
46322611f8

+ 4 - 2
huiliaoAPP/.babelrc

@@ -1,3 +1,5 @@
 {
-  "presets": ["react-native"]
-}
+  "presets": [
+    "react-native"
+  ]
+}

+ 5 - 16
huiliaoAPP/index.js

@@ -1,24 +1,13 @@
 /** @format */
 
-import {AppRegistry,AsyncStorage} from 'react-native';
+import {AppRegistry} from 'react-native';
 import App from './App';
 import {name as appName} from './app.json';
-import BottomTabNavigator from './src/navigators/BottomTabNavigator'
 
 
-import register from './src/config/register'
+// console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please use BackHandler instead.','source.uri should not be an empty string','Invalid props.style key'];
+ 
+// console.disableYellowBox = true // 关闭全部黄色警告
+console.ignoredYellowBox = ['Setting a timer'];
 
-// register.isRegister=true
-
-
-// AsyncStorage.getItem('USER').then((res)=>{
-
-//     console.log(res)
-
-
-// },(err)=>{
-
-// })
-
-// console.log(123)
 AppRegistry.registerComponent(appName, () => App);

+ 57 - 0
huiliaoAPP/ios/huiliaoAPP.xcodeproj/project.pbxproj

@@ -43,6 +43,7 @@
 		AC0E38A9407146FD97D072A4 /* libimageCropPicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B01B1EB32104611B4BD75FB /* libimageCropPicker.a */; };
 		ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
 		AE3B4C4D21328968006E0B16 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
+		AE708121213AE9F200EB73BF /* libRCTPushNotification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AE708101213AE9B900EB73BF /* libRCTPushNotification.a */; };
 		AE9332AE212FD01900A82ECC /* RSKImageCropper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE9332AD212FD01900A82ECC /* RSKImageCropper.framework */; };
 		AE9332AF212FD01900A82ECC /* RSKImageCropper.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AE9332AD212FD01900A82ECC /* RSKImageCropper.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		AE9332B2212FD01C00A82ECC /* QBImagePicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE9332B1212FD01C00A82ECC /* QBImagePicker.framework */; };
@@ -330,6 +331,20 @@
 			remoteGlobalIDString = 2B58405A1D10DE8700235F31;
 			remoteInfo = RCTContactsWrapper;
 		};
+		AE708100213AE9B900EB73BF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = AE7080ED213AE9B900EB73BF /* RCTPushNotification.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 134814201AA4EA6300B7C361;
+			remoteInfo = RCTPushNotification;
+		};
+		AE708102213AE9B900EB73BF /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = AE7080ED213AE9B900EB73BF /* RCTPushNotification.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 3D05745F1DE6004600184BB4;
+			remoteInfo = "RCTPushNotification-tvOS";
+		};
 		AE81389C21351B160081B250 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = 4209115BA512474B952551EB /* RNCamera.xcodeproj */;
@@ -415,6 +430,8 @@
 		79CCA97F54174204BA6D55E9 /* ContactsWrapper.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = ContactsWrapper.xcodeproj; path = "../node_modules/react-native-contacts-wrapper/ios/ContactsWrapper.xcodeproj"; sourceTree = "<group>"; };
 		832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
 		ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
+		AE7080ED213AE9B900EB73BF /* RCTPushNotification.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTPushNotification.xcodeproj; path = "../node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj"; sourceTree = "<group>"; };
+		AE708122213AEA2700EB73BF /* huiliaoAPP.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = huiliaoAPP.entitlements; path = huiliaoAPP/huiliaoAPP.entitlements; sourceTree = "<group>"; };
 		AE9332AD212FD01900A82ECC /* RSKImageCropper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RSKImageCropper.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		AE9332B1212FD01C00A82ECC /* QBImagePicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = QBImagePicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		B67DBD86D72F4F5596A86A19 /* libRNContactsPicker.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNContactsPicker.a; sourceTree = "<group>"; };
@@ -438,6 +455,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				AE708121213AE9F200EB73BF /* libRCTPushNotification.a in Frameworks */,
 				ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */,
 				AE9332AE212FD01900A82ECC /* RSKImageCropper.framework in Frameworks */,
 				5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
@@ -570,6 +588,7 @@
 		13B07FAE1A68108700A75B9A /* huiliaoAPP */ = {
 			isa = PBXGroup;
 			children = (
+				AE708122213AEA2700EB73BF /* huiliaoAPP.entitlements */,
 				008F07F21AC5B25A0029DE68 /* main.jsbundle */,
 				13B07FAF1A68108700A75B9A /* AppDelegate.h */,
 				13B07FB01A68108700A75B9A /* AppDelegate.m */,
@@ -633,6 +652,7 @@
 		832341AE1AAA6A7D00B99B32 /* Libraries */ = {
 			isa = PBXGroup;
 			children = (
+				AE7080ED213AE9B900EB73BF /* RCTPushNotification.xcodeproj */,
 				5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
 				146833FF1AC3E56700842450 /* React.xcodeproj */,
 				00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
@@ -709,6 +729,15 @@
 			name = Products;
 			sourceTree = "<group>";
 		};
+		AE7080EE213AE9B900EB73BF /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				AE708101213AE9B900EB73BF /* libRCTPushNotification.a */,
+				AE708103213AE9B900EB73BF /* libRCTPushNotification-tvOS.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
 		AE81389921351B160081B250 /* Products */ = {
 			isa = PBXGroup;
 			children = (
@@ -853,6 +882,14 @@
 					};
 					13B07F861A680F5B00A75B9A = {
 						DevelopmentTeam = 87KURQP592;
+						SystemCapabilities = {
+							com.apple.BackgroundModes = {
+								enabled = 1;
+							};
+							com.apple.Push = {
+								enabled = 1;
+							};
+						};
 					};
 					2D02E47A1E0B4A5D006451C7 = {
 						CreatedOnToolsVersion = 8.2.1;
@@ -914,6 +951,10 @@
 					ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
 				},
 				{
+					ProductGroup = AE7080EE213AE9B900EB73BF /* Products */;
+					ProjectRef = AE7080ED213AE9B900EB73BF /* RCTPushNotification.xcodeproj */;
+				},
+				{
 					ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
 					ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
 				},
@@ -1227,6 +1268,20 @@
 			remoteRef = AE3B4CFF2132995A006E0B16 /* PBXContainerItemProxy */;
 			sourceTree = BUILT_PRODUCTS_DIR;
 		};
+		AE708101213AE9B900EB73BF /* libRCTPushNotification.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = libRCTPushNotification.a;
+			remoteRef = AE708100213AE9B900EB73BF /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		AE708103213AE9B900EB73BF /* libRCTPushNotification-tvOS.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = "libRCTPushNotification-tvOS.a";
+			remoteRef = AE708102213AE9B900EB73BF /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
 		AE81389D21351B160081B250 /* libRNCamera.a */ = {
 			isa = PBXReferenceProxy;
 			fileType = archive.ar;
@@ -1461,6 +1516,7 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+				CODE_SIGN_ENTITLEMENTS = huiliaoAPP/huiliaoAPP.entitlements;
 				CURRENT_PROJECT_VERSION = 1;
 				DEAD_CODE_STRIPPING = NO;
 				DEVELOPMENT_TEAM = 87KURQP592;
@@ -1491,6 +1547,7 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+				CODE_SIGN_ENTITLEMENTS = huiliaoAPP/huiliaoAPP.entitlements;
 				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 87KURQP592;
 				HEADER_SEARCH_PATHS = (

+ 4 - 0
huiliaoAPP/ios/huiliaoAPP/Info.plist

@@ -53,6 +53,10 @@
 	<string>是否允许此App访问你的相册?</string>
 	<key>NSPhotoLibraryUsageDescription</key>
 	<string>是否允许此App访问相册选取照片?</string>
+	<key>UIBackgroundModes</key>
+	<array>
+		<string>remote-notification</string>
+	</array>
 	<key>UIRequiredDeviceCapabilities</key>
 	<array>
 		<string>armv7</string>

+ 8 - 0
huiliaoAPP/ios/huiliaoAPP/huiliaoAPP.entitlements

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>aps-environment</key>
+	<string>development</string>
+</dict>
+</plist>

+ 4 - 1
huiliaoAPP/package.json

@@ -4,7 +4,8 @@
   "private": true,
   "scripts": {
     "start": "node node_modules/react-native/local-cli/cli.js start",
-    "test": "jest"
+    "test": "jest",
+    "build": "React-native bundle --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.jsbundle--platform android --assets-dest ./android/app/src/main/res/ --dev false"
   },
   "dependencies": {
     "ac-qrcode": "^1.0.1",
@@ -34,6 +35,8 @@
   },
   "devDependencies": {
     "babel-jest": "23.4.2",
+    "babel-plugin-import": "^1.8.0",
+    "babel-plugin-transform-runtime": "^6.23.0",
     "babel-preset-react-native": "^5",
     "flow-bin": "^0.74.0",
     "jest": "23.5.0",

+ 67 - 56
huiliaoAPP/src/leancloud/index.js

@@ -1,6 +1,6 @@
 import AV from 'leancloud-storage';
 import {TypedMessagesPlugin} from 'leancloud-realtime-plugin-typed-messages'
-import {Realtime} from "leancloud-realtime";
+import {Realtime,Event} from "leancloud-realtime";
 import {AV_APP_ID as appId, AV_APP_KEY as appKey} from '../config'
 import {Toast} from 'antd-mobile-rn';
 import {AsyncStorage} from 'react-native'
@@ -9,9 +9,9 @@ class LeanCloudAPI {
       this.AV = null;
       this.realtime = null;
       this.imClient = null;
-      this.username = null;
-      this.userID = null ;
+      this.userId = null ;
       this.password = null;
+      this.user=null;
     }
   
     init() {
@@ -20,42 +20,43 @@ class LeanCloudAPI {
       this.realtime = new Realtime({
         appId,
         appKey,
-        plugins: [TypedMessagesPlugin],
+        plugins: [TypedMessagesPlugin]
       });
     }
   
    login(telphone,password,navigation) {
-      Toast.loading('登录中',20)
+      Toast.loading('登录中..',20)
       this.AV.User.logInWithMobilePhone(telphone, password).then((res)=>{
         Toast.success('登录成功',1)
-        this.user = res.attributes
-        this.userID = res.id
-        this.password = password
-        AsyncStorage.setItem('USERINFO',JSON.stringify({telphone,password}))
-        AsyncStorage.setItem('USER',JSON.stringify(this.user))
-        navigation.dispatch({type:'AV',AV:this.AV})
-        navigation.dispatch({type:'USER',user:this.user})
+        this.user = res
+        this.userId = res.id
+        this.password = password;
+        this.createIMClient()
+        AsyncStorage.setItem('Password',password)
+        navigation.dispatch({type:'USER',user:res.attributes})
         navigation.navigate({ routeName:"StackNavigator" })
       },(err)=>{
         Toast.info(err.rawMessage)
       })
     }
-    queryPassword(){
-      const query = new AV.Query('_User');
-      query.get(this.userID).then(function (res) {
-        console.log(res)
-        // 成功获得实例
-        // todo 就是 id 为 57328ca079bc44005c2472d0 的 Todo 对象实例
-      }, function (error) {
-        // 异常处理
-      });
+    async isLogin(){
+      let user = await this.AV.User.currentAsync()
+      if(!user){
+        return false
+      } 
+      this.password= await AsyncStorage.getItem('Password')
+      this.user = user
+      this.userId = user.id
+      return JSON.parse(await AsyncStorage.getItem('USER'))
     }
+
     updateUser(key,val,callback){
-      this.AV.Query.doCloudQuery(`update _User set ${key}="${val}" where objectId="${this.userID}"`)
+      this.AV.Query.doCloudQuery(`update _User set ${key}="${val}" where objectId="${this.userId}"`)
       .then(function (data) {
         // data 中的 results 是本次查询返回的结果,AV.Object 实例列表
         var results = data.results;
         callback(results)
+        Toast.success('修改成功',1)
       }, function (err) {
         // 异常处理
         Toast.info(err.rawMessage)
@@ -78,48 +79,58 @@ class LeanCloudAPI {
   
     async logout() {
       if (this.imClient) {
-        return await imClient.close();
+        return await this.imClient.close();
       }
       if (this.AV) {
         return await this.AV.User.logOut();
       }
     }
   
-    // async createIMClient(dispatch) {
-    //   console.log('init im client');
-    //   if (!this.username) {
-    //     throw new Error('Please login first.');
-    //   }
-    //   this.imClient = await this.realtime.createIMClient(this.username);
+    async createIMClient(dispatch) {
+
+      console.log('init im client');
+  
+      if (!this.userId) {
+        throw new Error('Please login first.');
+      }
+      this.imClient = await this.realtime.createIMClient(this.userId);
+      console.log(this.imClient)
+
+
+      for(var i in Event){
+        this.imClient.on(Event[i], function (msg) {
+          console.log(Event[i] ,msg);
+          // dispath && dispatch(receivedWsMsg(msg))
+        });
+      }
   
-    //   this.realtime.on('message', function (msg) {
-    //     console.log('msg: ' + msg);
-    //     dispath && dispatch(receivedWsMsg(msg))
-    //   });
-    //   this.realtime.on('disconnect', function () {
-    //     console.log('服务器连接已断开');
-    //     dispath && dispatch(offline());
-    //   });
-    //   this.realtime.on('offline', function () {
-    //     console.log('离线(网络连接已断开)');
-    //     dispath && dispatch(offline());
-    //   });
-    //   this.realtime.on('online', function () {
-    //     console.log('已恢复在线');
-    //     dispath && dispatch(online());
-    //   });
-    //   this.realtime.on('schedule', function (attempt, delay) {
-    //     console.log(delay + 'ms 后进行第' + (attempt + 1) + '次重连');
-    //   });
-    //   this.realtime.on('retry', function (attempt) {
-    //     console.log('正在进行第' + (attempt + 1) + '次重连');
-    //   });
-    //   this.realtime.on('reconnect', function () {
-    //     console.log('与服务端连接恢复');
-    //   });
+      // this.imClient.on('disconnect', function () {
+      //   console.log('服务器连接已断开');
+      //   // dispath && dispatch(offline());
+      // });
+      // this.imClient.on('offline', function () {
+      //   console.log('离线(网络连接已断开)');
+      //   // dispath && dispatch(offline());
+      // });
+      // this.imClient.on('online', function () {
+      //   console.log('已恢复在线');
+      //   // dispath && dispatch(online());
+      // });
+      // this.imClient.on('schedule', function (attempt, delay) {
+      //   console.log(delay + 'ms 后进行第' + (attempt + 1) + '次重连');
+      // });
+      // this.imClient.on('retry', function (attempt) {
+      //   console.log('正在进行第' + (attempt + 1) + '次重连');
+      // });
+      // this.imClient.on('reconnect', function () {
+      //   console.log('与服务端连接恢复');
+      // });
+      // this.imClient.on('conflict', function () {
+      //   console.log('被强制下线');
+      // });
   
-    //   return this.imClient;
-    // }
+      return this.imClient;
+    }
   }
 
   export default new LeanCloudAPI();

+ 0 - 4
huiliaoAPP/src/navigators/BottomTabNavigator.js

@@ -85,11 +85,7 @@ const BottomTabNavigator = createBottomTabNavigator(
 
 // // export default TabNav;
 BottomTabNavigator.navigationOptions = ({ navigation }) => {
-
-  console.log(navigation)
   let { routeName } = navigation.state.routes[navigation.state.index];
-
-  console.log(routeName)
   let title,headerRight
   if (routeName === 'MessageTab') {
     title = '消息';

+ 5 - 1
huiliaoAPP/src/navigators/SwitchNavigator.js

@@ -7,12 +7,16 @@ import Login from '../pages/Login';
 //mine
 import StackNavigator from './StackNavigator';
 
+import Welcome from '../pages/Welcome'
+
 const SwitchNavigator = createSwitchNavigator({
+  Welcome,
   Login,
   StackNavigator
 },
 {
-  initialRouteName:'Login'
+  initialRouteName:'Welcome',
+  mode: 'card',
 })
 
 

+ 1 - 1
huiliaoAPP/src/pages/Contact/QRScannerView/index.js

@@ -51,7 +51,7 @@ export default class DefaultScreen extends Component {
     }
 
     barcodeReceived(e) {
-        Toast.show('Type: ' + e.type + '\nData: ' + e.data);
+        alert('Type: ' + e.type + '\nData: ' + e.data);
         //console.log(e)
     }
 }

+ 5 - 4
huiliaoAPP/src/pages/Contact/components/ContactList/index.js

@@ -9,11 +9,11 @@ import {
   TouchableOpacity,
 } from 'react-native'
 import {connect} from 'react-redux'
-import 'pinyin4js'
-import {Device,Icon} from '../../../../tool'
+import {Device} from '../../../../tool'
 import  SearchBar from '../searchBar'
 import ItemInContact from '../ItemInContact';
 import SeparatorLine from './SeparatorLine';
+import simplePinyin from 'simple-pinyin';
 
 
  class ContactList extends Component {
@@ -143,6 +143,7 @@ import SeparatorLine from './SeparatorLine';
   render() {
     const { contacts, labels } = this.state
     const {navigation} =this.props.props
+    const Icon_Contact_search = require('../../../../../assets/2x/contact/search.png')
     const scollTo = (item) => {
       // 当viewPosition 为 0 时将它滚动到屏幕顶部,为 1 时将它滚动到屏幕底部,为 0.5 时将它滚动到屏幕中央。
       this._flatList.scrollToIndex({viewPosition:0, index:item.index})
@@ -184,7 +185,7 @@ import SeparatorLine from './SeparatorLine';
                     onPress={()=> scollTo(item)}>
                         <Image 
                         style={{width:Device.scale(12),height:Device.scale(12)}}
-                        source={Icon.Contact.search}></Image>
+                        source={Icon_Contact_search}></Image>
                     </TouchableOpacity>
                   )
               }
@@ -252,4 +253,4 @@ const styles = StyleSheet.create({
   },
 })
 
-export default connect()(ContactList);
+export default connect()(ContactList);

+ 12 - 17
huiliaoAPP/src/pages/Login/index.js

@@ -1,5 +1,4 @@
 import React,{Component} from 'react';
-import PropTypes from 'prop-types';
 import {StyleSheet, View,StatusBar,Image ,Text,Dimensions,AsyncStorage} from 'react-native';
 import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
 import {Button} from 'antd-mobile-rn';
@@ -9,25 +8,24 @@ import {Device ,Icon} from '../../tool'
 
 import Leancloud from '../../leancloud'
 
-const {width,height} = Dimensions.get('window');
 
 
 class LoginScreen extends Component{
   static navigationOptions = {title: '登录',header:null}
-  async componentWillMount(){
+  // async componentWillMount(){
 
-    let user = JSON.parse(await AsyncStorage.getItem('USERINFO'))
-    if(user) {
-      this.setState({
-        telphone:user.telphone,
-        password:user.password
-      },()=>{
-        this.submit()
-      })
+  //   let user = JSON.parse(await AsyncStorage.getItem('USERINFO'))
+  //   if(user) {
+  //     this.setState({
+  //       telphone:user.telphone,
+  //       password:user.password
+  //     },()=>{
+  //       this.submit()
+  //     })
      
-    }
+  //   }
 
-  }
+  // }
   constructor(props){
     super(props)
     this.state={
@@ -46,7 +44,7 @@ class LoginScreen extends Component{
     return (
       <View style={[commonStyle.page,{backgroundColor:'#fff'}]}>
       <KeyboardAwareScrollView
-      extraScrollHeight={50}
+      // extraScrollHeight={50}
       >
       <StatusBar  
          animated={true} //指定状态栏的变化是否应以动画形式呈现。目前支持这几种样式:backgroundColor, barStyle和hidden  
@@ -109,9 +107,6 @@ const styles = StyleSheet.create({
     position:'absolute',
     padding:Device.scale(26),
     alignItems:'center',
-    // borderWidth:1,
-    // borderColor:'red',
-    // borderStyle:'solid'
   },
   btn:{
     width:Device.scale(280),

+ 34 - 18
huiliaoAPP/src/pages/Message/index.js

@@ -1,9 +1,9 @@
 import React, { Component } from 'react';
-import { ListView ,View,Text,Image} from 'react-native';
+import { ListView ,View,Text,Image,StatusBar} from 'react-native';
 import { Container, Content, Button, List, ListItem} from 'native-base';
 import {Icon} from '../../tool'
 const datas = [
-  1,2,3,4,5,6,7,8,9,10
+  1,2,3,4
 ];
 export default class SwipeableListExample extends Component {
   constructor(props) {
@@ -12,8 +12,12 @@ export default class SwipeableListExample extends Component {
     this.state = {
       basic: true,
       listViewData: datas,
+      secId:null,
+      rowId:null,
+      rowMap:null
     };
   }
+
   deleteRow(secId, rowId, rowMap) {
     rowMap[`${secId}${rowId}`].props.closeRow();
     const newData = [...this.state.listViewData];
@@ -22,18 +26,29 @@ export default class SwipeableListExample extends Component {
   }
   render() {
     const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
-    const Icon_icon = require('../../../assets/icon.png')
+    
     return (
       <Container>
+        <StatusBar  
+                animated={true} //指定状态栏的变化是否应以动画形式呈现。目前支持这几种样式:backgroundColor, barStyle和hidden    
+                translucent={false}//指定状态栏是否透明。设置为true时,应用会在状态栏之下绘制(即所谓“沉浸式”——被状态栏遮住一部分)。常和带有半透明背景色的状态栏搭配使用。  
+                barStyle={'light-content'} // enum('default', 'light-content', 'dark-content')   
+                >  
+                </StatusBar>
         <Content>
           <List
             rightOpenValue={-120}
             dataSource={this.ds.cloneWithRows(this.state.listViewData)}
             disableRightSwipe={true}
+            swipeToOpenPercent={10}
             renderRow={data =>
-              <ListItem style={{height:65,position:'relative',padding:0}}>
+              <ListItem style={{height:65,position:'relative',padding:0}} onPress={()=>{
+
+                const {secId,rowId,rowMap} =this.state
+                rowMap[`${secId}${rowId}`].props.closeRow();
+              }}>
                 <View style={{marginLeft:10}}>
-                    <Image source={Icon_icon} style={{width:45,height:45}}></Image>
+                    <Image source={Icon.icon} style={{width:45,height:45}}></Image>
                 </View>
                 <View style={{justifyContent:'space-around',height:45,marginLeft:10}}>
                     <Text style={{fontSize:16,color:'#000'}}>文杰欧巴{data}</Text>
@@ -44,8 +59,14 @@ export default class SwipeableListExample extends Component {
                 </View>
               </ListItem>}
     
-            renderRightHiddenRow={(data, secId, rowId, rowMap) =>
-             <View style={{flexDirection:'row'}}>
+            renderRightHiddenRow={(data, secId, rowId, rowMap) =>{
+
+
+              // this.setState({
+              //   secId,rowId,rowMap
+              // })
+              return (
+                <View style={{flexDirection:'row'}}>
                 <Button full onPress={() => {
                     this.render()
 
@@ -56,19 +77,14 @@ export default class SwipeableListExample extends Component {
                 <Button full danger onPress={_ => this.deleteRow(secId, rowId, rowMap)} style={{height:65,width:60}}>
                     <Text>删除</Text>
                 </Button>
-             </View>}
+             </View>
+              )
+            }
+
+             }
           />
         </Content>
       </Container>
     );
   }
-}
-
-// export default Message;
-
-{/* <StatusBar  
-                animated={true} //指定状态栏的变化是否应以动画形式呈现。目前支持这几种样式:backgroundColor, barStyle和hidden    
-                translucent={false}//指定状态栏是否透明。设置为true时,应用会在状态栏之下绘制(即所谓“沉浸式”——被状态栏遮住一部分)。常和带有半透明背景色的状态栏搭配使用。  
-                barStyle={'light-content'} // enum('default', 'light-content', 'dark-content')   
-                >  
-                </StatusBar>   */}
+}

+ 0 - 1
huiliaoAPP/src/pages/Mine/ReName/index.js

@@ -30,7 +30,6 @@ class ReName extends Component {
       submit(){
         console.log(this.props)
         const {UserAction,navigation} = this.props
-        const {id} =UserAction
         UserAction.username = this.state.value
         
         Leancloud.updateUser('username',this.state.value,(e)=>{

+ 3 - 4
huiliaoAPP/src/pages/Mine/RePassword/index.js

@@ -32,14 +32,13 @@ class RePassword extends Component {
           const {navigation} =this.props
 
           if(password!=Leancloud.password){
-              return alert('原密码错误')
+              return Toast.info('原密码错误')
           }
           if(newpassword.length<8){
-              return alert('密码长度有误!请重试')
+              return Toast.info('新密码输入有误,请重试')
           }
         Leancloud.updateUser('password',this.state.newpassword,(e)=>{
-
-            Toast.success('密码修改成功,请重新登录')
+            Leancloud.logout()
             AsyncStorage.clear()
             navigation.navigate({ routeName:'Login' })
         })

+ 2 - 0
huiliaoAPP/src/pages/Mine/Setting/index.js

@@ -3,6 +3,7 @@ import React,{Component} from 'react';
 import { StyleSheet, Text, View,AsyncStorage } from 'react-native';
 import { List,Button } from 'antd-mobile-rn';
 import commonStyle from '../../../styles/styles.js';
+import LeanCloudAPI from '../../../leancloud'
 
 import {Device} from '../../../tool'
 
@@ -18,6 +19,7 @@ export default class Setting extends Component {
     push(routeName){
       if(routeName=='Login'){
         AsyncStorage.clear()
+        LeanCloudAPI.logout()
       }
         const { navigation } =this.props
         navigation.navigate({ routeName })

+ 1 - 2
huiliaoAPP/src/pages/Mine/index.js

@@ -107,8 +107,7 @@ const styles = StyleSheet.create({
     icon:{ width: Device.scale(21), height: Device.scale(21),marginRight:9 }
   });
 
-const mapStateToProps = ({UserAction} )=> {
-
+const mapStateToProps = ({UserAction})=> {
     return {UserAction}
 }
 export default connect(mapStateToProps)(Mine);

+ 7 - 6
huiliaoAPP/src/reducers/user/index.js

@@ -1,13 +1,14 @@
 
 import {AsyncStorage} from 'react-native'
-const UserAction =  (state={},action)=>{
-
-    // let user = await AsyncStorage.getItem('USER')
-    
+const UserAction = (state={},action)=>{
     const {type} = action;
     if(type=='USER'){
-        const {username,id,head,mobilePhoneNumber} =action.user
-        return {...state,username,id,head,mobilePhoneNumber}
+      
+         AsyncStorage.setItem('USER',JSON.stringify(action.user))
+
+        console.log(action)
+
+        return {...state,...action.user}
     }else{
         return {...state} 
     }

+ 26 - 0
huiliaoAPP/yarn.lock

@@ -120,6 +120,12 @@
     "@babel/types" "7.0.0-beta.47"
     lodash "^4.17.5"
 
+"@babel/helper-module-imports@^7.0.0-beta.34":
+  version "7.0.0"
+  resolved "http://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d"
+  dependencies:
+    "@babel/types" "^7.0.0"
+
 "@babel/helper-module-transforms@7.0.0-beta.47":
   version "7.0.0-beta.47"
   resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.0.0-beta.47.tgz#7eff91fc96873bd7b8d816698f1a69bbc01f3c38"
@@ -490,6 +496,14 @@
     lodash "^4.17.5"
     to-fast-properties "^2.0.0"
 
+"@babel/types@^7.0.0":
+  version "7.0.0"
+  resolved "http://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0.tgz#6e191793d3c854d19c6749989e3bc55f0e962118"
+  dependencies:
+    esutils "^2.0.2"
+    lodash "^4.17.10"
+    to-fast-properties "^2.0.0"
+
 "@expo/bunyan@1.8.10", "@expo/bunyan@^1.8.10":
   version "1.8.10"
   resolved "https://registry.yarnpkg.com/@expo/bunyan/-/bunyan-1.8.10.tgz#7d19354a6bce85aae5fea0e973569d3f0142533e"
@@ -1159,6 +1173,12 @@ babel-plugin-external-helpers@^6.22.0:
   dependencies:
     babel-runtime "^6.22.0"
 
+babel-plugin-import@^1.8.0:
+  version "1.8.0"
+  resolved "http://registry.npm.taobao.org/babel-plugin-import/download/babel-plugin-import-1.8.0.tgz#260deddd78f6fea0d110e1d106ba72a518d3c88c"
+  dependencies:
+    "@babel/helper-module-imports" "^7.0.0-beta.34"
+
 babel-plugin-istanbul@^4.1.6:
   version "4.1.6"
   resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45"
@@ -1372,6 +1392,12 @@ babel-plugin-transform-react-jsx@^6.8.0:
     babel-plugin-syntax-jsx "^6.8.0"
     babel-runtime "^6.22.0"
 
+babel-plugin-transform-runtime@^6.23.0:
+  version "6.23.0"
+  resolved "http://registry.npm.taobao.org/babel-plugin-transform-runtime/download/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee"
+  dependencies:
+    babel-runtime "^6.22.0"
+
 babel-plugin-transform-strict-mode@^6.24.1:
   version "6.24.1"
   resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758"