人脸识别

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
+8 -3
View File
@@ -1,15 +1,20 @@
<script>
import config from './config'
import store from '@/store'
import { getToken } from '@/utils/auth'
import { initEid,startEid } from './mp_ecard_sdk/main';
import {
getToken
} from '@/utils/auth'
import {
initEid
} from './mp_ecard_sdk/main';
export default {
globalData: {
requestUrl:'http://121.40.189.20:9001',
requestUrl: 'https://www.api.xayunmei.com/API',
},
onLaunch: function() {
this.initApp();
initEid();
uni.setStorageSync('certificationStatus', '未认证')
},
methods: {
// 初始化应用
+8
View File
@@ -57,3 +57,11 @@ export function getCodeImg() {
timeout: 20000
})
}
// 获取eidtoken
export function getEidtoken() {
return request({
'url': '/identityAuthentication/selectIdentityAuthenticaEIDtoken',
method: 'post',
})
}
+2 -1
View File
@@ -1,6 +1,7 @@
// 应用全局配置
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://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() {
// this.name = this.$store.state.user.name;
this.sendImg = `https://txroom.xayunmei.com`
this.name = this.$store.state.user.name;
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>
<script>
import { getCodeImg } from '@/api/login'
import {
getCodeImg
} from '@/api/login'
export default {
data() {
@@ -202,5 +204,4 @@
}
}
}
</style>
+39 -7
View File
@@ -12,7 +12,12 @@
</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>
{{certificationStatus}}
</template>
@@ -89,6 +94,9 @@
import {
startEid
} from '../../mp_ecard_sdk/main.js'
import {
getEidtoken
} from "../../api/login.js"
export default {
data() {
return {
@@ -104,7 +112,8 @@
image: 'https://img.tukuppt.com/bg_grid/00/81/07/DGEl4suqeV.jpg!/fh/350'
}
],
certificationStatus: "未认证"
certificationStatus: "未认证",
eidToken: ""
}
},
methods: {
@@ -116,6 +125,14 @@
},
changeGrid(e) {
// this.$modal.showToast('模块建设中~')
if (this.certificationStatus == "未认证") {
uni.showToast({
title: '请先完成实名认证',
icon: 'none',
duration: 1000
})
return
}
switch (e) {
case 0:
uni.navigateTo({
@@ -131,14 +148,22 @@
break;
}
},
// 获取eidtoken
getEidtokenFn() {
getEidtoken({}).then(res => {
console.log(res.data.eidToken, "kkkkkkkkk");
this.eidToken = res.data.eidToken
})
},
// 点击实名认证
certification() {
uni.navigateTo({
url: ('/mp_ecard_sdk/index/index')
})
let that = this
// uni.navigateTo({
// url: ('/mp_ecard_sdk/index/index')
// })
startEid({
data: {
token,
token: this.eidToken,
},
verifyDoneCallback(res) {
const {
@@ -148,10 +173,17 @@
console.log('收到核身完成的res:', res);
console.log('核身的token是:', token);
console.log('是否完成核身:', verifyDone);
// flagShow = '已认证'
// console.log(flagShow, "JKJJKJKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKk");
// console.log(this, "PPPPPPPPPPPPPPP");
that.certificationStatus = '已认证'
},
});
}
}
},
onLoad() {
this.getEidtokenFn()
},
}
</script>
+25 -7
View File
@@ -1,8 +1,16 @@
import config from '@/config'
import storage from '@/utils/storage'
import constant from '@/utils/constant'
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import {
login,
logout,
getInfo
} from '@/api/login'
import {
getToken,
setToken,
removeToken
} from '@/utils/auth'
const baseUrl = config.baseUrl
@@ -39,7 +47,9 @@ const user = {
actions: {
// 登录
Login({ commit }, userInfo) {
Login({
commit
}, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
@@ -56,12 +66,17 @@ const user = {
},
// 获取用户信息
GetInfo({ commit, state }) {
GetInfo({
commit,
state
}) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
const avatar = (user == null || user.avatar == "" || user.avatar == null) ?
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) {
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
@@ -78,7 +93,10 @@ const user = {
},
// 退出系统
LogOut({ commit, state }) {
LogOut({
commit,
state
}) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
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": "若依移动端",
"setting": {
"compileHotReLoad": true,
"urlCheck": false
"urlCheck": true
}
}