Răsfoiți Sursa

显示本类别 设置

wushaodong 3 ani în urmă
părinte
comite
6b91e79a90

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


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


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


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


+ 21 - 6
jscore/pages/Desktop/Home.js

@@ -40,18 +40,33 @@ class DesktopHome extends Component {
         // ReadUHF.changeFlag(0)
         DeviceEventEmitter.addListener('MsgFromAndroid', this._addCode);
         DeviceEventEmitter.addListener('onKeyDown', this.onKeyDown);
+        const show_type = SyncStorage.get('show_type')
+        if (show_type === undefined) {
+            SyncStorage.set('show_type', true)
+        }
     }
 
     _addCode = (item) => {
         const str = JSON.parse(item)
         // 防止重复扫描
+        const show_type = SyncStorage.get('show_type')
         let {data, userData, error} = this.state;
         const product_index = userData.indexOf(str['userData'])
         if (product_index < 0) {
-            userData.push(str['userData'])
-            data.unshift(str)
-            if (str['error']) {
-                error += 1
+            // 只显示本类别
+            if (show_type) {
+                // 且没有错误
+                if (!str['error']) {
+                    userData.push(str['userData'])
+                    data.unshift(str)
+                }
+            } else {
+                // 全部都显示
+                if (str['error']) {
+                    error += 1
+                }
+                userData.push(str['userData'])
+                data.unshift(str)
             }
             this.setState({data, userData, error})
         }
@@ -89,7 +104,7 @@ class DesktopHome extends Component {
             districtText = item.districtText
         } else {
             const len1 = item.districtText.split('-')[1].length
-            districtText = "国网"+item.districtText.split('-')[1].slice(0,len1-1)+"电力"
+            districtText = "国网" + item.districtText.split('-')[1].slice(0, len1 - 1) + "电力"
         }
         return (
             <View
@@ -177,7 +192,7 @@ class DesktopHome extends Component {
             districtText = item.districtText
         } else {
             const len1 = item.districtText.split('-')[1].length
-            districtText = "国网"+item.districtText.split('-')[1].slice(0,len1-1)+"电力"
+            districtText = "国网" + item.districtText.split('-')[1].slice(0, len1 - 1) + "电力"
         }
         return (
             <View

+ 35 - 3
jscore/pages/Desktop/setPower.js

@@ -1,6 +1,6 @@
 import React, {Component} from 'react';
-import {Text, View, TextInput, StyleSheet} from 'react-native';
-import {Button, Slider, Toast, Provider} from "@ant-design/react-native";
+import {Text, TouchableOpacity, View, TextInput, StyleSheet} from 'react-native';
+import {Button, Slider, Provider, Toast,} from "@ant-design/react-native";
 import ReadUHF from "../../utils/ReadUHF";
 import SyncStorage from "sync-storage";
 
@@ -11,6 +11,7 @@ class setPower extends Component {
             power: 30,
             no_begin: '8',
             no_length: '14',
+            show_type: true,
         };
     }
 
@@ -25,10 +26,15 @@ class setPower extends Component {
         if (no_begin && no_begin) {
             this.setState({no_begin, no_length})
         }
+        const show_type = SyncStorage.get('show_type')
+        this.setState({show_type})
     }
 
+    onTypeChange = () => {
+        this.setState({show_type: !this.state.show_type})
+    }
     _savePower = () => {
-        let {no_begin, no_length} = this.state;
+        let {no_begin, no_length, show_type} = this.state;
         no_begin = parseInt(no_begin)
         no_length = parseInt(no_length)
 
@@ -47,6 +53,7 @@ class setPower extends Component {
         }
         SyncStorage.set('no_begin', no_begin.toString())
         SyncStorage.set('no_length', no_length.toString())
+        SyncStorage.set('show_type', show_type)
         ReadUHF.setPower(this.state.power)
         this.props.navigation.goBack();
     }
@@ -85,6 +92,31 @@ class setPower extends Component {
                             placeholder={'请输入'}
                         />
                     </View>
+                    <View style={{marginTop: 10}}>
+                        <TouchableOpacity
+                            activeOpacity={0.9}
+                            onPress={() => this.onTypeChange()}
+                            style={{
+                                marginHorizontal: 3,
+                                flexDirection: 'row',
+                            }}>
+                            {this.state.show_type ?
+                                <Text style={{
+                                    borderWidth: 1,
+                                    width: 18,
+                                    height: 18,
+                                    textAlign: 'center',
+                                    color: 'red'
+                                }}>√</Text>
+                                :
+                                <Text style={{
+                                    borderWidth: 1,
+                                    width: 18,
+                                    height: 18,
+                                }}/>
+                            }<Text style={styles.font14}> 只显示本类别芯片</Text>
+                        </TouchableOpacity>
+                    </View>
                     <Button onPress={() => this._savePower()}
                             type="primary"
                             style={{