人脸识别

This commit is contained in:
Your Name
2023-10-07 16:19:18 +08:00
parent 61bf1f5b61
commit 1702d6dd85
16 changed files with 456 additions and 388 deletions
+9 -4
View File
@@ -1,15 +1,20 @@
<script> <script>
import config from './config' import config from './config'
import store from '@/store' import store from '@/store'
import { getToken } from '@/utils/auth' import {
import { initEid,startEid } from './mp_ecard_sdk/main'; getToken
} from '@/utils/auth'
import {
initEid
} from './mp_ecard_sdk/main';
export default { export default {
globalData:{ globalData: {
requestUrl:'http://121.40.189.20:9001', requestUrl: 'https://www.api.xayunmei.com/API',
}, },
onLaunch: function() { onLaunch: function() {
this.initApp(); this.initApp();
initEid(); initEid();
uni.setStorageSync('certificationStatus', '未认证')
}, },
methods: { methods: {
// 初始化应用 // 初始化应用
+8
View File
@@ -57,3 +57,11 @@ export function getCodeImg() {
timeout: 20000 timeout: 20000
}) })
} }
// 获取eidtoken
export function getEidtoken() {
return request({
'url': '/identityAuthentication/selectIdentityAuthenticaEIDtoken',
method: 'post',
})
}
+2 -1
View File
@@ -1,6 +1,7 @@
// 应用全局配置 // 应用全局配置
module.exports = { module.exports = {
baseUrl: 'http://121.40.189.20:9001', baseUrl: 'https://api.xayunmei.com/zhongcaiapi/',
// baseUrl: 'http://121.40.189.20:9001',
// baseUrl: 'http://192.168.3.77:8080', // baseUrl: 'http://192.168.3.77:8080',
// baseUrl: 'http://localhost:8080', // baseUrl: 'http://localhost:8080',
// 应用信息 // 应用信息
+3 -1
View File
@@ -1 +1,3 @@
export default{normalPath:"/pages"}; export default {
normalPath: ""
};
+3 -2
View File
@@ -12,8 +12,9 @@
} }
}, },
onLoad: function() { onLoad: function() {
// this.name = this.$store.state.user.name; this.name = this.$store.state.user.name;
this.sendImg = `https://txroom.xayunmei.com` this.sendImg = `https://txroom.xayunmei.com/#/?name=${this.name}`
// this.sendImg = `http://localhost:8080/#/?name=${this.name}`
}, },
} }
+3 -2
View File
@@ -43,7 +43,9 @@
</template> </template>
<script> <script>
import { getCodeImg } from '@/api/login' import {
getCodeImg
} from '@/api/login'
export default { export default {
data() { data() {
@@ -202,5 +204,4 @@
} }
} }
} }
</style> </style>
+39 -7
View File
@@ -12,7 +12,12 @@
</uni-swiper-dot> </uni-swiper-dot>
<!-- 宫格组件 --> <!-- 宫格组件 -->
<uni-section class="uni-section" title="系统管理" type="line" @click="certification"> <uni-section v-if="certificationStatus == '已认证'" class="uni-section" title="系统管理" type="line">
<template v-slot:right>
{{certificationStatus}}
</template>
</uni-section>
<uni-section v-else class="uni-section" title="系统管理" type="line" @click="certification">
<template v-slot:right> <template v-slot:right>
{{certificationStatus}} {{certificationStatus}}
</template> </template>
@@ -89,6 +94,9 @@
import { import {
startEid startEid
} from '../../mp_ecard_sdk/main.js' } from '../../mp_ecard_sdk/main.js'
import {
getEidtoken
} from "../../api/login.js"
export default { export default {
data() { data() {
return { return {
@@ -104,7 +112,8 @@
image: 'https://img.tukuppt.com/bg_grid/00/81/07/DGEl4suqeV.jpg!/fh/350' image: 'https://img.tukuppt.com/bg_grid/00/81/07/DGEl4suqeV.jpg!/fh/350'
} }
], ],
certificationStatus: "未认证" certificationStatus: "未认证",
eidToken: ""
} }
}, },
methods: { methods: {
@@ -116,6 +125,14 @@
}, },
changeGrid(e) { changeGrid(e) {
// this.$modal.showToast('模块建设中~') // this.$modal.showToast('模块建设中~')
if (this.certificationStatus == "未认证") {
uni.showToast({
title: '请先完成实名认证',
icon: 'none',
duration: 1000
})
return
}
switch (e) { switch (e) {
case 0: case 0:
uni.navigateTo({ uni.navigateTo({
@@ -131,14 +148,22 @@
break; break;
} }
}, },
// 获取eidtoken
getEidtokenFn() {
getEidtoken({}).then(res => {
console.log(res.data.eidToken, "kkkkkkkkk");
this.eidToken = res.data.eidToken
})
},
// 点击实名认证 // 点击实名认证
certification() { certification() {
uni.navigateTo({ let that = this
url: ('/mp_ecard_sdk/index/index') // uni.navigateTo({
}) // url: ('/mp_ecard_sdk/index/index')
// })
startEid({ startEid({
data: { data: {
token, token: this.eidToken,
}, },
verifyDoneCallback(res) { verifyDoneCallback(res) {
const { const {
@@ -148,10 +173,17 @@
console.log('收到核身完成的res:', res); console.log('收到核身完成的res:', res);
console.log('核身的token是:', token); console.log('核身的token是:', token);
console.log('是否完成核身:', verifyDone); console.log('是否完成核身:', verifyDone);
// flagShow = '已认证'
// console.log(flagShow, "JKJJKJKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKk");
// console.log(this, "PPPPPPPPPPPPPPP");
that.certificationStatus = '已认证'
}, },
}); });
} }
} },
onLoad() {
this.getEidtokenFn()
},
} }
</script> </script>
+25 -7
View File
@@ -1,8 +1,16 @@
import config from '@/config' import config from '@/config'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import constant from '@/utils/constant' import constant from '@/utils/constant'
import { login, logout, getInfo } from '@/api/login' import {
import { getToken, setToken, removeToken } from '@/utils/auth' login,
logout,
getInfo
} from '@/api/login'
import {
getToken,
setToken,
removeToken
} from '@/utils/auth'
const baseUrl = config.baseUrl const baseUrl = config.baseUrl
@@ -39,7 +47,9 @@ const user = {
actions: { actions: {
// 登录 // 登录
Login({ commit }, userInfo) { Login({
commit
}, userInfo) {
const username = userInfo.username.trim() const username = userInfo.username.trim()
const password = userInfo.password const password = userInfo.password
const code = userInfo.code const code = userInfo.code
@@ -56,12 +66,17 @@ const user = {
}, },
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({
commit,
state
}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.user const user = res.user
const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar const avatar = (user == null || user.avatar == "" || user.avatar == null) ?
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName require("@/static/images/profile.jpg") : baseUrl + user.avatar
const username = (user == null || user.userName == "" || user.userName ==
null) ? "" : user.userName
if (res.roles && res.roles.length > 0) { if (res.roles && res.roles.length > 0) {
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions) commit('SET_PERMISSIONS', res.permissions)
@@ -78,7 +93,10 @@ const user = {
}, },
// 退出系统 // 退出系统
LogOut({ commit, state }) { LogOut({
commit,
state
}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token).then(() => {
commit('SET_TOKEN', '') commit('SET_TOKEN', '')
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3,6 +3,6 @@
"projectname": "若依移动端", "projectname": "若依移动端",
"setting": { "setting": {
"compileHotReLoad": true, "compileHotReLoad": true,
"urlCheck": false "urlCheck": true
} }
} }