public.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2023 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. }, {
  21. noAuth: true
  22. }
  23. );
  24. }
  25. /**
  26. * 获取微信sdk配置
  27. * @returns {*}
  28. */
  29. export function wechatAuth(code, spread, login_type) {
  30. return request.get(
  31. "wechat/auth", {
  32. code,
  33. spread,
  34. login_type
  35. }, {
  36. noAuth: true
  37. }
  38. );
  39. }
  40. /**
  41. * 获取登录授权login
  42. *
  43. */
  44. export function getLogo() {
  45. return request.get('wechat/get_logo', {}, {
  46. noAuth: true
  47. });
  48. }
  49. /**
  50. * 小程序用户登录
  51. * @param data object 小程序用户登陆信息
  52. */
  53. export function login(data) {
  54. return request.post("wechat/mp_auth", data, {
  55. noAuth: true
  56. });
  57. }
  58. /**
  59. * 静默授权
  60. * @param {Object} data
  61. */
  62. export function silenceAuth(data) {
  63. //#ifdef MP
  64. return request.get("v2/wechat/silence_auth", data, {
  65. noAuth: true
  66. });
  67. //#endif
  68. //#ifdef H5
  69. return request.get("v2/wechat/wx_silence_auth", data, {
  70. noAuth: true
  71. });
  72. //#endif
  73. }
  74. /**
  75. * 分享
  76. * @returns {*}
  77. */
  78. export function getShare() {
  79. return request.get("share", {}, {
  80. noAuth: true
  81. });
  82. }
  83. /**
  84. * 获取关注海报
  85. * @returns {*}
  86. */
  87. export function follow() {
  88. return request.get("wechat/follow", {}, {
  89. noAuth: true
  90. });
  91. }
  92. /**
  93. * code生成用户
  94. * @returns {*}
  95. */
  96. export function authLogin(data) {
  97. return request.get("v2/wechat/silence_auth_login", data, {
  98. noAuth: true
  99. });
  100. }
  101. /**
  102. * 获取图片base64
  103. * @retins {*}
  104. * */
  105. export function imageBase64(image, code) {
  106. return request.post(
  107. "image_base64", {
  108. image: image,
  109. code: code
  110. }, {
  111. noAuth: true
  112. }
  113. );
  114. }
  115. /**
  116. * 自动复制口令功能
  117. * @returns {*}
  118. */
  119. export function copyWords() {
  120. return request.get("copy_words", {}, {
  121. noAuth: true
  122. });
  123. }
  124. /**
  125. * 获取商城是否强制绑定手机号
  126. */
  127. export function getShopConfig() {
  128. return request.get('v2/bind_status', {}, {
  129. noAuth: true
  130. });
  131. }
  132. /**
  133. * 小程序绑定手机号
  134. * @param {Object} data
  135. */
  136. export function getUserPhone(data) {
  137. return request.post('v2/auth_bindind_phone', data, {
  138. noAuth: true
  139. });
  140. }
  141. /**
  142. * 小程序用户登录
  143. * @param data object 小程序用户登陆信息
  144. */
  145. export function routineLogin(data) {
  146. return request.get("v2/wechat/routine_auth", data, {
  147. noAuth: true
  148. });
  149. }
  150. /**
  151. * 获取微信sdk配置
  152. * @returns {*}
  153. */
  154. export function wechatAuthV2(code, spread) {
  155. return request.get(
  156. "v2/wechat/auth", {
  157. code,
  158. spread
  159. }, {
  160. noAuth: true
  161. }
  162. );
  163. }
  164. /**
  165. * 获取组件底部菜单
  166. * @param data object 获取组件底部菜单
  167. */
  168. export function getNavigation(data) {
  169. return request.get("navigation", data, {
  170. noAuth: true
  171. });
  172. }
  173. export function getSubscribe() {
  174. return request.get("subscribe", {}, {
  175. noAuth: true
  176. });
  177. }
  178. /**
  179. * 获取版本信息
  180. * @param 系统类型
  181. */
  182. export function getUpdateInfo(type) {
  183. return request.get("get_new_app/" + type, {}, {
  184. noAuth: true
  185. });
  186. }