提交 5de17f15 authored 作者: vipcxj's avatar vipcxj

修复web移植到android的兼容性问题

上级 70a4c2f5
...@@ -138,6 +138,7 @@ android { ...@@ -138,6 +138,7 @@ android {
} }
dependencies { dependencies {
compile project(':react-native-device-info')
compile fileTree(dir: "libs", include: ["*.jar"]) compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:25.3.1" compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-sdk <uses-sdk
android:minSdkVersion="16" android:minSdkVersion="16"
......
...@@ -6,6 +6,7 @@ import android.support.multidex.MultiDex; ...@@ -6,6 +6,7 @@ import android.support.multidex.MultiDex;
import com.bolan.android.modules.IDCardReactPackage; import com.bolan.android.modules.IDCardReactPackage;
import com.facebook.react.ReactApplication; import com.facebook.react.ReactApplication;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage; import com.facebook.react.shell.MainReactPackage;
...@@ -26,6 +27,7 @@ public class MainApplication extends Application implements ReactApplication { ...@@ -26,6 +27,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() { protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList( return Arrays.<ReactPackage>asList(
new MainReactPackage(), new MainReactPackage(),
new RNDeviceInfo(),
new IDCardReactPackage() new IDCardReactPackage()
); );
} }
......
rootProject.name = 'bolanManagerApp' rootProject.name = 'bolanManagerApp'
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':app' include ':app'
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
}; };
objectVersion = 46; objectVersion = 46;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
...@@ -37,6 +36,8 @@ ...@@ -37,6 +36,8 @@
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
07BDEFA20656470B88D48554 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DADBDDA7F504C5193847D2D /* libRNDeviceInfo.a */; };
53E9F8ADCC714D9693F0C068 /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 83554850969D48C684F45F7F /* libRNDeviceInfo-tvOS.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
...@@ -264,6 +265,9 @@ ...@@ -264,6 +265,9 @@
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.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>"; }; 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>"; }; ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
20C53C1323F44CCBB35F0247 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
4DADBDDA7F504C5193847D2D /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
83554850969D48C684F45F7F /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo-tvOS.a"; path = "libRNDeviceInfo-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -292,6 +296,8 @@ ...@@ -292,6 +296,8 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
07BDEFA20656470B88D48554 /* libRNDeviceInfo.a in Frameworks */,
53E9F8ADCC714D9693F0C068 /* libRNDeviceInfo-tvOS.a in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -460,6 +466,7 @@ ...@@ -460,6 +466,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
20C53C1323F44CCBB35F0247 /* RNDeviceInfo.xcodeproj */,
); );
name = Libraries; name = Libraries;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -586,7 +593,7 @@ ...@@ -586,7 +593,7 @@
83CBB9F71A601CBA00E9B192 /* Project object */ = { 83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0610; LastUpgradeCheck = 610;
ORGANIZATIONNAME = Facebook; ORGANIZATIONNAME = Facebook;
TargetAttributes = { TargetAttributes = {
00E356ED1AD99517003FC87E = { 00E356ED1AD99517003FC87E = {
...@@ -1005,6 +1012,15 @@ ...@@ -1005,6 +1012,15 @@
); );
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp.app/bolanManagerApp"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp.app/bolanManagerApp";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
}; };
name = Debug; name = Debug;
}; };
...@@ -1022,6 +1038,15 @@ ...@@ -1022,6 +1038,15 @@
); );
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp.app/bolanManagerApp"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp.app/bolanManagerApp";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
}; };
name = Release; name = Release;
}; };
...@@ -1040,6 +1065,10 @@ ...@@ -1040,6 +1065,10 @@
); );
PRODUCT_NAME = bolanManagerApp; PRODUCT_NAME = bolanManagerApp;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
}; };
name = Debug; name = Debug;
}; };
...@@ -1057,6 +1086,10 @@ ...@@ -1057,6 +1086,10 @@
); );
PRODUCT_NAME = bolanManagerApp; PRODUCT_NAME = bolanManagerApp;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
}; };
name = Release; name = Release;
}; };
...@@ -1083,6 +1116,15 @@ ...@@ -1083,6 +1116,15 @@
SDKROOT = appletvos; SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3; TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2; TVOS_DEPLOYMENT_TARGET = 9.2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
}; };
name = Debug; name = Debug;
}; };
...@@ -1109,6 +1151,15 @@ ...@@ -1109,6 +1151,15 @@
SDKROOT = appletvos; SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3; TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2; TVOS_DEPLOYMENT_TARGET = 9.2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
}; };
name = Release; name = Release;
}; };
...@@ -1130,6 +1181,11 @@ ...@@ -1130,6 +1181,11 @@
SDKROOT = appletvos; SDKROOT = appletvos;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp-tvOS.app/bolanManagerApp-tvOS"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp-tvOS.app/bolanManagerApp-tvOS";
TVOS_DEPLOYMENT_TARGET = 10.1; TVOS_DEPLOYMENT_TARGET = 10.1;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
}; };
name = Debug; name = Debug;
}; };
...@@ -1151,6 +1207,11 @@ ...@@ -1151,6 +1207,11 @@
SDKROOT = appletvos; SDKROOT = appletvos;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp-tvOS.app/bolanManagerApp-tvOS"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bolanManagerApp-tvOS.app/bolanManagerApp-tvOS";
TVOS_DEPLOYMENT_TARGET = 10.1; TVOS_DEPLOYMENT_TARGET = 10.1;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
}; };
name = Release; name = Release;
}; };
......
...@@ -37,8 +37,10 @@ ...@@ -37,8 +37,10 @@
"fastjson_ref_resolver": "0.0.3", "fastjson_ref_resolver": "0.0.3",
"lodash": "latest", "lodash": "latest",
"moment": "^2.19.1", "moment": "^2.19.1",
"rc-form": "^1.4.8",
"react": "^16.0.0-beta.5", "react": "^16.0.0-beta.5",
"react-native": "^0.49.3", "react-native": "^0.49.3",
"react-native-device-info": "^0.12.1",
"react-navigation": "^1.0.0-beta.14", "react-navigation": "^1.0.0-beta.14",
"react-redux": "^5.0.6", "react-redux": "^5.0.6",
"redux-persist": "^4.10.1" "redux-persist": "^4.10.1"
......
import welcome from './welcome'; import welcome from './welcome';
import login from './login';
export default [ export default [
welcome, welcome,
login,
]; ];
...@@ -3,8 +3,26 @@ import { NavigationActions } from 'react-navigation'; ...@@ -3,8 +3,26 @@ import { NavigationActions } from 'react-navigation';
export default { export default {
namespace: 'login', namespace: 'login',
state: {
name: '',
password: '',
},
reducers: {
setName(state, { payload }) {
return {
...state,
name: payload,
};
},
setPassword(state, { payload }) {
return {
...state,
password: payload,
};
},
},
effects: { effects: {
*login(ignored, { put, call }) { *login(ignored, { put }) {
yield put(NavigationActions.navigate({ yield put(NavigationActions.navigate({
routeName: 'Main', routeName: 'Main',
})); }));
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, Text } from 'react-native'; import { View, Text } from 'react-native';
import { connect } from 'react-redux';
@connect((state) => {
return {
name: state.login.name,
password: state.login.password,
};
})
class Login extends Component { class Login extends Component {
render() { render() {
return ( return (
......
import Fingerprint from 'fingerprintjs'; import DeviceInfo from 'react-native-device-info';
import post from '../utils/post'; import post from '../utils/post';
import request from '../utils/request'; import request from '../utils/request';
import config from '../utils/config'; import config from '../utils/config';
...@@ -19,8 +19,8 @@ export async function login(payload) { ...@@ -19,8 +19,8 @@ export async function login(payload) {
}; };
} }
data.tokenInfo = { data.tokenInfo = {
productId: 'big-machine-web-front', productId: config.productId,
deviceId: `${new Fingerprint({ ie_activex: true }).get()}`, deviceId: `${DeviceInfo.getUniqueID()}`,
}; };
return post(`${config.apiContextPath}/api/auth/login`, data, {}, {}, false); return post(`${config.apiContextPath}/api/auth/login`, data, {}, {}, false);
} }
......
...@@ -41,6 +41,7 @@ const _contextPath = process.env.NODE_ENV === 'development' ? '' : contextPath; ...@@ -41,6 +41,7 @@ const _contextPath = process.env.NODE_ENV === 'development' ? '' : contextPath;
const config = { const config = {
name: 'Jbpm Demo', name: 'Jbpm Demo',
productId: 'manager-app-sz',
footerText: '上海铂蓝信息科技有限公司', footerText: '上海铂蓝信息科技有限公司',
logo: `${_contextPath}/logo.png`, logo: `${_contextPath}/logo.png`,
contextPath: _contextPath, contextPath: _contextPath,
......
...@@ -86,15 +86,6 @@ export function parseObject(response, { ...@@ -86,15 +86,6 @@ export function parseObject(response, {
throw new Error(json.message); throw new Error(json.message);
} }
}); });
} else if (contentType.indexOf('xml') !== -1) {
return response.text().then((text) => {
return require.ensure([], (require) => {
const { parseString } = require('xml2js');
const options = {};
const json = JSON.parse(parseString(text, options));
return needMap ? mapValue(json) : json;
});
});
} else if (contentType.indexOf('text') !== -1) { } else if (contentType.indexOf('text') !== -1) {
return response.text(); return response.text();
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论