duanxiaoduan 1 jaar geleden
bovenliggende
commit
a8f8242b49
4 gewijzigde bestanden met toevoegingen van 14 en 7 verwijderingen
  1. 2 2
      .env.production
  2. 1 0
      package.json
  3. 2 1
      src/store/modules/user.js
  4. 9 4
      src/views/login/index.vue

+ 2 - 2
.env.production

@@ -4,9 +4,9 @@ ENV = 'production'
 # base api
 # 正式线
 # VUE_APP_BASE_API = ':8081/'
-VUE_APP_BASE_API = '/'
+# VUE_APP_BASE_API = '/'
 # 测试线
-# VUE_APP_BASE_API = 'http://210.16.189.72:8081/'
+VUE_APP_BASE_API = 'http://192.168.1.70:8082/'
 # 洋洋本地
 # VUE_APP_BASE_API = 'http://192.168.1.104:8081/'
 #本地

+ 1 - 0
package.json

@@ -26,6 +26,7 @@
     "fuse.js": "3.4.4",
     "js-cookie": "^2.2.0",
     "js-table2excel": "^1.0.3",
+    "md5": "^2.3.0",
     "moment": "^2.24.0",
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",

+ 2 - 1
src/store/modules/user.js

@@ -96,7 +96,8 @@ const actions = {
   login({ commit }, userInfo) {
     const { username, password } = userInfo
     return new Promise((resolve, reject) => {
-      login({ username: username.trim(), password: password }).then(response => {
+      login({ user_name: username.trim(), password: password }).then(response => {
+      // login({ username: username.trim(), password: password }).then(response => {
         const { data, msg } = response
         if (msg !== 'ok') {
           Message({

+ 9 - 4
src/views/login/index.vue

@@ -48,7 +48,8 @@
 <script>
 import { validUsername } from '@/utils/validate'
 import Cookies from 'js-cookie'
-import { getToken } from '@/utils/auth'
+import { getToken } from '@/utils/auth'
+const md5 = require("md5")
 export default {
   name: 'Login',
   data() {
@@ -119,13 +120,17 @@ export default {
       })
     },
     handleLogin() {
+      var obj = {
+        username: this.loginForm.username,
+        password: md5(this.loginForm.password)
+      }
       var rememberStatus = this.rememberPassword
       var accountInfo = this.loginForm.username + '&' + this.loginForm.password
       this.$refs.loginForm.validate(valid => {
         if (valid) {
-          this.loading = true
-          this.$store
-            .dispatch('user/login', this.loginForm).then(() => {
+          this.loading = true
+          this.$store.dispatch('user/login', obj).then(() => {
+          // this.$store.dispatch('user/login', this.loginForm).then(() => {
               if (rememberStatus) {
                 console.log('勾选了记住密码,现在开始写入cookie')
                 Cookies.set('accountInfo', accountInfo, 1440 * 3)