Kaynağa Gözat

对接加密接口,初始化首页界面

wushaodong 4 yıl önce
ebeveyn
işleme
4beaf94aeb
49 değiştirilmiş dosya ile 727 ekleme ve 1823 silme
  1. 19 32
      android/app/build.gradle
  2. 88 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/MainApplication.java
  3. 62 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/MyIntentModule.java
  4. 28 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/MyReactPackage.java
  5. 165 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/activity/MainActivity.java
  6. 48 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/fragment/ProductInfo.java
  7. 169 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/fragment/UHFReadTagFragment.java
  8. 39 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/readUHF/ReadUHFModule.java
  9. 28 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/readUHF/ReadUHFPackage.java
  10. 25 0
      android/app/src/main/java/com/zzliaoyuan/power_sensor/tools/UIHelper.java
  11. BIN
      android/app/src/main/jniLibs/arm64-v8a/libcore.so
  12. BIN
      android/app/src/main/jniLibs/arm64-v8a/libcorewrapper.so
  13. BIN
      android/app/src/main/jniLibs/armeabi-v7a/libcore.so
  14. BIN
      android/app/src/main/jniLibs/armeabi-v7a/libcorewrapper.so
  15. BIN
      android/app/src/main/jniLibs/corewrapper.aar
  16. BIN
      android/app/src/main/jniLibs/x86/libcore.so
  17. BIN
      android/app/src/main/jniLibs/x86/libcorewrapper.so
  18. BIN
      android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  19. BIN
      android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  20. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  21. BIN
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  22. BIN
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  23. 2 5
      android/build.gradle
  24. 2 2
      android/settings.gradle
  25. 1 4
      jscore/App.js
  26. 0 30
      jscore/components/Button.js
  27. 0 109
      jscore/components/CheckValid.js
  28. 0 44
      jscore/components/FormateDate.js
  29. 0 12
      jscore/components/ResponseError.js
  30. 0 7
      jscore/components/Touchable.js
  31. 2 3
      jscore/components/index.js
  32. 0 106
      jscore/models/home.js
  33. 0 65
      jscore/models/user.js
  34. 0 293
      jscore/pages/Desktop/Deliver.js
  35. 0 123
      jscore/pages/Desktop/DeliverAdd.js
  36. 37 107
      jscore/pages/Desktop/Home.js
  37. 0 47
      jscore/pages/Desktop/Index.js
  38. 0 120
      jscore/pages/Desktop/Search.js
  39. 0 88
      jscore/pages/Desktop/SearchDistributor.js
  40. 0 224
      jscore/pages/Desktop/UHFDeliver.js
  41. 0 53
      jscore/pages/Outside/Index.js
  42. 0 94
      jscore/pages/Outside/Login.js
  43. 11 56
      jscore/pages/Welcome.js
  44. 0 2
      jscore/root.js
  45. 1 1
      jscore/router.js
  46. 0 55
      jscore/services/home.js
  47. 0 25
      jscore/services/user.js
  48. 0 3
      jscore/utils/index.js
  49. 0 113
      jscore/utils/request.js

+ 19 - 32
android/app/build.gradle

@@ -121,6 +121,7 @@ def enableHermes = project.ext.react.get("enableHermes", false);
 
 android {
     compileSdkVersion rootProject.ext.compileSdkVersion
+    buildToolsVersion = '29.0.1'
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
@@ -133,20 +134,13 @@ android {
         targetSdkVersion rootProject.ext.targetSdkVersion
         versionCode 10
         versionName "1.0.0"
-        multiDexEnabled true
-        // manifestPlaceholders = [
-        //        XG_ACCESS_ID : "2100348457",
-        //        XG_ACCESS_KEY: "A418SKXY4X8N",
-        //        qqappid : "101839333",
-        //        QQ_APPKEY: "830c5b1266259f7c8353e1f8e18beff7"
-       // ]
-        vectorDrawables.useSupportLibrary = true  //react-native-image-crop-picker
     }
+
     splits {
         abi {
             reset()
             enable enableSeparateBuildPerCPUArchitecture
-            universalApk false  // If true, also generate a universal APK
+            universalApk true  // If true, also generate a universal APK
             include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
         }
     }
@@ -168,15 +162,15 @@ android {
             }
         }
     }
-    buildToolsVersion = '28.0.3'
-    buildTypes {
-        debug {
-            signingConfig signingConfigs.debug
+
+    sourceSets {
+        main {
+            jniLibs.srcDirs = ['src\\main\\jniLibs']
         }
+    }
+
+    buildTypes {
         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.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }
@@ -196,24 +190,24 @@ android {
         }
     }
 }
-
+repositories {
+    flatDir{
+        dirs 'src\\main\\jniLibs'
+    }
+}
 dependencies {
-    implementation project(':react-native-gesture-handler')
+//    implementation project(':react-native-gesture-handler')
     implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation "com.facebook.react:react-native:+"  // From node_modules
     implementation 'com.android.support:multidex:1.0.3'
 
+    // rifdmastercore
+    implementation(name: 'corewrapper', ext:'aar')
+
     api 'com.github.dfqin:grantor:2.5'
     // UHF
     implementation files('libs/cw-deviceapi20191022.jar')
 
-    //jg包
-    implementation 'com.tencent.jg:jg:1.1'
-    //wup包
-    implementation 'com.tencent.wup:wup:1.0.0.E-Release'
-    //mid包,minSdkVersion 14
-    implementation 'com.tencent.mid:mid:4.0.7-Release'
-
     if (enableHermes) {
         def hermesPath = "../../node_modules/hermes-engine/android/";
         debugImplementation files(hermesPath + "hermes-debug.aar")
@@ -223,11 +217,4 @@ dependencies {
     }
 }
 
-// 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)

+ 88 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/MainApplication.java

@@ -0,0 +1,88 @@
+package com.zzliaoyuan.power_sensor;
+
+import android.app.Application;
+import android.content.Context;
+import com.facebook.react.PackageList;
+import com.facebook.react.ReactApplication;
+import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
+import com.facebook.react.ReactNativeHost;
+import com.facebook.react.ReactPackage;
+import com.facebook.soloader.SoLoader;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import com.zzliaoyuan.power_sensor.readUHF.ReadUHFPackage;
+
+public class MainApplication extends Application implements ReactApplication {
+  public static MainApplication CONTEXT;
+  public static final MyReactPackage reactPackage = new MyReactPackage();
+
+  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());
+          packages.add(reactPackage);
+          packages.add(new ReadUHFPackage());
+
+          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); // Remove this line if you don't want Flipper enabled
+
+      CONTEXT = this;
+  }
+
+    public static MyReactPackage GetReactPackage(){
+        return reactPackage;
+    }
+
+  /**
+   * Loads Flipper in React Native templates.
+   *
+   * @param context
+   */
+  private static void initializeFlipper(Context context) {
+    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.facebook.flipper.ReactNativeFlipper");
+        aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
+      } catch (ClassNotFoundException e) {
+        e.printStackTrace();
+      } catch (NoSuchMethodException e) {
+        e.printStackTrace();
+      } catch (IllegalAccessException e) {
+        e.printStackTrace();
+      } catch (InvocationTargetException e) {
+        e.printStackTrace();
+      }
+    }
+  }
+}

+ 62 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/MyIntentModule.java

@@ -0,0 +1,62 @@
+package com.zzliaoyuan.power_sensor;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.text.TextUtils;
+
+import com.facebook.react.bridge.Callback;
+import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
+import com.facebook.react.bridge.ReactMethod;
+import com.facebook.react.modules.core.DeviceEventManagerModule;
+
+public class MyIntentModule extends ReactContextBaseJavaModule {
+    ReactApplicationContext reactContext ;
+
+    public MyIntentModule(ReactApplicationContext reactContext) {
+        super(reactContext);
+        this.reactContext = reactContext;
+    }
+
+    @Override
+    public String getName() {
+        return "IntentMoudle";
+    }
+    //注意:记住getName方法中的命名名称,JS中调用需要
+
+    @ReactMethod
+    public void startActivityFromJS(String name, String params){
+        try{
+            Activity currentActivity = getCurrentActivity();
+            if(null!=currentActivity){
+                Class toActivity = Class.forName(name);
+                Intent intent = new Intent(currentActivity,toActivity);
+                intent.putExtra("params", params);
+                currentActivity.startActivity(intent);
+            }
+        }catch(Exception e){
+            throw new JSApplicationIllegalArgumentException(
+                    "不能打开Activity : "+e.getMessage());
+        }
+    }
+
+    @ReactMethod
+    public void dataToJS(Callback successBack, Callback errorBack){
+        try{
+            Activity currentActivity = getCurrentActivity();
+            String result = currentActivity.getIntent().getStringExtra("data");
+            if (TextUtils.isEmpty(result)){
+                result = "没有数据";
+            }
+            successBack.invoke(result);
+        }catch (Exception e){
+            errorBack.invoke(e.getMessage());
+        }
+    }
+
+    public void sendMsgToRN(String eventName, String msg) {
+        this.reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
+                .emit(eventName, msg);
+    }
+}

+ 28 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/MyReactPackage.java

@@ -0,0 +1,28 @@
+package com.zzliaoyuan.power_sensor;
+
+import com.facebook.react.ReactPackage;
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.uimanager.ViewManager;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class MyReactPackage implements ReactPackage {
+    public MyIntentModule reactModule;
+
+    @Override
+    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
+        List<NativeModule> modules = new ArrayList<>();
+        reactModule = new MyIntentModule(reactContext);
+        modules.add(reactModule);
+        return modules;
+
+        //return Arrays.<NativeModule>asList(new MyIntentModule(reactContext));
+    }
+    @Override
+    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
+        return Collections.emptyList();
+    }
+}

+ 165 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/activity/MainActivity.java

@@ -0,0 +1,165 @@
+package com.zzliaoyuan.power_sensor.activity;
+
+import android.Manifest;
+import android.app.ActionBar;
+import android.app.ProgressDialog;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.media.AudioManager;
+import android.media.SoundPool;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.widget.Toast;
+
+import com.facebook.react.ReactActivity;
+import com.facebook.react.ReactActivityDelegate;
+import com.facebook.react.ReactRootView;
+import com.github.dfqin.grantor.PermissionListener;
+import com.github.dfqin.grantor.PermissionsUtil;
+import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import androidx.annotation.NonNull;
+
+import com.zzliaoyuan.power_sensor.MainApplication;
+import com.zzliaoyuan.power_sensor.R;
+import com.rscja.deviceapi.RFIDWithUHFUART;
+import com.zzliaoyuan.power_sensor.fragment.UHFReadTagFragment;
+
+public class MainActivity extends ReactActivity {
+    /**
+     * Returns the name of the main component registered from JavaScript. This is used to schedule
+     * rendering of the component.
+     */
+    public RFIDWithUHFUART mReader;
+
+    @Override
+    protected String getMainComponentName() {
+        return "power_sensor";
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // 禁用横屏
+
+//        requirePerms();
+        initSound();
+        initUHF();
+        UHFReadTagFragment.getInstance().setContext(this);
+    }
+
+
+    @Override
+    protected ReactActivityDelegate createReactActivityDelegate() {
+        return new ReactActivityDelegate(this, getMainComponentName()) {
+            @Override
+            protected ReactRootView createRootView() {
+                return new RNGestureHandlerEnabledRootView(MainActivity.this);
+            }
+        };
+    }
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (keyCode == 139 ||keyCode == 280) {
+
+            if (event.getRepeatCount() == 0) {
+                UHFReadTagFragment.getInstance().myOnKeyDwon();
+                // MainApplication.GetReactPackage().reactModule.sendMsgToRN("onKeyDown", "1");
+            }
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+    // 初始化声音
+    HashMap<Integer, Integer> soundMap = new HashMap<Integer, Integer>();
+    private SoundPool soundPool;
+    private float volumnRatio;
+    private AudioManager am;
+    private void initSound(){
+        soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 5);
+        soundMap.put(1, soundPool.load(this, R.raw.barcodebeep, 1));
+        soundMap.put(2, soundPool.load(this, R.raw.serror, 1));
+        am = (AudioManager) this.getSystemService(AUDIO_SERVICE);// 实例化AudioManager对象
+    }
+    /**
+     * 播放提示音
+     *
+     * @param id 成功1,失败2
+     */
+    public void playSound(int id) {
+//        MainApplication.GetReactPackage().reactModule.sendMsgToRN("MsgFromAndroid", "cccccccccccplaySound"+id);
+//        MainApplication.GetReactPackage().reactModule.sendMsgToRN("MsgFromAndroid", "cccccccccccplaySound"+am);
+        float audioMaxVolumn = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); // 返回当前AudioManager对象的最大音量值
+        float audioCurrentVolumn = am.getStreamVolume(AudioManager.STREAM_MUSIC);// 返回当前AudioManager对象的音量值
+        volumnRatio = audioCurrentVolumn / audioMaxVolumn;
+        try {
+            soundPool.play(soundMap.get(id), volumnRatio, // 左声道音量
+                    volumnRatio, // 右声道音量
+                    1, // 优先级,0为最低
+                    0, // 循环次数,0无不循环,-1无永远循环
+                    1 // 回放速度 ,该值在0.5-2.0之间,1为正常速度
+            );
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+    }
+
+    public void initUHF() {
+
+        try {
+            mReader = RFIDWithUHFUART.getInstance();
+            toastMessage("初始化读卡器");
+        } catch (Exception ex) {
+//            Log.e("======", ex.getMessage());
+            toastMessage(ex.getMessage());
+
+            return;
+        }
+
+        if (mReader != null) {
+            mReader.init();
+        }
+    }
+
+    public void toastMessage(String msg) {
+        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
+    }
+
+    @Override
+    protected void onDestroy() {
+
+        if (mReader != null) {
+            mReader.free();
+        }
+        super.onDestroy();
+    }
+
+    private void requirePerms() {
+        String[] permissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE};
+        if (!PermissionsUtil.hasPermission(this, permissions)) {
+            PermissionsUtil.requestPermission(this, new PermissionListener() {
+                @Override
+                public void permissionGranted(@NonNull String[] permissions) {
+                    //用户授予了权限
+
+                }
+
+                @Override
+                public void permissionDenied(@NonNull String[] permissions) {
+                    //用户拒绝了申请
+                    Toast.makeText(MainActivity.this, "您拒绝了相机相关的权限,将无法使用部分功能!", Toast.LENGTH_SHORT).show();
+                }
+            }, permissions);
+        }
+    }
+
+}

+ 48 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/fragment/ProductInfo.java

@@ -0,0 +1,48 @@
+package com.zzliaoyuan.power_sensor.fragment;
+
+public class ProductInfo {
+    // 产品类型
+    public String kind;
+
+    // 型号
+    public String model;
+
+    // 用户代码
+    public String district;
+
+    // 生产厂家
+    public String manufacturer;
+
+    // 资产编号
+    public String assetID;
+
+    // 安装场所
+    public String place;
+
+    // 电压等级
+    public String voltageLevel;
+
+    // 二次绕组数量
+    public String secondWindingCount;
+
+    // 二次电压
+    public String secondVoltage;
+
+    // 一次电流
+    public String firstCurrent;
+
+    // 二次电流
+    public String senondCurrent;
+
+    // 准确等级
+    public String accuracy;
+
+    // 额定负荷
+    public String ratedLoad;
+
+    // 出厂日期
+    public String releaseDate;
+
+    // 电压因数
+    public String voltageFactor;
+}

+ 169 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/fragment/UHFReadTagFragment.java

@@ -0,0 +1,169 @@
+package com.zzliaoyuan.power_sensor.fragment;
+
+// wsdd
+import android.app.Fragment;
+
+import android.os.Bundle;
+import android.util.Log;
+
+import android.widget.TextView;
+import com.zzliaoyuan.power_sensor.MainApplication;
+import com.zzliaoyuan.power_sensor.activity.MainActivity;
+import com.zzliaoyuan.power_sensor.tools.UIHelper;
+import com.rscja.deviceapi.entity.UHFTAGInfo;
+import com.zzliaoyuan.rifdmastercore.LibCore;
+import com.zzliaoyuan.rifdmastercore.ProductInfo;
+import java.util.HashMap;
+
+public class UHFReadTagFragment {
+
+    private static UHFReadTagFragment mInstance;
+    private boolean isStart = true;
+
+    private boolean loopFlag = false;
+    private int inventoryFlag = 0;
+    private MainActivity mContext;
+
+    public static UHFReadTagFragment getInstance() {
+        if (mInstance == null) {
+            synchronized (UHFReadTagFragment.class) {
+                if (mInstance == null) {
+                    mInstance = new UHFReadTagFragment();
+                }
+            }
+        }
+
+        return mInstance;
+    }
+
+    public void setContext(MainActivity context)
+    {
+        mContext = context;
+    }
+
+
+    // wsdd userd
+    public void onCheckedChanged(int checkedId) {
+        // wsdd 选择单步,还是循环扫描
+        // 设置循环盘点同时读取 EPC、TID、USER 模式
+        mContext.mReader.setEPCAndTIDUserMode(0,6);
+        if (checkedId == 0) {
+            // 单步识别
+            inventoryFlag = 0;
+        } else if (checkedId == 1) {
+            // 单标签循环识别
+            inventoryFlag = 1;
+        }
+    }
+
+    private void readTag() {
+        // wsdd 点击开始按钮后,开始执行扫描
+        if (isStart)// 识别标签
+        {
+//            UIHelper.ToastMessage(mContext, "开始识别");
+            switch (inventoryFlag) {
+                case 0:// 单步
+                {
+                    // wsdd 单步读取的数据
+                    UHFTAGInfo strUII = mContext.mReader.inventorySingleTag();
+                    if (strUII != null) {
+                        String strTid = strUII.getTid();
+
+                        String strHex = "6a173f0fd2a140cf20204fbaa6d1c0158518031da248f306535dc6d10026a7c985671ae611afb4c151feb5712eba3d52";
+                        String key = "f1b088cbad4f07b5";
+                        byte[] szBuffer = LibCore.HexStringToByteArray(strHex);
+                        ProductInfo product = LibCore.decode(szBuffer, key);//
+
+                        String Data = "{";
+                        Data += "\"userData\":\"" + strHex + "\"";
+                        Data += ",\"assetID\":\"" + product.assetID+ "\"";
+                        Data += ",\"model\":\"" + product.model+ "\"";
+                        Data += ",\"manufacturer\":\"" + product.manufacturer+ "\"";
+                        Data += ",\"kind\":\"" + product.kind+ "\"";
+                        Data += "}";
+                        // wsdd 添加读取的数据,此处应该返回数据strEPC到RN
+                        // 返回给RN的数据格式 {"userData":"6a173f0fd2a140cf20204fbaa6d1c0158518031da248f306535dc6d10026a7c985671ae611afb4c151feb5712eba3d52","assetID":"4330012800000002178203  ","model":"002型","manufacturer":"北京***公司","kind":"电压互感器"}
+                        MainApplication.GetReactPackage().reactModule.sendMsgToRN("MsgFromAndroid", Data);
+                        mContext.playSound(1);
+                    } else {
+                        UIHelper.ToastMessage(mContext, "识别失败");
+                    }
+                }
+                break;
+                case 1:// 单标签循环  .startInventoryTag((byte) 0, (byte) 0))
+                {
+                    if (mContext.mReader.startInventoryTag()) {
+                        loopFlag = true;
+                        isStart = false;
+                        new TagThread().start();
+                    } else {
+                        mContext.mReader.stopInventory();
+                        UIHelper.ToastMessage(mContext, "开启识别标签失败");
+                    }
+                }
+                break;
+                default:
+                    break;
+            }
+        } else {// 停止识别
+            isStart = true;
+            stopInventory();
+        }
+    }
+
+    /**
+     * 停止识别
+     */
+    private void stopInventory() {
+        if (loopFlag) {
+            loopFlag = false;
+            if (mContext.mReader.stopInventory()) {
+                // wsdd 停止后,传回停止状态
+//                UIHelper.ToastMessage(mContext, "停止识别");
+            } else {
+                UIHelper.ToastMessage(mContext, "停止识别标签失败");
+            }
+        }
+    }
+
+    class TagThread extends Thread {
+        public void run() {
+            String epc;
+            String strTid;
+            String UserData;
+            UHFTAGInfo res = null;
+            while (loopFlag) {
+                res = mContext.mReader.readTagFromBuffer();
+                if (res != null) {
+//                    epc = res.getEPC();
+//                    Log.e("++++++++++", epc);
+                    strTid = res.getTid();
+//                    Log.e("==========", strTid);
+//                    UserData = res.getUser();
+//                    Log.e("----------", UserData);
+                    // wsdd  多线程,循环读取数据,此处应该返回数据epc到RN
+                    // MainApplication.GetReactPackage().reactModule.sendMsgToRN("MsgFromAndroid", strTid);
+                    mContext.playSound(1);
+                }
+                try
+                {
+                    Thread.sleep(100);//毫秒
+//                    Thread.currentThread().sleep(1000);//毫秒
+                }
+                catch(Exception e){
+                    UIHelper.ToastMessage(mContext, "读取标签异常,停止读取");
+                    stopInventory();
+                }
+            }
+        }
+    }
+
+    public void myOnKeyDwon() {
+        readTag();
+    }
+
+    public void stopRead() {
+        stopInventory();
+    }
+
+}

+ 39 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/readUHF/ReadUHFModule.java

@@ -0,0 +1,39 @@
+package com.zzliaoyuan.power_sensor.readUHF;
+
+import android.content.Context;
+
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
+import com.facebook.react.bridge.ReactMethod;
+import com.zzliaoyuan.power_sensor.fragment.UHFReadTagFragment;
+import com.zzliaoyuan.power_sensor.MainApplication;
+
+public class ReadUHFModule extends ReactContextBaseJavaModule {
+    Context context;
+    public ReadUHFModule(ReactApplicationContext reactContext) {
+        super(reactContext);
+        this.context = reactContext;
+    }
+
+    @Override
+    public String getName() {
+        return "ReadUHF";
+    }
+
+    @ReactMethod
+    public void changeFlag(Integer type) {
+        if(type == null)
+            type = 1;
+        UHFReadTagFragment.getInstance().onCheckedChanged(type);
+    }
+
+    @ReactMethod
+    public void doRead() {
+        UHFReadTagFragment.getInstance().myOnKeyDwon();
+    }
+
+    @ReactMethod
+    public void stopRead() {
+        UHFReadTagFragment.getInstance().stopRead();
+    }
+}

+ 28 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/readUHF/ReadUHFPackage.java

@@ -0,0 +1,28 @@
+package com.zzliaoyuan.power_sensor.readUHF;
+
+import com.facebook.react.ReactPackage;
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.uimanager.ViewManager;
+import com.zzliaoyuan.power_sensor.readUHF.ReadUHFModule;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ReadUHFPackage implements ReactPackage {
+
+    @Override
+    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public List<NativeModule> createNativeModules(
+            ReactApplicationContext reactContext) {
+        List<NativeModule> modules = new ArrayList<>();
+        modules.add(new ReadUHFModule(reactContext));
+        return modules;
+    }
+
+}

+ 25 - 0
android/app/src/main/java/com/zzliaoyuan/power_sensor/tools/UIHelper.java

@@ -0,0 +1,25 @@
+package com.zzliaoyuan.power_sensor.tools;
+
+import android.content.Context;
+import android.widget.Toast;
+
+public class UIHelper {
+
+	/**
+	 * 弹出Toast消息
+	 *
+	 * @param msg
+	 */
+	public static void ToastMessage(Context cont, String msg) {
+		Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
+	}
+
+	public static void ToastMessage(Context cont, int msg) {
+		Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
+	}
+
+	public static void ToastMessage(Context cont, String msg, int time) {
+		Toast.makeText(cont, msg, time).show();
+	}
+
+}

BIN
android/app/src/main/jniLibs/arm64-v8a/libcore.so


BIN
android/app/src/main/jniLibs/arm64-v8a/libcorewrapper.so


BIN
android/app/src/main/jniLibs/armeabi-v7a/libcore.so


BIN
android/app/src/main/jniLibs/armeabi-v7a/libcorewrapper.so


BIN
android/app/src/main/jniLibs/corewrapper.aar


BIN
android/app/src/main/jniLibs/x86/libcore.so


BIN
android/app/src/main/jniLibs/x86/libcorewrapper.so


BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


+ 2 - 5
android/build.gradle

@@ -2,10 +2,10 @@
 
 buildscript {
     ext {
-        buildToolsVersion = "28.0.3"
+        buildToolsVersion = "29.0.1"
         minSdkVersion = 19
         compileSdkVersion = 28
-        targetSdkVersion = 28
+        targetSdkVersion = 29
         androidXCore = "1.0.2"
     }
     repositories {
@@ -22,9 +22,6 @@ buildscript {
 
 allprojects {
     repositories {
-        flatDir {
-            dirs 'libs'
-        }
         mavenLocal()
         maven {
             // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm

+ 2 - 2
android/settings.gradle

@@ -1,5 +1,5 @@
 rootProject.name = 'power_sensor'
-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-gesture-handler'
+//project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
 apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
 include ':app'

+ 1 - 4
jscore/App.js

@@ -3,12 +3,9 @@ import React from 'react'
 import dva from './utils/dva'
 import Router, {routerMiddleware, routerReducer} from './router'
 
-import userModel from './models/user'
-import Home from './models/home'
-
 const app = dva({
     initialState: {},
-    models: [userModel, Home,],
+    models: [],
     extraReducers: {router: routerReducer},
     onAction: [routerMiddleware],
     onError(e) {

+ 0 - 30
jscore/components/Button.js

@@ -1,30 +0,0 @@
-
-import React from 'react'
-import { StyleSheet, Text } from 'react-native'
-
-import Touchable from './Touchable'
-
-export const Button = ({ title, children, style, textStyle, ...rest }) => (
-  <Touchable style={[styles.button, style]} {...rest}>
-    <Text style={[styles.text, textStyle]}>{title || children}</Text>
-  </Touchable>
-)
-
-const styles = StyleSheet.create({
-  button: {
-    paddingVertical: 6,
-    paddingHorizontal: 12,
-    borderRadius: 3,
-    backgroundColor: '#fff',
-    alignItems: 'center',
-    justifyContent: 'center',
-    borderColor: '#037aff',
-    borderWidth: StyleSheet.hairlineWidth,
-  },
-  text: {
-    fontSize: 16,
-    color: '#037aff',
-  },
-})
-
-export default Button

+ 0 - 109
jscore/components/CheckValid.js

@@ -1,109 +0,0 @@
-import {Toast} from "@ant-design/react-native";
-
-const CheckValid = (value, type) => {
-    if (type === 'ID') {
-        const aCity = {
-            11: "北京",
-            12: "天津",
-            13: "河北",
-            14: "山西",
-            15: "内蒙古",
-            21: "辽宁",
-            22: "吉林",
-            23: "黑龙江",
-            31: "上海",
-            32: "江苏",
-            33: "浙江",
-            34: "安徽",
-            35: "福建",
-            36: "江西",
-            37: "山东",
-            41: "河南",
-            42: "湖北",
-            43: "湖南",
-            44: "广东",
-            45: "广西",
-            46: "海南",
-            50: "重庆",
-            51: "四川",
-            52: "贵州",
-            53: "云南",
-            54: "西藏",
-            61: "陕西",
-            62: "甘肃",
-            63: "青海",
-            64: "宁夏",
-            65: "新疆",
-            71: "台湾",
-            81: "香港",
-            82: "澳门",
-            91: "国外"
-        }
-        let iSum = 0;
-        // 香港身份证
-        if (/^[A-Z]{1,2}[0-9]{6}\(?[0-9A]\)?$/i.test(value))
-            return true;
-
-        // 澳门身份证
-        if (/^[1|5|7][0-9]{6}\([0-9Aa]\)/i.test(value))
-            return true;
-
-        // 护照
-        if (/^[A-Z]{1,2}[0-9]{8}$/i.test(value))
-            return true;
-
-        // 台湾身份证
-        if (/^[a-zA-Z][0-9]{9}$/i.test(value))
-            return true;
-
-        if (!/^\d{17}(\d|x)$/i.test(value))
-            return false;
-
-        const sId = value.replace(/x$/i, "a");
-        if (aCity[parseInt(sId.substr(0, 2))] == null)
-            return false;
-        //return "Error:非法地区";
-
-        const sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
-        var d = new Date(sBirthday.replace(/-/g, "/"));
-        if (sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate()))
-            return false;
-        //return "Error:非法生日";
-
-        for (var i = 17; i >= 0; i--)
-            iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11)
-
-        if (iSum % 11 !== 1)
-            return false;
-        //return "Error:非法证号";
-
-        //alert(aCity[parseInt(sId.substr(0,2))]+","+sBirthday+","+(sId.substr(16,1)%2?"男":"女") );
-        //return {province:aCity[parseInt(sId.substr(0,2))],
-        //		birthday:sBirthday,
-        //		gender:(sId.substr(16,1)%2?"男":"女") };
-        return true;
-    }
-    else if (type === 'orgin') {
-        if (/[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}/g.test(value))
-            return true;
-        return false;
-    }
-    else if (type === 'tel') {
-        if (!value) {
-            return false
-        }
-        if (!/^1[3456789]\d{9}$/.test(value) && !/^([0-9]{3,4}-)?[0-9]{7,8}$/.test(value)) {
-            return false
-        }
-        return true
-    }
-    else if (type === 'num') {
-        if (parseFloat(value) < 0 || isNaN(value)){
-            return false
-        }
-        return true
-    }
-    return true
-}
-
-export default CheckValid;

+ 0 - 44
jscore/components/FormateDate.js

@@ -1,44 +0,0 @@
-const FormateDate = (date, fmt = 'YYYY-MM-DD HH:mm:ss') => {
-    if (!date) {
-        return ''
-    }
-    if (typeof date === 'string') {
-        date = new Date(date.replace(/-/g, '/'))
-    }
-    if (typeof date === 'number') {
-        date = new Date(date)
-    }
-    let o = {
-        'M+': date.getMonth() + 1,
-        'D+': date.getDate(),
-        'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12,
-        'H+': date.getHours(),
-        'm+': date.getMinutes(),
-        's+': date.getSeconds(),
-        'q+': Math.floor((date.getMonth() + 3) / 3),
-        'S': date.getMilliseconds()
-    }
-    let week = {
-        '0': '\u65e5',
-        '1': '\u4e00',
-        '2': '\u4e8c',
-        '3': '\u4e09',
-        '4': '\u56db',
-        '5': '\u4e94',
-        '6': '\u516d'
-    }
-    if (/(Y+)/.test(fmt)) {
-        fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
-    }
-    if (/(E+)/.test(fmt)) {
-        fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week[date.getDay() + ''])
-    }
-    for (var k in o) {
-        if (new RegExp('(' + k + ')').test(fmt)) {
-            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
-        }
-    }
-    return fmt
-}
-
-export default FormateDate;

+ 0 - 12
jscore/components/ResponseError.js

@@ -1,12 +0,0 @@
-import {Alert} from "react-native";
-
-const ResponseError = (response,) => {
-    Alert.alert(
-        '友情提醒',
-        response.msg ? response.msg : '当前页面出错了!',
-        [
-            {text: '我知道了', style: 'cancel'},
-        ],
-    );
-}
-export default ResponseError;

+ 0 - 7
jscore/components/Touchable.js

@@ -1,7 +0,0 @@
-import React from 'react'
-
-import { TouchableOpacity } from 'react-native'
-
-const Touchable = props => <TouchableOpacity activeOpacity={0.8} {...props} />
-
-export default Touchable

+ 2 - 3
jscore/components/index.js

@@ -1,3 +1,2 @@
-export { default as Button } from './Button'
-export { default as Touchable } from './Touchable'
-export { default as ComponentsStyles } from './ComponentsStyles'
+
+export { default as ComponentsStyles } from './ComponentsStyles'

+ 0 - 106
jscore/models/home.js

@@ -1,106 +0,0 @@
-import {queryHome, distributorFetch, fetchProductData,deliverSave,returnSave,fetchSearch} from './../services/home';
-import {createAction} from '../utils'
-import {REFRESH_STATE} from 'react-native-refresh-flatlist';
-import {NavigationActions} from "react-navigation";
-import {Alert} from "react-native";
-
-export default {
-    namespace: 'home',
-    state: {
-        refreshState: REFRESH_STATE.Ready,
-        list: [],
-        searchState: 0,
-        searchData: {},
-        searchNoData: {},
-        searchRState: REFRESH_STATE.Ready,
-        searchDistData: [],
-        searchProductData: {},
-    },
-
-    effects: {
-        * fetch({payload}, {call, put}) {
-            yield put(createAction('queryList')({refreshState: REFRESH_STATE.HeaderRefreshing}));
-            const response = yield call(queryHome, payload);
-            if (response == undefined || response.code == 1001) {
-                yield put(NavigationActions.navigate({routeName: 'Login'}))
-            } else {
-                yield put(createAction('queryList')({list: response.data, refreshState: REFRESH_STATE.Idle}));
-            }
-        },
-        * search({payload, callback}, {call, put}) {
-            const response = yield call(fetchSearch, payload);
-            if(response.code == 0) {
-                if (response.data) {
-                    callback({searchData: response.data, searchState: 1})
-                } else {
-                    callback({searchData: {}, searchState: 2})
-                }
-            }else {
-                Alert.alert('提示', response.msg);
-            }
-        },
-        * fetchProductData({payload,callback}, {call, put}) {
-            const response = yield call(fetchProductData, payload);
-            if (response.code == 0) {
-                if (response.data) {
-                    if(callback){
-                        callback(response.data)
-                    }
-                    yield put(createAction('queryList')({searchProductData: response.data,}));
-                }
-                else {
-                    // Alert.alert('提示', '未查询到产品!');
-                    yield put(createAction('queryList')({searchProductData: {},}));
-                }
-            } else {
-                Alert.alert('提示', response.msg);
-            }
-        },
-        * searchDist({payload}, {call, put}) {
-            yield put(createAction('queryList')({searchRState: REFRESH_STATE.HeaderRefreshing}));
-            const response = yield call(distributorFetch, payload);
-            if (response.code == 0) {
-                yield put(createAction('queryList')({
-                    searchDistData: response.data,
-                    searchRState: REFRESH_STATE.Idle,
-                }));
-            }
-            else {
-                Alert.alert('提示', response.msg);
-            }
-        },
-        * clear({}, {call, put}) {
-            yield put(createAction('updateState')({
-                searchDistData: [],
-                searchProductData: {},
-                searchState: 0,
-            }));
-        },
-        * deliverSave({payload, callback}, {call, put}) {
-            const response = yield call(deliverSave, payload);
-            if (response.code == 0) {
-                callback(response.data ?? {})
-            } else {
-                Alert.alert('提示', response.msg);
-            }
-        },
-        * returnSave({payload, callback}, {call, put}) {
-            const response = yield call(returnSave, payload);
-            if (response.code == 0) {
-                callback(response.data ?? {})
-            } else {
-                Alert.alert('提示', response.msg);
-            }
-        },
-    },
-
-    reducers: {
-        queryList(state, {payload}) {
-            // console.log('queryList', state, payload);
-            return {...state, ...payload};
-        },
-        updateState(state, {payload}) {
-            return {...state, ...payload};
-        },
-    },
-};

+ 0 - 65
jscore/models/user.js

@@ -1,65 +0,0 @@
-import {createAction, NavigationActions,} from '../utils'
-import SyncStorage from 'sync-storage';
-import * as authService from '../services/user'
-import {REFRESH_STATE} from "react-native-refresh-flatlist";
-import {Alert} from 'react-native';
-
-export default {
-    namespace: 'auth',
-    state: {
-        loading: false,
-        userData: {},
-    },
-    reducers: {
-        updateState(state, {payload}) {
-            return {...state, ...payload}
-        },
-        queryList(state, {payload}) {
-            return {...state, ...payload}
-        },
-    },
-    effects: {
-        * login({payload}, {call, put}) {
-            yield put(createAction('updateState')({loading: true}))
-            const result = yield call(authService.login, payload)
-            if (result.code == 0) {
-                yield put(createAction('updateState')({userData: result.data, loading: false,}))
-                SyncStorage.set('credential', result.data);
-                yield put(NavigationActions.navigate({routeName: 'DesktopHome'}))
-            } else {
-                Alert.alert('提示', result.msg);
-                yield put(createAction('updateState')({loading: false}))
-            }
-        },
-        * logout(action, {call, put}) {
-            yield put(createAction('updateState')({loading: false}));
-            SyncStorage.remove('credential');
-            yield put(NavigationActions.navigate({routeName: 'Login'}))
-        },
-        * tokenRefresh({payload, callback, unLogin}, {call, put}) {
-            const result = yield call(authService.tokenRefresh, payload.token);
-            if (result.code === 0) {
-                SyncStorage.set('credential', result.data);
-                if (callback) {
-                    callback()
-                }
-                yield put(createAction('updateState')({userData: result.data}))
-            } else {
-                SyncStorage.remove('credential');
-                unLogin()
-            }
-            // if (result.code == 0) {
-            //     credential['token'] = result.data.token
-            //     SyncStorage.set('credential', credential);
-            //     yield put(createAction('updateState')({userData: credential}))
-            //     yield put(NavigationActions.navigate({routeName: 'DesktopHome'}))
-            // }
-
-        },
-    },
-    subscriptions: {
-        setup({dispatch}) {
-            //dispatch({ type: 'loadStorage' })
-        },
-    },
-}

+ 0 - 293
jscore/pages/Desktop/Deliver.js

@@ -1,293 +0,0 @@
-import React, {Component} from 'react';
-import {
-    StyleSheet,
-    View,
-    Text,
-    Alert,
-    ScrollView,
-    TextInput,
-    TouchableOpacity
-} from 'react-native';
-
-import {WhiteSpace, List, SwipeAction, InputItem, Modal, Provider, Toast} from '@ant-design/react-native';
-
-import {createAction} from "../../utils";
-import {connect} from 'react-redux'
-import {Button} from "../../components";
-
-let productItems = []
-let productDatas = []
-
-@connect(home => ({...home}))
-class DeliverHome extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            notes: '',
-            distributor: '',
-            distributor_name: '',
-            type: this.props.navigation.state.params.type,
-            productDatas: [],
-            no: '',
-            total: 0,
-        };
-    }
-
-    componentDidMount() {
-        // this._fetchData()
-    }
-
-    componentWillUnmount() {
-        productItems = []
-        productDatas = []
-    }
-
-    _delete = (product_id, no) => {
-        for (let i in productDatas) {
-            if (productDatas[i].product_id == product_id && productDatas[i].no == no) {
-                this.state.total -= parseInt(productDatas[i].count)
-                productDatas.splice(i, 1)
-                productItems.splice(i, 1)
-            }
-        }
-        this.setState({
-            total: this.state.total,
-        })
-    }
-    _addProduct = (data) => {
-        const start_no_show = data.no.toUpperCase()
-        const start_no = start_no_show.slice(data.cross_code.length,)
-        const start_no_len = start_no.length
-
-        let end_no = parseInt(start_no) + parseInt(data.count) - 1
-        const end_no_len = end_no.toString().length
-        //终止窜货号前面补零
-        let zero = ''
-        for (let i = 0; i < start_no_len - end_no_len; i++) {
-            zero += '0';
-        }
-        end_no = data.cross_code + zero + end_no.toString()
-        // 防止重复扫描
-        for (let i in productDatas) {
-            if (productDatas[i].product_id == data.product_id && productDatas[i].no == data.no) {
-                this.state.total -= parseInt(productDatas[i].count)
-                productDatas.splice(i, 1)
-                productItems.splice(i, 1)
-            }
-        }
-        productDatas.push(
-            {product_id: data.product_id, return_count: data.count, count: data.count, start_num: start_no, no: data.no}
-        )
-        const count = this.state.total + parseInt(data.count)
-        this.setState({total: count, no: ''})
-        const right = [
-            {
-                text: '删除',
-                onPress: () => this._delete(data.product_id, data.no),
-                style: {backgroundColor: '#ff3d27', color: 'white'},
-            },
-        ];
-        productItems.push(
-            <View key={data.product_id} style={styles.cellContainer}>
-                <SwipeAction
-                    autoClose
-                    style={{backgroundColor: 'transparent'}}
-                    right={right}
-                >
-                    <TouchableOpacity onPress={() => this.props.navigation.navigate("DeliverAdd", {
-                        data: data,
-                        callback: this._addProduct
-                    })}>
-                        <View style={styles.rowPadding3}>
-                            <View style={styles.left}>
-                                <Text style={styles.blackText}>{data.name}</Text>
-                            </View>
-                            <Text style={styles.blackText}>数量:{data.count}</Text>
-                        </View>
-                        <View style={styles.rowPadding3}>
-                            <View style={styles.left}>
-                                <Text style={styles.blackText}>起始:{start_no_show}</Text>
-                            </View>
-                            <Text style={styles.blackText}>终止:{end_no}</Text>
-                        </View>
-                    </TouchableOpacity>
-                </SwipeAction>
-            </View>
-        )
-
-    }
-    _onSave = () => {
-        const type = this.props.navigation.state.params.type
-        if (this.state.distributor == '') {
-            Alert.alert('提示', "请选择经销商!");
-            return
-        }
-        if (productDatas.length == 0) {
-            Alert.alert('提示', "请添加产品!");
-            return
-        }
-        const save_data = {
-            "distributor": this.state.distributor,
-            "notes": this.state.notes,
-            "details": JSON.stringify(productDatas),
-            "save_type": 'code',
-        }
-        if (type == 'Deliver') {
-            this.props.dispatch({
-                type: 'home/deliverSave',
-                payload: save_data,
-                callback: (data) => {
-                    if(data.msg){
-                        Alert.alert('提示', data.msg);
-                    }
-                    this.props.navigation.goBack();
-                },
-            });
-        } else {
-            this.props.dispatch({
-                type: 'home/returnSave',
-                payload: save_data,
-                callback: (data) => {
-                    if(data.msg){
-                        Alert.alert('提示', data.msg);
-                    }
-                    this.props.navigation.goBack();
-                },
-            });
-        }
-    }
-    _searchNo = (value) => {
-        this.setState({no: value})
-        if (value) {
-            this.props.dispatch({
-                type: 'home/fetchProductData',
-                payload: {
-                    cross_code: value,
-                },
-                callback: (data) => {
-                    const item = {
-                        no: value,
-                        count: '1',
-                        name: data.name,
-                        cross_code: data.cross_code,
-                        product_id: data.id,
-                    }
-                    this._addProduct(item)
-                    // this.setState({no: ''})
-                    // Toast.info('扫码成功',1)
-                }
-            })
-        }
-    }
-
-    render() {
-        return (
-            <View style={{flex: 1}}>
-                <Provider>
-                    <ScrollView style={{flex: 1}}>
-                        <WhiteSpace/>
-                        <List>
-                            <List.Item extra={this.state.distributor_name} arrow="horizontal"
-                                       multipleLine={true} wrap={true}
-                                       onPress={() => this.props.navigation.navigate('SearchDistributor',
-                                           {
-                                               callback: (data) => this.setState({
-                                                   distributor_name: data.name,
-                                                   distributor: data.id
-                                               })
-                                           }
-                                       )}><Text style={styles.redText}>经销商</Text></List.Item>
-
-                            <InputItem
-                                clear
-                                placeholder="请输入"
-                                value={this.state.notes}
-                                onChange={value => {
-                                    this.setState({
-                                        notes: value,
-                                    });
-                                }}
-                            ><Text style={{fontSize: 17, color: '#333'}}>备注</Text></InputItem>
-                        </List>
-                        <View style={{borderTopWidth: 5, borderTopColor: '#eee'}}>
-                            <TextInput placeholder="请输入防窜货号" style={styles.input}
-                                       value={this.state.no}
-                                       autoFocus={true}
-                                       onChangeText={value => this._searchNo(value)}></TextInput>
-                        </View>
-                        {productItems}
-                    </ScrollView>
-                </Provider>
-                <View style={{
-                    backgroundColor: '#eee', height: 20, justifyContent: 'flex-end',
-                    flexDirection: 'row', paddingRight: 10
-                }}>
-                    <Text style={{fontSize: 14, textAlignVertical: 'center'}}>总数量:{this.state.total}</Text></View>
-                <View style={{flexDirection: 'row', height: 40}}>
-                    <Button onPress={() =>
-                        this.props.navigation.navigate("DeliverAdd", {
-                            callback: this._addProduct
-                        })
-                    }
-                            textStyle={{color: 'white'}} style={{
-                        flex: 1,
-                        borderRadius: 0,
-                        borderWidth: 0,
-                        backgroundColor: '#0099FF',
-                        color: '#fff'
-                    }} title='批量添加'/>
-                    <Button onPress={() => Alert.alert(
-                        '提示',
-                        '确定要保存吗?',
-                        [
-                            {text: '确定', onPress: () => this._onSave()},
-                            {text: '取消'},
-                        ]
-                    )} textStyle={{color: 'white'}} style={{
-                        flex: 1,
-                        borderRadius: 0,
-                        borderWidth: 0,
-                        backgroundColor: '#7DBEFF',
-                        color: '#fff'
-                    }} title='保存'/>
-
-                </View>
-            </View>
-        );
-    }
-}
-
-const styles = StyleSheet.create({
-    input: {
-        borderBottomWidth: 1,
-        borderBottomColor: '#eee',
-        marginBottom: 15
-    },
-    redText: {
-        color: 'red',
-        fontSize: 15,
-    },
-    cellContainer: {
-        paddingVertical: 5,
-        paddingHorizontal: 5,
-        borderBottomWidth: 1,
-        borderColor: '#eee',
-        marginHorizontal: 5,
-        overflow: 'hidden'
-
-    },
-    rowPadding3: {
-        flexDirection: 'row',
-        padding: 3,
-    },
-    left: {
-        flex: 3,
-        flexDirection: 'row',
-    },
-    blackText: {
-        color: '#333',
-        fontSize: 14,
-    },
-})
-
-export default DeliverHome;

+ 0 - 123
jscore/pages/Desktop/DeliverAdd.js

@@ -1,123 +0,0 @@
-import React, {Component} from 'react';
-import {View, Text, StyleSheet, Dimensions, Alert} from 'react-native';
-import {connect} from 'react-redux'
-import {createAction} from '../../utils/'
-import {Button, List, InputItem, Toast, WhiteSpace, Picker, Provider} from "@ant-design/react-native";
-
-@connect(home => ({...home}))
-class DeliverAdd extends Component {
-    constructor(props) {
-        super(props);
-        let data = {}
-        if (this.props.navigation.state.params.data) {
-            data = this.props.navigation.state.params.data
-        }
-        this.state = {
-            no: data.no,
-            count: data.count,
-            name: data.name,
-            cross_code: data.cross_code,
-            product_id: data.product_id,
-
-        };
-    }
-
-    componentDidMount() {
-        //this._fetchSelect();
-        if(this.state.no) {
-            this._searchNo(this.state.no)
-        }
-
-    }
-
-    componentWillUnmount() {
-        this.props.dispatch({
-            type: 'home/clear'
-        });
-    }
-
-    onSave = () => {
-        if (!this.state.no) {
-            Toast.info('请输入防窜货号', 1)
-            return
-        }
-        if (!this.state.product_id) {
-            Toast.info('未查询到防窜货号', 1)
-            return
-        }
-        if (this.state.count == '' || this.state.count == null) {
-            Toast.info('请填写数量', 1)
-            return
-        }
-        const {goBack, state} = this.props.navigation;
-        //在页面返回,卸载时,将上个页面的方法取到,并回传参数,这样回传的参数会重走render方法
-        state.params.callback(this.state);
-        goBack();
-
-        //this.props.dispatch(createAction('part_new/editParts')(this.state))
-    }
-    _searchNo = (value) => {
-        if (value) {
-            this.props.dispatch(createAction('home/fetchProductData')({cross_code: value}))
-            this.setState({no: value})
-        } else {
-            Toast.info("请输入防窜货号!", 1)
-        }
-    }
-
-    render() {
-        const {searchProductData} = this.props.home;
-
-        this.state.name = searchProductData.name
-        this.state.cross_code = searchProductData.cross_code
-        this.state.product_id = searchProductData.id
-
-        return (
-            <Provider>
-                <WhiteSpace/>
-                <List>
-                    <InputItem
-                        clear
-                        // extra={<Button onPress={this._searchNo}
-                        //                type="primary"
-                        //                size="small"
-                        // >查询</Button>}
-                        value={this.state.no}
-                        onChange={value => this._searchNo(value)}
-                    ><Text style={styles.redText}>防窜货号</Text></InputItem>
-                    <InputItem
-                        clear
-                        type={"number"}
-                        value={this.state.count}
-                        onChange={value => {
-                            this.setState({
-                                count: value,
-                            });
-                        }}
-                    ><Text style={styles.redText}>数量</Text></InputItem>
-
-                    <List.Item extra={this.state.name} style={styles.text}>产品名称</List.Item>
-                    <List.Item>
-                        <Button
-                            type="primary"
-                            loading={false}
-                            onPress={this.onSave}
-                        >保存</Button>
-                    </List.Item>
-                </List>
-            </Provider>
-        )
-    }
-}
-
-const styles = StyleSheet.create({
-    text: {
-        color: '#333'
-    },
-    redText: {
-        color: 'red',
-        fontSize: 16,
-    },
-})
-
-export default DeliverAdd

+ 37 - 107
jscore/pages/Desktop/Home.js

@@ -1,135 +1,65 @@
 import React, {Component} from 'react';
-import {StyleSheet, View, Text, DeviceEventEmitter, TouchableOpacity, ToastAndroid, StatusBar} from 'react-native';
-import {FlatGrid} from 'react-native-super-grid';
-import {Badge,} from "@ant-design/react-native";
-
-import {createAction} from "../../utils";
-import {connect} from 'react-redux'
+import {StyleSheet, View, Text, DeviceEventEmitter, TouchableOpacity, ToastAndroid} from 'react-native';
+import {Button} from '@ant-design/react-native';
 import ReadUHF from "../../utils/ReadUHF";
-@connect(home => ({...home}))
-@connect(auth => ({...auth}))
+
 class DesktopHome extends Component {
     constructor(props) {
         super(props);
-        const {refreshState} = this.props.home
         this.state = {
-            refreshState: refreshState,
+            data: [3, 4, 5],
         };
     }
 
     componentDidMount() {
-        this._fetchData();
+        ReadUHF.changeFlag(0)
+        DeviceEventEmitter.addListener('MsgFromAndroid', this._addCode);
+    }
+
+    componentWillUnmount() {
+        ReadUHF.stopRead()
     }
 
-    _fetchData = () => {
-        // this.props.dispatch(createAction('auth/tokenRefresh')());
+    _addCode = (item) => {
+        console.log(111111111111,item)
+        // let str = '{"userData":"6a173f0fd2a140cf20204fbaa6d1c0158518031da248f306535dc6d10026a7c985671ae611afb4c151feb5712eba3d52",' +
+        //     '"assetID":"4330012800000002178203"  ,"model":"002型","manufacturer":"北京公司","kind":"电压互感器"}'
+        // let str = '{"name": "cxh", "sex": "man" }';
+        // console.log(2333333333,str)
+        const str = JSON.parse(item)
+        console.log(22222222222,str, str['kind'])
+        let {data} = this.state;
+        data.push(item)
+        this.setState({data})
     }
-    _logout = () => {
-        this.props.dispatch(createAction('auth/logout')());
+    _start = () => {
+        let {isStart} = this.state;
+        ReadUHF.doRead()
+        this.setState({isStart: !isStart})
     }
 
     render() {
-        const {list, refreshState} = this.props.home
-        const {userData} = this.props.auth
-        const items = [
-            {
-                "icon": "\ue600",
-                "title": "出库",
-                "key": "3_1",
-                "stack": "DeliverHome",
-                "type": "Deliver",
 
-            },
-            {
-                "icon": "\ue601",
-                "title": "退货",
-                "key": "3_2",
-                "stack": "ReturnHome",
-                "type": "Return",
-            }, {
-                "icon": "\ue645",
-                "title": "窜货查询",
-                "key": "3_3",
-                "stack": "SearchHome"
-            },
-            {
-                "icon": "\ue600",
-                "title": "射频出库",
-                "key": "3_4",
-                "stack": "UHFDeliver",
-                "type": "Deliver",
-            },
-            {
-                "icon": "\ue601",
-                "title": "射频退货",
-                "key": "3_5",
-                "stack": "UHFReturn",
-                "type": "Return",
-            },
-        ]
         return (
             <View style={styles.container}>
+                {
+                    this.state.data.map((item, index) => {
 
-                <FlatGrid
-                    style={styles.gridView}
-                    itemDimension={120}
-                    spacing={0}
-                    items={items}
-                    renderItem={({item}) => <ItemGrid name={item.title} icon={item.icon}
-                                                      navigation={this.props.navigation} stack={item.stack} type={item.type}
-                    />}
-                />
-
-                <View style={styles.userContainer}>
-                    <Text style={styles.userImg}>{"\ue602"}</Text>
-
-                    <View style={styles.userInfo}>
-                        <Text style={styles.userInfoText}>账号:{userData.username}</Text>
-                        <Text style={styles.userInfoText}>姓名:{userData.name}</Text>
-                    </View>
-
-                    <View style={styles.loginOut}>
-                        <TouchableOpacity onPress={() => this._logout()}>
-                            <Text style={styles.loginOutText}>注销登录</Text>
-                        </TouchableOpacity>
-                    </View>
-                </View>
+                        return (
+                            <Text key={index}>{item}</Text>
+                        )
+                    })
+                }
+                <Button onPress={() => this._start()}
+                        type="primary"
+                >
+                    开始
+                </Button>
             </View>
         );
     }
 }
 
-class ItemGrid extends Component {
-    constructor(props) {
-        super(props);
-    }
-
-    doPress=()=>{
-        DeviceEventEmitter.emit("MsgFromAndroid", {msg:'aaaa'});
-        ReadUHF.changeFlag(1)
-        ReadUHF.doRead()
-    }
-
-    render() {
-        return (
-            <View style={styles.itemContainer}>
-                <TouchableOpacity
-                    onPress={() => this.props.navigation.navigate(this.props.stack,{type:this.props.type})}>
-                    {/*onPress={() => this.doPress()}>*/}
-                    <View>
-                        <Badge text={this.props.tips} size='small'>
-                            <Text style={styles.iconFont}>{this.props.icon}</Text>
-                            <View>
-                                <Text style={styles.sizeFont}>{this.props.name}</Text>
-                            </View>
-                        </Badge>
-                    </View>
-                </TouchableOpacity>
-            </View>
-        )
-    }
-}
-
 const styles = StyleSheet.create({
     container: {
         flex: 1

+ 0 - 47
jscore/pages/Desktop/Index.js

@@ -4,11 +4,6 @@ import { Platform } from 'react-native'
 import { createStackNavigator } from 'react-navigation'
 
 import DesktopHome from './Home'
-import SearchHome from './Search'
-import DeliverHome from './Deliver'
-import DeliverAdd from './DeliverAdd'
-import SearchDistributor from './SearchDistributor'
-import UHFDeliver from './UHFDeliver'
 
 const TITLE_OFFSET = Platform.OS === 'ios' ? 70 : 56;
 
@@ -19,48 +14,6 @@ const HomeStack = createStackNavigator({
             title: '电金睛'
         },
     },
-    SearchHome: {
-        screen: SearchHome,
-        navigationOptions: {
-            title: '窜货查询'
-        },
-    },
-    DeliverHome: {
-        screen: DeliverHome,
-        navigationOptions: {
-            title: '出库'
-        },
-    },
-    DeliverAdd: {
-        screen: DeliverAdd,
-        navigationOptions: {
-            title: '批量添加'
-        },
-    },
-    ReturnHome: {
-        screen: DeliverHome,
-        navigationOptions: {
-            title: '退货'
-        },
-    },
-    SearchDistributor: {
-        screen: SearchDistributor,
-        navigationOptions: {
-            title: '查询经销商'
-        },
-    },
-    UHFDeliver: {
-        screen: UHFDeliver,
-        navigationOptions: {
-            title: '射频出库'
-        },
-    },
-    UHFReturn: {
-        screen: UHFDeliver,
-        navigationOptions: {
-            title: '射频退货'
-        },
-    },
 },
 {
     defaultNavigationOptions: {

+ 0 - 120
jscore/pages/Desktop/Search.js

@@ -1,120 +0,0 @@
-import React, {Component} from 'react';
-import {
-    StyleSheet,
-    View,
-    Text,
-    DeviceEventEmitter, TextInput,
-} from 'react-native';
-
-import {SearchBar, List,} from '@ant-design/react-native';
-
-import ReadUHF from "../../utils/ReadUHF";
-import {connect} from 'react-redux'
-import {Button} from "../../components";
-
-@connect(home => ({...home}))
-class SearchHome extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            value: '',
-            no: '',
-            searchData: {},
-            searchState: 0,
-        };
-    }
-
-    componentDidMount() {
-        ReadUHF.changeFlag(0)
-        DeviceEventEmitter.addListener('MsgFromAndroid', this._onSearch);
-    }
-
-    componentWillUnmount() {
-        ReadUHF.stopRead()
-    }
-
-    componentWillUnmount() {
-        this.props.dispatch({
-            type: 'home/clear'
-        });
-    }
-
-    _onSearch = (value) => {
-        this.props.dispatch({
-            type: 'home/search',
-            payload: {
-                cross_code: value,
-            },
-            callback: (data) => {
-                if (data.searchState === 1) {
-                    this.setState({searchData: data.searchData, searchState: data.searchState, value: value, no: '',})
-                } else {
-                    this.setState({
-                        searchData: data.searchData,
-                        searchState: data.searchState,
-                        value: value,
-                        no: value,
-                    })
-                }
-            }
-        })
-        this.setState({no: value,})
-    }
-    _cancel = () => {
-        this.props.dispatch({
-            type: 'home/clear'
-        });
-        this.setState({value: ''});
-    };
-    _start = () => {
-        ReadUHF.doRead()
-    }
-
-    render() {
-        const {searchData, searchState,} = this.state;
-
-        return (
-            <View style={{flex: 1}}>
-                {/*搜索*/}
-                <View style={{borderBottomWidth: 5, borderBottomColor: '#eee'}}>
-                    <TextInput placeholder="请输入防窜货号" style={styles.input}
-                               value={this.state.no}
-                               autoFocus={true}
-                               onChangeText={value => this._onSearch(value)}>
-                    </TextInput>
-                </View>
-                <View style={searchState == 2 ? {padding: 10} : styles.hide}>
-                    <Text>未查询到该编码 {this.state.value} </Text>
-                </View>
-                <View style={searchState == 1 ? {} : styles.hide}>
-                    <List>
-                        <List.Item extra={this.state.value}>编码</List.Item>
-                        <List.Item extra={searchData.product_name}>产品</List.Item>
-                        <List.Item extra={searchData.distributor_name}>分销商</List.Item>
-                        <List.Item extra={searchData.create_time}>出库时间</List.Item>
-                        <List.Item extra={searchData.create_user_text}>出库人</List.Item>
-                        <List.Item extra={searchData.check_time}>审核时间</List.Item>
-                        <List.Item extra={searchData.check_user_text}>审核人</List.Item>
-                    </List>
-                </View>
-                <Button onPress={() => this._start()}
-                        textStyle={{color: 'white'}}
-                        style={{
-                            marginTop: 30,
-                            borderRadius: 0,
-                            borderWidth: 0,
-                            backgroundColor: '#0099FF',
-                            color: '#fff'
-                        }} title="开始识别"/>
-            </View>
-        );
-    }
-}
-
-const styles = StyleSheet.create({
-    hide: {
-        display: 'none',
-    },
-})
-
-export default SearchHome;

+ 0 - 88
jscore/pages/Desktop/SearchDistributor.js

@@ -1,88 +0,0 @@
-import React, {Component} from 'react';
-import {
-    View,
-    Text,
-} from 'react-native';
-
-import {SearchBar, List,} from '@ant-design/react-native';
-
-import {createAction} from "../../utils";
-import {connect} from 'react-redux'
-import RefreshFlatList from "react-native-refresh-flatlist";
-
-@connect(home => ({...home}))
-class SearchDistributor extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            hide: false,
-        };
-    }
-
-    componentDidMount() {
-        //this._fetchData()
-    }
-
-    componentWillUnmount() {
-        this.props.dispatch({
-            type: 'home/clear'
-        });
-    }
-
-    _onChange = (value) => {
-        if (value) {
-            this.props.dispatch(createAction('home/searchDist')({keyword: value}));
-            this.setState({value: value, hide: false,})
-        } else {
-            this.setState({value: '', hide: true,})
-        }
-    }
-
-    _searchDataPress = (id, name) => {
-        const {goBack, state} = this.props.navigation;
-        //在页面返回,卸载时,将上个页面的方法取到,并回传参数,这样回传的参数会重走render方法
-        state.params.callback({id: id, name: name});
-        goBack();
-    }
-    _keyExtractor = (item, index) => item.id.toString();
-    _renderItem = (data) => {
-        const item = data.item;
-        const dist = item.name + ' - ' + item.tel + ' - ' + item.notes
-        return (
-            <List.Item key={item.id} wrap={true}
-                       thumb={<Text style={{fontFamily: 'iconfont', paddingRight: 3}}>{'\ue645'}</Text>}
-                       onPress={() => this._searchDataPress(item.id, item.name)}>{dist}</List.Item>
-        );
-
-    }
-
-    render() {
-        const {searchDistData, searchRState,} = this.props.home;
-
-        return (
-            <View style={{flex: 1}}>
-                {/*搜索*/}
-                <SearchBar placeholder="搜索" showCancelButton
-                           cancelText='搜索'
-                           value={this.state.value}
-                           onCancel={(value) => this._onChange(value)}
-                           onSubmit={(value) => this._onChange(value)}
-                           onChange={(value) => this._onChange(value)}
-                />
-
-                <View style={this.state.hide ? {display: 'none',} : {}}>
-                    <RefreshFlatList
-                        data={searchDistData}
-                        renderItem={this._renderItem}
-                        keyExtractor={this._keyExtractor}
-                        refreshState={searchRState}
-                        ItemSeparatorComponent={() => <View style={{height: 0}}/>}
-                        ListHeaderComponent={() => <View style={{height: 0}}/>}
-                    />
-                </View>
-            </View>
-        );
-    }
-}
-
-export default SearchDistributor;

+ 0 - 224
jscore/pages/Desktop/UHFDeliver.js

@@ -1,224 +0,0 @@
-import React, {Component} from 'react';
-import {
-    StyleSheet,
-    View,
-    Text,
-    ScrollView,
-    Alert,
-    DeviceEventEmitter
-} from 'react-native';
-
-import {WhiteSpace, List, InputItem, Provider, Toast} from '@ant-design/react-native';
-
-import {connect} from 'react-redux'
-import {Button} from "../../components";
-import ReadUHF from "../../utils/ReadUHF";
-
-@connect(home => ({...home}))
-class UHFDeliver extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            notes: '',
-            distributor: '',
-            distributor_name: '',
-            type: this.props.navigation.state.params.type,
-            no: '',
-            total: 0,
-            isStart: true,
-            productDatas: [],
-        };
-    }
-
-    componentDidMount() {
-        ReadUHF.changeFlag(1)
-        DeviceEventEmitter.addListener('MsgFromAndroid', this._addProduct);
-        DeviceEventEmitter.addListener('onKeyDown', this.onKeyDown);
-    }
-
-    componentWillUnmount() {
-        ReadUHF.stopRead()
-    }
-
-    _addProduct = (start_no) => {
-        // 防止重复扫描
-        let {productDatas} = this.state;
-        const product_index = productDatas.indexOf(start_no)
-        if (product_index < 0) {
-            productDatas.push(start_no)
-            this.setState({total: productDatas.length, productDatas})
-        }
-    }
-    _onSave = () => {
-        const type = this.props.navigation.state.params.type
-        if (this.state.distributor == '') {
-            Alert.alert('提示', "请选择经销商!");
-            return
-        }
-        if (this.state.productDatas.length == 0) {
-            Alert.alert('提示', "请添加产品!");
-            return
-        }
-        const save_data = {
-            "distributor": this.state.distributor,
-            "notes": this.state.notes,
-            "details": JSON.stringify(this.state.productDatas),
-            "save_type": 'UHF',
-        }
-        if (type == 'Deliver') {
-            this.props.dispatch({
-                type: 'home/deliverSave',
-                payload: save_data,
-                callback: (data) => {
-                    if (data.msg) {
-                        Alert.alert('提示', data.msg);
-                    }
-                    this.props.navigation.goBack();
-
-                },
-            });
-        } else {
-            this.props.dispatch({
-                type: 'home/returnSave',
-                payload: save_data,
-                callback: (data) => {
-                    if (data.msg) {
-                        Alert.alert('提示', data.msg);
-                    }
-                    this.props.navigation.goBack();
-                },
-            });
-        }
-    }
-
-    _start = () => {
-        let {isStart} = this.state;
-        ReadUHF.doRead()
-        this.setState({isStart: !isStart})
-    }
-
-    onKeyDown = () => {
-        let {isStart} = this.state;
-        this.setState({isStart: !isStart})
-    }
-
-    render() {
-        let {isStart} = this.state;
-        const start_text = isStart ? '开始识别' : '停止识别'
-        return (
-            <View style={{flex: 1}}>
-                <Provider>
-                    <ScrollView style={{flex: 1}}>
-                        <WhiteSpace/>
-                        <List>
-                            <List.Item extra={this.state.distributor_name} arrow="horizontal"
-                                       multipleLine={true} wrap={true}
-                                       onPress={() => this.props.navigation.navigate('SearchDistributor',
-                                           {
-                                               callback: (data) => this.setState({
-                                                   distributor_name: data.name,
-                                                   distributor: data.id
-                                               })
-                                           }
-                                       )}><Text style={styles.redText}>经销商</Text></List.Item>
-
-                            <InputItem
-                                clear
-                                placeholder="请输入"
-                                value={this.state.notes}
-                                onChange={value => {
-                                    this.setState({
-                                        notes: value,
-                                    });
-                                }}
-                            ><Text style={{fontSize: 17, color: '#333'}}>备注</Text>
-                            </InputItem>
-                        </List>
-                        {this.state.productDatas.map((item, index) => (
-                            <View key={index} style={styles.cellContainer}>
-
-                                <View style={styles.rowPadding3}>
-                                    <View style={styles.left}>
-                                        <Text style={styles.blackText}>鞋子</Text>
-                                    </View>
-                                    <Text style={styles.blackText}>数量:1</Text>
-                                </View>
-                                <View style={styles.rowPadding3}>
-                                    <View style={styles.left}>
-                                        <Text style={styles.blackText}>编号:{item}</Text>
-                                    </View>
-                                </View>
-                            </View>
-                        ))}
-                    </ScrollView>
-                </Provider>
-                <View style={{
-                    backgroundColor: '#eee', height: 20, justifyContent: 'flex-end',
-                    flexDirection: 'row', paddingRight: 10
-                }}>
-                    <Text style={{fontSize: 14, textAlignVertical: 'center'}}>总数量:{this.state.total}</Text></View>
-                <View style={{flexDirection: 'row', height: 40}}>
-                    <Button onPress={() => this._start()}
-                            textStyle={{color: 'white'}}
-                            style={{
-                                flex: 1,
-                                borderRadius: 0,
-                                borderWidth: 0,
-                                backgroundColor: isStart ? '#0099FF' : 'red',
-                                color: '#fff'
-                            }} title={start_text}/>
-                    <Button onPress={() => Alert.alert(
-                        '提示',
-                        '确定要保存吗?',
-                        [
-                            {text: '确定', onPress: () => this._onSave()},
-                            {text: '取消'},
-                        ]
-                    )} textStyle={{color: 'white'}} style={{
-                        flex: 1,
-                        borderRadius: 0,
-                        borderWidth: 0,
-                        backgroundColor: '#7DBEFF',
-                        color: '#fff'
-                    }} title='保存'/>
-
-                </View>
-            </View>
-        );
-    }
-}
-
-const styles = StyleSheet.create({
-    input: {
-        borderBottomWidth: 1,
-        borderBottomColor: '#eee',
-        marginBottom: 15
-    },
-    redText: {
-        color: 'red',
-        fontSize: 15,
-    },
-    cellContainer: {
-        paddingVertical: 5,
-        paddingHorizontal: 5,
-        borderBottomWidth: 1,
-        borderColor: '#eee',
-        marginHorizontal: 5,
-        overflow: 'hidden'
-
-    },
-    rowPadding3: {
-        flexDirection: 'row',
-        padding: 3,
-    },
-    left: {
-        flex: 3,
-        flexDirection: 'row',
-    },
-    blackText: {
-        color: '#333',
-        fontSize: 14,
-    },
-})
-
-export default UHFDeliver;

+ 0 - 53
jscore/pages/Outside/Index.js

@@ -1,53 +0,0 @@
-'use strict'
-import React, { Component } from 'react'
-import { Platform } from 'react-native'
-import { createStackNavigator } from 'react-navigation'
-
-import Login from './Login'
-
-const TITLE_OFFSET = Platform.OS === 'ios' ? 70 : 56;
-
-const Outside = createStackNavigator({
-    Login: {
-       screen: Login,
-       navigationOptions: {
-           title: '电金睛'
-       }
-    },
-},
-{
-    defaultNavigationOptions: {
-        headerStyle: {
-            backgroundColor: "#5394e4",
-            borderBottomWidth: 0,
-            borderColor: '#ccc',
-            fontColor: '#fff',
-            elevation: 0,
-            height: 50
-        },
-        headerTintColor: '#ffffff',
-        headerTitleStyle: {
-            fontWeight: 'normal',
-            fontSize: 18,
-            color: '#ffffff',
-            alignSelf:'center',
-            textAlign: 'center',
-            flex:1
-        },
-        headerTitleContainerStyle:{
-            left: TITLE_OFFSET,
-            right: TITLE_OFFSET,
-        },
-        headerBackTitle: null         // ~注意~ 这个地方是隐藏返回按钮文字的
-    }
-})
-Outside.navigationOptions = ({ navigation }) => {  // ~注意~ 如果想实现隐藏Tabbar的功能要调用这个方法
-    let tabBarVisible = true
-    if (navigation.state.index > 0) {
-        tabBarVisible = false
-    }
-    return {
-        tabBarVisible
-    }
-}
-module.exports = Outside

+ 0 - 94
jscore/pages/Outside/Login.js

@@ -1,94 +0,0 @@
-import React, { Component } from 'react'
-import { StyleSheet, View, Text, Alert, TouchableOpacity, Image } from 'react-native'
-import { connect } from 'react-redux'
-import { Button, InputItem, List, WhiteSpace, WingBlank } from '@ant-design/react-native';
-
-import { createAction, ScreenUtil } from '../../utils'
-import {NavigationActions} from "react-navigation";
-
-@connect(auth => ({...auth}))
-class Login extends Component {
-  constructor(props) {
-    super(props);
-    this.state = { 
-      username: '',
-      password: ''
-    };
-  }
-
-
-  onLogin = () => {
-      if(this.state.username == ''){
-          Alert.alert('提示', '请输入用户名!');
-          return
-      }
-      if(this.state.password == ''){
-          Alert.alert('提示', '请输入密码!');
-          return
-      }
-    this.props.dispatch(createAction('auth/login')(this.state))
-  }
-
-  renderMessage = content => (
-    <Text style={{ marginBottom: 24 }}>{content}</Text>
-  );
-
-  render() {
-    const {
-      loading,
-     } = this.props.auth
-    return (
-      <View style={styles.container}>
-        <View style={styles.logoContainer}>
-          <Image source={require('../../../assets/images/logo.png')} style={styles.logo}/>
-        </View>
-        <WhiteSpace size="xl" />
-        <List style={styles.list}>
-            <InputItem
-              clear
-              value={this.state.username}
-              onChange={value => {
-                this.setState({
-                  username:value,
-                });
-              }}
-            >用户名:</InputItem>   
-            <InputItem
-              clear
-              type="password"
-              value={this.state.password}
-              onChange={value => {
-                this.setState({
-                  password:value,
-                });
-              }}
-            >密码:</InputItem>     
-        </List>
-        <WhiteSpace />
-        <WingBlank>
-          <Button loading={loading} onPress={this.onLogin} type="primary">登录</Button>
-        </WingBlank>
-      </View>
-    )
-  }
-}
-
-const styles = StyleSheet.create({
-  container:{
-    flex:1,
-  },  
-  logoContainer:{
-    alignItems:'center',
-    marginTop: 60
-  },
-  logo: {
-    width:ScreenUtil.scaleSize(80),
-    height:ScreenUtil.scaleSize(80),
-  },  
-  list: {
-    marginTop: 10
-  }
-})
-
-
-export default Login

+ 11 - 56
jscore/pages/Welcome.js

@@ -12,63 +12,18 @@ class Welcome extends Component {
     }
 
     componentDidMount() {
-        const {navigation, dispatch} = this.props;
-
-        SyncStorage.init().then((data) => {
-            const credential = SyncStorage.get('credential');
-            var resetAction;
-            if (credential && credential.token) {
-                // resetAction = NavigationActions.navigate({
-                //     routeName: "Main",
-                //     actions: [NavigationActions.navigate({routeName: 'HomePage'})],
-                // })
-                // resetAction = StackActions.reset({
-                //     index: 0,//默认打开actions中的第几个页面
-                //     actions: [//actions是页面集合
-                //         NavigationActions.navigate({routeName: 'Main'}),
-                //     ]
-                // });
-                dispatch({
-                    type: 'auth/tokenRefresh',
-                    payload: credential,
-                    callback: () => {
-                        resetAction = NavigationActions.navigate({
-                            routeName: "Main",
-                            actions: [NavigationActions.navigate({routeName: 'DesktopHome'})],
-                        })
-                        navigation.dispatch(resetAction);
-                    },
-                    unLogin: () => {
-                        resetAction = NavigationActions.navigate({
-                            routeName: "Login",
-                            actions: [NavigationActions.navigate({routeName: 'Login'})],
-                        })
-                        navigation.dispatch(resetAction);
-                    }
-                })
-            } else {
-                // resetAction = NavigationActions.navigate({ routeName: 'Login' })
-                // resetAction = NavigationActions.navigate({
-                //     routeName: "Login",
-                //     actions: [NavigationActions.navigate({routeName: 'Login'})],
-                // })
-
-                // resetAction = StackActions.reset({
-                //     index: 1,//默认打开actions中的第几个页面
-                //     actions: [//actions是页面集合
-                //         NavigationActions.navigate({routeName: 'Main'}),
-                //         NavigationActions.navigate({routeName: 'Login'}),
-                //     ]
-                // });
-                SyncStorage.remove('credential');
-                resetAction = NavigationActions.navigate({
-                    routeName: "Login",
-                    actions: [NavigationActions.navigate({routeName: 'Login'})],
-                })
-                navigation.dispatch(resetAction);
-            }
+        const {navigation} = this.props;
 
+        const resetAction = NavigationActions.navigate({
+            routeName: "DesktopHome",
+            actions: [NavigationActions.navigate({routeName: 'DesktopHome'})],
         })
+        this.timer = setTimeout(
+            () => {
+                navigation.dispatch(resetAction);
+            },
+            2000
+        );
     }
 
     componentWillUnmount() {
@@ -83,7 +38,7 @@ class Welcome extends Component {
                     <Text style={styles.title}>电金睛</Text>
                 </View>
                 <View style={styles.down}>
-                    <Text style={styles.rights}>©2020 郑州燎原 All rights reserved.</Text>
+                    <Text style={styles.rights}>©2021 郑州燎原 All rights reserved.</Text>
                 </View>
             </View>
         )

+ 0 - 2
jscore/root.js

@@ -9,7 +9,6 @@ import {
 } from 'react-navigation';
 
 import Welcome from './pages/Welcome';
-import Outside from './pages/Outside/Index';
 import HomePage from './pages/Desktop/Index';
 
 const styles = StyleSheet.create({
@@ -28,7 +27,6 @@ const styles = StyleSheet.create({
 const AppNavigator = createStackNavigator(
     {
         Welcome: {screen: Welcome},
-        Login: {screen: Outside},
         Main: {screen: HomePage},
     },
     {

+ 1 - 1
jscore/router.js

@@ -51,7 +51,7 @@ class Router extends React.PureComponent {
         if (currentScreen === 'Main') {
             return true;
         }
-        const MainRouteNames = ['DesktopHome', 'Login',];
+        const MainRouteNames = ['DesktopHome',];
         if (MainRouteNames.indexOf(currentScreen) === -1) {
             this.props.dispatch(NavigationActions.back());
             return true;

+ 0 - 55
jscore/services/home.js

@@ -1,55 +0,0 @@
-import {stringify} from 'qs';
-import request from './../utils/request';
-
-export async function queryHome(params) {
-    return request(`/touch/home/data/?${stringify(params)}`);
-}
-
-export async function distributorFetch(params) {
-    return request(`/distributor/search/?${stringify(params)}`);
-}
-
-export async function fetchProductData(params) {
-    return request(`/product/app/search/?${stringify(params)}`);
-}
-
-export async function fetchSearch(params) {
-    return request(`/deliver/search/?${stringify(params)}`);
-}
-
-export async function deliverSave(params) {
-    if (params.save_type === 'code') {
-        return request(`/deliver/`, {
-            method: 'POST',
-            body: {
-                ...params,
-            },
-        });
-    } else {
-        return request(`/deliver/UHF/`, {
-            method: 'POST',
-            body: {
-                ...params,
-            },
-        });
-    }
-
-}
-
-export async function returnSave(params) {
-    if (params.save_type === 'code') {
-        return request(`/back/`, {
-            method: 'POST',
-            body: {
-                ...params,
-            },
-        });
-    } else {
-        return request(`/back/UHF/`, {
-            method: 'POST',
-            body: {
-                ...params,
-            },
-        });
-    }
-}

+ 0 - 25
jscore/services/user.js

@@ -1,25 +0,0 @@
-import { stringify } from 'qs';
-import request from './../utils/request';
-
-export async function login(params) {
-  let formdata = new FormData();
-  formdata.append("username", params.username);
-  formdata.append("password", params.password);
-
-  return request('/account/login/', {
-    method: 'POST',
-    body: formdata,
-  });
-}
-
-export async function userfetch(params) {
-  return request(`/account/token/refresh/?${stringify(params)}`);
-}
-export async function tokenRefresh(params) {
-  return request('/account/token/refresh/', {
-    method: 'POST',
-    body: {"token":params.toString()},
-    // body: {"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6IjE1NTE3NTU4Mzg4IiwiZXhwIjoxNTgxOTA3NTI1LCJvcmlnX2lhdCI6MTU3OTMxNTUyNX0.d0rROpUZ6swYT6DUSrUl0tWquhArLeL61em7nEsqvQI"},
-
-  });
-}

+ 0 - 3
jscore/utils/index.js

@@ -1,6 +1,3 @@
 export { NavigationActions, StackActions } from 'react-navigation'
 
-export { default as Storage } from './storage'
 export { default as ScreenUtil } from './screen'
-
-export const createAction = type => payload => ({ type, payload })

+ 0 - 113
jscore/utils/request.js

@@ -1,113 +0,0 @@
-import SyncStorage from 'sync-storage';
-import {Alert} from 'react-native';
-
-const codeMessage = {
-  200: '服务器成功返回请求的数据。',
-  201: '新建或修改数据成功。',
-  202: '一个请求已经进入后台排队(异步任务)。',
-  204: '删除数据成功。',
-  400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
-  401: '用户没有权限(令牌、用户名、密码错误)。',
-  403: '用户得到授权,但是访问是被禁止的。',
-  404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
-  406: '请求的格式不可得。',
-  410: '请求的资源被永久删除,且不会再得到的。',
-  422: '当创建一个对象时,发生一个验证错误。',
-  500: '服务器发生错误,请检查服务器。',
-  502: '网关错误。',
-  503: '服务不可用,服务器暂时过载或维护。',
-  504: '网关超时。',
-};
-
-const checkStatus = response => {
-  if (response.status >= 200 && response.status < 300) {
-    return response;
-  }
-  const errortext = codeMessage[response.status] || response.statusText;
-  const error = new Error(errortext);
-  error.name = response.status;
-  error.response = response;
-  throw error;
-};
-
-/**
- * Requests a URL, returning a promise.
- *
- * @param  {string} url       The URL we want to request
- * @param  {object} [option] The options we want to pass to "fetch"
- * @return {object}           An object containing either "data" or "err"
- */
-export default function request(url, option) {
-  const options = {
-    //expirys: true,
-    ...option,
-  };
-
-  const defaultOptions = {
-    //credentials: 'include',
-    headers: {},
-  };
-  const newOptions = { ...defaultOptions, ...options };
-  if (
-    newOptions.method === 'POST' ||
-    newOptions.method === 'PUT' ||
-    newOptions.method === 'DELETE'
-  ) {
-    if (!(newOptions.body instanceof FormData)) {
-      newOptions.headers = {
-        Accept: 'application/json',
-        'Content-Type': 'application/json; charset=utf-8',
-        ...newOptions.headers,
-      };
-      newOptions.body = JSON.stringify(newOptions.body);
-    } else {
-      // newOptions.body is FormData
-      newOptions.headers = {
-        Accept: 'application/json',
-        ...newOptions.headers,
-      };
-    }
-  }
-
-  const baseURL = SyncStorage.get('baseURL');
-  url = baseURL + url;
-  console.log(url)
-
-  let credential = SyncStorage.get('credential');
-  if(credential) {
-    newOptions.headers = {
-      ...newOptions.headers,
-      Authorization:`JWT ${credential.token}`,
-    };
-  };
-
-  return fetch(url, newOptions)
-    .then(checkStatus)
-    //.then(response => cachedSave(response, hashcode))
-    .then(response => {
-      // DELETE and 204 do not return data by default
-      // using .json will report an error.
-      if (newOptions.method === 'DELETE' || response.status === 204) {
-        return response.text();
-      }
-      const resp = response.json();
-      if (resp.code === 1001){
-        //  resp.code是未定义,不会执行此处
-        this.props.dispatch(NavigationActions.navigate({ routeName: 'Login' }));
-        return;
-      }
-      return resp;
-    })
-    .catch(e => {
-      const status = e.name;
-      if (status == 'TypeError' || status == 400) {
-        Alert.alert('无效的服务器地址,请重新登录!');
-      }
-      if (status == 404) {
-        Alert.alert('请求的操作不存在!');
-      }
-      if (status == 500) {
-        Alert.alert('远程错误!');
-      }
-    });
-}