正在显示
5 个修改的文件
包含
151 行增加
和
119 行删除
| ... | @@ -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 | - <h3 class="title">后台管理框架</h3> | 4 | + <el-form |
| 5 | - <el-form-item prop="username"> | 5 | + class="login-form" |
| 6 | - <span class="svg-container svg-container_login"> | 6 | + autocomplete="on" |
| 7 | - <svg-icon icon-class="user" /> | 7 | + :model="loginForm" |
| 8 | - </span> | 8 | + :rules="loginRules" |
| 9 | - <el-input name="username" type="text" v-model="loginForm.username" autoComplete="on" placeholder="用户名" /> | 9 | + ref="loginForm" |
| 10 | - </el-form-item> | 10 | + label-position="left" |
| 11 | - <el-form-item prop="password"> | 11 | + > |
| 12 | - <span class="svg-container"> | 12 | + <h3 class="title">后台管理框架</h3> |
| 13 | - <svg-icon icon-class="password"></svg-icon> | 13 | + <el-form-item prop="username"> |
| 14 | - </span> | 14 | + <span class="svg-container svg-container_login"> |
| 15 | - <el-input name="password" :type="pwdType" @keyup.enter.native="handleLogin" v-model="loginForm.password" autoComplete="on" | 15 | + <svg-icon icon-class="user" /> |
| 16 | - placeholder="密码"></el-input> | 16 | + </span> |
| 17 | - <span class="show-pwd" @click="showPwd"><svg-icon icon-class="eye" /></span> | 17 | + <el-input |
| 18 | - </el-form-item> | 18 | + name="username" |
| 19 | - <el-form-item> | 19 | + type="text" |
| 20 | - <el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin"> | 20 | + v-model="loginForm.username" |
| 21 | - 登录 | 21 | + autocomplete="on" |
| 22 | - </el-button> | 22 | + placeholder="用户名" |
| 23 | - </el-form-item> | 23 | + /> |
| 24 | - <div class="tips"> | 24 | + </el-form-item> |
| 25 | - <span style="margin-right:20px;">用户名: admin</span> | 25 | + <el-form-item prop="password"> |
| 26 | - <span> 密码:随便什么都行</span> | 26 | + <span class="svg-container"> |
| 27 | - </div> | 27 | + <svg-icon icon-class="password"></svg-icon> |
| 28 | - </el-form> | 28 | + </span> |
| 29 | + <el-input | ||
| 30 | + name="password" | ||
| 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> | ||
| 40 | + </el-form-item> | ||
| 41 | + <el-form-item> | ||
| 42 | + <el-button | ||
| 43 | + type="primary" | ||
| 44 | + style="width:100%;" | ||
| 45 | + :loading="loading" | ||
| 46 | + @click.native.prevent="handleLogin" | ||
| 47 | + >登录</el-button> | ||
| 48 | + </el-form-item> | ||
| 49 | + <div class="tips"> | ||
| 50 | + <span style="margin-right:20px;">用户名: admin</span> | ||
| 51 | + <span>密码:随便什么都行</span> | ||
| 52 | + </div> | ||
| 53 | + </el-form> | ||
| 54 | + </div> | ||
| 29 | </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 | } | 69 | } |
| 44 | - } | 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 | } | 76 | } |
| 51 | - } | 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,69 +155,61 @@ $light_gray:#eee; | ... | @@ -117,69 +155,61 @@ $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 { |
| 127 | - | 165 | + position: relative; |
| 128 | -</style> | 166 | + backdrop-filter: saturate(180%) blur(20px); |
| 129 | 167 | ||
| 130 | -<style rel="stylesheet/scss" lang="scss" scoped> | 168 | + .login-form { |
| 131 | -$bg:#2d3a4b; | 169 | + position: absolute; |
| 132 | -$dark_gray:#889aa4; | 170 | + left: 0; |
| 133 | -$light_gray:#eee; | 171 | + right: 0; |
| 134 | -.login-container { | 172 | + width: 520px; |
| 135 | - position: fixed; | 173 | + padding: 35px 35px 15px 35px; |
| 136 | - height: 100%; | 174 | + margin: 120px auto; |
| 137 | - width: 100%; | 175 | + } |
| 138 | - background-color: $bg; | 176 | + .tips { |
| 139 | - .login-form { | 177 | + font-size: 14px; |
| 140 | - position: absolute; | 178 | + color: #fff; |
| 141 | - left: 0; | 179 | + margin-bottom: 10px; |
| 142 | - right: 0; | 180 | + span { |
| 143 | - width: 520px; | 181 | + &:first-of-type { |
| 144 | - padding: 35px 35px 15px 35px; | 182 | + margin-right: 16px; |
| 145 | - margin: 120px auto; | 183 | + } |
| 146 | - } | ||
| 147 | - .tips { | ||
| 148 | - font-size: 14px; | ||
| 149 | - color: #fff; | ||
| 150 | - margin-bottom: 10px; | ||
| 151 | - span { | ||
| 152 | - &:first-of-type { | ||
| 153 | - margin-right: 16px; | ||
| 154 | } | 184 | } |
| 155 | } | 185 | } |
| 156 | - } | 186 | + .svg-container { |
| 157 | - .svg-container { | 187 | + padding: 6px 5px 6px 15px; |
| 158 | - padding: 6px 5px 6px 15px; | 188 | + color: $dark_gray; |
| 159 | - color: $dark_gray; | 189 | + vertical-align: middle; |
| 160 | - vertical-align: middle; | 190 | + width: 30px; |
| 161 | - width: 30px; | 191 | + display: inline-block; |
| 162 | - display: inline-block; | 192 | + &_login { |
| 163 | - &_login { | 193 | + font-size: 20px; |
| 164 | - font-size: 20px; | 194 | + } |
| 195 | + } | ||
| 196 | + .title { | ||
| 197 | + font-size: 26px; | ||
| 198 | + font-weight: 400; | ||
| 199 | + color: $light_gray; | ||
| 200 | + margin: 0px auto 40px auto; | ||
| 201 | + text-align: center; | ||
| 202 | + font-weight: bold; | ||
| 203 | + } | ||
| 204 | + .show-pwd { | ||
| 205 | + position: absolute; | ||
| 206 | + right: 10px; | ||
| 207 | + top: 7px; | ||
| 208 | + font-size: 16px; | ||
| 209 | + color: $dark_gray; | ||
| 210 | + cursor: pointer; | ||
| 211 | + user-select: none; | ||
| 165 | } | 212 | } |
| 166 | - } | ||
| 167 | - .title { | ||
| 168 | - font-size: 26px; | ||
| 169 | - font-weight: 400; | ||
| 170 | - color: $light_gray; | ||
| 171 | - margin: 0px auto 40px auto; | ||
| 172 | - text-align: center; | ||
| 173 | - font-weight: bold; | ||
| 174 | - } | ||
| 175 | - .show-pwd { | ||
| 176 | - position: absolute; | ||
| 177 | - right: 10px; | ||
| 178 | - top: 7px; | ||
| 179 | - font-size: 16px; | ||
| 180 | - color: $dark_gray; | ||
| 181 | - cursor: pointer; | ||
| 182 | - user-select: none; | ||
| 183 | } | 213 | } |
| 184 | } | 214 | } |
| 185 | </style> | 215 | </style> | ... | ... |
-
请 注册 或 登录 后发表评论