public.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. * 获取微信sdk配置
  25. * @returns {*}
  26. */
  27. export function wechatAuth(code, spread, login_type) {
  28. return request.get(
  29. "wechat/auth",
  30. { code, spread, login_type },
  31. { noAuth: true }
  32. );
  33. }
  34. /**
  35. * 获取登录授权login
  36. *
  37. */
  38. export function getLogo()
  39. {
  40. return request.get('wechat/get_logo', {}, { noAuth : true});
  41. }
  42. /**
  43. * 小程序用户登录
  44. * @param data object 小程序用户登陆信息
  45. */
  46. export function login(data) {
  47. return request.post("wechat/mp_auth", data, { noAuth : true });
  48. }
  49. /**
  50. * 静默授权
  51. * @param {Object} data
  52. */
  53. export function silenceAuth(data) {
  54. //#ifdef MP
  55. return request.get("v2/wechat/silence_auth", data, { noAuth : true });
  56. //#endif
  57. //#ifdef H5
  58. return request.get("v2/wechat/wx_silence_auth", data, { noAuth : true });
  59. //#endif
  60. }
  61. /**
  62. * 分享
  63. * @returns {*}
  64. */
  65. export function getShare() {
  66. return request.get("share", {}, { noAuth: true });
  67. }
  68. /**
  69. * 获取关注海报
  70. * @returns {*}
  71. */
  72. export function follow() {
  73. return request.get("wechat/follow", {}, { noAuth: true });
  74. }
  75. /**
  76. * code生成用户
  77. * @returns {*}
  78. */
  79. export function authLogin(data) {
  80. return request.get("v2/wechat/silence_auth_login", data, {
  81. noAuth: true
  82. });
  83. }
  84. /**
  85. * 获取图片base64
  86. * @retins {*}
  87. * */
  88. export function imageBase64(image, code) {
  89. return request.post(
  90. "image_base64",
  91. { image: image, code: code },
  92. { noAuth: true }
  93. );
  94. }
  95. /**
  96. * 自动复制口令功能
  97. * @returns {*}
  98. */
  99. export function copyWords() {
  100. return request.get("copy_words", {}, { noAuth: true });
  101. }
  102. /**
  103. * 获取商城是否强制绑定手机号
  104. */
  105. export function getShopConfig() {
  106. return request.get('v2/bind_status' ,{} ,{noAuth : true});
  107. }
  108. /**
  109. * 小程序绑定手机号
  110. * @param {Object} data
  111. */
  112. export function getUserPhone(data){
  113. return request.post('v2/auth_bindind_phone',data,{noAuth : true});
  114. }
  115. /**
  116. * 小程序用户登录
  117. * @param data object 小程序用户登陆信息
  118. */
  119. export function routineLogin(data) {
  120. return request.get("v2/wechat/routine_auth", data, {
  121. noAuth: true
  122. });
  123. }
  124. /**
  125. * 获取微信sdk配置
  126. * @returns {*}
  127. */
  128. export function wechatAuthV2(code, spread) {
  129. return request.get(
  130. "v2/wechat/auth", {
  131. code,
  132. spread
  133. }, {
  134. noAuth: true
  135. }
  136. );
  137. }
  138. /**
  139. * 获取组件底部菜单
  140. * @param data object 获取组件底部菜单
  141. */
  142. export function getNavigation(data) {
  143. return request.get("navigation", data, {
  144. noAuth: true
  145. });
  146. }
  147. export function getSubscribe(){
  148. return request.get("subscribe", {}, {
  149. noAuth: true
  150. });
  151. }