api.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. import request from "@/utils/request.js";
  2. /**
  3. * 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册
  4. *
  5. */
  6. /**
  7. * 获取主页数据 无需授权
  8. *
  9. */
  10. export function getIndexData() {
  11. return request.get("v2/index", {}, {
  12. noAuth: true
  13. });
  14. }
  15. /**
  16. * 获取服务器类型
  17. *
  18. */
  19. export function getServerType() {
  20. return request.get("v2/site_serve", {}, {
  21. noAuth: true
  22. });
  23. }
  24. /**
  25. * 获取登录授权login
  26. *
  27. */
  28. export function getLogo() {
  29. return request.get('wechat/get_logo', {}, {
  30. noAuth: true
  31. });
  32. }
  33. /**
  34. * 保存form_id
  35. * @param string formId
  36. */
  37. export function setFormId(formId) {
  38. return request.post("wechat/set_form_id", {
  39. formId: formId
  40. });
  41. }
  42. /**
  43. * 领取优惠卷
  44. * @param int couponId
  45. *
  46. */
  47. export function setCouponReceive(couponId) {
  48. return request.post('coupon/receive', {
  49. couponId: couponId
  50. });
  51. }
  52. /**
  53. * 优惠券列表
  54. * @param object data
  55. */
  56. export function getCoupons(data) {
  57. return request.get('v2/coupons', data, {
  58. noAuth: true
  59. })
  60. }
  61. /**
  62. * 首页优惠券列表组件数据
  63. * @param object data
  64. */
  65. export function getCouponsIndex(data) {
  66. return request.get('coupons', data, {
  67. noAuth: true
  68. })
  69. }
  70. /**
  71. * 我的优惠券
  72. * @param int types 0全部 1未使用 2已使用
  73. */
  74. export function getUserCoupons(types, data) {
  75. return request.get('coupons/user/' + types, data)
  76. }
  77. /**
  78. * 首页新人优惠券
  79. *
  80. */
  81. export function getNewCoupon() {
  82. return request.get('v2/new_coupon')
  83. }
  84. /**
  85. * 文章分类列表
  86. *
  87. */
  88. export function getArticleCategoryList() {
  89. return request.get('article/category/list', {}, {
  90. noAuth: true
  91. })
  92. }
  93. /**
  94. * 文章列表
  95. * @param int cid
  96. *
  97. */
  98. export function getArticleList(cid, data) {
  99. return request.get('article/list/' + cid, data, {
  100. noAuth: true
  101. })
  102. }
  103. /**
  104. * 文章 热门列表
  105. *
  106. */
  107. export function getArticleHotList() {
  108. return request.get('article/hot/list', {}, {
  109. noAuth: true
  110. });
  111. }
  112. /**
  113. * 文章 轮播列表
  114. *
  115. */
  116. export function getArticleBannerList() {
  117. return request.get('article/banner/list', {}, {
  118. noAuth: true
  119. })
  120. }
  121. /**
  122. * 文章详情
  123. * @param int id
  124. *
  125. */
  126. export function getArticleDetails(id) {
  127. return request.get('article/details/' + id, {}, {
  128. noAuth: true
  129. });
  130. }
  131. /**
  132. * 手机号+验证码登录接口
  133. * @param object data
  134. */
  135. export function loginMobile(data) {
  136. return request.post('login/mobile', data, {
  137. noAuth: true
  138. })
  139. }
  140. /**
  141. * 获取短信KEY
  142. * @param object phone
  143. */
  144. export function verifyCode() {
  145. return request.get('verify_code', {}, {
  146. noAuth: true
  147. })
  148. }
  149. /**
  150. * 验证码发送
  151. * @param object phone
  152. */
  153. export function registerVerify(phone, reset, key, code) {
  154. return request.post('register/verify', {
  155. phone: phone,
  156. type: reset === undefined ? 'reset' : reset,
  157. key: key,
  158. code: code
  159. }, {
  160. noAuth: true
  161. })
  162. }
  163. /**
  164. * 手机号注册
  165. * @param object data
  166. *
  167. */
  168. export function phoneRegister(data) {
  169. return request.post('register', data, {
  170. noAuth: true
  171. });
  172. }
  173. /**
  174. * 手机号修改密码
  175. * @param object data
  176. *
  177. */
  178. export function phoneRegisterReset(data) {
  179. return request.post('register/reset', data, {
  180. noAuth: true
  181. })
  182. }
  183. /**
  184. * 手机号+密码登录
  185. * @param object data
  186. *
  187. */
  188. export function phoneLogin(data) {
  189. return request.post('login', data, {
  190. noAuth: true
  191. })
  192. }
  193. /**
  194. * 切换H5登录
  195. * @param object data
  196. */
  197. // #ifdef MP
  198. export function switchH5Login() {
  199. return request.post('switch_h5', {
  200. 'from': 'routine'
  201. });
  202. }
  203. // #endif
  204. /*
  205. * h5切换公众号登陆
  206. * */
  207. // #ifdef H5
  208. export function switchH5Login() {
  209. return request.post("switch_h5", {
  210. 'from': "wechat"
  211. });
  212. }
  213. // #endif
  214. /**
  215. * 绑定手机号
  216. *
  217. */
  218. export function bindingPhone(data) {
  219. return request.post('binding', data, {
  220. noAuth: true
  221. });
  222. }
  223. /**
  224. * 绑定手机号
  225. *
  226. */
  227. export function bindingUserPhone(data) {
  228. return request.post('user/binding', data);
  229. }
  230. /**
  231. * 退出登錄
  232. *
  233. */
  234. export function logout() {
  235. return request.get('logout');
  236. }
  237. /**
  238. * 获取订阅消息id
  239. */
  240. export function getTempIds() {
  241. return request.get('wechat/temp_ids', {}, {
  242. noAuth: true
  243. });
  244. }
  245. /**
  246. * 首页拼团数据
  247. */
  248. export function pink() {
  249. return request.get('pink', {}, {
  250. noAuth: true
  251. });
  252. }
  253. /**
  254. * 获取城市信息
  255. */
  256. export function getCity() {
  257. return request.get('city_list', {}, {
  258. noAuth: true
  259. });
  260. }
  261. /**
  262. * 获取列表
  263. */
  264. export function getLiveList(page, limit) {
  265. return request.get('wechat/live', {
  266. page,
  267. limit
  268. }, {
  269. noAuth: true
  270. });
  271. }
  272. /**
  273. * 获取首页DIY;
  274. */
  275. export function getDiy(id) {
  276. return request.get(`v2/diy/get_diy/default${id ? '?id='+id:''}`, {}, {
  277. noAuth: true
  278. });
  279. }
  280. /**
  281. * 一键换色;
  282. */
  283. export function colorChange(name) {
  284. return request.get('v2/diy/color_change/' + name, {}, {
  285. noAuth: true
  286. });
  287. }
  288. /**
  289. * 获取公众号关注
  290. * @returns {*}
  291. */
  292. export function follow() {
  293. return request.get("wechat/follow", {}, {
  294. noAuth: true
  295. });
  296. }
  297. /**
  298. * 更换手机号码
  299. * @returns {*}
  300. */
  301. export function updatePhone(data) {
  302. return request.post("user/updatePhone", data, {
  303. noAuth: true
  304. });
  305. }
  306. /**
  307. * 首页优惠券弹窗
  308. * @returns {*}
  309. */
  310. export function getCouponV2() {
  311. return request.get("v2/get_today_coupon", {}, {
  312. noAuth: true
  313. });
  314. }
  315. /**
  316. * 新用户优惠券弹窗
  317. * @returns {*}
  318. */
  319. export function getCouponNewUser() {
  320. return request.get("v2/new_coupon", {}, {
  321. noAuth: true
  322. });
  323. }
  324. /**
  325. * 首页快速选择数据
  326. * @param {Object} data
  327. */
  328. export function category(data) {
  329. return request.get("category", data, {
  330. noAuth: true
  331. });
  332. }
  333. /**
  334. * 个人搜索历史
  335. * @param {Object} data
  336. */
  337. export function searchList(data) {
  338. return request.get('v2/user/search_list', data, {
  339. noAuth: true
  340. });
  341. }
  342. /**
  343. * 删除搜索历史
  344. */
  345. export function clearSearch() {
  346. return request.get('v2/user/clean_search');
  347. }
  348. /**
  349. * 获取网站基础配置
  350. */
  351. export function siteConfig(data) {
  352. return request.get('site_config', data, {
  353. noAuth: true
  354. });
  355. }
  356. /**
  357. * App微信登录
  358. * @returns {*}
  359. */
  360. export function wechatAppAuth(data) {
  361. return request.post("wechat/app_auth", data, {
  362. noAuth: true
  363. });
  364. }
  365. /**
  366. * 获取客服类型
  367. * @returns {*}
  368. */
  369. export function getCustomerType(data) {
  370. return request.get("get_customer_type", {}, {
  371. noAuth: true
  372. });
  373. }
  374. /**
  375. * 获取开屏广告
  376. * @returns {*}
  377. */
  378. export function getOpenAdv(data) {
  379. return request.get("get_open_adv", {}, {
  380. noAuth: true
  381. });
  382. }
  383. /**
  384. * 获取版权信息
  385. */
  386. export function getCrmebCopyRight() {
  387. return request.get('copyright', {}, {
  388. noAuth: true
  389. })
  390. }