This commit is contained in:
qinjie 2021-08-20 16:29:28 +08:00
parent 1fd2c069c9
commit 5039bc0deb
3 changed files with 133 additions and 56 deletions

118
public/index.html vendored
View File

@ -1,34 +1,134 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-cmn-Hans"> <html lang="zh-cmn-Hans">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>logo.png"> <link rel="icon" href="<%= BASE_URL %>logo.png">
<title>Ant Design Pro</title> <title>Ant Design Pro</title>
<style>.first-loading-wrp{display:flex;justify-content:center;align-items:center;flex-direction:column;min-height:420px;height:100%}.first-loading-wrp>h1{font-size:128px}.first-loading-wrp .loading-wrp{padding:98px;display:flex;justify-content:center;align-items:center}.dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:32px;width:32px;height:32px;box-sizing:border-box}.dot i{width:14px;height:14px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.dot i:nth-child(1){top:0;left:0}.dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style> <style>
.first-loading-wrp {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 420px;
height: 100%
}
.first-loading-wrp>h1 {
font-size: 128px
}
.first-loading-wrp .loading-wrp {
padding: 98px;
display: flex;
justify-content: center;
align-items: center
}
.dot {
animation: antRotate 1.2s infinite linear;
transform: rotate(45deg);
position: relative;
display: inline-block;
font-size: 32px;
width: 32px;
height: 32px;
box-sizing: border-box
}
.dot i {
width: 14px;
height: 14px;
position: absolute;
display: block;
background-color: #1890ff;
border-radius: 100%;
transform: scale(.75);
transform-origin: 50% 50%;
opacity: .3;
animation: antSpinMove 1s infinite linear alternate
}
.dot i:nth-child(1) {
top: 0;
left: 0
}
.dot i:nth-child(2) {
top: 0;
right: 0;
-webkit-animation-delay: .4s;
animation-delay: .4s
}
.dot i:nth-child(3) {
right: 0;
bottom: 0;
-webkit-animation-delay: .8s;
animation-delay: .8s
}
.dot i:nth-child(4) {
bottom: 0;
left: 0;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s
}
@keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg)
}
}
@-webkit-keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg)
}
}
@keyframes antSpinMove {
to {
opacity: 1
}
}
@-webkit-keyframes antSpinMove {
to {
opacity: 1
}
}
</style>
<!-- require cdn assets css --> <!-- require cdn assets css -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %> <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" /> <link rel="stylesheet" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
<% } %> <% } %>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript> </noscript>
<div id="app"> <div id="app">
<div class="first-loading-wrp"> <div class="first-loading-wrp">
<h1>Pro</h1> <!-- <h1>Pro</h1> -->
<div class="loading-wrp"> <div class="loading-wrp">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span> <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div> </div>
<div style="display: flex; justify-content: center; align-items: center;">Ant Design</div> <!-- <div style="display: flex; justify-content: center; align-items: center;">Ant Design</div> -->
</div> </div>
</div> </div>
<!-- require cdn assets js --> <!-- require cdn assets js -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script type="text/javascript" src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script> <script type="text/javascript" src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %> <% } %>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
</html> </html>

View File

@ -1,57 +1,31 @@
<template> <template>
<div class="main"> <div class="main">
<a-form <a-form id="formLogin" class="user-layout-login" ref="formLogin" :form="form" @submit="handleSubmit">
id="formLogin"
class="user-layout-login"
ref="formLogin"
:form="form"
@submit="handleSubmit"
>
<a-alert v-if="isLoginError" type="error" showIcon style="margin-bottom: 24px;" message="账户或密码错误18729260811/a123456789 )" /> <a-alert v-if="isLoginError" type="error" showIcon style="margin-bottom: 24px;" message="账户或密码错误18729260811/a123456789 )" />
<a-form-item> <a-form-item>
<a-input <a-input size="large" type="text" placeholder="账户: 18729260811" v-decorator="[
size="large"
type="text"
placeholder="账户: 18729260811"
v-decorator="[
'mobile', 'mobile',
{rules: [{ required: true, message: '请输入帐户名或邮箱地址' }], validateTrigger: 'change'} {rules: [{ required: true, message: '请输入帐户名或邮箱地址' }], validateTrigger: 'change'}
]" ]">
> <a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }" />
<a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-input-password <a-input-password size="large" placeholder="密码: a123456789" v-decorator="[
size="large"
placeholder="密码: a123456789"
v-decorator="[
'password', 'password',
{rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur'} {rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur'}
]" ]">
> <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }" />
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input-password> </a-input-password>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-checkbox v-decorator="['rememberMe', { valuePropName: 'checked' }]">自动登录</a-checkbox> <a-checkbox v-decorator="['rememberMe', { valuePropName: 'checked' }]">自动登录</a-checkbox>
<router-link <router-link :to="{ name: 'recover', params: { user: 'aaa'} }" class="forge-password" style="float: right;">忘记密码</router-link>
:to="{ name: 'recover', params: { user: 'aaa'} }"
class="forge-password"
style="float: right;"
>忘记密码</router-link>
</a-form-item> </a-form-item>
<a-form-item style="margin-top:24px"> <a-form-item style="margin-top:24px">
<a-button <a-button size="large" type="primary" htmlType="submit" class="login-button" :loading="state.loginBtn" :disabled="state.loginBtn">确定</a-button>
size="large"
type="primary"
htmlType="submit"
class="login-button"
:loading="state.loginBtn"
:disabled="state.loginBtn"
>确定</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
@ -62,7 +36,7 @@ import { mapActions } from 'vuex'
import { timeFix } from '@/utils/util' import { timeFix } from '@/utils/util'
export default { export default {
data () { data() {
return { return {
loginBtn: false, loginBtn: false,
loginType: 0, loginType: 0,
@ -77,7 +51,7 @@ export default {
}, },
methods: { methods: {
...mapActions(['Login', 'Logout']), ...mapActions(['Login', 'Logout']),
handleSubmit (e) { handleSubmit(e) {
e.preventDefault() e.preventDefault()
const { const {
form: { validateFields }, form: { validateFields },
@ -108,7 +82,7 @@ export default {
} }
}) })
}, },
loginSuccess (res) { loginSuccess(res) {
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
// 1 // 1
setTimeout(() => { setTimeout(() => {
@ -119,7 +93,7 @@ export default {
}, 1000) }, 1000)
this.isLoginError = false this.isLoginError = false
}, },
requestFailed () { requestFailed() {
this.isLoginError = true this.isLoginError = true
} }
} }

View File

@ -5,7 +5,7 @@ const GitRevision = new GitRevisionPlugin()
const buildDate = JSON.stringify(new Date().toLocaleString()) const buildDate = JSON.stringify(new Date().toLocaleString())
const createThemeColorReplacerPlugin = require('./config/plugin.config') const createThemeColorReplacerPlugin = require('./config/plugin.config')
function resolve (dir) { function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
@ -93,14 +93,17 @@ const vueConfig = {
}, },
devServer: { devServer: {
disableHostCheck: true, // 解决vue项目中的“Invalid Host header”问题 disableHostCheck: true, // <EFBFBD><EFBFBD><EFBFBD>vue<EFBFBD><EFBFBD>Ŀ<EFBFBD>еġ<EFBFBD>Invalid Host header<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
port: 8001, // development server port 默认8001这个得看你的项目申请的端口号是多少而定 port: 8001, // development server port Ĭ<EFBFBD><EFBFBD>8001<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ˿ں<EFBFBD><EFBFBD>Ƕ<EFBFBD><EFBFBD>ٶ<EFBFBD><EFBFBD><EFBFBD>
// 如果需要开启代理,请移除mockjs /src/main.jsL11 // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>mockjs /src/main.jsL11
proxy: { proxy: {
'/dawa': { // 捕获API的标志如果API中有这个字符串那么就开始匹配代理 '/dawa': { // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>API<EFBFBD>ı<EFBFBD>־<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>API<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD>Ϳ<EFBFBD>ʼƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
target: 'http://a.3a6.cn/', // 地址可以是域名也可以是IP地址。比如API请求/api/getList, 会被代理到请求http://www.baidu.com/api/getList 。 target: 'http://a.3a6.cn/', // <EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>API<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/api/getList, <20><EFBFBD><E1B1BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>http://www.baidu.com/api/getList <20><>
ws: false, ws: false,
changeOrigin: true // 如果target是域名需要额外添加一个参数changeOrigin: true否则会代理失败。 changeOrigin: true // <20><><EFBFBD>target<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>changeOrigin: true<75><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܡ<EFBFBD>
// ,pathRewrite: {
// '^/dawa': '/'
// }
} }
} }
}, },