blob: baa100d731ebb99851832fd60914c47f2c6764da [file] [log] [blame]
huibing.xie1f1606f2018-08-20 15:46:55 +08001import { param2Obj } from '@/utils'
2
3const userMap = {
4 admin: {
5 data: {
6 roles: ['admin'],
7 token: 'admin',
8 introduction: '我是超级管理员',
9 avatar: 'https://cn.vuejs.org/images/logo.png',
10 name: 'Super Admin'
11 },
12 code: 200
13 }
14}
15export default {
16 loginByUsername: config => {
17 const { username } = JSON.parse(config.body)
18 return userMap[username]
19 },
20 getUserInfo: config => {
21 const { token } = param2Obj(config.url)
22 if (userMap[token]) {
23 return userMap[token]
24 } else {
25 return false
26 }
27 },
28 logout: () => {
29 return {
30 code: 200
31 }
32 }
33}