public.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. * 获取图片base64
  77. * @retins {*}
  78. * */
  79. export function imageBase64(image, code) {
  80. return request.post(
  81. "image_base64",
  82. { image: image, code: code },
  83. { noAuth: true }
  84. );
  85. }
  86. /**
  87. * 自动复制口令功能
  88. * @returns {*}
  89. */
  90. export function copyWords() {
  91. return request.get("copy_words", {}, { noAuth: true });
  92. }
  93. /**
  94. * 获取商城是否强制绑定手机号
  95. */
  96. export function getShopConfig() {
  97. return request.get('v2/bind_status' ,{} ,{noAuth : true});
  98. }
  99. /**
  100. * 小程序绑定手机号
  101. * @param {Object} data
  102. */
  103. export function getUserPhone(data){
  104. return request.post('v2/auth_bindind_phone',data,{noAuth : true});
  105. }
  106. /**
  107. * 小程序用户登录
  108. * @param data object 小程序用户登陆信息
  109. */
  110. export function routineLogin(data) {
  111. return request.get("v2/wechat/routine_auth", data, {
  112. noAuth: true
  113. });
  114. }
  115. /**
  116. * 获取微信sdk配置
  117. * @returns {*}
  118. */
  119. export function wechatAuthV2(code, spread) {
  120. return request.get(
  121. "v2/wechat/auth", {
  122. code,
  123. spread
  124. }, {
  125. noAuth: true
  126. }
  127. );
  128. }
  129. /**
  130. * 获取组件底部菜单
  131. * @param data object 获取组件底部菜单
  132. */
  133. export function getNavigation(data) {
  134. return request.get("navigation", data, {
  135. noAuth: true
  136. });
  137. }
  138. export function getSubscribe(){
  139. return request.get("subscribe", {}, {
  140. noAuth: true
  141. });
  142. }