public.js 4.1 KB

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