chenjj před 3 měsíci
rodič
revize
856e59958a

+ 19 - 0
api/face.js

@@ -0,0 +1,19 @@
+import request from '../utils/request'
+
+
+//获取人脸识别token
+export function getEidToken() {
+	return request({
+		url: `/face/getEidToken`,
+		method: 'get',
+	})
+}
+
+//获取人脸核身结果
+export function getEidResult(data) {
+	return request({
+		url: `/face/getEidResult`,
+		method: 'get',
+        params: data
+	})
+}

+ 2 - 2
config.js

@@ -1,8 +1,8 @@
 const base_url = {
-  // develop:'http://192.168.100.128:9527',//开发版 
+  develop:'http://192.168.100.128:9527',//开发版
   // develop: 'https://yongc.top/prod-api',//开发版
   // develop: 'http://192.168.100.139:9527', //嵘哥
-  develop: 'https://yongc.top/prod-api',//体验版
+  // develop: 'https://yongc.top/prod-api',//体验版
   // develop: 'https://goldshulin.com/prod-api',//体验版
 
   trial: 'https://yongc.top/prod-api',//体验版

+ 0 - 6
pages.json

@@ -251,12 +251,6 @@
 						"navigationBarTitleText": "个人信息"
 					}
 				},
-				{
-					"path": "pages/authentication/index",
-					"style": {
-						"navigationBarTitleText": "实名认证"
-					}
-				},
 				{
 					"path": "pages/mp_ecard_sdk/index/index",
 					"style": {

+ 11 - 30
pages/mine/index.vue

@@ -101,6 +101,7 @@ import QRCode from '@/components/QRCode/index.vue'
 import { getNavBarHeight } from '@/utils/index.js'
 import { getToken } from '@/utils/auth'
 import { showConfirm } from '@/utils/common'
+import { getInfo } from '@/api/login'
 import {
   userOrWorker
 } from '@/api/login';
@@ -190,15 +191,6 @@ const priceList = computed(() => {
 const userType = uni.getStorageSync('userType') //读取本地存储
 
 const adminList = [
-{
-    name: '实名认证',
-    img: '/static/serverImg/mine/adress.png',
-    key: 'map',
-    text: '前往实名认证',
-    operate: () => {
-      hanldeAuthentication()
-    },
-  },
   {
     name: '我的地址',
     img: '/static/serverImg/mine/adress.png',
@@ -255,15 +247,6 @@ const adminList = [
 
 ]
 const userList = [
-  {
-    name: '实名认证',
-    img: '/static/serverImg/mine/adress.png',
-    key: 'map',
-    text: '前往实名认证',
-    operate: () => {
-      hanldeAuthentication()
-    },
-  },
   {
     name: '我的地址',
     img: '/static/serverImg/mine/adress.png',
@@ -303,13 +286,6 @@ const userList = [
   },
 ]
 
-
-// 实名认证
-const hanldeAuthentication = () => {
-  uni.navigateTo({
-        url: `/pages_mine/pages/authentication/index`
- })
-}
 const switchUserType = (userType) => {
   uni.setStorageSync('userType', userType)
   store.dispatch('GetInfo').then((res) => {
@@ -411,11 +387,16 @@ const handLsetTing = () => {
 }
 
 const geUserInfo = () => {
-  console.log(store.state.user, '>>>>99')
-  userInfo.value = store.state.user
-  // store.dispatch('GetInfo').then((res) => {
-  // 	userInfo.value = store.state.user
-  // });
+  // userInfo.value = store.state.user
+  getInfo().then(res => {
+    console.log("TCL: geUserInfo -> res", res)
+    userInfo.value = res.user;
+    // showConfirm('您未完成实名认证,是否前往实名?').then(res => {
+    //   if (res.confirm) {
+    //     handLsetTing();
+    //   }
+    // })
+  })
 }
 
 onShow(() => {

+ 0 - 79
pages_mine/pages/authentication/index.vue

@@ -1,79 +0,0 @@
-<template>
-  <view class="token-input">
-
-    <view class="title">
-      请输入EID token
-    </view>
-
-    <view style="margin-bottom: 60rpx">
-      <input @input="bindTokenInput" placeholder="请输入token" :value="token" />
-    </view>
-
-    <view>
-      <button @click='onConfirm'>跳转到eID小程序</button>
-    </view>
-
-  </view>
-</template>
-
-<script>
-import { startEid, initEid } from '../mp_ecard_sdk/main'
-export default {
-  data() {
-    return {
-      token: '',
-    }
-  },
-  onLaunch: function () {
-    //初始化
-    initEid();
-  },
-  methods: {
-    bindTokenInput(e) {
-      console.log('dd', e)
-      this.token = e.detail.value;
-    },
-    onConfirm() {
-      console.log('startEid', startEid)
-      const param = {
-        data: {
-          token: this.token,
-        },
-        verifyDoneCallback(res) {
-          console.log('收到核身完成的res', res);
-        },
-      };
-      this.token && startEid(param);
-    },
-  }
-}
-</script>
-
-
-<style>
-.token-input {
-  height: 100%;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  /* justify-content: center; */
-}
-
-input {
-  margin-bottom: 40rpx;
-  border: 1px solid #ccc;
-  width: 600rpx;
-  height: 80rpx;
-}
-
-button {
-  width: 622rpx !important;
-  height: 96rpx !important;
-  background-color: #198eea;
-  color: #FFFFFF;
-  border: 2rpx solid #DDDDDD;
-  font-size: 32rpx;
-  font-weight: normal !important;
-  line-height: 96rpx !important;
-}
-</style>

+ 81 - 40
pages_mine/pages/setupUser/index.vue

@@ -15,6 +15,11 @@
 			<up-icon name="arrow-right" class="icon"></up-icon>
 			<up-divider></up-divider>
 		</view> -->
+		<view class="wrapper" @click="handelAuthentication">
+			<text class="text">实名认证</text>
+			<up-icon name="arrow-right" class="icon"></up-icon>
+			<up-divider></up-divider>
+		</view>
 		<view class="wrapper" @click="logoOut">
 			<text class="text">退出登陆</text>
 			<up-icon name="arrow-right" class="icon"></up-icon>
@@ -24,15 +29,20 @@
 </template>
 
 <script setup>
-	import {
-		ref
-	} from 'vue'
+import {
+	ref
+} from 'vue'
 import { showConfirm } from '@/utils/common'
 import store from '@/store'
-	const handlServiceAddress = () => {
-		uni.navigateTo({
-			url: '/pages_mine/pages/setupUser/Address'
-		})
+import { onLoad, onShow } from '@dcloudio/uni-app'
+import { startEid, initEid } from '../mp_ecard_sdk/main'
+import { getEidToken,getEidResult } from '@/api/face'
+
+const eidToken = ref('2C4B0550-55F0-47E2-AF8D-0E359C9EBC74');
+const handlServiceAddress = () => {
+	uni.navigateTo({
+		url: '/pages_mine/pages/setupUser/Address'
+	})
 }
 
 const handlePersonalInfo = () => {
@@ -43,44 +53,75 @@ const handlePersonalInfo = () => {
 
 const logoOut = () => {
 	showConfirm('确认退出登陆吗?').then((res) => {
-        if (res.confirm) {
-            store.dispatch('LogOut').then((res) => {
-                uni.reLaunch({
-                    url: '/pages/index',
-                })
-            })
-        }
-    })
+		if (res.confirm) {
+			store.dispatch('LogOut').then((res) => {
+				uni.reLaunch({
+					url: '/pages/index',
+				})
+			})
+		}
+	})
 }
+
+
+const handelAuthentication = () => {
+	getEidToken().then(res => {
+		eidToken.value = res.data;
+		const param = {
+        data: {
+          token: eidToken.value,
+        },
+        verifyDoneCallback(res) {
+          console.log('收到核身完成的res', res);
+		  getEidResult({eidToken: res.token,verifyDone:res.verifyDone}).then(result=>{
+            console.log("TCL: verifyDoneCallback -> result", result)
+			if(result.code){
+				uni.showToast({
+					title: '您已完成实名认证!',
+					icon: 'success',
+				})
+			}
+		  })
+        },
+      };
+      eidToken.value && startEid(param);
+	})
+}
+
+onLoad(() => {
+	//初始化
+	initEid();
+})
+
 </script>
 
 <style scoped>
-	.wrapper {
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		padding: 24rpx 32rpx;
-	}
+.wrapper {
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+	padding: 24rpx 32rpx;
+}
 
-	.text {
-		flex: 1;
-		/* 文字占据剩余空间 */
-		font-size: 28rpx;
-		color: #333;
-	}
+.text {
+	flex: 1;
+	/* 文字占据剩余空间 */
+	font-size: 28rpx;
+	color: #333;
+}
 
-	.icon {
-		margin-left: 16rpx;
-		/* 图标与文字的间距 */
-		color: #999;
-		/* 图标颜色 */
-		font-size: 28rpx;
-		/* 与文字大小匹配 */
-	}
+.icon {
+	margin-left: 16rpx;
+	/* 图标与文字的间距 */
+	color: #999;
+	/* 图标颜色 */
+	font-size: 28rpx;
+	/* 与文字大小匹配 */
+}
 
-	/* 分隔线样式调整 */
-	.up-divider {
-		margin: 0 32rpx;
-		/* 与内容对齐 */
-	}
+/* 分隔线样式调整 */
+.up-divider {
+	margin: 0 32rpx;
+	/* 与内容对齐 */
+}
 </style>