public.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2021 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. import wechat from "@/libs/wechat.js";
  12. /**
  13. * 获取微信sdk配置
  14. * @returns {*}
  15. */
  16. export function getWechatConfig() {
  17. return request.get(
  18. "wechat/config",
  19. { url: wechat.signLink() },
  20. { noAuth: true }
  21. );
  22. }
  23. /**
  24. * 获取登录授权login
  25. *
  26. */
  27. export function getLogo()
  28. {
  29. return request.get('wechat/get_logo', {}, { noAuth : true});
  30. }
  31. /**
  32. * 小程序用户登录
  33. * @param data object 小程序用户登陆信息
  34. */
  35. export function login(data) {
  36. return request.post("wechat/mp_auth", data, { noAuth : true });
  37. }
  38. /**
  39. * 静默授权
  40. * @param {Object} data
  41. */
  42. export function silenceAuth(data) {
  43. //#ifdef MP
  44. return request.get("v2/wechat/silence_auth", data, { noAuth : true });
  45. //#endif
  46. //#ifdef H5
  47. return request.get("v2/wechat/wx_silence_auth", data, { noAuth : true });
  48. //#endif
  49. }
  50. /**
  51. * 分享
  52. * @returns {*}
  53. */
  54. export function getShare() {
  55. return request.get("share", {}, { noAuth: true });
  56. }
  57. /**
  58. * 获取关注海报
  59. * @returns {*}
  60. */
  61. export function follow() {
  62. return request.get("wechat/follow", {}, { noAuth: true });
  63. }
  64. /**
  65. * code生成用户
  66. * @returns {*}
  67. */
  68. export function authLogin(data) {
  69. return request.get("v2/wechat/silence_auth_login", data, {
  70. noAuth: true
  71. });
  72. }
  73. /**
  74. * 获取图片base64
  75. * @retins {*}
  76. * */
  77. export function imageBase64(image, code) {
  78. return request.post(
  79. "image_base64",
  80. { image: image, code: code },
  81. { noAuth: true }
  82. );
  83. }
  84. /**
  85. * 自动复制口令功能
  86. * @returns {*}
  87. */
  88. export function copyWords() {
  89. return request.get("copy_words", {}, { noAuth: true });
  90. }
  91. /**
  92. * 获取商城是否强制绑定手机号
  93. */
  94. export function getShopConfig() {
  95. return request.get('v2/bind_status' ,{} ,{noAuth : true});
  96. }
  97. /**
  98. * 小程序绑定手机号
  99. * @param {Object} data
  100. */
  101. export function getUserPhone(data){
  102. return request.post('v2/auth_bindind_phone',data,{noAuth : true});
  103. }
  104. /**
  105. * 小程序用户登录
  106. * @param data object 小程序用户登陆信息
  107. */
  108. export function routineLogin(data) {
  109. return request.get("v2/wechat/routine_auth", data, {
  110. noAuth: true
  111. });
  112. }
  113. /**
  114. * 获取微信sdk配置
  115. * @returns {*}
  116. */
  117. export function wechatAuthV2(code, spid) {
  118. return request.get(
  119. "v2/wechat/auth",
  120. {code : code, spread_spid : spid},
  121. {noAuth: true}
  122. );
  123. }
  124. /**
  125. * 获取组件底部菜单
  126. * @param data object 获取组件底部菜单
  127. */
  128. export function getNavigation(data) {
  129. return request.get("navigation", data, {
  130. noAuth: true
  131. });
  132. }
  133. export function getSubscribe(){
  134. return request.get("subscribe", {}, {
  135. noAuth: true
  136. });
  137. }