user.js 6.4 KB

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