You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.9 KiB

3 months ago
  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 {
  13. toLogin,
  14. checkLogin
  15. } from '../libs/login';
  16. /**
  17. * 获取微信公众号js配置
  18. * @returns {*}
  19. */
  20. export function getWechatConfig() {
  21. return request.get("wechat/config",{ url: encodeURIComponent(wechat.signLink()) },{ noAuth: true });
  22. }
  23. /**
  24. * 获取微信sdk配置
  25. * @returns {*}
  26. */
  27. export function wechatAuth(code, spread) {
  28. var reg=/^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 ,判断正整数用/^[1-9]+[0-9]*]*$/
  29. spread = reg.test(spread) ? spread : 0;
  30. return request.get(
  31. "wechat/authorize/login?code=" + code + "&spread_spid=" + spread, {},
  32. { noAuth: true }
  33. );
  34. }
  35. /**
  36. * 获取登录授权login
  37. *
  38. */
  39. export function getLogo()
  40. {
  41. // wechat/get_logo
  42. return request.get('wechat/getLogo', {}, { noAuth : true});
  43. }
  44. /**
  45. * 小程序用户登录
  46. * @param data object 小程序用户登录信息
  47. */
  48. export function login(code,data) {
  49. return request.post("wechat/authorize/program/login?code="+code, 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/base64",image,{ noAuth: true },1);
  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('wechat/register/binding/phone',data,{noAuth : true});
  85. }
  86. /**
  87. * APP微信登录
  88. * @param {Object} data
  89. */
  90. export function appAuth(data) {
  91. return request.post("wechat/authorize/app/login", data, { noAuth : true });
  92. }
  93. /**
  94. * 苹果绑定手机号
  95. * @param {Object} data
  96. */
  97. export function iosBinding(data) {
  98. return request.post("ios/binding/phone", data, { noAuth : true });
  99. }
  100. /**
  101. * IOS绑定手机号 -注册后使用
  102. * @param {Object} data
  103. */
  104. export function iosRegisterBinding(data) {
  105. return request.post("ios/register/binding/phone", data, { noAuth : true });
  106. }