人脸识别
This commit is contained in:
@@ -1,38 +1,43 @@
|
|||||||
<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
|
||||||
export default {
|
} from '@/utils/auth'
|
||||||
globalData:{
|
import {
|
||||||
requestUrl:'http://121.40.189.20:9001',
|
initEid
|
||||||
},
|
} from './mp_ecard_sdk/main';
|
||||||
onLaunch: function() {
|
export default {
|
||||||
this.initApp();
|
globalData: {
|
||||||
initEid();
|
requestUrl: 'https://www.api.xayunmei.com/API',
|
||||||
},
|
},
|
||||||
methods: {
|
onLaunch: function() {
|
||||||
// 初始化应用
|
this.initApp();
|
||||||
initApp() {
|
initEid();
|
||||||
// 初始化应用配置
|
uni.setStorageSync('certificationStatus', '未认证')
|
||||||
this.initConfig()
|
},
|
||||||
// 检查用户登录状态
|
methods: {
|
||||||
//#ifdef H5
|
// 初始化应用
|
||||||
this.checkLogin()
|
initApp() {
|
||||||
//#endif
|
// 初始化应用配置
|
||||||
},
|
this.initConfig()
|
||||||
initConfig() {
|
// 检查用户登录状态
|
||||||
this.globalData.config = config
|
//#ifdef H5
|
||||||
},
|
this.checkLogin()
|
||||||
checkLogin() {
|
//#endif
|
||||||
if (!getToken()) {
|
},
|
||||||
this.$tab.reLaunch('/pages/login')
|
initConfig() {
|
||||||
}
|
this.globalData.config = config
|
||||||
}
|
},
|
||||||
}
|
checkLogin() {
|
||||||
}
|
if (!getToken()) {
|
||||||
|
this.$tab.reLaunch('/pages/login')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import '@/static/scss/index.scss'
|
@import '@/static/scss/index.scss'
|
||||||
</style>
|
</style>
|
||||||
+46
-38
@@ -2,58 +2,66 @@ import request from '@/utils/request'
|
|||||||
|
|
||||||
// 登录方法
|
// 登录方法
|
||||||
export function login(username, password, code, uuid) {
|
export function login(username, password, code, uuid) {
|
||||||
const data = {
|
const data = {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
code,
|
code,
|
||||||
uuid
|
uuid
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
'url': '/login',
|
'url': '/login',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false
|
isToken: false
|
||||||
},
|
},
|
||||||
'method': 'post',
|
'method': 'post',
|
||||||
'data': data
|
'data': data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注册方法
|
// 注册方法
|
||||||
export function register(data) {
|
export function register(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/register',
|
url: '/register',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false
|
isToken: false
|
||||||
},
|
},
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户详细信息
|
// 获取用户详细信息
|
||||||
export function getInfo() {
|
export function getInfo() {
|
||||||
return request({
|
return request({
|
||||||
'url': '/getInfo',
|
'url': '/getInfo',
|
||||||
'method': 'get'
|
'method': 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出方法
|
// 退出方法
|
||||||
export function logout() {
|
export function logout() {
|
||||||
return request({
|
return request({
|
||||||
'url': '/logout',
|
'url': '/logout',
|
||||||
'method': 'post'
|
'method': 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
export function getCodeImg() {
|
export function getCodeImg() {
|
||||||
return request({
|
return request({
|
||||||
'url': '/captchaImage',
|
'url': '/captchaImage',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false
|
isToken: false
|
||||||
},
|
},
|
||||||
method: 'get',
|
method: 'get',
|
||||||
timeout: 20000
|
timeout: 20000
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取eidtoken
|
||||||
|
export function getEidtoken() {
|
||||||
|
return request({
|
||||||
|
'url': '/identityAuthentication/selectIdentityAuthenticaEIDtoken',
|
||||||
|
method: 'post',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,28 @@
|
|||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
baseUrl: 'http://121.40.189.20:9001',
|
baseUrl: 'https://api.xayunmei.com/zhongcaiapi/',
|
||||||
// baseUrl: 'http://192.168.3.77:8080',
|
// baseUrl: 'http://121.40.189.20:9001',
|
||||||
// baseUrl: 'http://localhost:8080',
|
// baseUrl: 'http://192.168.3.77:8080',
|
||||||
// 应用信息
|
// baseUrl: 'http://localhost:8080',
|
||||||
appInfo: {
|
// 应用信息
|
||||||
// 应用名称
|
appInfo: {
|
||||||
name: "arbitrate-wx",
|
// 应用名称
|
||||||
// 应用版本
|
name: "arbitrate-wx",
|
||||||
version: "1.1.0",
|
// 应用版本
|
||||||
// 应用logo
|
version: "1.1.0",
|
||||||
logo: "/static/chuizi.png",
|
// 应用logo
|
||||||
// 官方网站
|
logo: "/static/chuizi.png",
|
||||||
site_url: "http://ruoyi.vip",
|
// 官方网站
|
||||||
// 政策协议
|
site_url: "http://ruoyi.vip",
|
||||||
agreements: [{
|
// 政策协议
|
||||||
title: "隐私政策",
|
agreements: [{
|
||||||
url: "https://ruoyi.vip/protocol.html"
|
title: "隐私政策",
|
||||||
},
|
url: "https://ruoyi.vip/protocol.html"
|
||||||
{
|
},
|
||||||
title: "用户服务协议",
|
{
|
||||||
url: "https://ruoyi.vip/protocol.html"
|
title: "用户服务协议",
|
||||||
}
|
url: "https://ruoyi.vip/protocol.html"
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
export default{normalPath:"/pages"};
|
export default {
|
||||||
|
normalPath: ""
|
||||||
|
};
|
||||||
+3
-2
@@ -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}`
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+176
-175
@@ -1,206 +1,207 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="normal-login-container">
|
<view class="normal-login-container">
|
||||||
<view class="logo-content align-center justify-center flex">
|
<view class="logo-content align-center justify-center flex">
|
||||||
<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
|
<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
|
||||||
</image>
|
</image>
|
||||||
<text class="title">法务平台</text>
|
<text class="title">法务平台</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="login-form-content">
|
<view class="login-form-content">
|
||||||
<view class="input-item flex align-center">
|
<view class="input-item flex align-center">
|
||||||
<view class="iconfont icon-user icon"></view>
|
<view class="iconfont icon-user icon"></view>
|
||||||
<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
|
<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
|
||||||
</view>
|
</view>
|
||||||
<view class="input-item flex align-center">
|
<view class="input-item flex align-center">
|
||||||
<view class="iconfont icon-password icon"></view>
|
<view class="iconfont icon-password icon"></view>
|
||||||
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
||||||
</view>
|
</view>
|
||||||
<view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
|
<view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
|
||||||
<view class="iconfont icon-code icon"></view>
|
<view class="iconfont icon-code icon"></view>
|
||||||
<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
||||||
<view class="login-code">
|
<view class="login-code">
|
||||||
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="action-btn">
|
<view class="action-btn">
|
||||||
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
|
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="reg text-center" v-if="register">
|
<view class="reg text-center" v-if="register">
|
||||||
<text class="text-grey1">没有账号?</text>
|
<text class="text-grey1">没有账号?</text>
|
||||||
<text @click="handleUserRegister" class="text-blue">立即注册</text>
|
<text @click="handleUserRegister" class="text-blue">立即注册</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="reg text-center" v-if="register">
|
<!-- <view class="reg text-center" v-if="register">
|
||||||
<text class="text-grey1">使用其他方式登录:</text>
|
<text class="text-grey1">使用其他方式登录:</text>
|
||||||
<text @click="handleUserRegister" class="text-blue"></text>
|
<text @click="handleUserRegister" class="text-blue"></text>
|
||||||
</view> -->
|
</view> -->
|
||||||
<!-- <view class="xieyi text-center">
|
<!-- <view class="xieyi text-center">
|
||||||
<text class="text-grey1">登录即代表同意</text>
|
<text class="text-grey1">登录即代表同意</text>
|
||||||
<text @click="handleUserAgrement" class="text-blue">《用户协议》</text>
|
<text @click="handleUserAgrement" class="text-blue">《用户协议》</text>
|
||||||
<text @click="handlePrivacy" class="text-blue">《隐私协议》</text>
|
<text @click="handlePrivacy" class="text-blue">《隐私协议》</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg } from '@/api/login'
|
import {
|
||||||
|
getCodeImg
|
||||||
|
} from '@/api/login'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
codeUrl: "",
|
codeUrl: "",
|
||||||
captchaEnabled: true,
|
captchaEnabled: true,
|
||||||
// 用户注册开关
|
// 用户注册开关
|
||||||
register: true,
|
register: true,
|
||||||
globalConfig: getApp().globalData.config,
|
globalConfig: getApp().globalData.config,
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: "admin",
|
username: "admin",
|
||||||
password: "admin123",
|
password: "admin123",
|
||||||
code: "",
|
code: "",
|
||||||
uuid: ''
|
uuid: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getCode()
|
this.getCode()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 用户注册
|
// 用户注册
|
||||||
handleUserRegister() {
|
handleUserRegister() {
|
||||||
this.$tab.redirectTo(`/pages/register`)
|
this.$tab.redirectTo(`/pages/register`)
|
||||||
},
|
},
|
||||||
// 隐私协议
|
// 隐私协议
|
||||||
handlePrivacy() {
|
handlePrivacy() {
|
||||||
let site = this.globalConfig.appInfo.agreements[0]
|
let site = this.globalConfig.appInfo.agreements[0]
|
||||||
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
||||||
},
|
},
|
||||||
// 用户协议
|
// 用户协议
|
||||||
handleUserAgrement() {
|
handleUserAgrement() {
|
||||||
let site = this.globalConfig.appInfo.agreements[1]
|
let site = this.globalConfig.appInfo.agreements[1]
|
||||||
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
||||||
},
|
},
|
||||||
// 获取图形验证码
|
// 获取图形验证码
|
||||||
getCode() {
|
getCode() {
|
||||||
getCodeImg().then(res => {
|
getCodeImg().then(res => {
|
||||||
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
||||||
if (this.captchaEnabled) {
|
if (this.captchaEnabled) {
|
||||||
this.codeUrl = 'data:image/gif;base64,' + res.img
|
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||||
this.loginForm.uuid = res.uuid
|
this.loginForm.uuid = res.uuid
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 登录方法
|
// 登录方法
|
||||||
async handleLogin() {
|
async handleLogin() {
|
||||||
if (this.loginForm.username === "") {
|
if (this.loginForm.username === "") {
|
||||||
this.$modal.msgError("请输入您的账号")
|
this.$modal.msgError("请输入您的账号")
|
||||||
} else if (this.loginForm.password === "") {
|
} else if (this.loginForm.password === "") {
|
||||||
this.$modal.msgError("请输入您的密码")
|
this.$modal.msgError("请输入您的密码")
|
||||||
} else if (this.loginForm.code === "" && this.captchaEnabled) {
|
} else if (this.loginForm.code === "" && this.captchaEnabled) {
|
||||||
this.$modal.msgError("请输入验证码")
|
this.$modal.msgError("请输入验证码")
|
||||||
} else {
|
} else {
|
||||||
this.$modal.loading("登录中,请耐心等待...")
|
this.$modal.loading("登录中,请耐心等待...")
|
||||||
this.pwdLogin()
|
this.pwdLogin()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 密码登录
|
// 密码登录
|
||||||
async pwdLogin() {
|
async pwdLogin() {
|
||||||
this.$store.dispatch('Login', this.loginForm).then(() => {
|
this.$store.dispatch('Login', this.loginForm).then(() => {
|
||||||
this.$modal.closeLoading()
|
this.$modal.closeLoading()
|
||||||
this.loginSuccess()
|
this.loginSuccess()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
if (this.captchaEnabled) {
|
if (this.captchaEnabled) {
|
||||||
this.getCode()
|
this.getCode()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 登录成功后,处理函数
|
// 登录成功后,处理函数
|
||||||
loginSuccess(result) {
|
loginSuccess(result) {
|
||||||
// 设置用户信息
|
// 设置用户信息
|
||||||
this.$store.dispatch('GetInfo').then(res => {
|
this.$store.dispatch('GetInfo').then(res => {
|
||||||
this.$tab.reLaunch('/pages/index')
|
this.$tab.reLaunch('/pages/index')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.normal-login-container {
|
.normal-login-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.logo-content {
|
.logo-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 21px;
|
font-size: 21px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-top: 15%;
|
padding-top: 15%;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form-content {
|
.login-form-content {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
margin-top: 15%;
|
margin-top: 15%;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|
||||||
.input-item {
|
.input-item {
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
background-color: #f5f6f7;
|
background-color: #f5f6f7;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
font-size: 38rpx;
|
font-size: 38rpx;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-btn {
|
.login-btn {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reg {
|
.reg {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xieyi {
|
.xieyi {
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-code {
|
.login-code {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
float: right;
|
float: right;
|
||||||
|
|
||||||
.login-code-img {
|
|
||||||
height: 38px;
|
|
||||||
position: absolute;
|
|
||||||
margin-left: 10px;
|
|
||||||
width: 200rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.login-code-img {
|
||||||
|
height: 38px;
|
||||||
|
position: absolute;
|
||||||
|
margin-left: 10px;
|
||||||
|
width: 200rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
+39
-7
@@ -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>
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,8 +1,8 @@
|
|||||||
const getters = {
|
const getters = {
|
||||||
token: state => state.user.token,
|
token: state => state.user.token,
|
||||||
avatar: state => state.user.avatar,
|
avatar: state => state.user.avatar,
|
||||||
name: state => state.user.name,
|
name: state => state.user.name,
|
||||||
roles: state => state.user.roles,
|
roles: state => state.user.roles,
|
||||||
permissions: state => state.user.permissions
|
permissions: state => state.user.permissions
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
+102
-84
@@ -1,98 +1,116 @@
|
|||||||
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
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
state: {
|
state: {
|
||||||
token: getToken(),
|
token: getToken(),
|
||||||
name: storage.get(constant.name),
|
name: storage.get(constant.name),
|
||||||
avatar: storage.get(constant.avatar),
|
avatar: storage.get(constant.avatar),
|
||||||
roles: storage.get(constant.roles),
|
roles: storage.get(constant.roles),
|
||||||
permissions: storage.get(constant.permissions)
|
permissions: storage.get(constant.permissions)
|
||||||
},
|
},
|
||||||
|
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_TOKEN: (state, token) => {
|
SET_TOKEN: (state, token) => {
|
||||||
state.token = token
|
state.token = token
|
||||||
},
|
},
|
||||||
SET_NAME: (state, name) => {
|
SET_NAME: (state, name) => {
|
||||||
state.name = name
|
state.name = name
|
||||||
storage.set(constant.name, name)
|
storage.set(constant.name, name)
|
||||||
},
|
},
|
||||||
SET_AVATAR: (state, avatar) => {
|
SET_AVATAR: (state, avatar) => {
|
||||||
state.avatar = avatar
|
state.avatar = avatar
|
||||||
storage.set(constant.avatar, avatar)
|
storage.set(constant.avatar, avatar)
|
||||||
},
|
},
|
||||||
SET_ROLES: (state, roles) => {
|
SET_ROLES: (state, roles) => {
|
||||||
state.roles = roles
|
state.roles = roles
|
||||||
storage.set(constant.roles, roles)
|
storage.set(constant.roles, roles)
|
||||||
},
|
},
|
||||||
SET_PERMISSIONS: (state, permissions) => {
|
SET_PERMISSIONS: (state, permissions) => {
|
||||||
state.permissions = permissions
|
state.permissions = permissions
|
||||||
storage.set(constant.permissions, permissions)
|
storage.set(constant.permissions, permissions)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// 登录
|
// 登录
|
||||||
Login({ commit }, userInfo) {
|
Login({
|
||||||
const username = userInfo.username.trim()
|
commit
|
||||||
const password = userInfo.password
|
}, userInfo) {
|
||||||
const code = userInfo.code
|
const username = userInfo.username.trim()
|
||||||
const uuid = userInfo.uuid
|
const password = userInfo.password
|
||||||
return new Promise((resolve, reject) => {
|
const code = userInfo.code
|
||||||
login(username, password, code, uuid).then(res => {
|
const uuid = userInfo.uuid
|
||||||
setToken(res.token)
|
return new Promise((resolve, reject) => {
|
||||||
commit('SET_TOKEN', res.token)
|
login(username, password, code, uuid).then(res => {
|
||||||
resolve()
|
setToken(res.token)
|
||||||
}).catch(error => {
|
commit('SET_TOKEN', res.token)
|
||||||
reject(error)
|
resolve()
|
||||||
})
|
}).catch(error => {
|
||||||
})
|
reject(error)
|
||||||
},
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
GetInfo({ commit, state }) {
|
GetInfo({
|
||||||
return new Promise((resolve, reject) => {
|
commit,
|
||||||
getInfo().then(res => {
|
state
|
||||||
const user = res.user
|
}) {
|
||||||
const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar
|
return new Promise((resolve, reject) => {
|
||||||
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
|
getInfo().then(res => {
|
||||||
if (res.roles && res.roles.length > 0) {
|
const user = res.user
|
||||||
commit('SET_ROLES', res.roles)
|
const avatar = (user == null || user.avatar == "" || user.avatar == null) ?
|
||||||
commit('SET_PERMISSIONS', res.permissions)
|
require("@/static/images/profile.jpg") : baseUrl + user.avatar
|
||||||
} else {
|
const username = (user == null || user.userName == "" || user.userName ==
|
||||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
null) ? "" : user.userName
|
||||||
}
|
if (res.roles && res.roles.length > 0) {
|
||||||
commit('SET_NAME', username)
|
commit('SET_ROLES', res.roles)
|
||||||
commit('SET_AVATAR', avatar)
|
commit('SET_PERMISSIONS', res.permissions)
|
||||||
resolve(res)
|
} else {
|
||||||
}).catch(error => {
|
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||||
reject(error)
|
}
|
||||||
})
|
commit('SET_NAME', username)
|
||||||
})
|
commit('SET_AVATAR', avatar)
|
||||||
},
|
resolve(res)
|
||||||
|
}).catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 退出系统
|
// 退出系统
|
||||||
LogOut({ commit, state }) {
|
LogOut({
|
||||||
return new Promise((resolve, reject) => {
|
commit,
|
||||||
logout(state.token).then(() => {
|
state
|
||||||
commit('SET_TOKEN', '')
|
}) {
|
||||||
commit('SET_ROLES', [])
|
return new Promise((resolve, reject) => {
|
||||||
commit('SET_PERMISSIONS', [])
|
logout(state.token).then(() => {
|
||||||
removeToken()
|
commit('SET_TOKEN', '')
|
||||||
storage.clean()
|
commit('SET_ROLES', [])
|
||||||
resolve()
|
commit('SET_PERMISSIONS', [])
|
||||||
}).catch(error => {
|
removeToken()
|
||||||
reject(error)
|
storage.clean()
|
||||||
})
|
resolve()
|
||||||
})
|
}).catch(error => {
|
||||||
}
|
reject(error)
|
||||||
}
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default user
|
export default user
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -3,6 +3,6 @@
|
|||||||
"projectname": "若依移动端",
|
"projectname": "若依移动端",
|
||||||
"setting": {
|
"setting": {
|
||||||
"compileHotReLoad": true,
|
"compileHotReLoad": true,
|
||||||
"urlCheck": false
|
"urlCheck": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
const TokenKey = 'App-Token'
|
const TokenKey = 'App-Token'
|
||||||
|
|
||||||
export function getToken() {
|
export function getToken() {
|
||||||
return uni.getStorageSync(TokenKey)
|
return uni.getStorageSync(TokenKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setToken(token) {
|
export function setToken(token) {
|
||||||
return uni.setStorageSync(TokenKey, token)
|
return uni.setStorageSync(TokenKey, token)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeToken() {
|
export function removeToken() {
|
||||||
return uni.removeStorageSync(TokenKey)
|
return uni.removeStorageSync(TokenKey)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user