Commit ac57239e by Denglingling Committed by zhangzh

初始化项目

parent b4c27178
Showing with 3626 additions and 0 deletions
[android]
target = Google Inc.:Google APIs:23
[maven_repositories]
central = https://repo1.maven.org/maven2
module.exports = {
root: true,
extends: '@react-native-community',
};
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
[include]
[libs]
node_modules/react-native/interface.js
node_modules/react-native/flow/
[options]
emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
munge_underscores=true
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[version]
^0.113.0
*.pbxproj -text
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
# Bundle artifact
*.jsbundle
# CocoaPods
/ios/Pods/
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
{}
\ No newline at end of file
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import { Text, TextInput } from 'react-native';
import {Provider} from 'react-redux';
import configureStore from './app/store/configureStore';
import Router from './app/Router';
import { fetch as fetchPolyfill } from 'whatwg-fetch'
const store = configureStore();
global.fetch = fetchPolyfill
// 字体不随系统字体变化
Text.defaultProps = Object.assign({}, Text.defaultProps, { allowFontScaling: false })
TextInput.defaultProps = Object.assign({}, TextInput.defaultProps, { allowFontScaling: false })
export default class App extends Component {
render() {
return (
<Provider store={store}>
<Router/>
</Provider>
);
}
}
/**
* @format
*/
import 'react-native';
import React from 'react';
import App from '../App';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
renderer.create(<App />);
});
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
lib_deps = []
create_aar_targets(glob(["libs/*.aar"]))
create_jar_targets(glob(["libs/*.jar"]))
android_library(
name = "all-libs",
exported_deps = lib_deps,
)
android_library(
name = "app-code",
srcs = glob([
"src/main/java/**/*.java",
]),
deps = [
":all-libs",
":build_config",
":res",
],
)
android_build_config(
name = "build_config",
package = "com.orderapp",
)
android_resource(
name = "res",
package = "com.orderapp",
res = "src/main/res",
)
android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.orderapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
"""Helper definitions to glob .aar and .jar targets"""
def create_aar_targets(aarfiles):
for aarfile in aarfiles:
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
lib_deps.append(":" + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
def create_jar_targets(jarfiles):
for jarfile in jarfiles:
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
lib_deps.append(":" + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)
No preview for this file type
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.orderapp;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.orderapp">
<uses-permission android:name="android.permission.INTERNET" />
<!-- add -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
package com.orderapp;
import com.facebook.react.ReactActivity;
// import com.facebook.react.ReactActivityDelegate;
// import com.facebook.react.ReactRootView;
// import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "OrderApp";
}
// @Override
// protected ReactActivityDelegate createReactActivityDelegate() {
// return new ReactActivityDelegate(this, getMainComponentName()) {
// @Override
// protected ReactRootView createRootView() {
// return new RNGestureHandlerEnabledRootView(MainActivity.this);
// }
// };
// }
}
package com.orderapp;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.rnim.rn.audio.ReactNativeAudioPackage;
import com.reactnativecommunity.viewpager.RNCViewPagerPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.rnfs.RNFSPackage;
import com.rnfs.RNFSPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.orderapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
<resources>
<string name="app_name">OrderApp</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
</resources>
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.33.1
No preview for this file type
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
rootProject.name = 'OrderApp'
include ':react-native-audio'
project(':react-native-audio').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-audio/android')
include ':@react-native-community_viewpager'
project(':@react-native-community_viewpager').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/viewpager/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
{
"name": "OrderApp",
"displayName": "OrderApp"
}
\ No newline at end of file
import React, {Component} from 'react';
import {
Easing,
Animated
} from 'react-native';
import { createStackNavigator, createAppContainer} from 'react-navigation';
// import { createAppContainer} from 'react-navigation';
// import { createStackNavigator } from 'react-navigation-stack';
import LoginPage from './containers/login/LoginPage';
import HomePage from './containers/home/HomePage';
import SelfOrderPage from './containers/selfOrder/SelfOrderPage';
import ChooseProductPage from './containers/selfOrder/module/ChooseProductPage';
import EditStencilPage from './containers/selfOrder/module/EditStencilPage';
import SubSuccessPage from './containers/selfOrder/module/SubSuccessPage';
import EquipConsuPage from './containers/equipConsu/EquipConsuPage';
import QuickOrderPage from './containers/quickOrder/QuickOrderPage';
import TransOrderPage from './containers/transOrder/TransOrderPage';
const Router = createAppContainer(createStackNavigator({
LoginPage: { screen: LoginPage },
HomePage: {screen: HomePage},
SelfOrderPage: {screen: SelfOrderPage},
ChooseProductPage: {screen: ChooseProductPage},
EditStencilPage: {screen: EditStencilPage},
SubSuccessPage: {screen: SubSuccessPage},
EquipConsuPage: {screen: EquipConsuPage},
QuickOrderPage: {screen: QuickOrderPage},
TransOrderPage: {screen: TransOrderPage}
}, {
navigationOptions: {
gesturesEnabled: true
},
headerMode: 'none',
transitionConfig: () => ({
transitionSpec: {
duration: 300,
easing: Easing.out(Easing.poly(4)),
timing: Animated.timing
},
screenInterpolator: sceneProps => {
const {layout, position, scene} = sceneProps;
const {index} = scene;
const Width = layout.initWidth;
//沿X轴平移
const translateX = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [Width, 0, -(Width - 10)],
});
//透明度
const opacity = position.interpolate({
inputRange: [index - 1, index - 0.99, index],
outputRange: [0, 1, 1]
});
return {opacity, transform: [{translateX}]};
}
})
}))
// const defaultGetStateForAction = Router.router.getStateForAction;
// Router.router.getStateForAction = ((action, state) => {
// // goBack返回指定页面
// if (state && action.type === 'Navigation/BACK' && action.key) {
// const backRoute = state.routes.find((route) => route.routeName === action.key);
// if (backRoute) {
// const backRouteIndex = state.routes.indexOf(backRoute);
// const purposeState = {
// ...state,
// routes: state.routes.slice(0, backRouteIndex + 1),
// index: backRouteIndex,
// };
// return purposeState;
// }
// }
// return defaultGetStateForAction(action, state)
// })
export default Router
\ No newline at end of file
import { PostRequest, GetRequest } from '../network/RequestUtils';
import { show } from '../utils/Utils';
import { exitLoginStatus } from './LoginAction';
// import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE } from '../base/ActionTypes';
import {LOGIN_DOING,LOGIN_SUCCESS,LOGIN_FAILURE,EXIT_LOGIN,AUTO_LOGIN_SUCCESS,AUTO_LOGIN_FAILURE} from '../base/ActionTypes';
import { PostRequest,GetRequest } from '../network/RequestUtils';
import {show} from '../utils/Utils';
export function requestLogin(params) {
return dispatch => {
dispatch(logining());
PostRequest('/access_token/password/search?app_code=PDA', params).then((res) => {
if(res.error_code === 0){
show('登录成功');
dispatch(loginSuccess(res, params.data.user_name, params.data.user_password));
}else {
show(res.error_msg);
dispatch(loginFailure())
}
}).catch((err) => {
show(err.error);
})
}
}
function logining() {
return {
type: LOGIN_DOING
}
}
function loginSuccess(userInfo, username, password) {
return {
type: LOGIN_SUCCESS,
rawData:userInfo,
username,
password
}
}
function loginFailure() {
return {
type: LOGIN_FAILURE
}
}
export function exitLoginStatus(){
return {
type: EXIT_LOGIN
}
}
function autoLoginSuccess(userInfo) {
return {
type: AUTO_LOGIN_SUCCESS,
rawData: userInfo
}
}
function autoLoginFailure() {
return {
type: AUTO_LOGIN_FAILURE
}
}
export function autoLogin(params) {
return dispatch => {
PostRequest('/access_token/password/search?app_code=PDA', params).then((res) => {
if(res.error_code === 0){
console.warn('auto------',res);
dispatch(autoLoginSuccess(res))
}else {
console.warn(res.error_msg);
show(res.error_msg);
dispatch(autoLoginFailure())
}
}).catch((err) => {
show(err.error);
})
}
}
\ No newline at end of file
import { PostRequest, GetRequest } from '../network/RequestUtils';
import { show, getUrlParams } from '../utils/Utils';
import { exitLoginStatus } from './LoginAction';
import { QUICK_ORDER_LIST_DOING, QUICK_ORDER_LIST_SUCCESS, QUICK_ORDER_LIST_FAILURE } from '../base/ActionTypes';
// 获取组织 params={access_token:''}
// export const requestQuickOrganizations = async (params) => {
// return await GetRequest(`/api/latest/authorized_inventory/search?access_token=${params.access_token}`)
// }
export function requestQuickOrganizations(params) {
return dispatch => {
console.warn('----requestQuickOrganizations====================')
dispatch(requestOrganizationsing());
// GetRequest(`/authorized_inventory/search?access_token=${access_token}`)
GetRequest(getUrlParams('/authorized_inventory/search', params))
.then(res => {
console.warn('res=====', Object.keys(res), res.error, res.message);
if(res.error_code == 0) {
console.warn('res====organizations==========', res.data.organizations);
let { data: { organizations } } = res
dispatch(requestOrganizationsSuccess(organizations));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestOrganizationsFail());
}
})
.catch(err => {
console.log('------err--====organizations----', Object.keys(err), err.error, err.message)
show(err.error);
})
}
}
// 获取手术医院 params={access_token:'', org_code:'', seller_code:''}
export function requestQuickSurgeryHospital(params) {
return dispatch => {
console.warn('----requestQuickSurgeryHospital====================', params)
dispatch(requestOrganizationsing());
GetRequest(getUrlParams('/sale/seller_customer/search', params))
// GetRequest('/sale/seller_customer/search?access_token=20200512140017932dcdff2129a5f4201900f116c819e74865T473Ma2PGh16ek&org_code=A02&seller_code=shi.ming')
.then(res => {
console.warn('res===!!==', Object.keys(res), res.error, res.message);
if(res.error_code == 0) {
console.warn('res====requestQuickSurgeryHospital==========', res.data.organizations);
let { data: { customers } } = res
dispatch(requestOrganizationsSuccess(customers));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestOrganizationsFail());
}
})
.catch(err => {
console.log('------err--====requestQuickSurgeryHospital----', Object.keys(err))
show(err.error);
})
}
}
function requestOrganizationsing() {
return {
type: QUICK_ORDER_LIST_DOING
}
}
function requestOrganizationsSuccess(data) {
return {
type: QUICK_ORDER_LIST_SUCCESS,
rawData: data
}
}
function requestOrganizationsFail() {
return {
type: QUICK_ORDER_LIST_FAILURE
}
}
\ No newline at end of file
import { PostRequest, GetRequest } from '../network/RequestUtils';
import { show } from '../utils/Utils';
import { exitLoginStatus } from './LoginAction';
import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE } from '../base/ActionTypes';
// 获取组织
// export const requestOrganizations = async (params) => {
// return await GetRequest(`/api/latest/authorized_inventory/search?access_token=${params.access_token}`)
// }
export function requestOrganizations(access_token) {
return dispatch => {
// console.warn('----requestOrganizations')
dispatch(requestOrganizationsing());
GetRequest(`/authorized_inventory/search?access_token=${access_token}`)
.then(res => {
// console.warn('res=====', Object.keys(res));
if(res.error_code == 0) {
// console.warn('res====organizations=', res.data.organizations);
let { data: { organizations } } = res
dispatch(requestOrganizationsSuccess(organizations));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
show(res.error_msg);
dispatch(requestOrganizationsFail());
}
})
.catch(err => {
show(err.error);
})
}
}
function requestOrganizationsing() {
return {
type: SELF_ORDER_LIST_DOING
}
}
function requestOrganizationsSuccess(data) {
return {
type: SELF_ORDER_LIST_SUCCESS,
rawData: data
}
}
function requestOrganizationsFail() {
return {
type: SELF_ORDER_LIST_FAILURE
}
}
import { PostRequest, GetRequest } from '../network/RequestUtils';
import { show } from '../utils/Utils';
import { exitLoginStatus } from './LoginAction';
// import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE } from '../base/ActionTypes';
//-----------user---------------------------
export const LOGIN_NO = "LOGIN_NO"
export const LOGIN_DOING = "LOGIN_DOING"
export const LOGIN_SUCCESS = "LOGIN_SUCCESS"
export const LOGIN_FAILURE = "LOGIN_FAILURE"
export const EXIT_LOGIN = "EXIT_LOGIN"
export const AUTO_LOGIN_SUCCESS = "AUTO_LOGIN_SUCCESS"
export const AUTO_LOGIN_FAILURE = "AUTO_LOGIN_FAILURE"
//-----------self order---------------------
export const SELF_ORDER_LIST_NO = "SELF_ORDER_LIST_NO"
export const SELF_ORDER_LIST_DOING = "SELF_ORDER_LIST_DOING"
export const SELF_ORDER_LIST_SUCCESS = "SELF_ORDER_LIST_SUCCESS"
export const SELF_ORDER_LIST_FAILURE = "SELF_ORDER_LIST_FAILURE"
export const SELF_SUBMIT_NO = "SELF_SUBMIT_NO"
export const SELF_SUBMIT_DOING = "SELF_SUBMIT_DOING"
export const SELF_SUBMIT_SUCCESS = "SELF_SUBMIT_SUCCESS"
export const SELF_SUBMIT_FAILURE = "SELF_SUBMIT_FAILURE"
//-----------quick order---------------------
export const QUICK_ORDER_LIST_NO = "QUICK_ORDER_LIST_NO"
export const QUICK_ORDER_LIST_DOING = "QUICK_ORDER_LIST_DOING"
export const QUICK_ORDER_LIST_SUCCESS = "QUICK_ORDER_LIST_SUCCESS"
export const QUICK_ORDER_LIST_FAILURE = "QUICK_ORDER_LIST_FAILURE"
export const QUICK_SUBMIT_NO = "QUICK_SUBMIT_NO"
export const QUICK_SUBMIT_DOING = "QUICK_SUBMIT_DOING"
export const QUICK_SUBMIT_SUCCESS = "QUICK_SUBMIT_SUCCESS"
export const QUICK_SUBMIT_FAILURE = "QUICK_SUBMIT_FAILURE"
\ No newline at end of file
export const BaseUrl = "https://obs.uat.sfrx.guke.tech";
export const BaseUrlOther = "https://sob-os.uat.sfrx.guke.tech";
export const VERSION = '/api/latest';
export const ACCESS_TOKEN = '201904091445193616b5e3d3a777848dda1de1a8123d0fdf9xw7t566c1S92U88';//未获取到access_token时使用
import {
Dimensions
} from 'react-native'
const { width, height } = Dimensions.get('window');
export const Height = () => {
return height
};
export const Width = () => {
return width
};
// UI 默认图是414*896
const uiWidthPx = 414;
const uiHeightPx = 896;
export function pxSize(uiElementPx) {
return uiElementPx * Width() / uiWidthPx;
}
export function pxHeight(uiElementPx) {
return uiElementPx * Height() / uiHeightPx;
}
// 背景色
export const promary_color = "#007EFF"; // 主色
export const foundation_color = "#ffffff"; // 底色
export const promary_shadow_color = "#3CA2FF"; // 按钮阴影色
export const home_background_color = "#F7F7F7"; // 背景色
export const btn_sub_color = "#0296F7"; // 按钮色
export const dis_sub_color = "#BBBBBB"; // 禁用按钮色
// 字体色
export const promary_text_color = "#000000"; // 主字颜色
export const title_text_color = "#ffffff"; // 标题颜色
export const placehold_text_color = "#919191"; // input placeholder颜色
export const first_text_color = '#333333'; // 一级字体
export const second_text_color = "#666666"; // 次级字体
export const third_text_color = "#999999"; // 三级字体
export const point_color = "#ff0000"; // * 颜色
// 字号
export const first_text_size = 20; // 一级字号
export const second_text_size = 16; // 二级字号
export const third_text_size = 12; // 三级字号
// 字体样式
export const font_family_semibold = "PingFangSC-Semibold";
export const font_family_medium = "PingFangSC-Medium";
export const font_family_regular = "PingFangSC-Regular";
export const font_family_light = "PingFangSC-Light";
export const header_height = 58
export const icon_style = {
resizeMode: 'contain',
width: '100%',
height: '100%'
}
export const safe_view = {
flex: 1
}
\ No newline at end of file
import React from 'react';
import {
View,
Text,
StyleSheet,
TextInput,
TouchableOpacity
} from 'react-native';
import {
first_text_color,
third_text_color,
foundation_color,
dis_sub_color,
title_text_color,
second_text_size,
font_family_medium,
font_family_semibold,
font_family_regular
} from '../../base/BaseStyle';
// 星号
export function AsteriskTextStyle({style, ...props}) {
return <Text style={[styles.asterisk_text, style]} {...props} />
}
// 列表标题
export function TitleTextStyle({style, ...props}) {
return <Text style={[styles.title_text, style]} {...props} />
}
// 列表内容
export function ContTextStyle({style, ...props}) {
return <Text style={[styles.cont_text, style]} {...props} />
}
// 列表输入框内容
export function ContInputTextStyle({style, ...props}) {
return <TextInput style={[styles.cont_text, styles.text_input, style]} {...props} />
}
// 列表右侧箭头
export function ImageTextStyle({style, ...props}) {
return <View style={[styles.image_box, style]} {...props} />
}
// 包含每一个列表的样式
export function CellTextStyle({style, ...props}) {
return <View style={[styles.call_box, style]} {...props} />
}
// 子页面底部按钮
export function FooterBtnStyle({style, textStyle, title, activeOpacity, ...props}) {
return <TouchableOpacity
activeOpacity={activeOpacity}
style={[styles.sub_btn_box, style]}
{...props}>
<Text style={[styles.sub_btn, textStyle]}>{title}</Text>
</TouchableOpacity>
}
const styles = StyleSheet.create({
asterisk_text: {
color: '#FF0000',
fontSize: second_text_size
},
title_text: {
fontSize: second_text_size,
color: first_text_color,
fontFamily: font_family_semibold
// fontWeight: 'bold'
},
cont_text: {
fontSize: second_text_size,
color: third_text_color,
flex: 1,
textAlign: 'right',
fontFamily: font_family_regular,
paddingLeft: 20
},
text_input: {
height: 38,
paddingRight: 20
},
image_box: {
width: 14,
marginLeft: 6
},
call_box: {
flexDirection: 'row',
alignItems: 'center',
height: 58,
backgroundColor: foundation_color,
paddingHorizontal: 20,
// paddingVertical: 20,
marginBottom: 18
},
sub_btn_box: {
backgroundColor: dis_sub_color,
height: 64,
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
},
sub_btn: {
color: title_text_color,
fontSize: 18,
fontFamily: font_family_medium
}
})
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Modal,
ScrollView,
TouchableOpacity,
SafeAreaView
} from 'react-native';
import {
Width,
pxHeight,
third_text_color,
first_text_color,
safe_view,
font_family_regular,
promary_color
} from '../../base/BaseStyle';
import DatePicker from 'react-native-date-picker';
import { changeDateFormat } from '../../utils/Utils';
class DateModel extends Component {
constructor(props) {
super(props);
this.state = {
isVisible: this.props.show,
// entityList: this.props.entityList
currentDate: this.props.date
}
}
componentWillReceiveProps(nextProps) {
// console.warn('------show--------------',nextProps.show, this.state.isVisible )
if (this.state.isVisible != nextProps.show) {
this.setState({
isVisible: nextProps.show
});
}
if (this.state.currentDate != nextProps.date) {
this.setState({
currentDate: nextProps.date
});
}
}
handleCloseModal() {
this.setState({
isVisible: false
});
this.props.closeModal(false);
}
subCancel() {
// console.warn('取消')
this.handleCloseModal()
}
subSure(date) {
// console.warn('确认',date, date instanceof Date)
if(date instanceof Date) {
date = changeDateFormat(date, 'yyyy-MM-dd hh:mm')
}
this.props.callback(date)
this.handleCloseModal()
}
currentDateChange(date) {
// let formatDate = changeDateFormat(date, 'yyyy-MM-dd hh:mm')
// console.warn('date',date)
// console.warn(formatDate)
this.setState({
currentDate: date
});
}
renderDialog() {
// let { entityList } = this.state
let { currentDate } = this.state
return (
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.scro_box}>
<View style={ styles.box_btn }>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.subCancel()}
style={[styles.btn_sty, styles.btn_sty_left]}
>
<Text style={[styles.btn_text, styles.btn_text_left]}>取消</Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.subSure(currentDate)}
style={styles.btn_sty}
>
<Text style={[styles.btn_text, styles.btn_text_right]}>确认</Text>
</TouchableOpacity>
</View>
<View style={styles.date_box}>
<DatePicker
date={currentDate}
onDateChange={(date) => this.currentDateChange(date)}
locale="zh"
mode="datetime"
// style={{height:100}}
/>
</View>
</View>
</View>
</View>
)
}
render() {
return (
// <View style={styles.dia_container}>
// <Text style={styles.dis_cont}>遮照层</Text>
// </View>
<View style={styles.dia_container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
onRequestClose={() => this.handleCloseModal()}>
<SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.handleCloseModal()}
>
{this.renderDialog()}
</TouchableOpacity>
</SafeAreaView>
</Modal>
</View>
);
}
}
const styles = StyleSheet.create({
dia_container: {
flex: 1,
// position: 'absolute',
// top: 0,
// left: 0,
// right: 0,
// backgroundColor: '#ccc',
// width: Width(),
// height: Height()
},
dis_cont: {
width: '80%',
maxHeight: '80%',
backgroundColor: '#FFF',
borderRadius: 10
},
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
},
opt_area: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
position: 'relative',
// marginTop: 12,
// marginBottom: 12,
// height: pxHeight(420)
},
modal_style: {
position: "absolute",
left: 0,
bottom: 0,
width: Width(),
flex: 1,
flexDirection: "column",
backgroundColor: '#ffffff',
borderTopLeftRadius: 12,
borderTopRightRadius: 12,
maxHeight: pxHeight(480)
// maxHeight: '100%'
},
item: {
width: Width(),
height: 40,
paddingLeft: 20,
paddingRight: 20,
alignItems: 'center'
},
itemText: {
fontSize: 16,
color: third_text_color
},
curr_item: {
color: first_text_color,
fontWeight: 'bold'
},
scro_box: {
paddingVertical: 30,
paddingTop: 10
// paddingTop: 42,
// alignItems: 'center'
},
box_btn: {
flex: 1,
paddingHorizontal: 20,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'flex-start',
borderBottomColor: '#e8e8e8',
borderBottomWidth: 1
},
btn_sty: {
// backgroundColor: '#ccc',
width: '50%',
height: 42
},
btn_sty_left: {
// borderRightWidth: 1,
// borderRightColor: '#FF0000'
},
btn_text: {
fontFamily: font_family_regular,
fontSize: 16,
lineHeight: 42,
color: promary_color
},
btn_text_left: {
},
btn_text_right: {
textAlign: 'right'
},
date_box: {
transform: [
{ scale: .9 }
],
alignItems: 'center'
},
item_scroll: {
// height: '80%',
// marginTop: 30,
// paddingBottom: 30
},
// cancel: {
// width: Width(),
// height: 30,
// marginTop: 12,
// alignItems: 'center',
// backgroundColor: '#ffffff'
// },
})
export default DateModel;
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Modal,
ScrollView,
TouchableOpacity,
SafeAreaView
} from 'react-native';
import {
Width,
pxHeight,
third_text_color,
first_text_color,
safe_view
} from '../../base/BaseStyle';
class DialogModel extends Component {
constructor(props) {
super(props);
this.state = {
isVisible: this.props.show,
entityList: this.props.entityList
}
// this.entityList = this.props.entityList
}
componentWillReceiveProps(nextProps) {
// console.warn('------show--------------',nextProps.show, this.state.isVisible )
if (this.state.isVisible != nextProps.show) {
this.setState({
isVisible: nextProps.show
});
}
if (this.state.entityList != nextProps.entityList) {
// this.entityList = nextProps.entityList
this.setState({
entityList: nextProps.entityList
})
}
}
closeModal() {
this.setState({
isVisible: false
});
this.props.closeModal(false);
}
renderItem(item, index) {
// console.warn(this.props.itemIndex)
let { itemIndex, itemValue } = this.props
return (
<TouchableOpacity key={index} onPress={this.choose.bind(this, item, index)} style={[styles.item]}>
{/* <TouchableOpacity key={i} onPress={this.choose.bind(this, index)} style={[styles.item]}> */}
{/* <Text style={[styles.itemText, itemIndex == index ? styles.curr_item : '']}>{item.name}</Text> */}
<Text style={[styles.itemText, itemValue == item.value ? styles.curr_item : '']}>{item.name}</Text>
</TouchableOpacity>
);
}
choose(item, index) {
let { itemTitle } = this.props
if (this.state.isVisible) {
// this.props.callback(i);
this.props.callback(item, itemTitle);
this.closeModal();
}
}
renderDialog() {
let { entityList } = this.state
return (
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.scro_box}>
<ScrollView
style={styles.item_scroll}
// showsVerticalScrollIndicator={false}
>
{
entityList.map((item, index) => this.renderItem(item, index))
}
</ScrollView>
</View>
</View>
</View>
)
}
render() {
return (
// <View style={styles.dia_container}>
// <Text style={styles.dis_cont}>遮照层</Text>
// </View>
<View style={styles.dia_container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
onRequestClose={() => this.closeModal()}>
<SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
onPress={() => this.closeModal()}>
{this.renderDialog()}
</TouchableOpacity>
</SafeAreaView>
</Modal>
</View>
);
}
}
const styles = StyleSheet.create({
dia_container: {
flex: 1,
// position: 'absolute',
// top: 0,
// left: 0,
// right: 0,
// backgroundColor: '#ccc',
// width: Width(),
// height: Height()
},
dis_cont: {
width: '80%',
maxHeight: '80%',
backgroundColor: '#FFF',
borderRadius: 10
},
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
},
opt_area: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
position: 'relative',
// marginTop: 12,
// marginBottom: 12,
// height: pxHeight(420)
},
modal_style: {
position: "absolute",
left: 0,
bottom: 0,
width: Width(),
flex: 1,
flexDirection: "column",
backgroundColor: '#ffffff',
borderTopLeftRadius: 12,
borderTopRightRadius: 12,
maxHeight: pxHeight(480)
// maxHeight: '100%'
},
item: {
width: Width(),
height: 40,
paddingLeft: 20,
paddingRight: 20,
alignItems: 'center'
},
itemText: {
fontSize: 16,
color: third_text_color
},
curr_item: {
color: first_text_color,
fontWeight: 'bold'
},
scro_box: {
paddingVertical: 40,
paddingTop: 46
},
item_scroll: {
// height: '80%',
// marginTop: 30,
// paddingBottom: 30
},
// cancel: {
// width: Width(),
// height: 30,
// marginTop: 12,
// alignItems: 'center',
// backgroundColor: '#ffffff'
// },
})
export default DialogModel;
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image
} from 'react-native';
import {
header_height,
promary_color,
title_text_color,
font_family_regular,
pxSize,
Width
} from '../../base/BaseStyle';
class HeadBackItem extends Component {
constructor(props) {
super(props);
this.state = { }
}
goBack() {
// console.warn('返回!=====')
// console.warn(this.props)
this.props.navigation.goBack()
}
render() {
// console.warn(this.props)
let {title} = this.props
return (
<View style={styles.header_style}>
<TouchableOpacity
activeOpacity={.8}
style={styles.head_img_box}
onPress={() => this.goBack()}
>
<View style={styles.back_style}>
<Image source={require('../../images/arrow_icon.png')} style={styles.back_style_img}/>
</View>
</TouchableOpacity>
<Text style={styles.title_style}>{title}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
header_style: {
flexDirection: 'row',
height: header_height,
width: Width(),
backgroundColor: promary_color,
alignItems: 'center',
justifyContent: 'flex-start',
paddingLeft: '5%'
},
head_img_box: {
width: 40,
alignItems: 'flex-start',
justifyContent: 'flex-start'
},
back_style: {
width: pxSize(18),
height: pxSize(18)
},
back_style_img: {
resizeMode: 'contain',
width: '100%'
},
title_style: {
width: Width() - 120,
textAlign: 'center',
fontSize: 18,
color: title_text_color,
fontFamily: font_family_regular
}
})
export default HeadBackItem;
\ No newline at end of file
import React, { Component } from 'react';
import {
ActivityIndicator,
SafeAreaView,
View,
Text,
StyleSheet,
Modal
} from 'react-native';
import {
safe_view,
promary_color
} from '../../base/BaseStyle';
class LodingModel extends Component {
constructor(props) {
super(props);
this.state = {
title: '加载中',
isVisible: this.props.show
}
}
componentWillReceiveProps(nextProps) {
if (this.state.isVisible != nextProps.show) {
this.setState({
isVisible: nextProps.show
})
}
}
render() {
let { title, size, color, style_back } = this.props
return (
<View style={styles.container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
// onRequestClose={() => this.closeModal()}>
>
<SafeAreaView style={safe_view}>
<View style={[styles.loding_cont, style_back]}>
<View style={styles.loding_title}>
<ActivityIndicator size={size ? size : "small"} color={color ? color : promary_color} />
<Text style={styles.tit_inner}>{title ? title : this.state.title}</Text>
</View>
</View>
</SafeAreaView>
</Modal>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1
},
loding_cont: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.1)',
paddingTop: '55%',
alignItems: 'center'
},
loding_title: {
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row'
},
tit_inner: {
fontSize: 16,
paddingLeft: 10,
color: promary_color
}
})
export default LodingModel;
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Modal,
TouchableOpacity,
Image,
SafeAreaView
} from 'react-native';
import {
Width,
pxHeight,
first_text_size,
pxSize,
safe_view,
icon_style,
font_family_medium
} from '../../base/BaseStyle';
class ShowModel extends Component {
constructor(props) {
super(props);
this.state = {
isVisible: false
}
}
componentWillReceiveProps(nextProps) {
if (this.state.isVisible != nextProps.show) {
this.setState({
isVisible: nextProps.show
});
}
}
closeModal() {
this.setState({
isVisible: false
})
this.props.closeModal(false)
}
renderDialog() {
let { title, children } = this.props
console.warn(title, children)
return (
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.modal_head}>
<Text style={styles.modal_tit}>{title}</Text>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.closeModal()}
style={styles.head_tou_clo}
>
<Image style={icon_style} source={require('../../images/close_icon.png')}></Image>
</TouchableOpacity>
</View>
<View style={styles.model_cont}>
{ children }
</View>
</View>
</View>
)
}
render() {
return (
<View style={styles.dia_container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
onRequestClose={() => this.closeModal()}>
<SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()}
>
{this.renderDialog()}
</TouchableOpacity>
</SafeAreaView>
</Modal>
</View>
);
}
}
const styles = StyleSheet.create({
dia_container: {
flex: 1
},
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.1)'
},
opt_area: {
flex: 1,
// flexDirection: 'column',
justifyContent: 'center',
position: 'relative'
},
modal_style: {
position: "absolute",
left: 0,
top: '26%',
width: Width() - 40,
flex: 1,
flexDirection: "column",
backgroundColor: '#ffffff',
// borderTopLeftRadius: 20,
// borderTopRightRadius: 20,
minHeight: pxHeight(380),
borderRadius: 20,
marginHorizontal: 20,
paddingHorizontal: 20,
paddingTop: 20,
paddingBottom: 30
},
modal_head: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'flex-end'
},
modal_tit: {
fontSize: first_text_size,
fontFamily: font_family_medium
},
head_tou_clo: {
width: pxSize(28),
height: pxSize(28)
},
// clo_icon: {
// width: '100%',
// height: '100%'
// },
model_cont: {
paddingTop: 20
},
})
export default ShowModel;
\ No newline at end of file
import React, {Component} from 'react'
import {Platform, StatusBar, View} from 'react-native'
import {isIphoneX} from '../../utils/Utils'
import {connect} from "react-redux";
const iosStatusBarHeight = 20;
const iosStatusBarXHeight = 44;
const PropTypes = require('prop-types');
class StatusBarView extends Component {
static propsTypes = {
backgroundColor: PropTypes.string,
isReactStackNavigator: PropTypes.boolean,
barStyle: PropTypes.string
}
static defaultProps = {
isReactStackNavigator: false,
barStyle: 'dark-content'
}
render() {
let height = 0
if (Platform.OS == 'ios') {
if (this.props.isReactStackNavigator) {
height = isIphoneX() ? iosStatusBarXHeight : iosStatusBarHeight
}
}
return (
<View style={{
height : height,
backgroundColor: this.props.backgroundColor
}}>
<StatusBar
barStyle = {this.props.barStyle}
backgroundColor={this.props.backgroundColor}
/>
</View>
)
}
}
const mapStateToProps = (state) => ({
})
const mapDispatchToProps = (dispatch) => ({
})
export default connect(mapStateToProps, mapDispatchToProps)(StatusBarView)
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
SafeAreaView,
ScrollView,
Image,
TouchableOpacity
} from 'react-native';
import {
home_background_color,
promary_color,
safe_view,
icon_style
} from '../../base/BaseStyle';
import StatusBarView from '../common/StatusBarView';
import HeadBackItem from '../common/HeadBackItem';
import { FooterBtnStyle, ImageTextStyle, CellTextStyle, AsteriskTextStyle, TitleTextStyle, ContInputTextStyle } from '../common/CellTextStyle';
import { connect } from 'react-redux';
import { isEmpty } from '../../utils/Utils';
class EquipConsuPage extends Component {
constructor(props) {
super(props);
this.state = {
canSubFlag: false, // 生成订单按钮样式改变
listOptionData: [ // 备注以上的元素
{
"id": "0",
title: '销售员',
name: '蔡妍',
value: '蔡妍',
isPicker: false,
select: false,
isEditable: false // 不可编辑
},
{
"id": "1",
title: '组织',
name: '请选择',
value: '',
isPicker: true,
select: false
},
{
"id": "2",
title: '手术医院',
name: '请选择',
value: '',
isPicker: true,
select: false
},
{
"id": "3",
title: '订单信息',
name: '请选择',
value: '',
isPicker: true,
select: false
},
{
"id": "4",
title: '消耗时间',
name: '请选择',
value: '',
isPicker: true,
select: false
},
{
"id": "5",
title: '患者姓名',
value: '',
isPicker: false,
select: false
},
{
"id": "6",
title: '性别', // 选择
name: '请选择',
value: '',
isPicker: true,
select: false
},
{
"id": "7",
title: '年龄', // 输入
value: '',
isPicker: false,
select: false
},
{
"id": "8",
title: '床位',
value: '',
isPicker: false,
select: false
},
{
"id": "9",
title: '病历号',
value: '',
isPicker: false,
select: false
},
{
"id": "10",
title: '是否结单',
value: '',
isPicker: false, // 单选
select: false
},
{
"id": "11",
title: '备注',
value: '',
isPicker: false,
select: false,
isRemark: true // 备注
},
{
"id": "12",
title: '耗材明细', // 跳转
value: '',
isPicker: false,
select: false
},
{
"id": "13",
title: '添加图片',
value: '',
isPicker: false,
select: false,
isAddImg: true
}
],
submitOption: { // 提交的信息
},
currentItem: {
name: '请选择',
value: '-1'
},
currentTitle: '组织', // 当前点击项
showTypePop: false, // 选择器弹窗
isSubLoding: false, // 加载中弹窗
lodingTitle: '加载中',
listCurrentOption: [ // 当前选择器数据
{
name: '男',
value: 'boy'
},
{
name: '女',
value: 'girl'
}
],
}
}
// 生成订单 点击
handleSubmit() {
}
// 返回备注以上的元素
renderListItem() {
let { listOptionData } = this.state
let {userInfo:{ person_name }} = this.props
if(!isEmpty(person_name)) {
// this.setState({
// listOptionData: listOptionData.map(item => {
// if(item.title === '销售员') {
// item.name = person_name
// item.value = person_name
// }
// return item
// })
// })
}
return(
<View style={styles.list_cont}>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={1}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'销售员'}</TitleTextStyle>
<ContInputTextStyle editable={false} defaultValue={listOptionData[0].value}></ContInputTextStyle>
</CellTextStyle>
</TouchableOpacity>
</View>
</View>
)
}
// 返回右侧箭头
renderRightArrowItem() {
return (
<ImageTextStyle>
<Image source={require('../../images/arr_rig.png')} style={icon_style}/>
</ImageTextStyle>
)
}
// 返回选择器
renderPickerModelAndLodingModel() {
}
render() {
let {canSubFlag} = this.state
let {navigation} = this.props
let {title} = navigation.state.params
return (
<View style={styles.equip_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<ScrollView
style={styles.equip_main}
showsVerticalScrollIndicator={false}
>
<Text>'器械消耗'</Text>
{this.renderListItem()}
</ScrollView>
</SafeAreaView>
<FooterBtnStyle
style={canSubFlag ? styles.sub_btn_pro : ''}
activeOpacity={canSubFlag ? .8 : 1}
title={'生成订单'}
textStyle= {styles.sub_btn}
onPress={() => this.handleSubmit()}
/>
</View>
);
}
}
const styles = StyleSheet.create({
equip_container : {
flex: 1,
backgroundColor: home_background_color
},
equip_main : {
padding: 14
},
list_cont: {
flex: 1
},
item_container: {
flex: 1
},
sub_btn_pro: {
backgroundColor: promary_color
},
sub_btn: {},
})
const mapStateToProps = (state) => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
}
}
const mapDispatchToProps = (dispatch) => {
return {
// requestOrganizations: (token) => {
// dispatch(requestOrganizations(token))
// }
}
}
export default connect(mapStateToProps, mapDispatchToProps)(EquipConsuPage);
\ No newline at end of file
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
Image,
SafeAreaView,
TouchableOpacity
} from 'react-native';
import {connect} from "react-redux";
import {
foundation_color,
promary_text_color,
second_text_size,
home_background_color,
pxSize,
promary_color,
safe_view,
font_family_regular
} from '../../base/BaseStyle';
import { exitLoginStatus } from '../../action/LoginAction';
import HeadBackItem from '../common/HeadBackItem';
import StatusBarView from '../common/StatusBarView';
class HomePage extends Component {
constructor(props) {
super(props)
this.state = {
showList: [
{
icon: require('../../images/quick_order.png'),
title: '快速下单',
page: 'QuickOrderPage',
},
{
icon: require('../../images/self_order.png'),
title: '自助下单',
page: 'SelfOrderPage',
},
{
icon: require('../../images/trans_order.png'),
title: '转单',
page: 'TransOrderPage',
},
{
icon: require('../../images/equip_consu.png'),
title: '器械消耗',
page: 'EquipConsuPage',
},
{
icon: require('../../images/return_login.png'),
title: '返回登录页',
page: 'LoginPage',
}
]
}
}
// componentWillReceiveProps(nextProps) {
// console.warn('home---------!!!!',nextProps)
// if(this.props.loginState != nextProps.loginState) {
// switch(nextProps.loginState) {
// case LOGIN_NO:
// console.warn('home-------LOGIN_NO---',nextProps.loginState)
// break
// default:
// break;
// }
// }
// }
jumpToSubpage(index) {
// console.warn('跳转')
// console.warn(index)
let {page, title} = this.state.showList[index]
if('LoginPage' === page) {
// console.warn('返回!')
// console.warn(this.props)
this.props.exitLoginStatus()
}
this.props.navigation.navigate(page, {title})
}
render() {
let {navigation} = this.props
return (
<View style={styles.home_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={'骨科智慧仓'} navigation={navigation} />
<View style={styles.home_cont}>
{
this.state.showList.map((item, index) =>
<TouchableOpacity
activeOpacity={.8}
style={[styles.home_list, (index%2 !== 0) && styles.home_list_even]}
onPress={() => this.jumpToSubpage(index)}>
<View style={styles.list_item}>
<View style={styles.img_box}>
<Image source={item.icon} style={styles.list_img}/>
</View>
<Text style={styles.list_tit}>{item.title}</Text>
</View>
</TouchableOpacity>
)
}
</View>
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
home_container: {
flex: 1,
// width: Width(),
// height: Height(),
// flexDirection: 'row',
// flexWrap: 'wrap',
backgroundColor: home_background_color
},
home_cont: {
// flex: 1,
flexDirection: 'row',
flexWrap: 'wrap',
marginTop: '8%',
marginLeft: '10%',
justifyContent: 'flex-start',
// backgroundColor: home_background_color
},
home_list: {
// width: '40%',
width: pxSize(150),
height: pxSize(150),
backgroundColor: foundation_color,
marginBottom: '6%',
// paddingTop: '8%',
// paddingBottom: '6%',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 4
},
home_list_even: {
marginLeft: '8%'
},
list_item: {
width: '100%',
justifyContent: 'center',
alignItems: 'center'
},
img_box: {
// width: '28%',
width: pxSize(46),
marginBottom: 6
},
list_img: {
resizeMode: 'contain',
width: '100%'
},
list_tit: {
fontSize: second_text_size,
color: promary_text_color,
lineHeight: second_text_size + 12,
fontFamily: font_family_regular
}
})
const mapStateToProps = (state) => ({
loginState:state.login.loginState
})
const mapDispatchToProps = (dispatch) => ({
exitLoginStatus: () => {
dispatch(exitLoginStatus())
}
})
export default connect(mapStateToProps, mapDispatchToProps)(HomePage)
\ No newline at end of file
import React, { Component } from 'react';
import {
SafeAreaView,
StyleSheet,
View,
Text,
Image,
TouchableOpacity
} from 'react-native';
import { connect } from 'react-redux';
import HeadBackItem from '../../common/HeadBackItem';
import {
promary_color,
second_text_color,
first_text_color,
pxSize,
title_text_color,
safe_view,
font_family_medium,
font_family_regular
} from '../../../base/BaseStyle';
import StatusBarView from '../../common/StatusBarView';
class SubSuccessPage extends Component {
constructor(props) {
super(props);
this.state = { }
}
handleSubmit() {
console.warn('复制订单号并返回主页')
}
render() {
let {navigation} = this.props
let {title} = navigation.state.params
return (
<View style={styles.succ_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.succ_inner}>
<View style={styles.img_box}>
<Image source={require('../../../images/cor_green.png')} style={styles.img_icon}/>
</View>
<Text style={styles.succ_title}>{'提交成功'}</Text>
<Text style={styles.succ_text}>{'订单号:20200318121230'}</Text>
<TouchableOpacity
activeOpacity={.9}
style={styles.succ_btn}
onPress={() => this.handleSubmit()}
>
<Text style={styles.btn_text}>{'复制订单号并返回主页'}</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
succ_container: {
flex: 1
},
succ_inner: {
justifyContent: 'center',
alignItems: 'center',
paddingTop: '26%'
},
img_box: {
width: pxSize(80),
height: pxSize(80)
},
img_icon: {
width: '100%',
height: '100%'
},
succ_title: {
fontSize: 17,
fontFamily: font_family_medium,
// fontWeight: 'bold',
color: first_text_color,
paddingTop: 8,
paddingBottom: 20
},
succ_text: {
fontSize: 14,
color: second_text_color,
paddingBottom: 30,
fontFamily: font_family_regular
},
succ_btn: {
backgroundColor: promary_color,
width: pxSize(330),
borderRadius: 30,
height: 48,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
},
btn_text: {
color: title_text_color,
fontSize: 16,
fontFamily: font_family_regular
}
})
export default SubSuccessPage;
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
ScrollView
} from 'react-native';
import {
first_text_color,
third_text_size,
second_text_color,
pxSize,
foundation_color,
promary_color
} from '../../../../base/BaseStyle';
class TopTabBar extends Component {
constructor(props) {
super(props);
this.state = {
}
}
// 返回自定义 bar 元素
renderTabOption(barItem, index) {
// ScrollableTabView默认传递的属性值,即跳转方法
// console.warn('top_tab_----', this.props)
// console.warn('barItem, index----', barItem, index)
let {activeTab, tabNames, goToPage, imgTabArr, textStyle, activeTextColor} = this.props
console.warn(activeTab, index, 'hh')
return (
<TouchableOpacity
activeOpacity={.8}
key={barItem}
onPress={() => goToPage(index)}
style={[styles.bar_box, activeTab == index ? styles.bar_box_act : '']}
>
<View style={styles.img_box}>
<Image source={imgTabArr[index]} style={styles.img_inner}/>
</View>
<Text style={[textStyle, activeTab == index ? activeTextColor : '']}>{barItem}</Text>
</TouchableOpacity>
)
}
render() {
let {style, tabs} = this.props
console.warn('hhhhh', tabs)
console.warn(this.props)
return (
<View style={[styles.bar_cont, style]}>
<ScrollView
style={styles.top_scroll_cont}
horizontal={true}
showsHorizontalScrollIndicator={false}
>
{
this.props.tabs.map((tab, index) => this.renderTabOption(tab, index))
}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
bar_cont: {
backgroundColor: foundation_color,
borderBottomColor: '#F4F4F4',
borderBottomWidth: 1,
flexDirection: 'row',
height: 76,
paddingHorizontal: 20
},
top_scroll_cont: {
},
tab: {
},
bar_box: {
flex: 1,
alignItems: 'center',
justifyContent: 'flex-start',
// paddingBottom: 10,
borderBottomWidth: 2,
borderBottomColor: foundation_color,
width: 58,
marginRight: 8
},
bar_box_act: {
borderBottomWidth: 2,
borderBottomColor: promary_color
},
img_box: {
width: pxSize(30),
height: pxSize(30)
},
img_inner: {
width: '100%',
height: '100%'
},
tit_text: {
paddingTop: 10,
paddingBottom: 16,
color: second_text_color,
fontSize: third_text_size
},
tit_text_act: {
color: first_text_color,
fontWeight: 'bold'
}
})
export default TopTabBar;
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
ScrollView
} from 'react-native';
import {
first_text_color,
third_text_size,
second_text_color,
pxSize,
foundation_color,
promary_color
} from '../../../../base/BaseStyle';
class TopTabBar extends Component {
constructor(props) {
super(props);
this.state = {
}
}
// 返回自定义 bar 元素
renderTabOption(barItem, index) {
// ScrollableTabView默认传递的属性值,即跳转方法
// console.warn('top_tab_----', this.props)
// console.warn('barItem, index----', barItem, index)
let {activeTab, tabNames, goToPage, imgTabArr, textStyle, activeTextColor} = this.props
// console.warn(activeTab, index, 'hh')
return (
<TouchableOpacity
activeOpacity={.8}
key={barItem}
onPress={() => goToPage(index)}
style={[styles.bar_box, activeTab == index ? styles.bar_box_act : '']}
>
<View style={styles.img_box}>
<Image source={imgTabArr[index]} style={styles.img_inner}/>
</View>
<Text style={[textStyle, activeTab == index ? activeTextColor : '']}>{barItem}</Text>
</TouchableOpacity>
)
}
render() {
let {style, tabs} = this.props
// console.warn('hhhhh', tabs)
// console.warn(this.props)
return (
<View style={[styles.bar_cont, style]}>
<ScrollView
style={styles.top_scroll_cont}
horizontal={true}
showsHorizontalScrollIndicator={false}
>
{
this.props.tabs.map((tab, index) => this.renderTabOption(tab, index))
}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
bar_cont: {
backgroundColor: foundation_color,
borderBottomColor: '#F4F4F4',
borderBottomWidth: 1,
flexDirection: 'row',
height: 76,
paddingHorizontal: 20
},
top_scroll_cont: {
},
tab: {
},
bar_box: {
flex: 1,
alignItems: 'center',
justifyContent: 'flex-start',
// paddingBottom: 10,
borderBottomWidth: 2,
borderBottomColor: foundation_color,
width: 58,
marginRight: 8
},
bar_box_act: {
borderBottomWidth: 2,
borderBottomColor: promary_color
},
img_box: {
width: pxSize(30),
height: pxSize(30)
},
img_inner: {
width: '100%',
height: '100%'
},
tit_text: {
paddingTop: 10,
paddingBottom: 16,
color: second_text_color,
fontSize: third_text_size
},
tit_text_act: {
color: first_text_color,
fontWeight: 'bold'
}
})
export default TopTabBar;
\ No newline at end of file
export default [
{
isRequest: true,
title: '销售员',
value: '易凯源',
isPicker: false,
isEditText: true
},
{
isRequest: true,
title: '组织',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '手术医院',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收单地点',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收货地点',
value: '请选择',
isPicker: true
},
{
isRequest: false,
title: '主治医生',
value: '请选择',
isPicker: true,
showInput: true
},
{
isRequest: false,
title: '手术名称',
value: '请输入',
isPicker: false
},
{
isRequest: false,
title: '手术类时间',
value: '请选择',
isPicker: true,
showDatePicker: true
},
{
isRequest: true,
title: '手术类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '订单类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '选择产品',
value: '请选择',
isPicker: true,
showItemPage: true
}
]
\ No newline at end of file
export const leftOptionList = [
{
title: '手术模版',
iconImg: require('../../../images/surg_temp.png'),
stencilData: [{
"id": "0",
title: '髋关节手术001',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "1",
title: '髋关节手术002',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "2",
title: '髋关节手术003',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "3",
title: '髋关节手术004',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "4",
title: '髋关节手术005',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "5",
title: '髋关节手术006',
tip1: '描述信息',
tip2: '描述信息',
select: false
}
], // 模版数据
},
{
title: '螺钉盒',
iconImg: require('../../../images/screw_box.png'),
stencilData: [{
"id": "0",
title: '髋关节手术001--ldh',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "1",
title: '髋关节手术002',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "2",
title: '髋关节手术003',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "3",
title: '髋关节手术004',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "4",
title: '髋关节手术005',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "5",
title: '髋关节手术006',
tip1: '描述信息',
tip2: '描述信息',
select: false
}
], // 模版数据
},
{
title: '器械包',
iconImg: require('../../../images/equip_bag.png'),
stencilData: [{
"id": "0",
title: '髋关节手术001----qxb',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "1",
title: '髋关节手术002',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "2",
title: '髋关节手术003',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "3",
title: '髋关节手术004',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "4",
title: '髋关节手术005',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "5",
title: '髋关节手术006',
tip1: '描述信息',
tip2: '描述信息',
select: false
}
], // 模版数据
},
{
title: '辅助工具',
iconImg: require('../../../images/auxili_tool.png'),
stencilData: [{
"id": "0",
title: '髋关节手术001------fzgj',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "1",
title: '髋关节手术002',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "2",
title: '髋关节手术003',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "3",
title: '髋关节手术004',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "4",
title: '髋关节手术005',
tip1: '描述信息',
tip2: '描述信息',
select: false
},
{
"id": "5",
title: '髋关节手术006',
tip1: '描述信息',
tip2: '描述信息',
select: false
}
], // 模版数据
},
{
title: '人工髋关节假体'
},
{
title: '膝关节假体备份'
},
{
title: '骨小梁髋关节假体'
},
{
title: '骨小梁髋关节假体22'
},
{
title: '骨小梁髋关节假体33'
},
{
title: '骨小梁髋关节假体44'
},
{
title: '骨小梁髋关节假体55'
},
] // 左侧数据 - 二级菜单
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
SafeAreaView,
ScrollView
} from 'react-native';
import {
home_background_color,
promary_color,
safe_view
} from '../../base/BaseStyle';
import StatusBarView from '../common/StatusBarView';
import HeadBackItem from '../common/HeadBackItem';
import { FooterBtnStyle } from '../common/CellTextStyle';
class EquipConsuPage extends Component {
constructor(props) {
super(props);
this.state = {
canSubFlag: false, // 生成订单按钮样式改变
}
}
// 生成订单 点击
handleSubmit() {
}
render() {
let {canSubFlag} = this.state
let {navigation} = this.props
let {title} = navigation.state.params
return (
<View style={styles.trans_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<ScrollView
style={styles.trans_main}
showsVerticalScrollIndicator={false}
>
<Text>'转单⚠️⚠️'</Text>
</ScrollView>
</SafeAreaView>
<FooterBtnStyle
style={canSubFlag ? styles.sub_btn_pro : ''}
activeOpacity={canSubFlag ? .8 : 1}
title={'生成订单'}
textStyle= {styles.sub_btn}
onPress={() => this.handleSubmit()}
/>
</View>
);
}
}
const styles = StyleSheet.create({
trans_container : {
flex: 1,
backgroundColor: home_background_color
},
trans_main : {
padding: 14
},
sub_btn_pro: {
backgroundColor: promary_color
},
sub_btn: {},
})
export default EquipConsuPage;
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment