瀏覽代碼

Merge branch 'feature-201823-hb' into dev

huangb 7 年之前
父節點
當前提交
2e08590b36
共有 2 個文件被更改,包括 40 次插入38 次删除
  1. 39 37
      components/login/Login.vue
  2. 1 1
      server.js

+ 39 - 37
components/login/Login.vue

@@ -76,7 +76,7 @@
                 </el-form-item>
                 <el-form-item class="text-position">
                   <div class="page-part" v-if="loginStyle.needRememberPwd">
-                    <el-checkbox v-model="checked">记住密码</el-checkbox>
+                    <el-checkbox v-model="checked">30天免登陆</el-checkbox>
                   </div>
                   <a class="forget" id='forget' @click="goForgetPassword">忘记密码?</a>
                 </el-form-item>
@@ -378,9 +378,9 @@
     mounted () {
       this.$nextTick(() => {
         this.getUrl()
-        if (this.appId === 'mall' || this.appId === 'home') {
-          this.getCookie()
-        }
+        // if (this.appId === 'mall' || this.appId === 'home') {
+        //   this.getCookie()
+        // }
         this.validUserName()
         if (this.$route.query.code) {
           this.wxEnterprise()
@@ -499,6 +499,7 @@
           param.append('appId', this.appId ? this.appId : '')
           param.append('returnUrl', this.returnUrl ? this.returnUrl : '')
           param.append('baseUrl', this.baseUrl ? this.baseUrl : '')
+          param.append('maxage', this.checked ? 2592000 : '')
           let config = {
             headers: {'Content-Type': 'multipart/form-data'}
           }
@@ -580,13 +581,14 @@
             this.fastToLogin(flag)
           }
         }
-        if (this.appId === 'mall' || this.appId === 'home') {
-          if (this.checked) {
-            this.setCookie(this.login.username, this.login.password, 7)
-          } else {
-            this.clearCookie()
-          }
-        }
+        // 记住密码
+        // if (this.appId === 'mall' || this.appId === 'home') {
+        //   if (this.checked) {
+        //     this.setCookie(this.login.username, this.login.password, 7)
+        //   } else {
+        //     this.clearCookie()
+        //   }
+        // }
       },
       // 短信快捷登录
       fastToLogin (flag) {
@@ -691,34 +693,34 @@
         })
       },
       // 设置cookie
-      setCookie (cName, cPwd, exdays) {
-        let exdate = new Date()
-        exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays)
-        window.document.cookie = 'userName' + '=' + cName + ';path=/;expires=' + exdate.toGMTString()
-        window.document.cookie = 'userPwd' + '=' + cPwd + ';path=/;expires=' + exdate.toGMTString()
-      },
+      // setCookie (cName, cPwd, exdays) {
+      //   let exdate = new Date()
+      //   exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays)
+      //   window.document.cookie = 'userName' + '=' + cName + ';path=/;expires=' + exdate.toGMTString()
+      //   window.document.cookie = 'userPwd' + '=' + cPwd + ';path=/;expires=' + exdate.toGMTString()
+      // },
       // 读取cookies
-      getCookie () {
-        if (document.cookie.length > 0) {
-          let arr = document.cookie.split(';')
-          for (var i = 0; i < arr.length; i++) {
-            let arr2 = arr[i].split('=')
-            if (arr2[0].trim() === 'userName') {
-              this.login.username = arr2[1]
-            }
-            if (arr2[0].trim() === 'userPwd') {
-              this.login.password = arr2[1]
-            }
-            if (this.login.username && this.login.username) {
-              this.checked = true
-            }
-          }
-        }
-      },
+      // getCookie () {
+      //   if (document.cookie.length > 0) {
+      //     let arr = document.cookie.split(';')
+      //     for (var i = 0; i < arr.length; i++) {
+      //       let arr2 = arr[i].split('=')
+      //       if (arr2[0].trim() === 'userName') {
+      //         this.login.username = arr2[1]
+      //       }
+      //       if (arr2[0].trim() === 'userPwd') {
+      //         this.login.password = arr2[1]
+      //       }
+      //       if (this.login.username && this.login.username) {
+      //         this.checked = true
+      //       }
+      //     }
+      //   }
+      // },
       // 清除cookie
-      clearCookie () {
-        this.setCookie('', '', -1)
-      },
+      // clearCookie () {
+      //   this.setCookie('', '', -1)
+      // },
       // 获取校验码
       getCheckCode () {
         this.isShowLoading = true

+ 1 - 1
server.js

@@ -3,7 +3,7 @@ const app = require('express')()
 const proxy = require('http-proxy-middleware')
 const cookiejar = require('cookiejar')
 const host = process.env.HOST || '127.0.0.1'
-const port = process.env.PORT || 3001
+const port = process.env.PORT || 80
 process.noDeprecation = true
 
 app.set('port', port)