瀏覽代碼

登录修改

zhaoke 1 年之前
父節點
當前提交
98de189759
共有 4 個文件被更改,包括 24 次插入41 次删除
  1. 6 6
      public/staticConfig.js
  2. 2 2
      src/api/login.js
  3. 3 0
      src/utils/request-new.js
  4. 13 33
      src/views/login/index.vue

+ 6 - 6
public/staticConfig.js

@@ -2,8 +2,8 @@
 window.PLATFROM_CONFIG = {
   baseNewUrl: '', //登录前的http请求地址
   baseURLCA: '', // 登录后的http请求地址
-  appKeyString: '9inu7zpllz1folzsljm498dcpi0lsog1', //appSecret
-  appId: 'q7kdjmmaf0kerwpf', //appid
+  appKeyString: 'test', //appSecret
+  appId: 'test', //appid
   baggageMessageURL: '/openApi/query',
   getBase64: 'http://10.211.67.163:8083/getBase64',
   editRule: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[`!@#$%^&*()_+{}":?><`,./';=-])[\da-zA-Z`!@#$%^&*()_+{}":?><`,./';=-]{8,}$/
@@ -51,10 +51,10 @@ switch (baseNewUrl) {
   case 'localhost':
     PLATFROM_CONFIG = {
       ...PLATFROM_CONFIG,
-      baseNewUrl: 'http://10.211.67.177:8043',
-      baseURLCA: 'http://10.211.67.177:8043',
-      fileUrl: 'http://10.211.67.177:8043',
-      expressUrl: 'http://10.211.67.177:8043',
+      baseNewUrl: 'http://120.26.64.82:8085',
+      baseURLCA: 'http://120.26.64.82:8085',
+      fileUrl: 'http://120.26.64.82:8085',
+      expressUrl: 'http://120.26.64.82:8085',
       tempUrl: 'http://10.211.67.163:16300', // 1.0临时地址
       tempToken: 'bb1bcfcb336b40e9b8602e808b053c3b', // 1.0临时token
       tempUserId: '1656481036109',

+ 2 - 2
src/api/login.js

@@ -38,7 +38,7 @@ export function loginOut (params) {
 //获取验证码
 export function getVCode (params) {
     return request({
-        url: '/foxlibc/getVCode',
+        url: '/foxlibc/verification-code',
         method: 'post',
         data: params
     })
@@ -56,7 +56,7 @@ export function refreshToken (params) {
 //token
 export function getToken (params) {
     return request({
-        url: '/foxlibc/getToken',
+        url: '/user/getToken',
         method: 'post',
         data: params,
         istoken: true

+ 3 - 0
src/utils/request-new.js

@@ -15,6 +15,7 @@ const service = axios.create({
     'Content-Type': 'application/json'
   },
 })
+axios.defaults.withCredentials = true
 // request interceptor
 service.interceptors.request.use(
   config => {
@@ -22,6 +23,8 @@ service.interceptors.request.use(
     if (config.istoken) {
       config.headers['appSecret'] = PLATFROM_CONFIG.appKeyString
       isMttoken = config.istoken
+    } else if (getCodeToken()) {
+      config.headers["token"] = getCodeToken();
     }
     return config
   },

+ 13 - 33
src/views/login/index.vue

@@ -2,23 +2,16 @@
   <div class="login-container">
     <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
       <div class="title-container flex-wrap">
-        <!-- <el-divider direction="vertical"></el-divider> -->
         <div class="content-box">
           <div class="title">{{ pageTitle }}</div>
         </div>
       </div>
 
       <el-form-item prop="username">
-        <!-- <span class="svg-container">
-            <svg-icon style="color:#606266;" icon-class="user" />
-          </span> -->
         <el-input ref="username" v-model="loginForm.username" placeholder="用户名" name="username" type="text" tabindex="1" auto-complete="on" />
       </el-form-item>
 
       <el-form-item prop="password">
-        <!-- <span class="svg-container">
-            <svg-icon style="color:#606266;" icon-class="password" />
-          </span> -->
         <el-input ref="password" v-model="loginForm.password" show-password placeholder="密码" name="password" tabindex="2" auto-complete="on" />
       </el-form-item>
 
@@ -43,7 +36,6 @@ export default {
   name: "Login",
   data () {
     return {
-      text: `<a onclick='("XSS")'>链接</a>`,
       flag: false,
       PwdMessage: null,
       loginForm: {
@@ -70,34 +62,27 @@ export default {
       appId: ''
     };
   },
-  watch: {
-    $route: {
-      handler: function (route) {
-        this.redirect = route.query && route.query.redirect;
-      },
-      immediate: true,
-    }
-  },
   async created () {
     try {
       const { code, returnData, message } = await getToken({
         'appid': PLATFROM_CONFIG.appId,
-        'appSecret': PLATFROM_CONFIG.appKeyString
+        'appsecret': PLATFROM_CONFIG.appKeyString
       })
       if (code == 0 && isValue(returnData)) {
-        const { app_log, app_name, app_token, active_duration, app_code_rule } = returnData;
-        this.imgSrc = window.location.origin + app_log
-        this.pageTitle = app_name
-        this.isCode = app_code_rule
-        setCodeToken(app_token);
-        setToken('active_duration', active_duration);
-        sessionStorage.setItem('appLog', app_log)
-        sessionStorage.setItem('appName', app_name)
-        if (app_code_rule) {
+        const { appenname, appname, background, expirestime, logo, securitycoderule, smalllogo, token } = returnData;
+        this.imgSrc = window.location.origin + logo
+        this.pageTitle = appname
+        this.isCode = securitycoderule
+        setCodeToken(token);
+        sessionStorage.setItem('appConfig', JSON.stringify({ ...returnData }))
+        // setToken('active_duration', active_duration);
+        sessionStorage.setItem('appLog', logo)
+        sessionStorage.setItem('appName', appname)
+        if (securitycoderule) {
           this.getCheckCode()
         }
       } else {
-        this.$message.error(message);
+        this.$router.push('/404')
       }
     } catch (error) {
       this.$message.error(error.message);
@@ -145,9 +130,7 @@ export default {
     },
     //获取动态验证码
     async getCheckCode () {
-      const { code, message, returnData } = await getVCode({
-        app_token: getCodeToken()
-      });
+      const { code, message, returnData } = await getVCode();
       if (code == 0 && isValue(returnData)) {
         const { verifyCode } = returnData;
         this.baseImg = "data:image/gif;base64," + verifyCode;
@@ -159,9 +142,6 @@ export default {
     changeCode () {
       this.getCheckCode();
     },
-    errorHandler () {
-      return true
-    }
   },
 };
 </script>