From 27821f7b598e9e87de8fb179bdcbfdc5e2cb31fa Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 25 九月 2019 00:17:55 +0800
Subject: [PATCH] 2019-09-25update

---
 src/api/index.js |   67 +++++++++++++++++++++++++++++----
 1 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index cdd6846..a8d4518 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1,18 +1,20 @@
 import axios from 'axios'
+import qs from 'qs'
 
 axios.defaults.crossDomain = true
-axios.defaults.headers.common['token'] = 'token'
+// axios.defaults.headers.common['token'] = 'token'
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
 axios.defaults.withCredentials = true
 
 axios.interceptors.request.use((config) => {
-  config.url = config.url || '/dostar'
   config.method = 'post'
-  config.data = config.data || {}
-  if (config.url !== '/login') {
-    config.data.userid = sessionStorage.getItem('UserID') || ''
+  config.headers.token = sessionStorage.getItem('TOKEN') || ''
+  if (config.url.includes('LoginAndRedirect')) {
+    config.data = qs.stringify(config.data)
+  } else {
+    config.data = JSON.stringify(config.data)
   }
-  config.data = JSON.stringify(config.data)
+
   return config
 }, (error) => {
   return Promise.reject(error)
@@ -27,11 +29,40 @@
 class Api {
   constructor() {
     if (process.env.NODE_ENV === 'production') {
-      axios.defaults.baseURL = document.location.origin + '/' + window.Glob.Service
+      axios.defaults.baseURL = document.location.origin + '/MKWMS'
     } else {
       axios.defaults.baseURL = 'http://127.0.0.1:8888'
     }
   }
+
+  /**
+   * @description 绯荤粺鎺堟潈
+   */
+  systemauth (appId, timestamp) {
+    return axios({
+      // url: 'http://minkesoft.com/mksepc/webapi/dostar',
+      url: '/mksepc',
+      data: {
+        func: 'sEmpowerCloud_Get_LinkUrl',
+        userid: '',
+        AppID: appId,
+        TimeStamp: timestamp
+      }
+    })
+  }
+  
+  // /**
+  //  * @description 鐧诲綍绯荤粺
+  //  */
+  // loginsystem (username, password) {
+  //   return axios({
+  //     url: 'http://qingqiumarket.cn/MKWMS/zh-CN/Home/LoginAndRedirect',
+  //     data: {
+  //       Username: username,
+  //       Password: password
+  //     }
+  //   })
+  // }
 
   /**
    * @description 鐧诲綍绯荤粺
@@ -53,7 +84,8 @@
     return axios({
       url: '/dostar',
       data: {
-        func: 'logout'
+        func: 'logout',
+        userid: sessionStorage.getItem('UserID')
       }
     })
   }
@@ -66,6 +98,7 @@
       url: '/dostar',
       data: {
         func: 'ResetPassword',
+        userid: sessionStorage.getItem('UserID'),
         OriginPwd: originpwd,
         NewPwd: newpwd
       }
@@ -79,7 +112,8 @@
     return axios({
       url: '/dostar',
       data: {
-        func: 'GetTopMenus'
+        func: 'GetTopMenus',
+        userid: sessionStorage.getItem('UserID')
       }
     })
   }
@@ -93,6 +127,7 @@
       url: '/dostar',
       data: {
         func: 'GetSubMenus',
+        userid: sessionStorage.getItem('UserID'),
         ParentID: menuId
       }
     })
@@ -107,6 +142,7 @@
       url: '/dostar',
       data: {
         func: 'GetMainConfigs',
+        userid: sessionStorage.getItem('UserID'),
         MenuNo: MenuNo
       }
     })
@@ -121,6 +157,7 @@
       url: '/dostar',
       data: {
         func: 'GetMainData',
+        userid: sessionStorage.getItem('UserID'),
         MenuNo: MenuNo,
         PageIndex: pageIndex,
         PageSize: pageSize,
@@ -130,6 +167,18 @@
       }
     })
   }
+
+  /**
+   * @description 鑾峰彇椤甸潰鍒楄〃鏁版嵁
+   * @param {String} param 鎻愪氦鍙傛暟
+   */
+  setActionSubmit (param) {
+    param.userid = sessionStorage.getItem('UserID')
+    return axios({
+      url: '/dostar',
+      data: param
+    })
+  }
 }
 
 export default new Api()
\ No newline at end of file

--
Gitblit v1.8.0