张恒

修改登录页效果,提升electron版本

...@@ -37,7 +37,7 @@ npm config edit ...@@ -37,7 +37,7 @@ npm config edit
37 37
38 --- 38 ---
39 39
40 -这个项目使用了 [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). 文档你们可以在这里看到: [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html). 40 +这个项目使用了 [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). 文档你们可以在这里看到: [这里](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
41 这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin) 41 这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
42 42
43 # 更新日志 43 # 更新日志
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
90 "css-loader": "^3.1.0", 90 "css-loader": "^3.1.0",
91 "del": "^5.0.0", 91 "del": "^5.0.0",
92 "devtron": "^1.4.0", 92 "devtron": "^1.4.0",
93 - "electron": "^5.0.10", 93 + "electron": "^5.0.11",
94 "electron-builder": "^21.1.1", 94 "electron-builder": "^21.1.1",
95 "electron-debug": "^3.0.1", 95 "electron-debug": "^3.0.1",
96 "electron-devtools-installer": "^2.2.4", 96 "electron-devtools-installer": "^2.2.4",
...@@ -124,13 +124,13 @@ ...@@ -124,13 +124,13 @@
124 "spectron": "^3.8.0", 124 "spectron": "^3.8.0",
125 "style-loader": "^0.21.0", 125 "style-loader": "^0.21.0",
126 "svg-sprite-loader": "^4.1.6", 126 "svg-sprite-loader": "^4.1.6",
127 - "terser-webpack-plugin": "^2.1.0", 127 + "terser-webpack-plugin": "^2.1.2",
128 "url-loader": "^2.1.0", 128 "url-loader": "^2.1.0",
129 "vue-html-loader": "^1.2.4", 129 "vue-html-loader": "^1.2.4",
130 "vue-loader": "^15.7.1", 130 "vue-loader": "^15.7.1",
131 "vue-style-loader": "^4.1.2", 131 "vue-style-loader": "^4.1.2",
132 "vue-template-compiler": "^2.6.10", 132 "vue-template-compiler": "^2.6.10",
133 - "webpack": "^4.40.2", 133 + "webpack": "^4.41.0",
134 "webpack-cli": "^3.3.9", 134 "webpack-cli": "^3.3.9",
135 "webpack-dev-server": "^3.8.1", 135 "webpack-dev-server": "^3.8.1",
136 "webpack-hot-middleware": "^2.25.0", 136 "webpack-hot-middleware": "^2.25.0",
......
...@@ -32,7 +32,9 @@ function createWindow () { ...@@ -32,7 +32,9 @@ function createWindow () {
32 backgroundColor: '#fffff', 32 backgroundColor: '#fffff',
33 titleBarStyle: 'hidden', 33 titleBarStyle: 'hidden',
34 webPreferences: { 34 webPreferences: {
35 - nodeIntegration: true 35 + nodeIntegration: true,
36 + webSecurity: false,
37 + experimentalFeatures: true
36 } 38 }
37 // 隐藏边框 39 // 隐藏边框
38 // frame: false, 40 // frame: false,
......
1 <template> 1 <template>
2 <div class="login-container"> 2 <div class="login-container">
3 - <el-form class="login-form" autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="left"> 3 + <div class="login-from-box">
4 + <el-form
5 + class="login-form"
6 + autocomplete="on"
7 + :model="loginForm"
8 + :rules="loginRules"
9 + ref="loginForm"
10 + label-position="left"
11 + >
4 <h3 class="title">后台管理框架</h3> 12 <h3 class="title">后台管理框架</h3>
5 <el-form-item prop="username"> 13 <el-form-item prop="username">
6 <span class="svg-container svg-container_login"> 14 <span class="svg-container svg-container_login">
7 <svg-icon icon-class="user" /> 15 <svg-icon icon-class="user" />
8 </span> 16 </span>
9 - <el-input name="username" type="text" v-model="loginForm.username" autoComplete="on" placeholder="用户名" /> 17 + <el-input
18 + name="username"
19 + type="text"
20 + v-model="loginForm.username"
21 + autocomplete="on"
22 + placeholder="用户名"
23 + />
10 </el-form-item> 24 </el-form-item>
11 <el-form-item prop="password"> 25 <el-form-item prop="password">
12 <span class="svg-container"> 26 <span class="svg-container">
13 <svg-icon icon-class="password"></svg-icon> 27 <svg-icon icon-class="password"></svg-icon>
14 </span> 28 </span>
15 - <el-input name="password" :type="pwdType" @keyup.enter.native="handleLogin" v-model="loginForm.password" autoComplete="on" 29 + <el-input
16 - placeholder="密码"></el-input> 30 + name="password"
17 - <span class="show-pwd" @click="showPwd"><svg-icon icon-class="eye" /></span> 31 + :type="pwdType"
32 + @keyup.enter.native="handleLogin"
33 + v-model="loginForm.password"
34 + autocomplete="on"
35 + placeholder="密码"
36 + ></el-input>
37 + <span class="show-pwd" @click="showPwd">
38 + <svg-icon icon-class="eye" />
39 + </span>
18 </el-form-item> 40 </el-form-item>
19 <el-form-item> 41 <el-form-item>
20 - <el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin"> 42 + <el-button
21 - 登录 43 + type="primary"
22 - </el-button> 44 + style="width:100%;"
45 + :loading="loading"
46 + @click.native.prevent="handleLogin"
47 + >登录</el-button>
23 </el-form-item> 48 </el-form-item>
24 <div class="tips"> 49 <div class="tips">
25 <span style="margin-right:20px;">用户名: admin</span> 50 <span style="margin-right:20px;">用户名: admin</span>
26 - <span> 密码:随便什么都行</span> 51 + <span>密码:随便什么都行</span>
27 </div> 52 </div>
28 </el-form> 53 </el-form>
29 </div> 54 </div>
55 + </div>
30 </template> 56 </template>
31 57
32 <script> 58 <script>
33 -import { isvalidUsername } from '@/utils/validate' 59 +import { isvalidUsername } from "@/utils/validate";
34 60
35 export default { 61 export default {
36 - name: 'login', 62 + name: "login",
37 data() { 63 data() {
38 const validateUsername = (rule, value, callback) => { 64 const validateUsername = (rule, value, callback) => {
39 if (!isvalidUsername(value)) { 65 if (!isvalidUsername(value)) {
40 - callback(new Error('请输入正确的用户名')) 66 + callback(new Error("请输入正确的用户名"));
41 } else { 67 } else {
42 - callback() 68 + callback();
43 - }
44 } 69 }
70 + };
45 const validatePass = (rule, value, callback) => { 71 const validatePass = (rule, value, callback) => {
46 if (value.length < 5) { 72 if (value.length < 5) {
47 - callback(new Error('密码不能小于5位')) 73 + callback(new Error("密码不能小于5位"));
48 } else { 74 } else {
49 - callback() 75 + callback();
50 - }
51 } 76 }
77 + };
52 return { 78 return {
53 loginForm: { 79 loginForm: {
54 - username: 'admin', 80 + username: "admin",
55 - password: 'admin' 81 + password: "admin"
56 }, 82 },
57 loginRules: { 83 loginRules: {
58 - username: [{ required: true, trigger: 'blur', validator: validateUsername }], 84 + username: [
59 - password: [{ required: true, trigger: 'blur', validator: validatePass }] 85 + { required: true, trigger: "blur", validator: validateUsername }
86 + ],
87 + password: [{ required: true, trigger: "blur", validator: validatePass }]
60 }, 88 },
61 loading: false, 89 loading: false,
62 - pwdType: 'password' 90 + pwdType: "password"
63 - } 91 + };
64 }, 92 },
65 methods: { 93 methods: {
66 showPwd() { 94 showPwd() {
67 - if (this.pwdType === 'password') { 95 + if (this.pwdType === "password") {
68 - this.pwdType = '' 96 + this.pwdType = "";
69 } else { 97 } else {
70 - this.pwdType = 'password' 98 + this.pwdType = "password";
71 } 99 }
72 }, 100 },
73 handleLogin() { 101 handleLogin() {
74 - console.log(11111) 102 + console.log(11111);
75 this.$refs.loginForm.validate(valid => { 103 this.$refs.loginForm.validate(valid => {
76 - console.log(valid) 104 + console.log(valid);
77 if (valid) { 105 if (valid) {
78 - this.loading = true 106 + this.loading = true;
79 - this.$store.dispatch('Login', this.loginForm).then(() => { 107 + this.$store
80 - this.loading = false 108 + .dispatch("Login", this.loginForm)
81 - this.$router.push({ path: '/' }) 109 + .then(() => {
82 - }).catch(() => { 110 + this.loading = false;
83 - this.loading = false 111 + this.$router.push({ path: "/" });
84 }) 112 })
113 + .catch(() => {
114 + this.loading = false;
115 + });
85 } else { 116 } else {
86 - console.log('error submit!!') 117 + console.log("error submit!!");
87 - return false 118 + return false;
88 } 119 }
89 - }) 120 + });
90 } 121 }
91 } 122 }
92 -} 123 +};
93 </script> 124 </script>
94 125
95 -<style rel="stylesheet/scss" lang="scss"> 126 +<style rel="stylesheet/scss" lang="scss" scoped>
96 -$bg:#2d3a4b; 127 +$bg: #2d3a4b;
97 -$light_gray:#eee; 128 +$light_gray: #eee;
129 +$dark_gray: #889aa4;
130 +$light_gray: #eee;
98 131
99 /* reset element-ui css */ 132 /* reset element-ui css */
100 .login-container { 133 .login-container {
134 + position: fixed;
135 + height: 100%;
136 + width: 100%;
137 + top: 0;
101 left: 0; 138 left: 0;
102 - .el-input { 139 + background-image: url("https://cn.bing.com/th?id=OHR.ClavijoLandscape_ZH-CN1525245124_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp");
140 + /deep/ .el-input {
103 display: inline-block; 141 display: inline-block;
104 height: 47px; 142 height: 47px;
105 width: 85%; 143 width: 85%;
...@@ -117,25 +155,16 @@ $light_gray:#eee; ...@@ -117,25 +155,16 @@ $light_gray:#eee;
117 } 155 }
118 } 156 }
119 } 157 }
120 - .el-form-item { 158 + /deep/ .el-form-item {
121 border: 1px solid rgba(255, 255, 255, 0.1); 159 border: 1px solid rgba(255, 255, 255, 0.1);
122 background: rgba(0, 0, 0, 0.1); 160 background: rgba(0, 0, 0, 0.1);
123 border-radius: 5px; 161 border-radius: 5px;
124 color: #454545; 162 color: #454545;
125 } 163 }
126 -} 164 + .login-from-box {
165 + position: relative;
166 + backdrop-filter: saturate(180%) blur(20px);
127 167
128 -</style>
129 -
130 -<style rel="stylesheet/scss" lang="scss" scoped>
131 -$bg:#2d3a4b;
132 -$dark_gray:#889aa4;
133 -$light_gray:#eee;
134 -.login-container {
135 - position: fixed;
136 - height: 100%;
137 - width: 100%;
138 - background-color: $bg;
139 .login-form { 168 .login-form {
140 position: absolute; 169 position: absolute;
141 left: 0; 170 left: 0;
...@@ -181,5 +210,6 @@ $light_gray:#eee; ...@@ -181,5 +210,6 @@ $light_gray:#eee;
181 cursor: pointer; 210 cursor: pointer;
182 user-select: none; 211 user-select: none;
183 } 212 }
213 + }
184 } 214 }
185 </style> 215 </style>
......