Parcourir la source

1.识别身份证OCR。

石慧云 il y a 4 ans
Parent
commit
bd2a53ff48

+ 4 - 0
app/src/main/java/com/quansu/heifengwuliu/activity/HomeActivity.kt

@@ -145,4 +145,8 @@ class HomeActivity : MBActivity<HomeVModel, ActivityHomeBinding>() {
 
     }
 
+    override fun transluent(): Boolean {
+        return true
+    }
+
 }

+ 2 - 0
app/src/main/java/com/quansu/heifengwuliu/activity/PersonalVerityActivity.kt

@@ -3,6 +3,7 @@ package com.quansu.heifengwuliu.activity
 import android.app.Activity
 import android.content.Intent
 import android.os.Bundle
+import android.util.Log
 import com.luck.picture.lib.PictureSelector
 import com.quansu.heifengwuliu.R
 import com.quansu.heifengwuliu.base.MBActivity
@@ -82,6 +83,7 @@ class PersonalVerityActivity : MBActivity<PersonalVerityVModel, ActivityPersonal
 
         if (vm.type == "1") {
             vm.imgIDMan.value = ss[1]
+            vm.discernID(ss[1])
         } else {
             vm.imgIDEmblem.value = ss[1]
         }

+ 2 - 2
app/src/main/java/com/quansu/heifengwuliu/fragment/DriverWayBillFragment.kt

@@ -21,7 +21,7 @@ class DriverWayBillFragment : MBTabFragment<BViewModel<BRepository>, FragmentWay
 
     override fun initView(view: View?) {
         super.initView(view)
-        titleBar?.tvRight?.text = getString(R.string.filter)
+
 
     }
 
@@ -30,7 +30,7 @@ class DriverWayBillFragment : MBTabFragment<BViewModel<BRepository>, FragmentWay
     }
 
     override fun title(): String? {
-        return getString(R.string.source_information)
+        return null
     }
 
     override fun backable(): Boolean {

+ 1 - 1
app/src/main/java/com/quansu/heifengwuliu/fragment/IndexFragment.kt

@@ -34,7 +34,7 @@ class IndexFragment :  MBRFragment<IndexVModel, IndexAdapter, FragmentIndexBindi
     }
 
     override fun title(): String? {
-        return "货源大厅"
+        return null
     }
 
     override fun initAdapter(): IndexAdapter {

+ 1 - 0
app/src/main/java/com/quansu/heifengwuliu/fragment/MineFragment.kt

@@ -30,4 +30,5 @@ class MineFragment : MBFragment<MineVModel, FragmentMineBinding>() {
         return MineRepository()
     }
 
+
 }

+ 2 - 2
app/src/main/java/com/quansu/heifengwuliu/fragment/WayBillFragment.kt

@@ -21,7 +21,7 @@ class WayBillFragment : MBTabFragment<BViewModel<BRepository>, FragmentWaybillBi
 
     override fun initView(view: View?) {
         super.initView(view)
-        titleBar?.tvRight?.text = getString(R.string.filter)
+        binding.tvTitle.text="货源信息"
 
     }
 
@@ -30,7 +30,7 @@ class WayBillFragment : MBTabFragment<BViewModel<BRepository>, FragmentWaybillBi
     }
 
     override fun title(): String? {
-        return getString(R.string.source_information)
+        return null
     }
 
     override fun backable(): Boolean {

+ 11 - 0
app/src/main/java/com/quansu/heifengwuliu/model/Idcard.kt

@@ -0,0 +1,11 @@
+package com.quansu.heifengwuliu.model
+
+import com.ysnows.base.inter.IModel
+
+/**
+ *Created by shihuiyun
+ *on 2020/9/21
+ */
+data class Idcard(var name:String,var id:String,var gender:String,
+var addr:String): IModel {
+}

+ 9 - 0
app/src/main/java/com/quansu/heifengwuliu/utils/net/ApiService.kt

@@ -363,4 +363,13 @@ interface ApiService {
     fun getInfoDriver(@Query("info_id") info_id: String?): Observable<Response<Any>>
 
 
+
+    /**
+     * 识别身份证-OCR
+     * @return
+     */
+    @GET("api/wxocr/cv_idcard")
+    fun cvIdcard(@Query("img") img: String?): Observable<Response<Idcard>>
+
+
 }

+ 16 - 0
app/src/main/java/com/quansu/heifengwuliu/vmodel/PersonalVerityVModel.kt

@@ -6,6 +6,7 @@ import androidx.databinding.Bindable
 import androidx.lifecycle.MutableLiveData
 import com.quansu.heifengwuliu.BR
 import com.quansu.heifengwuliu.activity.HomeActivity
+import com.quansu.heifengwuliu.model.Idcard
 import com.quansu.heifengwuliu.model.LoginBean
 import com.quansu.heifengwuliu.model.User
 import com.quansu.heifengwuliu.repository.PersonalVerifyRepository
@@ -105,4 +106,19 @@ class PersonalVerityVModel : BViewModel<PersonalVerifyRepository>() {
     }
 
 
+    fun discernID(img:String){//识别身份证
+
+        repository().lreq(NetEngine.service.cvIdcard(img))
+                .doOnNext {
+                    if (it.ok()) {
+                       var bean=it.data() as Idcard
+                        name=bean.name
+                        iDNumber=bean.id
+                    }
+                }
+                .subscribe()
+
+     }
+
+
 }

BIN
app/src/main/res/drawable-xxhdpi/ic_details_grab.png


BIN
app/src/main/res/drawable-xxhdpi/ic_human_face.png


BIN
app/src/main/res/drawable-xxhdpi/ic_national_emblem.png


+ 21 - 5
app/src/main/res/layout/activity_grabdetails.xml

@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<layout xmlns:android="http://schemas.android.com/apk/res/android">
+<layout xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    xmlns:android="http://schemas.android.com/apk/res/android">
 
     <data>
 
@@ -9,8 +11,7 @@
 
     </data>
 
-    <LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
-        xmlns:tools="http://schemas.android.com/tools"
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="#F5F5F5"
@@ -50,7 +51,6 @@
                             android:layout_width="0dp"
                             android:layout_height="wrap_content"
                             android:layout_weight="1"
-
                             android:gravity="center_vertical">
 
                             <ImageView
@@ -525,12 +525,28 @@
 
                     </LinearLayout>
 
+
+                    <FrameLayout
+                        android:layout_width="match_parent"
+                        android:onClick="@{v->vm.toGrab(vm.info.info.info_id)}"
+                        android:layout_height="wrap_content">
                     <ImageView
                         android:layout_width="match_parent"
                         android:layout_height="106dp"
-                        android:onClick="@{v->vm.toGrab(vm.info.info.info_id)}"
                         android:src="@drawable/ic_details_grab" />
 
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_gravity="center"
+                            android:text="抢单"
+                            android:textColor="@color/white"
+                            android:textSize="16sp"
+                            android:layout_height="wrap_content">
+
+                        </TextView>
+
+                    </FrameLayout>
+
 
                 </LinearLayout>
 

+ 220 - 79
app/src/main/res/layout/activity_personal_verify.xml

@@ -1,82 +1,180 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto" >
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <data>
 
-    <data >
         <import type="android.view.View" />
 
         <variable
             name="vm"
             type="com.quansu.heifengwuliu.vmodel.PersonalVerityVModel" />
-    </data >
+    </data>
 
-    <androidx.constraintlayout.widget.ConstraintLayout
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:paddingStart="@dimen/dp_14"
-        android:paddingEnd="@dimen/dp_14" >
+        android:background="#F5F5F5"
+        android:orientation="vertical">
 
-        <TextView
-            android:id="@+id/tv_title"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/dp_55"
-            android:text="@string/id_information_upload"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-<!--     app:url="@{vm.imgIDMan}"    -->
-
-        <com.qmuiteam.qmui.widget.QMUIRadiusImageView
-            android:id="@+id/img_id_man"
-            android:layout_width="146dp"
-            android:layout_height="96dp"
-            android:layout_marginTop="@dimen/dp_8"
-            android:onClick="@{v->vm.choseImg(1)}"
-            android:scaleType="fitXY"
-            android:src="@drawable/ic_default_image"
-            app:layout_constraintStart_toStartOf="@id/tv_title"
-            app:layout_constraintTop_toBottomOf="@id/tv_title"
-            app:qmui_radius="1dp"
-            app:url="@{vm.imgIDMan}" />
-
-        <com.qmuiteam.qmui.widget.QMUIRadiusImageView
-            android:id="@+id/img_id_emblem"
-            android:layout_width="146dp"
-            android:layout_height="96dp"
-            android:scaleType="fitXY"
-            android:src="@drawable/ic_default_image"
-            app:layout_constraintEnd_toEndOf="parent"
-            android:onClick="@{v->vm.choseImg(2)}"
-            app:layout_constraintTop_toTopOf="@id/img_id_man"
-            app:qmui_radius="1dp"
-            app:url="@{vm.imgIDEmblem}"/>
 
         <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
-            android:id="@+id/lay_input"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/dp_12"
-            android:gravity="center_vertical"
+            android:layout_marginStart="17dp"
+            android:layout_marginTop="12dp"
+            android:layout_marginEnd="16dp"
             android:orientation="vertical"
-            android:paddingStart="@dimen/dp_8"
-            android:paddingEnd="@dimen/dp_14"
-            app:layout_constraintTop_toBottomOf="@id/img_id_man"
-            app:qmui_borderColor="#F4F3F9"
-            app:qmui_borderWidth="@dimen/dp_1"
-            app:rv_radius="25dp" >
-
-            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+            android:paddingStart="11dp"
+            android:paddingTop="14dp"
+            android:paddingEnd="11dp"
+            android:paddingBottom="21dp"
+            app:qmui_backgroundColor="@color/white"
+            app:qmui_borderColor="@color/white"
+            app:qmui_radius="4dp">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/id_information_upload" />
+
+            <LinearLayout
                 android:layout_width="match_parent"
-                android:layout_height="48dp"
-                android:gravity="center_vertical"
-                android:paddingStart="@dimen/dp_8"
-                android:paddingEnd="@dimen/dp_14" >
+                android:layout_height="wrap_content"
+                android:layout_marginTop="22dp"
+                android:orientation="horizontal">
+
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:gravity="center"
+                    android:orientation="vertical">
+
+
+                    <com.qmuiteam.qmui.widget.QMUIRadiusImageView
+                        android:id="@+id/img_id_man"
+                        android:layout_width="137dp"
+                        android:layout_height="86dp"
+                        android:onClick="@{v->vm.choseImg(1)}"
+                        android:scaleType="fitXY"
+                        android:src="@drawable/ic_human_face"
+                        app:qmui_corner_radius="@dimen/dp_4"
+                        app:qmui_border_color="@color/white"
+                        app:url="@{vm.imgIDMan}" />
+
+
+                    <LinearLayout
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="9dp"
+                        android:orientation="horizontal">
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="点击上传 "
+                            android:textColor="#7B7B7B"
+                            android:textSize="13sp" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="人像面"
+                            android:textColor="#F5BF41"
+                            android:textSize="13sp" />
+
+
+                    </LinearLayout>
+
+
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:gravity="center"
+                    android:orientation="vertical">
+
+
+                    <com.qmuiteam.qmui.widget.QMUIRadiusImageView
+                        android:id="@+id/img_id_emblem"
+                        android:layout_width="137dp"
+                        android:layout_height="86dp"
+                        android:onClick="@{v->vm.choseImg(2)}"
+                        android:scaleType="fitXY"
+                        android:src="@drawable/ic_national_emblem"
+                        app:qmui_corner_radius="@dimen/dp_4"
+                        app:qmui_border_color="@color/white"
+                        app:url="@{vm.imgIDEmblem}" />
+
+
+
+                    <LinearLayout
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="9dp"
+                        android:orientation="horizontal">
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="点击上传 "
+                            android:textColor="#7B7B7B"
+                            android:textSize="13sp" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="国徽面"
+                            android:textColor="#F5BF41"
+                            android:textSize="13sp" />
+
+
+                    </LinearLayout>
+
+
+                </LinearLayout>
+
 
+            </LinearLayout>
+
+
+        </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
+
+
+
+
+        <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="17dp"
+            android:layout_marginTop="12dp"
+            android:layout_marginEnd="16dp"
+            android:orientation="vertical"
+            android:paddingStart="11dp"
+            android:paddingTop="3dp"
+            android:paddingEnd="11dp"
+            android:paddingBottom="3dp"
+            app:qmui_backgroundColor="@color/white"
+            app:qmui_borderColor="@color/white"
+            app:qmui_radius="4dp">
+
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:orientation="horizontal"
+                android:gravity="center"
+                android:layout_height="50dp">
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="@string/name" />
+                    android:textColor="#26292F"
+                    android:textSize="14sp"
+                    android:minWidth="56dp"
+                    android:text="姓  名" />
 
                 <com.ysnows.base.widget.DelEditText
                     android:id="@+id/edt_name"
@@ -85,21 +183,35 @@
                     android:background="@color/white"
                     android:hint="@string/name_must_equal_to_id_card"
                     android:paddingStart="@dimen/dp_18"
+                    android:gravity="right|center"
                     android:text="@={vm.name}"
+                    android:textColorHint="#979899"
+                    android:textColor="#26292F"
                     android:textSize="@dimen/sp_13" />
 
-            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
 
-            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+            </LinearLayout>
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_marginEnd="3dp"
+                android:layout_marginStart="2dp"
+                android:background="@color/line_color"
+                android:layout_height="@dimen/dp_1"/>
+
+
+            <LinearLayout
                 android:layout_width="match_parent"
-                android:layout_height="48dp"
-                android:gravity="center_vertical"
-                android:paddingStart="@dimen/dp_8"
-                android:paddingEnd="@dimen/dp_14" >
+                android:orientation="horizontal"
+                android:gravity="center"
+                android:layout_height="50dp">
 
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
+                    android:textColor="#26292F"
+                    android:textSize="14sp"
+                    android:minWidth="56dp"
                     android:text="@string/id_number" />
 
                 <com.ysnows.base.widget.DelEditText
@@ -111,35 +223,64 @@
                     android:inputType="phone"
                     android:paddingStart="@dimen/dp_18"
                     android:text="@={vm.iDNumber}"
+                    android:gravity="center|right"
+                    android:textColor="#26292F"
+                    android:textColorHint="#979899"
                     android:textSize="@dimen/sp_13" />
 
-            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+            </LinearLayout>
+
+
+
+
+        </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
+
+
 
-        </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
 
         <TextView
             android:id="@+id/tv_tip"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/sp_12"
+            android:layout_marginTop="14dp"
             android:text="@string/personal_verify_tip"
-            android:textColor="#F17706"
+            android:textColor="#767778"
             android:textSize="@dimen/sp_12"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/lay_input" />
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp"
+            />
+
+
 
-        <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
-            android:id="@+id/btn_submmit"
+
+
+        <FrameLayout
             android:layout_width="match_parent"
-            android:layout_height="@dimen/dp_40"
-            android:layout_marginStart="@dimen/dp_30"
-            android:layout_marginEnd="@dimen/dp_30"
-            android:layout_marginBottom="@dimen/dp_30"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="@dimen/dp_16"
+            android:layout_marginTop="13dp"
             android:onClick="@{v->vm.toSubmit()}"
             android:visibility="@{vm.isShow?View.VISIBLE :View.GONE}"
-            android:text="@string/submit"
-            app:layout_constraintBottom_toBottomOf="parent" />
+            android:layout_height="wrap_content">
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="106dp"
+                android:src="@drawable/ic_details_grab" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_gravity="center"
+                android:text="提交"
+                android:textColor="@color/white"
+                android:textSize="16sp"
+                android:layout_height="wrap_content">
+
+            </TextView>
+
+        </FrameLayout>
+
+
 
-    </androidx.constraintlayout.widget.ConstraintLayout >
+    </LinearLayout>
 
-</layout >
+</layout>

+ 1 - 1
app/src/main/res/layout/fragment_delivergoods.xml

@@ -26,7 +26,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center_horizontal"
-                    android:layout_marginTop="10dp"
+                    android:layout_marginTop="28dp"
                     android:orientation="horizontal">
 
                     <Button

+ 28 - 0
app/src/main/res/layout/fragment_index.xml

@@ -13,10 +13,38 @@
         android:background="@color/color_bg"
         android:orientation="vertical">
 
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:orientation="horizontal"
+            android:paddingTop="29dp"
+            android:paddingBottom="6dp"
+            android:background="@color/white"
+            android:gravity="center"
+            android:layout_height="wrap_content">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:text="货源大厅"
+            android:textSize="20sp"
+            android:gravity="center"
+            android:layout_marginStart="49dp"
+            android:layout_height="wrap_content"/>
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:textSize="16sp"
+                android:text="筛选"
+                android:textColor="#FFBC00"
+                android:layout_marginEnd="17dp"
+                android:layout_height="wrap_content"/>
+
+        </LinearLayout>
 
         <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
             android:id="@+id/refresh_layout"
             android:layout_width="match_parent"
+            android:layout_marginTop="12dp"
             android:layout_height="match_parent">
 
             <androidx.recyclerview.widget.RecyclerView

+ 36 - 1
app/src/main/res/layout/fragment_waybill.xml

@@ -8,9 +8,44 @@
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:background="@color/color_page_bg"
+        android:background="@color/color_bg"
         android:orientation="vertical" >
 
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:orientation="horizontal"
+            android:paddingTop="29dp"
+            android:paddingBottom="6dp"
+            android:background="@color/white"
+            android:gravity="center"
+            android:layout_height="wrap_content">
+
+            <TextView
+                android:id="@+id/tv_title"
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:text="我的运单"
+                android:textSize="20sp"
+                android:gravity="center"
+                android:layout_marginStart="49dp"
+                android:layout_height="wrap_content"/>
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:textSize="16sp"
+                android:text="筛选"
+                android:textColor="#FFBC00"
+                android:layout_marginEnd="17dp"
+                android:layout_height="wrap_content"/>
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:background="@color/line_color"
+            android:layout_height="1dp"/>
+
+
         <FrameLayout
             android:id="@+id/lay_container"
             android:layout_width="match_parent"

+ 2 - 2
app/src/main/res/values/strings.xml

@@ -439,12 +439,12 @@ Api 已达到使用限制
     <string name="vehicle_certified" >车辆已认证</string >
 
 
-    <string name="id_information_upload" >身份证信息上传</string >
+    <string name="id_information_upload" >请点击上传身份证正本</string >
     <string name="name_must_equal_to_id_card" >姓名需与身份证姓名一致</string >
     <string name="name" >姓名</string >
     <string name="id_number" >身份证号</string >
     <string name="please_input_id_number" >请输入身份证号码</string >
-    <string name="personal_verify_tip" >* 此信息只作为审核使用,平台不会泄露信息给第三方,审 核通过后即可发货</string >
+    <string name="personal_verify_tip" >*此信息只作为审核使用,平台不会泄漏信息给第三方,审核通过 后即可发货</string >
     <string name="identity_verify" >身份认证</string >
     <string name="com_verify" >公司认证</string >
     <string name="bl_upload" >营业执照上传</string >