From b9230dce0548cf0fdabccc6eb80e8fbdf14037fc Mon Sep 17 00:00:00 2001 From: leiyongsheng <leiyongsheng@hikcreate.com> Date: Sun, 27 Sep 2020 15:23:57 +0800 Subject: [PATCH] 添加用户信息模块 --- android | 2 +- src/test/NavigateEntryTest.js | 40 ++++++++++++++++++++++++++++++++++++++++ src/test/ui.js | 3 ++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/android b/android index 1b110e0..e108a7d 160000 --- a/android +++ b/android @@ -1 +1 @@ -Subproject commit 1b110e079ac8e510cbb513b122c95ed9c1328958 +Subproject commit e108a7d998fec6596b0dfdc572b478779f3f3f73 diff --git a/src/test/NavigateEntryTest.js b/src/test/NavigateEntryTest.js index 7fe9d17..daf0cfd 100644 --- a/src/test/NavigateEntryTest.js +++ b/src/test/NavigateEntryTest.js @@ -11,6 +11,7 @@ import { IC_LAUNCHER, IC_WARN } from '../assets/images' import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; +import { BMCInfo, BMCUI } from './ui.js' function LogoTitle(props) { return ( @@ -91,6 +92,9 @@ function TabHome() { } class HomeScreen extends React.Component { + constructor(props) { + super(props); + } componentDidMount() { this.props.navigation.setParams({ itemId: 87, @@ -101,6 +105,30 @@ class HomeScreen extends React.Component { componentWillUnmount() { console.log('HomeScreen componentWillUnmount:' + JSON.stringify(this.props.route.params)); } + showAppInfo() { + BMCInfo.getUserInfo((result) => { + console.log("获取用户信息,结果为:" + result); + BMCUI.showConfirmDialog(result, '确定', (result) => { + console.log("你点击了取确定按钮,结果为:" + result); + }) + }) + } + showLoginInfo() { + BMCInfo.getLoginInfo((result) => { + console.log("获取登录信息,结果为:" + result); + BMCUI.showConfirmDialog(result, '确定', (result) => { + console.log("你点击了取确定按钮,结果为:" + result); + }) + }) + } + showDevicesInfo() { + BMCInfo.getDeviceInfo((result) => { + console.log("获取设备信息,结果为:" + result); + BMCUI.showConfirmDialog(result, '确定', (result) => { + console.log("你点击了取确定按钮,结果为:" + result); + }) + }) + } render() { console.log('HomeScreen path:' + this.props.path); const { itemId } = this.props.route.params; @@ -135,6 +163,18 @@ class HomeScreen extends React.Component { onPress={() => this.props.navigation.setOptions({ title: 'Updated!' })} /> <Text style={{ margin: 10 }}>result data: {this.props.route.params?.post}</Text> + <Button + title="show app info" + onPress={this.showAppInfo} + /> + <Button + title="show login info" + onPress={this.showLoginInfo} + /> + <Button + title="show devices info" + onPress={this.showDevicesInfo} + /> </View> ); } diff --git a/src/test/ui.js b/src/test/ui.js index 1a4da3a..c3b77d6 100644 --- a/src/test/ui.js +++ b/src/test/ui.js @@ -11,4 +11,5 @@ import { NativeModules, requireNativeComponent } from 'react-native'; //export default NativeModules.BMCUI; //不使用export default时,对应的import语句需要使用大括号 export var BMCUI = NativeModules.BMCUI; -export var ImagePicker = NativeModules.ImagePicker; \ No newline at end of file +export var ImagePicker = NativeModules.ImagePicker; +export var BMCInfo = NativeModules.BMCInfo; \ No newline at end of file -- libgit2 0.26.0