public.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2025 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. import { toLogin, checkLogin } from "../libs/login";
  13. /**
  14. * 获取微信公众号js配置
  15. * @returns {*}
  16. */
  17. export function getWechatConfig() {
  18. return request.get(
  19. "wechat/get/public/js/config",
  20. { url: wechat.signLink() },
  21. { noAuth: true }
  22. );
  23. }
  24. /**
  25. * 获取微信sdk配置
  26. * @returns {*}
  27. */
  28. export function wechatAuth(code, spread) {
  29. var reg = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 ,判断正整数用/^[1-9]+[0-9]*]*$/
  30. spread = reg.test(spread) ? spread : 0;
  31. return request.post(
  32. "login/wechat/public",
  33. { code: code, spreadPid: spread },
  34. { noAuth: true }
  35. );
  36. }
  37. /**
  38. * 获取登录授权login
  39. *
  40. */
  41. export function loginConfigApi() {
  42. return request.get("login/config", {}, { noAuth: true });
  43. }
  44. /**
  45. * 小程序用户登录
  46. * @param data object 小程序用户登录信息
  47. */
  48. export function login(data) {
  49. return request.post("login/wechat/routine", data, { noAuth: true });
  50. }
  51. /**
  52. * 分享
  53. * @returns {*}
  54. */
  55. export function getShare() {
  56. return request.get("share", {}, { noAuth: true });
  57. }
  58. /**
  59. * 获取关注海报
  60. * @returns {*}
  61. */
  62. export function follow() {
  63. return request.get("wechat/follow", {}, { noAuth: true });
  64. }
  65. /**
  66. * 获取图片base64
  67. * @retins {*}
  68. * */
  69. export function imageBase64(image) {
  70. return request.post("qrcode/url/to/base64", image, { noAuth: true });
  71. }
  72. /**
  73. * 自动复制口令功能
  74. * @returns {*}
  75. */
  76. export function copyWords() {
  77. return request.get("copy_words", {}, { noAuth: true });
  78. }
  79. /**
  80. * 微信(公众号,小程序)绑定手机号
  81. * @param {Object} data
  82. */
  83. export function getUserPhone(data) {
  84. return request.post("login/wechat/register/binding/phone", data, {
  85. noAuth: true,
  86. });
  87. }
  88. /**
  89. * APP微信登录
  90. * @param {Object} data
  91. */
  92. export function appAuth(data) {
  93. return request.post("login/wechat/app/login", data, { noAuth: true });
  94. }
  95. /**
  96. * 苹果登录
  97. * @param {Object} data
  98. */
  99. export function appleLogin(data) {
  100. return request.post("login/ios/login", data, { noAuth: true });
  101. }
  102. /**
  103. * 苹果绑定手机号
  104. * @param {Object} data
  105. */
  106. export function iosBinding(data) {
  107. return request.post("ios/binding/phone", data, { noAuth: true });
  108. }
  109. /**
  110. * 微信地址导入
  111. * @param {Object} data
  112. */
  113. export function addressWxImportApi(data) {
  114. return request.post("address/wechant/import", data);
  115. }
  116. /**
  117. * 微信直播间列表
  118. * @param {Object} data
  119. */
  120. export function liveroomApi(data) {
  121. return request.get("wechat/liveroom", data, { noAuth: true });
  122. }
  123. /**
  124. * 全局配置信息
  125. */
  126. export function globalConfigApi() {
  127. return request.get("index/global/config/info", {}, { noAuth: true });
  128. }
  129. /**
  130. * 获取商圈树
  131. */
  132. export function circleAreasTreeApi() {
  133. return request.get("circle/areas/tree", "", { noAuth: true });
  134. }