user.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. const tokens = {
  2. admin: {
  3. token: 'admin-token'
  4. },
  5. editor: {
  6. token: 'editor-token'
  7. }
  8. }
  9. // const users = {
  10. // 'admin-token': {
  11. // roles: ['admin'],
  12. // introduction: 'I am a super administrator',
  13. // avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
  14. // name: 'Super Admin'
  15. // },
  16. // 'editor-token': {
  17. // roles: ['editor'],
  18. // introduction: 'I am an editor',
  19. // avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
  20. // name: 'Normal Editor'
  21. // }
  22. // }
  23. module.exports = [
  24. // user login
  25. {
  26. url: '/v1/user/login',
  27. type: 'post',
  28. response: config => {
  29. return {
  30. code: 200,
  31. status: true,
  32. data: { data: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJMYXJhdmVsIiwibGF0IjoxNjM2Nzg1NTQ4LCJleHAiOjE2Mzc2NDk1NDgsInN1YiI6IjE3NzE5MTE4NzYzIiwiZGF0YSI6eyJ1c2VyX2lkIjoxNzEwLCJ1c2VyX3Bob25lIjoiMTc3MTkxMTg3NjMiLCJ1c2VyX3JlYWxuYW1lIjoiXHU5YWQ4XHU2NWIwXHU2NjBlIiwic3RhdHVzIjoyLCJsb2dpbmlwIjoiMTE1LjE5My4xMzcuMTQ4IiwibG9naW50aW1lIjoiMjAxOS0xMS0wNSAxNzo1ODo0NSIsInVwZGF0ZWRfYXQiOiIxNjM2NzgzNDY4IiwibGV2ZWxfaWQiOjQsImF1dGhfZmFjZSI6MSwicHJvamVjdCI6Inl4OV9mcm9udCJ9fQ.EWXtDqo1tURytZUe8VzIK-Gdhu8mu2Uwt7GCZt6ipqM' },
  33. message: '成功'
  34. }
  35. }
  36. },
  37. // get user info
  38. {
  39. url: '/v1/personal/user/info\.*',
  40. type: 'get',
  41. response: config => {
  42. // const { token } = config.query
  43. // const info = users[token]
  44. // // mock error
  45. // if (!info) {
  46. // return {
  47. // code: 50008,
  48. // message: 'Login failed, unable to get user details.'
  49. // }
  50. // }
  51. return {
  52. code: 200,
  53. status: true,
  54. message: '成功',
  55. data: {
  56. roles: ['admin'],
  57. introduction: 'I am a super administrator',
  58. avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
  59. name: '高新明',
  60. data: {
  61. 'user_id': 1710,
  62. 'user_phone': '17719118763',
  63. 'user_realname': '高新明',
  64. 'chennal': '游戏久 1446',
  65. 'user_money': '2113.78863',
  66. 'dongjie': '2000.00000',
  67. 'shangwubi': '681.29130',
  68. 'user_IDCard': '7897897899896',
  69. 'icon': '20200518614516391710.jpg',
  70. 'user_address': '北京*北京市*东城区*卡视角',
  71. 'user_email': '2281216777@qq.com',
  72. 'bankid': null,
  73. 'alipay': '17719118763',
  74. 'weixin': '',
  75. 'qq': '2281216777',
  76. 'status': 2,
  77. 'auth_face': 1,
  78. 'error': null,
  79. 'shangwu_rabc': 2,
  80. 'level_id': 4,
  81. 'company': '❤心新科技',
  82. 'logintime': '2019-11-05 17:58:45',
  83. 'last_loginip': '115.193.137.148',
  84. 'loginip': '115.193.137.148',
  85. 'user_IDCard_qy': '913601006859508926',
  86. 'user_realname_qy': '高新明',
  87. 'user_email_qy': '2281216777@qq.com',
  88. 'bankid_qy': '621799281010672917',
  89. 'user_address_qy': '河南省*周口市*项城市*6988989899688966',
  90. 'qq_qy': '21611226688',
  91. 'user_id_1_qy': '20200518268755971710.jpg',
  92. 'user_id_2_qy': '20200518541747191710.jpg',
  93. 'is_show_app': 1,
  94. 'is_make_app': 1,
  95. 'star_level': 1,
  96. 'star_amount': 36,
  97. 'star_name': '白银会员',
  98. 'star_free_cash': 0,
  99. 'use_free_cash': -100,
  100. 'cur_star_level': 2,
  101. 'cur_star_amount': 100042,
  102. 'cur_star_name': '黄金会员',
  103. 'shouyibao': 507.89,
  104. 'box_show': 1,
  105. 'level_value': 'A'
  106. }
  107. }
  108. }
  109. }
  110. },
  111. // user login
  112. {
  113. url: '/vue-element-admin/user/login',
  114. type: 'post',
  115. response: config => {
  116. const { username } = config.body
  117. const token = tokens[username]
  118. // mock error
  119. if (!token) {
  120. return {
  121. code: 60204,
  122. message: 'Account and password are incorrect.'
  123. }
  124. }
  125. return {
  126. code: 200,
  127. data: token,
  128. message: '成功'
  129. }
  130. }
  131. },
  132. // user logout
  133. {
  134. url: '/vue-element-admin/user/logout',
  135. type: 'post',
  136. response: _ => {
  137. return {
  138. code: 200,
  139. data: 'success',
  140. message: '成功'
  141. }
  142. }
  143. }
  144. ]