hanchaobo před 2 roky
rodič
revize
aef3c0f53f
2 změnil soubory, kde provedl 82 přidání a 59 odebrání
  1. 8
    1
      src/api/login.js
  2. 74
    58
      src/views/login.vue

+ 8
- 1
src/api/login.js Zobrazit soubor

@@ -98,4 +98,11 @@ export function getIdType() {
98 98
     url: '/system/dict/data/type/skipToken/id_type',
99 99
     method: 'get',
100 100
   })
101
-}
101
+}
102
+// 获取pc端的EIDtoken
103
+export function selectIdentityAuthenticaEIDtoken() {
104
+  return request({
105
+    url: '/identityAuthentication/selectIdentityAuthenticaEIDtoken',
106
+    method: 'post'
107
+  })
108
+} 

+ 74
- 58
src/views/login.vue Zobrazit soubor

@@ -10,61 +10,46 @@
10 10
     </div>
11 11
     <!-- 右侧 -->
12 12
     <div class="rightBox">
13
-    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
14
-      <h2 class="title">用户登录</h2>
15
-      <el-form-item prop="username">
16
-        <el-input
17
-          v-model="loginForm.username"
18
-          type="text"
19
-          auto-complete="off"
20
-          placeholder="账号"
21
-        >
22
-          <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
23
-        </el-input>
24
-      </el-form-item>
25
-      <el-form-item prop="password">
26
-        <el-input
27
-          v-model="loginForm.password"
28
-          type="password"
29
-          auto-complete="off"
30
-          placeholder="密码"
31
-          @keyup.enter.native="handleLogin"
32
-        >
33
-          <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
34
-        </el-input>
35
-      </el-form-item>
36
-      <el-form-item prop="code" v-if="captchaEnabled">
37
-        <el-input
38
-          v-model="loginForm.code"
39
-          auto-complete="off"
40
-          placeholder="验证码"
41
-          style="width: 63%"
42
-          @keyup.enter.native="handleLogin"
43
-        >
44
-          <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
45
-        </el-input>
46
-        <div class="login-code">
47
-          <img :src="codeUrl" @click="getCode" class="login-code-img"/>
48
-        </div>
49
-      </el-form-item>
50
-      <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
51
-      <el-form-item style="width:100%;">
52
-        <el-button
53
-          :loading="loading"
54
-          size="medium"
55
-          type="primary"
56
-          style="width:100%;"
57
-          @click.native.prevent="handleLogin"
58
-        >
59
-          <span v-if="!loading">登 录</span>
60
-          <span v-else>登 录 中...</span>
61
-        </el-button>
62
-        <div style="float: right;" v-if="register">
63
-          <router-link class="link-type" :to="'/register'">立即注册</router-link>
64
-        </div>
65
-      </el-form-item>
66
-    </el-form>
13
+      <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
14
+        <h2 class="title">用户登录</h2>
15
+        <el-form-item prop="username">
16
+          <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
17
+            <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
18
+          </el-input>
19
+        </el-form-item>
20
+        <el-form-item prop="password">
21
+          <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
22
+            @keyup.enter.native="handleLogin">
23
+            <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
24
+          </el-input>
25
+        </el-form-item>
26
+        <el-form-item prop="code" v-if="captchaEnabled">
27
+          <el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
28
+            @keyup.enter.native="handleLogin">
29
+            <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
30
+          </el-input>
31
+          <div class="login-code">
32
+            <img :src="codeUrl" @click="getCode" class="login-code-img" />
33
+          </div>
34
+        </el-form-item>
35
+        <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
36
+        <el-form-item style="width:100%;">
37
+          <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
38
+            @click.native.prevent="handleLogin">
39
+            <span v-if="!loading">登 录</span>
40
+            <span v-else>登 录 中...</span>
41
+          </el-button>
42
+          <div style="float: right;" v-if="register">
43
+            <router-link class="link-type" :to="'/register'">立即注册</router-link>
44
+            <!-- <el-button type="text" @click="registrationLink('/register')">立即注册</el-button> -->
45
+          </div>
46
+          <!-- <div class="registerImg">
47
+            <div id="qrcodeImg"></div>
48
+          </div> -->
49
+        </el-form-item>
50
+      </el-form>
67 51
     </div>
52
+
68 53
     <!--  底部  -->
69 54
     <div class="el-login-footer">
70 55
       <div>Copyright © 2023 乙巢(上海)企业管理服务有限公司.</div>
@@ -74,8 +59,9 @@
74 59
 </template>
75 60
 
76 61
 <script>
77
-import { getCodeImg } from "@/api/login";
62
+import { getCodeImg, selectIdentityAuthenticaEIDtoken } from "@/api/login";
78 63
 import Cookies from "js-cookie";
64
+import QRCode from "qrcodejs2";
79 65
 import { encrypt, decrypt } from '@/utils/jsencrypt'
80 66
 
81 67
 export default {
@@ -109,7 +95,7 @@ export default {
109 95
   },
110 96
   watch: {
111 97
     $route: {
112
-      handler: function(route) {
98
+      handler: function (route) {
113 99
         this.redirect = route.query && route.query.redirect;
114 100
       },
115 101
       immediate: true
@@ -153,7 +139,7 @@ export default {
153 139
             Cookies.remove('rememberMe');
154 140
           }
155 141
           this.$store.dispatch("Login", this.loginForm).then(() => {
156
-            this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
142
+            this.$router.push({ path: this.redirect || "/" }).catch(() => { });
157 143
           }).catch(() => {
158 144
             this.loading = false;
159 145
             if (this.captchaEnabled) {
@@ -162,6 +148,21 @@ export default {
162 148
           });
163 149
         }
164 150
       });
151
+    },
152
+    registrationLink(path) {
153
+      selectIdentityAuthenticaEIDtoken().then(res => {
154
+        console.log(res)
155
+        document.getElementById("qrcodeImg").innerHTML = "";
156
+        return new QRCode("qrcodeImg", {
157
+          width: 200,
158
+          height: 200,
159
+          text: url,
160
+          colorDark: "#000",
161
+          colorLight: "#fff",
162
+        });
163
+      })
164
+      // this.$router.push(path);
165
+      console.log("注册链接")
165 166
     }
166 167
   }
167 168
 };
@@ -173,23 +174,28 @@ export default {
173 174
   justify-content: center;
174 175
   align-items: center;
175 176
   height: 100%;
177
+
176 178
   .leftBox {
177 179
     width: 50%;
178 180
     height: 90%;
181
+
179 182
     .leftIcon {
180 183
       height: 20%;
181 184
       width: 100%;
182 185
       margin: 0% 10% 1% 15%;
186
+
183 187
       .Icon {
184 188
         width: 100px;
185 189
         height: 105px;
186 190
         background-image: url("../assets/images/logos.png");
187 191
         background-size: cover;
188 192
       }
193
+
189 194
       div {
190 195
         font-size: 18px;
191 196
       }
192 197
     }
198
+
193 199
     .leftImage {
194 200
       width: 100%;
195 201
       height: 90%;
@@ -199,7 +205,7 @@ export default {
199 205
       background-size: cover;
200 206
     }
201 207
   }
202
-  
208
+
203 209
   .rightBox {
204 210
     width: 50%;
205 211
     height: 90%;
@@ -208,6 +214,7 @@ export default {
208 214
     align-items: center;
209 215
   }
210 216
 }
217
+
211 218
 .title {
212 219
   margin: 0px auto 30px auto;
213 220
   text-align: center;
@@ -220,32 +227,39 @@ export default {
220 227
   background: #ffffff;
221 228
   width: 400px;
222 229
   padding: 25px 25px 5px 25px;
230
+
223 231
   .el-input {
224 232
     height: 38px;
233
+
225 234
     input {
226 235
       height: 38px;
227 236
     }
228 237
   }
238
+
229 239
   .input-icon {
230 240
     height: 39px;
231 241
     width: 14px;
232 242
     margin-left: 2px;
233 243
   }
234 244
 }
245
+
235 246
 .login-tip {
236 247
   font-size: 13px;
237 248
   text-align: center;
238 249
   color: #bfbfbf;
239 250
 }
251
+
240 252
 .login-code {
241 253
   width: 33%;
242 254
   height: 38px;
243 255
   float: right;
256
+
244 257
   img {
245 258
     cursor: pointer;
246 259
     vertical-align: middle;
247 260
   }
248 261
 }
262
+
249 263
 .el-login-footer {
250 264
   background-color: rgb(126, 131, 135);
251 265
   height: 55px;
@@ -258,10 +272,12 @@ export default {
258 272
   font-family: Arial;
259 273
   font-size: 12px;
260 274
   letter-spacing: 1px;
275
+
261 276
   div {
262 277
     height: 30%;
263 278
   }
264 279
 }
280
+
265 281
 .login-code-img {
266 282
   height: 38px;
267 283
 }