From a80ef0c3a7376d14e8a6f79c076b3536a6a7b287 Mon Sep 17 00:00:00 2001 From: yoe Date: Wed, 13 May 2020 17:57:10 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=B3=BB=E7=BB=9F=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../desktop.ini | 3 - src/api/api_sys.js | 23 ++++++ src/api/api_user.js | 21 ----- src/main.js | 2 - src/utils/httpRequest.js | 76 ------------------- src/views/common/login.vue | 2 +- .../layout/main-navbar-update-password.vue | 2 +- src/views/layout/main-navbar.vue | 2 +- src/views/layout/main.vue | 2 +- 9 files changed, 27 insertions(+), 106 deletions(-) delete mode 100644 $Recycle.Bin/S-1-5-21-3231082881-2130090724-2273209683-500/desktop.ini delete mode 100644 src/api/api_user.js delete mode 100644 src/utils/httpRequest.js diff --git a/$Recycle.Bin/S-1-5-21-3231082881-2130090724-2273209683-500/desktop.ini b/$Recycle.Bin/S-1-5-21-3231082881-2130090724-2273209683-500/desktop.ini deleted file mode 100644 index 5d0694e..0000000 --- a/$Recycle.Bin/S-1-5-21-3231082881-2130090724-2273209683-500/desktop.ini +++ /dev/null @@ -1,3 +0,0 @@ -[.ShellClassInfo] -CLSID={645FF040-5081-101B-9F08-00AA002F954E} -LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-8964 diff --git a/src/api/api_sys.js b/src/api/api_sys.js index fca4cb7..97bd94e 100644 --- a/src/api/api_sys.js +++ b/src/api/api_sys.js @@ -1,5 +1,28 @@ import http from '../utils/http' +/** + * 用户相关的 + */ +// 登录 +export const apiLogin = data => { + return http({ url: '/lz_management/sys/login', method: 'post', data }) +} + +// 退出登录 +export const apiLogout = data => { + return http({ url: '/lz_management/sys/logout', method: 'post', data }) +} + +// 修改密码 +export const apiSysUserPassword = data => { + return http({ url: '/lz_management/sys/user/password', method: 'post', data }) +} + +// 获取用户相关 +export const apiGetUserInfo = (params, id) => { + return http({ url: `/lz_management/sys/user/info${id}`, method: 'get', params }) +} + /** * 管理员列表 */ diff --git a/src/api/api_user.js b/src/api/api_user.js deleted file mode 100644 index 174c66c..0000000 --- a/src/api/api_user.js +++ /dev/null @@ -1,21 +0,0 @@ -import http from '../utils/http' - -// 登录 -export const apiLogin = data => { - return http({ url: '/lz_management/sys/login', method: 'post', data }) -} - -// 退出登录 -export const apiLogout = data => { - return http({ url: '/lz_management/sys/logout', method: 'post', data }) -} - -// 修改密码 -export const apiSysUserPassword = data => { - return http({ url: '/lz_management/sys/user/password', method: 'post', data }) -} - -// 获取用户相关 -export const apiGetUserInfo = (params, id) => { - return http({ url: `/lz_management/sys/user/info${id}`, method: 'get', params }) -} diff --git a/src/main.js b/src/main.js index 717f1ab..c77261d 100644 --- a/src/main.js +++ b/src/main.js @@ -5,7 +5,6 @@ import store from '@/store' import VueCookie from 'vue-cookie' import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' -import httpRequest from '@/utils/httpRequest' import { isAuth } from '@/utils' import echarts from 'echarts' import '@/assets/scss/index.scss' @@ -19,7 +18,6 @@ Vue.config.productionTip = false // 挂载全局 Vue.prototype.$echarts = echarts // echarts画图 -Vue.prototype.$http = httpRequest // ajax请求方法 Vue.prototype.isAuth = isAuth // 权限方法 /* eslint-disable no-new */ diff --git a/src/utils/httpRequest.js b/src/utils/httpRequest.js deleted file mode 100644 index a97928d..0000000 --- a/src/utils/httpRequest.js +++ /dev/null @@ -1,76 +0,0 @@ -import Vue from 'vue' -import axios from 'axios' -import router from '@/router' -import qs from 'qs' -import merge from 'lodash/merge' -import { clearLoginInfo } from '@/utils' - -const http = axios.create({ - timeout: 1000 * 30, - withCredentials: true, - headers: { - 'Content-Type': 'application/json; charset=utf-8' - } -}) - -/** - * 请求拦截 - */ -http.interceptors.request.use(config => { - config.headers['token'] = Vue.cookie.get('token') // 请求头带上token - return config -}, error => { - return Promise.reject(error) -}) - -/** - * 响应拦截 - */ -http.interceptors.response.use(response => { - if (response.data && response.data.code === 401) { // 401, token失效 - clearLoginInfo() - router.push({ name: 'login' }) - } - return response -}, error => { - return Promise.reject(error) -}) - -/** - * 请求地址处理 - * @param {*} actionName action方法名称 - */ -http.adornUrl = (actionName) => { - // 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截! - return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi/' : window.SITE_CONFIG.baseUrl) + actionName -} - -/** - * get请求参数处理 - * @param {*} params 参数对象 - * @param {*} openDefultParams 是否开启默认参数? - */ -http.adornParams = (params = {}, openDefultParams = true) => { - var defaults = { - 't': new Date().getTime() - } - return openDefultParams ? merge(defaults, params) : params -} - -/** - * post请求数据处理 - * @param {*} data 数据对象 - * @param {*} openDefultdata 是否开启默认数据? - * @param {*} contentType 数据格式 - * json: 'application/json; charset=utf-8' - * form: 'application/x-www-form-urlencoded; charset=utf-8' - */ -http.adornData = (data = {}, openDefultdata = true, contentType = 'json') => { - var defaults = { - 't': new Date().getTime() - } - data = openDefultdata ? merge(defaults, data) : data - return contentType === 'json' ? JSON.stringify(data) : qs.stringify(data) -} - -export default http diff --git a/src/views/common/login.vue b/src/views/common/login.vue index dbe567d..ec83c0a 100644 --- a/src/views/common/login.vue +++ b/src/views/common/login.vue @@ -37,7 +37,7 @@