强制使用谷歌浏览器

This commit is contained in:
guoyue 2022-09-13 09:38:00 +08:00
parent 1e06abbf11
commit 7996d8a701
1 changed files with 163 additions and 123 deletions

View File

@ -15,22 +15,16 @@
</a-input>
</a-form-item>
<a-form-item>
<a-input
v-model:value="form.password"
type="password"
placeholder="Password"
>
<a-input v-model:value="form.password" type="password" placeholder="Password">
<template v-slot:prefix>
<LockOutlined style="color: rgba(0, 0, 0, 0.25)" />
</template>
</a-input>
</a-form-item>
<a-form-item>
<a-button
type="primary"
html-type="submit"
:disabled="form.username === '' || form.password === ''"
>
<!-- IE Chrome -->
<a-button type="primary" html-type="submit"
:disabled="form.username === '' || form.password === '' || judgeAgent() !== 'Chrome'">
登录
</a-button>
</a-form-item>
@ -46,7 +40,7 @@
import { mapActions, mapGetters } from 'vuex'
import { Encrypt } from '@/utils/crypto'
import { UserOutlined, LockOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { message, Modal } from 'ant-design-vue'
export default {
name: 'Login',
@ -85,11 +79,50 @@
/* setTimeout(() => {
this.handleSubmit()
}, 3000) */
if (this.judgeAgent() !== 'Chrome') {
Modal.warning({
title: '提示',
content: '请使用谷歌浏览器!',
});
}
},
methods: {
...mapActions({
login: 'user/login',
}),
//
judgeAgent() {
let userAgent = navigator.userAgent // userAgent
let isOpera = userAgent.indexOf('Opera') > -1
//Opera
if (isOpera) {
return 'Opera'
}
//Firefox
if (userAgent.indexOf('Firefox') > -1) {
return 'FF'
}
//chorme
if (userAgent.indexOf('Chrome') > -1) {
return 'Chrome'
}
//Safari
if (userAgent.indexOf('Safari') > -1) {
return 'Safari'
}
//IE
if (
userAgent.indexOf('compatible') > -1 &&
userAgent.indexOf('MSIE') > -1 &&
!isOpera
) {
return 'IE'
}
//Edge
if (userAgent.indexOf('Trident') > -1) {
return 'Edge'
}
},
handleRoute() {
return this.redirect === '/404' || this.redirect === '/403'
? '/home'
@ -124,6 +157,7 @@
height: 100vh;
background: url('~@/assets/login_images/login_background.png');
background-size: cover;
&-form {
width: calc(100% - 40px);
height: 380px;
@ -136,15 +170,18 @@
border-radius: 10px;
box-shadow: 0 2px 8px 0 rgba(7, 17, 27, 0.06);
}
&-hello {
font-size: 32px;
color: #fff;
}
&-title {
margin-bottom: 30px;
font-size: 20px;
color: #fff;
}
&-tips {
position: fixed;
bottom: @vab-margin;
@ -153,13 +190,16 @@
color: rgba(255, 255, 255, 0.856);
text-align: center;
}
.ant-col {
width: 100%;
padding: 0 10px 0 10px;
}
.ant-input {
height: 35px;
}
.ant-btn {
width: 100%;
height: 45px;