强制使用谷歌浏览器

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