user.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. updateMpUserInfo: (data) =>
  102. request({
  103. url: '/user/api/user/updateMpUserInfo',
  104. method: 'POST',
  105. data,
  106. }),
  107. // 第三方授权信息
  108. thirdOauthInfo: () =>
  109. request({
  110. url: '/user/api/user/thirdOauth',
  111. method: 'GET',
  112. params: {
  113. provider: $platform.provider,
  114. platform: $platform.platform,
  115. },
  116. custom: {
  117. showLoading: false,
  118. },
  119. }),
  120. // 添加分享记录
  121. addShareLog: (data) =>
  122. request({
  123. url: 'share/add',
  124. method: 'POST',
  125. data,
  126. custom: {
  127. showError: false,
  128. },
  129. }),
  130. share: {
  131. list: (params) =>
  132. request({
  133. url: 'share/list',
  134. method: 'GET',
  135. params,
  136. }),
  137. },
  138. // 账号登出
  139. logout: (data) =>
  140. request({
  141. url: '/user/api/user/logout',
  142. method: 'POST',
  143. data,
  144. }),
  145. // 账号注销
  146. logoff: (data) =>
  147. request({
  148. url: '/user/api/user/logoff',
  149. method: 'POST',
  150. data,
  151. }),
  152. address: {
  153. default: () =>
  154. request({
  155. url: 'user/address/default',
  156. method: 'GET',
  157. custom: {
  158. showError: false,
  159. },
  160. }),
  161. list: () =>
  162. request({
  163. url: 'user/address',
  164. method: 'GET',
  165. custom: {},
  166. }),
  167. create: (data) =>
  168. request({
  169. url: 'user/address',
  170. method: 'POST',
  171. data,
  172. custom: {
  173. showSuccess: true,
  174. },
  175. }),
  176. update: (id, data) =>
  177. request({
  178. url: 'user/address/' + id,
  179. method: 'PUT',
  180. data,
  181. custom: {
  182. showSuccess: true,
  183. },
  184. }),
  185. detail: (id) =>
  186. request({
  187. url: 'user/address/' + id,
  188. method: 'GET',
  189. }),
  190. delete: (id) =>
  191. request({
  192. url: 'user/address/' + id,
  193. method: 'DELETE',
  194. }),
  195. },
  196. invoice: {
  197. list: () =>
  198. request({
  199. url: 'user/invoice',
  200. method: 'GET',
  201. custom: {},
  202. }),
  203. create: (data) =>
  204. request({
  205. url: 'user/invoice',
  206. method: 'POST',
  207. data,
  208. custom: {
  209. showSuccess: true,
  210. },
  211. }),
  212. update: (id, data) =>
  213. request({
  214. url: 'user/invoice/' + id,
  215. method: 'PUT',
  216. data,
  217. custom: {
  218. showSuccess: true,
  219. },
  220. }),
  221. detail: (id) =>
  222. request({
  223. url: 'user/invoice/' + id,
  224. method: 'GET',
  225. }),
  226. delete: (id) =>
  227. request({
  228. url: 'user/invoice/' + id,
  229. method: 'DELETE',
  230. }),
  231. },
  232. favorite: {
  233. list: (params) =>
  234. request({
  235. url: 'user/goodsLog/favorite',
  236. method: 'GET',
  237. params,
  238. }),
  239. do: (id) =>
  240. request({
  241. url: 'user/goodsLog/favorite',
  242. method: 'POST',
  243. data: {
  244. goods_id: id,
  245. },
  246. custom: {
  247. showSuccess: true,
  248. auth: true,
  249. },
  250. }),
  251. cancel: (id) =>
  252. request({
  253. url: 'user/goodsLog/favorite',
  254. method: 'POST',
  255. data: {
  256. goods_ids: id,
  257. },
  258. custom: {
  259. showSuccess: true,
  260. auth: true,
  261. },
  262. }),
  263. },
  264. view: {
  265. list: (params) =>
  266. request({
  267. url: 'user/goodsLog/views',
  268. method: 'GET',
  269. params,
  270. custom: {},
  271. }),
  272. delete: (data) =>
  273. request({
  274. url: 'user/goodsLog/viewDel',
  275. method: 'DELETE',
  276. data,
  277. custom: {
  278. showSuccess: true,
  279. },
  280. }),
  281. },
  282. wallet: {
  283. log: (params) =>
  284. request({
  285. url: '/user/api/walletLog',
  286. method: 'GET',
  287. params,
  288. custom: {},
  289. }),
  290. },
  291. account: {
  292. info: (params) =>
  293. request({
  294. url: 'user/account',
  295. method: 'GET',
  296. params,
  297. custom: {
  298. showError: false,
  299. auth: true,
  300. },
  301. }),
  302. save: (data) =>
  303. request({
  304. url: 'user/account',
  305. method: 'POST',
  306. data,
  307. custom: {
  308. showSuccess: true,
  309. auth: true,
  310. },
  311. }),
  312. },
  313. //数量接口
  314. data: () =>
  315. request({
  316. url: 'user/user/data',
  317. method: 'GET',
  318. custom: {
  319. showLoading: false,
  320. auth: true,
  321. },
  322. }),
  323. };