public.js 4.0 KB

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