api.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. import request from "./../utils/request.js";
  2. /**
  3. * 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册
  4. *
  5. */
  6. /**
  7. * 获取主页数据 无需授权
  8. *
  9. */
  10. export function getIndexData()
  11. {
  12. return request.get("index",{},{ noAuth : true})
  13. }
  14. export function getNotifications()
  15. {
  16. return request.get('notifications', {}, {noAuth: true})
  17. }
  18. /**
  19. * 获取登录授权login
  20. *
  21. */
  22. export function getLogo()
  23. {
  24. return request.get('wechat/get_logo', {}, { noAuth : true})
  25. }
  26. /**
  27. * 保存form_id
  28. * @param string formId
  29. */
  30. export function setFormId(formId) {
  31. return request.post("wechat/set_form_id", { formId: formId})
  32. }
  33. /**
  34. * 领取优惠卷
  35. * @param int couponId
  36. *
  37. */
  38. export function setCouponReceive(couponId){
  39. return request.post('coupon/receive', { couponId: couponId})
  40. }
  41. /**
  42. * 优惠券列表
  43. * @param object data
  44. */
  45. export function getCoupons(data){
  46. return request.get('coupons',data,{noAuth:true})
  47. }
  48. /**
  49. * 我的优惠券
  50. * @param int types 0全部 1未使用 2已使用
  51. */
  52. export function getUserCoupons(types){
  53. return request.get('coupons/user/'+types)
  54. }
  55. /**
  56. * 文章分类列表
  57. *
  58. */
  59. export function getArticleCategoryList(){
  60. return request.get('article/category/list',{},{noAuth:true})
  61. }
  62. /**
  63. * 文章列表
  64. * @param int cid
  65. *
  66. */
  67. export function getArticleList(cid,data){
  68. return request.get('article/list/' + cid, data,{noAuth:true})
  69. }
  70. /**
  71. * 文章 热门列表
  72. *
  73. */
  74. export function getArticleHotList(){
  75. return request.get('article/hot/list',{},{noAuth:true})
  76. }
  77. /**
  78. * 文章 轮播列表
  79. *
  80. */
  81. export function getArticleBannerList(){
  82. return request.get('article/banner/list',{},{noAuth:true})
  83. }
  84. /**
  85. * 文章详情
  86. * @param int id
  87. *
  88. */
  89. export function getArticleDetails(id){
  90. return request.get('article/details/'+id,{},{noAuth:true})
  91. }
  92. /**
  93. * 手机号+验证码登录接口
  94. * @param object data
  95. */
  96. export function loginMobile(data){
  97. return request.post('login/mobile',data,{noAuth:true})
  98. }
  99. /**
  100. * 验证码发送
  101. * @param object phone
  102. */
  103. export function registerVerify(code, key, phone, reset){
  104. return request.post('register/verify', { code: code, key: key, phone: phone, type: reset === undefined ? 'reset' : reset },{noAuth:true})
  105. }
  106. /**
  107. * 手机号注册
  108. * @param object data
  109. *
  110. */
  111. export function phoneRegister(data){
  112. return request.post('register',data,{noAuth:true})
  113. }
  114. /**
  115. * 手机号修改密码
  116. * @param object data
  117. *
  118. */
  119. export function phoneRegisterReset(data){
  120. return request.post('register/reset',data,{noAuth:true})
  121. }
  122. /**
  123. * 手机号+密码登录
  124. * @param object data
  125. *
  126. */
  127. export function phoneLogin(data){
  128. return request.post('login',data,{noAuth:true})
  129. }
  130. /**
  131. * 切换H5登录
  132. * @param object data
  133. */
  134. export function switchH5Login(){
  135. return request.post('switch_h5', { 'from':'routine'})
  136. }
  137. /**
  138. * 绑定手机号
  139. *
  140. */
  141. export function bindingPhone(data){
  142. return request.post('binding',data)
  143. }
  144. /**
  145. * 退出登錄
  146. *
  147. */
  148. export function logout(){
  149. return request.get('logout')
  150. }
  151. /**
  152. * 获取订阅消息id
  153. */
  154. export function getTemlIds()
  155. {
  156. return request.get('wechat/teml_ids', {}, { noAuth:true})
  157. }
  158. /**
  159. * 获取小程序直播列表
  160. */
  161. export function getLiveList(page,limit) {
  162. return request.get('wechat/live', { page, limit }, { noAuth: true })
  163. }
  164. /**
  165. * 获取key值
  166. */
  167. export function verifyCode() {
  168. return request.get('verify_code', {}, { noAuth: true })
  169. }
  170. /**
  171. * 获取城市信息
  172. */
  173. export function getCity() {
  174. return request.get('city_list', {}, { noAuth: true })
  175. }
  176. export function getUserNotifications() {
  177. return request.get('user/notifications', {})
  178. }
  179. // 获取排行榜
  180. export function getLeaderBoard() {
  181. return request.get('boards', {}, { noAuth: true })
  182. }