api.js 7.2 KB

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