Blame view

src/api/user.js 1.15 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',
b58b17e1e   Adam   auto commit the c...
18
19
20
      params: {
        token
      }
80a28914e   吉鹏   init
21
22
    })
  }
a6e433928   Adam   auto commit the c...
23
  // logout
d7d9c38c2   Adam   auto commit the c...
24
  export function logout() {
1172ebb79   Adam   auto commit the c...
25
    return request({
50760eab9   Adam   auto commit the c...
26
      url: '/yp/user/logout',
d7d9c38c2   Adam   auto commit the c...
27
      method: 'post'
80a28914e   吉鹏   init
28
29
    })
  }
50760eab9   Adam   auto commit the c...
30

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