user.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. import request from '@/sheep/request';
  2. import $platform from '@/sheep/platform';
  3. export default {
  4. profile: () =>
  5. request({
  6. url: '/user/api/user/profile',
  7. method: 'GET',
  8. custom: {
  9. showLoading: false,
  10. auth: true,
  11. },
  12. }),
  13. update: (data) =>
  14. request({
  15. url: '/user/api/user/update',
  16. method: 'POST',
  17. custom: {
  18. showSuccess: true,
  19. auth: true,
  20. },
  21. data,
  22. }),
  23. // 账号登录
  24. accountLogin: (data) =>
  25. request({
  26. url: '/user/api/user/accountLogin',
  27. method: 'POST',
  28. data,
  29. custom: {
  30. showSuccess: true,
  31. loadingMsg: '登录中',
  32. },
  33. }),
  34. // 短信登录
  35. smsLogin: (data) =>
  36. request({
  37. url: '/user/api/user/smsLogin',
  38. method: 'POST',
  39. data,
  40. custom: {
  41. showSuccess: true,
  42. loadingMsg: '登录中',
  43. },
  44. }),
  45. // 短信注册
  46. smsRegister: (data) =>
  47. request({
  48. url: '/user/api/user/smsRegister',
  49. method: 'POST',
  50. data,
  51. custom: {
  52. showSuccess: true,
  53. loadingMsg: '正在注册',
  54. },
  55. }),
  56. // 重置密码
  57. resetPassword: (data) =>
  58. request({
  59. url: '/user/api/user/resetPassword',
  60. method: 'POST',
  61. data,
  62. custom: {
  63. showSuccess: true,
  64. loadingMsg: '验证中',
  65. },
  66. }),
  67. // 修改密码
  68. changePassword: (data) =>
  69. request({
  70. url: '/user/api/user/changePassword',
  71. method: 'POST',
  72. data,
  73. custom: {
  74. showSuccess: true,
  75. loadingMsg: '验证中',
  76. },
  77. }),
  78. // 绑定、更换手机号
  79. changeMobile: (data) =>
  80. request({
  81. url: '/user/api/user/changeMobile',
  82. method: 'POST',
  83. data,
  84. custom: {
  85. showSuccess: true,
  86. loadingMsg: '验证中',
  87. },
  88. }),
  89. // 修改用户名
  90. changeUsername: (data) =>
  91. request({
  92. url: '/user/api/user/changeUsername',
  93. method: 'POST',
  94. data,
  95. custom: {
  96. showSuccess: true,
  97. loadingMsg: '验证中',
  98. },
  99. }),
  100. // 第三方授权信息
  101. thirdOauthInfo: () =>
  102. request({
  103. url: '/user/api/user/thirdOauth',
  104. method: 'GET',
  105. params: {
  106. provider: $platform.provider,
  107. platform: $platform.platform,
  108. },
  109. custom: {
  110. showLoading: false,
  111. },
  112. }),
  113. // 添加分享记录
  114. addShareLog: (data) =>
  115. request({
  116. url: 'share/add',
  117. method: 'POST',
  118. data,
  119. custom: {
  120. showError: false,
  121. },
  122. }),
  123. share: {
  124. list: (params) =>
  125. request({
  126. url: 'share/list',
  127. method: 'GET',
  128. params,
  129. }),
  130. },
  131. // 账号登出
  132. logout: (data) =>
  133. request({
  134. url: '/user/api/user/logout',
  135. method: 'POST',
  136. data,
  137. }),
  138. // 账号注销
  139. logoff: (data) =>
  140. request({
  141. url: '/user/api/user/logoff',
  142. method: 'POST',
  143. data,
  144. }),
  145. address: {
  146. default: () =>
  147. request({
  148. url: 'user/address/default',
  149. method: 'GET',
  150. custom: {
  151. showError: false,
  152. },
  153. }),
  154. list: () =>
  155. request({
  156. url: 'user/address',
  157. method: 'GET',
  158. custom: {},
  159. }),
  160. create: (data) =>
  161. request({
  162. url: 'user/address',
  163. method: 'POST',
  164. data,
  165. custom: {
  166. showSuccess: true,
  167. },
  168. }),
  169. update: (id, data) =>
  170. request({
  171. url: 'user/address/' + id,
  172. method: 'PUT',
  173. data,
  174. custom: {
  175. showSuccess: true,
  176. },
  177. }),
  178. detail: (id) =>
  179. request({
  180. url: 'user/address/' + id,
  181. method: 'GET',
  182. }),
  183. delete: (id) =>
  184. request({
  185. url: 'user/address/' + id,
  186. method: 'DELETE',
  187. }),
  188. },
  189. invoice: {
  190. list: () =>
  191. request({
  192. url: 'user/invoice',
  193. method: 'GET',
  194. custom: {},
  195. }),
  196. create: (data) =>
  197. request({
  198. url: 'user/invoice',
  199. method: 'POST',
  200. data,
  201. custom: {
  202. showSuccess: true,
  203. },
  204. }),
  205. update: (id, data) =>
  206. request({
  207. url: 'user/invoice/' + id,
  208. method: 'PUT',
  209. data,
  210. custom: {
  211. showSuccess: true,
  212. },
  213. }),
  214. detail: (id) =>
  215. request({
  216. url: 'user/invoice/' + id,
  217. method: 'GET',
  218. }),
  219. delete: (id) =>
  220. request({
  221. url: 'user/invoice/' + id,
  222. method: 'DELETE',
  223. }),
  224. },
  225. favorite: {
  226. list: (params) =>
  227. request({
  228. url: 'user/goodsLog/favorite',
  229. method: 'GET',
  230. params,
  231. }),
  232. do: (id) =>
  233. request({
  234. url: 'user/goodsLog/favorite',
  235. method: 'POST',
  236. data: {
  237. goods_id: id,
  238. },
  239. custom: {
  240. showSuccess: true,
  241. auth: true,
  242. },
  243. }),
  244. cancel: (id) =>
  245. request({
  246. url: 'user/goodsLog/favorite',
  247. method: 'POST',
  248. data: {
  249. goods_ids: id,
  250. },
  251. custom: {
  252. showSuccess: true,
  253. auth: true,
  254. },
  255. }),
  256. },
  257. view: {
  258. list: (params) =>
  259. request({
  260. url: 'user/goodsLog/views',
  261. method: 'GET',
  262. params,
  263. custom: {},
  264. }),
  265. delete: (data) =>
  266. request({
  267. url: 'user/goodsLog/viewDel',
  268. method: 'DELETE',
  269. data,
  270. custom: {
  271. showSuccess: true,
  272. },
  273. }),
  274. },
  275. wallet: {
  276. log: (params) =>
  277. request({
  278. url: '/user/api/walletLog',
  279. method: 'GET',
  280. params,
  281. custom: {},
  282. }),
  283. },
  284. account: {
  285. info: (params) =>
  286. request({
  287. url: 'user/account',
  288. method: 'GET',
  289. params,
  290. custom: {
  291. showError: false,
  292. auth: true,
  293. },
  294. }),
  295. save: (data) =>
  296. request({
  297. url: 'user/account',
  298. method: 'POST',
  299. data,
  300. custom: {
  301. showSuccess: true,
  302. auth: true,
  303. },
  304. }),
  305. },
  306. //数量接口
  307. data: () =>
  308. request({
  309. url: 'user/user/data',
  310. method: 'GET',
  311. custom: {
  312. showLoading: false,
  313. auth: true,
  314. },
  315. }),
  316. };