Blame view

src/api/user.js 1.14 KB
80a28914e   吉鹏   init
1
  import request from '@/utils/request'
a6e433928   Adam   auto commit the c...
2
3
4
5
  import {
    Notification
  } from 'element-ui'
  // login
80a28914e   吉鹏   init
6
7
  export function login(data) {
    return request({
50760eab9   Adam   auto commit the c...
8
      url: '/yp/user/login',
80a28914e   吉鹏   init
9
      method: 'post',
d7d9c38c2   Adam   auto commit the c...
10
      data
c44ba96f6   Adam   auto commit the c...
11
12
    })
  }
a6e433928   Adam   auto commit the c...
13
  // getInfo
d7d9c38c2   Adam   auto commit the c...
14
  export function getInfo(token) {
c44ba96f6   Adam   auto commit the c...
15
    return request({
50760eab9   Adam   auto commit the c...
16
      url: '/yp/user/info',
80a28914e   吉鹏   init
17
      method: 'get',
d7d9c38c2   Adam   auto commit the c...
18
      params: { token }
80a28914e   吉鹏   init
19
20
    })
  }
a6e433928   Adam   auto commit the c...
21
  // logout
d7d9c38c2   Adam   auto commit the c...
22
  export function logout() {
1172ebb79   Adam   auto commit the c...
23
    return request({
50760eab9   Adam   auto commit the c...
24
      url: '/yp/user/logout',
d7d9c38c2   Adam   auto commit the c...
25
      method: 'post'
80a28914e   吉鹏   init
26
27
    })
  }
50760eab9   Adam   auto commit the c...
28

a6e433928   Adam   auto commit the c...
29
  // fetchList
50760eab9   Adam   auto commit the c...
30
  export function fetchList(query) {
a6e433928   Adam   auto commit the c...
31
32
33
34
35
36
37
38
    const options = {
      type: 'error',
      message: query,
      title: '==query value ===',
      showClose: true,
      duration: 4000
    }
    Notification(options)
50760eab9   Adam   auto commit the c...
39
40
41
42
43
44
    return request({
      url: '/yp/user/list',
      method: 'get',
      params: query
    })
  }
a6e433928   Adam   auto commit the c...
45
  // createUser
50760eab9   Adam   auto commit the c...
46
47
48
49
50
51
52
  export function createUser(query) {
    return request({
      url: '/yp/user/create',
      method: 'post',
      params: query
    })
  }
a6e433928   Adam   auto commit the c...
53
  // updateUser
50760eab9   Adam   auto commit the c...
54
55
56
57
58
59
60
  export function updateUser(query) {
    return request({
      url: '/yp/user/update',
      method: 'post',
      params: query
    })
  }
a6e433928   Adam   auto commit the c...
61
  // delUser
50760eab9   Adam   auto commit the c...
62
63
64
65
66
67
68
  export function delUser(query) {
    return request({
      url: '/yp/user/del',
      method: 'post',
      params: query
    })
  }