feat: 优化接口配置设计,注册的网络请求会自动注册到 vue 原型 $api 上,修改了一些旧的接口调用方式

This commit is contained in:
FairyEver
2020-05-07 15:49:28 +08:00
parent 804f66eb05
commit 28acfdbb04
21 changed files with 118 additions and 103 deletions

View File

@@ -1,7 +1,7 @@
import { Message, MessageBox } from 'element-ui'
import util from '@/libs/util.js'
import router from '@/router'
import { accountLogin } from '@api/sys.login'
import api from '@/api'
export default {
namespaced: true,
@@ -17,7 +17,7 @@ export default {
username = '',
password = ''
} = {}) {
const res = await accountLogin({ username, password })
const res = await api.SYS_USER_LOGIN({ username, password })
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
// 整个系统依赖这两个数据进行校验和存储
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复