public.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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/auth_type", 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 wechatAuthLogin(data) {
  88. return request.get("v2/wechat/auth_login", data, {
  89. noAuth: true
  90. });
  91. }
  92. /**
  93. * 获取关注海报
  94. * @returns {*}
  95. */
  96. export function follow() {
  97. return request.get("wechat/follow", {}, {
  98. noAuth: true
  99. });
  100. }
  101. /**
  102. * code生成用户
  103. * @returns {*}
  104. */
  105. export function authType(data) {
  106. return request.get("v2/routine/auth_type", data, {
  107. noAuth: true
  108. });
  109. }
  110. /**
  111. * 授权登录
  112. * @returns {*}
  113. */
  114. export function authLogin(data) {
  115. return request.get("v2/routine/auth_login", data, {
  116. noAuth: true
  117. });
  118. }
  119. /**
  120. * 获取图片base64
  121. * @retins {*}
  122. * */
  123. export function imageBase64(image, code) {
  124. return request.post(
  125. "image_base64", {
  126. image: image,
  127. code: code
  128. }, {
  129. noAuth: true
  130. }
  131. );
  132. }
  133. /**
  134. * 自动复制口令功能
  135. * @returns {*}
  136. */
  137. export function copyWords() {
  138. return request.get("copy_words", {}, {
  139. noAuth: true
  140. });
  141. }
  142. /**
  143. * 获取商城是否强制绑定手机号
  144. */
  145. export function getShopConfig() {
  146. return request.get('v2/bind_status', {}, {
  147. noAuth: true
  148. });
  149. }
  150. /**
  151. * 小程序绑定手机号
  152. * @param {Object} data
  153. */
  154. export function routineBindingPhone(data) {
  155. return request.post('v2/routine/auth_binding_phone', data, {
  156. noAuth: true
  157. });
  158. }
  159. /**
  160. * 小程序绑定手机号
  161. * @param {Object} data
  162. */
  163. export function wechatBindingPhone(data) {
  164. return request.post('v2/wechat/auth_binding_phone', data, {
  165. noAuth: true
  166. });
  167. }
  168. /**
  169. * 小程序手机号登录
  170. * @param {Object} data
  171. */
  172. export function phoneLogin(data) {
  173. return request.post('v2/routine/phone_login', data, {
  174. noAuth: true
  175. });
  176. }
  177. /**
  178. * 小程序用户登录
  179. * @param data object 小程序用户登陆信息
  180. */
  181. export function routineLogin(data) {
  182. return request.get("v2/wechat/routine_auth", data, {
  183. noAuth: true
  184. });
  185. }
  186. /**
  187. * 获取微信sdk配置
  188. * @returns {*}
  189. */
  190. export function wechatAuthV2(code, spread) {
  191. return request.get(
  192. "v2/wechat/auth", {
  193. code,
  194. spread
  195. }, {
  196. noAuth: true
  197. }
  198. );
  199. }
  200. /**
  201. * 获取组件底部菜单
  202. * @param data object 获取组件底部菜单
  203. */
  204. export function getNavigation(data) {
  205. return request.get("navigation", data, {
  206. noAuth: true
  207. });
  208. }
  209. export function getSubscribe() {
  210. return request.get("subscribe", {}, {
  211. noAuth: true
  212. });
  213. }
  214. /**
  215. * 获取版本信息
  216. * @param 系统类型
  217. */
  218. export function getUpdateInfo(type) {
  219. return request.get("get_new_app/" + type, {}, {
  220. noAuth: true
  221. });
  222. }
  223. /**
  224. * 获取首页DIY数据版本号
  225. *
  226. */
  227. export function getVersion(name) {
  228. return request.get(`v2/diy/get_version/${name}`, {}, {
  229. noAuth: true
  230. });
  231. }
  232. /**
  233. * 获取商品分类版本号
  234. *
  235. */
  236. export function getCategoryVersion(name) {
  237. return request.get(`category_version`, {}, {
  238. noAuth: true
  239. });
  240. }
  241. /**
  242. * 配置信息
  243. *
  244. */
  245. export function basicConfig(name) {
  246. return request.get(`basic_config`, {}, {
  247. noAuth: true
  248. });
  249. }
  250. /**
  251. * 后台版本信息
  252. *
  253. */
  254. export function getSystemVersion() {
  255. return request.get(`version`, {}, {
  256. noAuth: true
  257. });
  258. }