From a0a285c90987eb9b1591f90333f3aeb15659ded2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 17 一月 2020 19:04:57 +0800
Subject: [PATCH] 2020-01-17

---
 src/api/index.js |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index b89eb20..5984450 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1,8 +1,8 @@
 import axios from 'axios'
 import qs from 'qs'
 import {notification } from 'antd'
-// import md5 from 'md5'
-// import Utils from '@/utils/utils.js'
+import md5 from 'md5'
+import Utils from '@/utils/utils.js'
 import options from '@/store/options.js'
 
 axios.defaults.crossDomain = true
@@ -26,10 +26,10 @@
 })
 
 const setCurrentUrl = () => {
-  if (!!(window.history && window.history.pushState)) {
-    window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login')
-    window.location.reload()
-  }
+  // if (!!(window.history && window.history.pushState)) {
+  //   window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login')
+  //   window.location.reload()
+  // }
 }
 
 let GlobMap = new Map()
@@ -93,14 +93,22 @@
   /**
    * @description 鐧诲綍绯荤粺, 鑾峰彇鐢ㄦ埛淇℃伅
    */
-  getusermsg (username, password) {
+  getusermsg (username, password, isCloud = false) {
+    let param = {
+      // func: 'webapi_login',
+      UserName: username,
+      Password: password,
+      Type: 'X'
+    }
+    param.Password = Utils.formatOptions(param.Password)
+
+    if (isCloud && options.cloudLoginApi) {
+      param.rduri = options.cloudLoginApi
+    }
+
     return axios({
-      url: 'webapi/getjsonresult',
-      data: {
-        DBT: 'proc',
-        DBS: 'webapi_login',
-        DBP: JSON.stringify({ 'UserName': username, 'Password': password })
-      }
+      url: '/webapi/dologon',
+      data: param
     })
   }
 
@@ -169,6 +177,7 @@
     delete _param.timestamp
     delete _param.secretkey
     _param = JSON.stringify(_param)
+    _param  = md5(_param)
 
     if (GlobMap.has(_param)) {
       return Promise.resolve(GlobMap.get(_param))

--
Gitblit v1.8.0