public.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import request from "@/utils/request.js";
  2. import wechat from "@/libs/wechat.js";
  3. /**
  4. * 获取微信sdk配置
  5. * @returns {*}
  6. */
  7. export function getWechatConfig() {
  8. return request.get(
  9. "wechat/config", {
  10. url: wechat.signLink()
  11. }, {
  12. noAuth: true
  13. }
  14. );
  15. }
  16. /**
  17. * 获取微信sdk配置
  18. * @returns {*}
  19. */
  20. export function wechatAuth(code, spread, login_type) {
  21. return request.get(
  22. "wechat/auth", {
  23. code,
  24. spread,
  25. login_type
  26. }, {
  27. noAuth: true
  28. }
  29. );
  30. }
  31. /**
  32. * 获取登录授权login
  33. *
  34. */
  35. export function getLogo() {
  36. return request.get('wechat/get_logo', {}, {
  37. noAuth: true
  38. });
  39. }
  40. /**
  41. * 小程序用户登录
  42. * @param data object 小程序用户登陆信息
  43. */
  44. export function login(data) {
  45. return request.post("wechat/mp_auth", data, {
  46. noAuth: true
  47. });
  48. }
  49. /**
  50. * 静默授权
  51. * @param {Object} data
  52. */
  53. export function silenceAuth(data) {
  54. //#ifdef MP
  55. return request.get("v2/wechat/silence_auth", data, {
  56. noAuth: true
  57. });
  58. //#endif
  59. //#ifdef H5
  60. return request.get("v2/wechat/wx_silence_auth", data, {
  61. noAuth: true
  62. });
  63. //#endif
  64. }
  65. /**
  66. * 分享
  67. * @returns {*}
  68. */
  69. export function getShare() {
  70. return request.get("share", {}, {
  71. noAuth: true
  72. });
  73. }
  74. /**
  75. * 获取关注海报
  76. * @returns {*}
  77. */
  78. export function follow() {
  79. return request.get("wechat/follow", {}, {
  80. noAuth: true
  81. });
  82. }
  83. /**
  84. * 获取图片base64
  85. * @retins {*}
  86. * */
  87. export function imageBase64(image, code) {
  88. return request.post(
  89. "image_base64", {
  90. image: image,
  91. code: code
  92. }, {
  93. noAuth: true
  94. }
  95. );
  96. }
  97. /**
  98. * 自动复制口令功能
  99. * @returns {*}
  100. */
  101. export function copyWords() {
  102. return request.get("copy_words", {}, {
  103. noAuth: true
  104. });
  105. }
  106. /**
  107. * 获取商城是否强制绑定手机号
  108. */
  109. export function getShopConfig() {
  110. return request.get('v2/bind_status', {}, {
  111. noAuth: true
  112. });
  113. }
  114. /**
  115. * 小程序绑定手机号
  116. * @param {Object} data
  117. */
  118. export function getUserPhone(data) {
  119. return request.post('v2/auth_bindind_phone', data, {
  120. noAuth: true
  121. });
  122. }
  123. /**
  124. * 小程序用户登录
  125. * @param data object 小程序用户登陆信息
  126. */
  127. export function routineLogin(data) {
  128. return request.get("v2/wechat/routine_auth", data, {
  129. noAuth: true
  130. });
  131. }
  132. /**
  133. * 获取微信sdk配置
  134. * @returns {*}
  135. */
  136. export function wechatAuthV2(code, spread) {
  137. return request.get(
  138. "v2/wechat/auth", {
  139. code,
  140. spread
  141. }, {
  142. noAuth: true
  143. }
  144. );
  145. }
  146. /**
  147. * 获取组件底部菜单
  148. * @param data object 获取组件底部菜单
  149. */
  150. export function getNavigation(data) {
  151. return request.get("navigation", data, {
  152. noAuth: true
  153. });
  154. }
  155. export function getSubscribe() {
  156. return request.get("subscribe", {}, {
  157. noAuth: true
  158. });
  159. }
  160. /**
  161. * 获取版本信息
  162. * @param 系统类型
  163. */
  164. export function getUpdateInfo(type) {
  165. return request.get("get_new_app/" + type, {}, {
  166. noAuth: true
  167. });
  168. }