public.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2024 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. {
  20. url: wechat.signLink(),
  21. },
  22. {
  23. noAuth: true,
  24. },
  25. );
  26. }
  27. /**
  28. * 获取微信sdk配置
  29. * @returns {*}
  30. */
  31. export function wechatAuth(code, spread, login_type) {
  32. return request.get(
  33. "wechat/auth",
  34. {
  35. code,
  36. spread,
  37. login_type,
  38. },
  39. {
  40. noAuth: true,
  41. },
  42. );
  43. }
  44. /**
  45. * 获取登录授权login
  46. *
  47. */
  48. export function getLogo() {
  49. return request.get(
  50. "wechat/get_logo",
  51. {},
  52. {
  53. noAuth: true,
  54. },
  55. );
  56. }
  57. /**
  58. * 小程序用户登录
  59. * @param data object 小程序用户登录信息
  60. */
  61. export function login(data) {
  62. return request.post("wechat/mp_auth", data, {
  63. noAuth: true,
  64. });
  65. }
  66. /**
  67. * 静默授权
  68. * @param {Object} data
  69. */
  70. export function silenceAuth(data) {
  71. //#ifdef MP
  72. return request.get("v2/wechat/silence_auth", data, {
  73. noAuth: true,
  74. });
  75. //#endif
  76. //#ifdef H5
  77. return request.get("v2/wechat/auth_type", data, {
  78. noAuth: true,
  79. });
  80. //#endif
  81. }
  82. /**
  83. * 分享
  84. * @returns {*}
  85. */
  86. export function getShare() {
  87. return request.get(
  88. "share",
  89. {},
  90. {
  91. noAuth: true,
  92. },
  93. );
  94. }
  95. /**
  96. * 公众号登录
  97. * @returns {*}
  98. */
  99. export function wechatAuthLogin(data) {
  100. return request.get("v2/wechat/auth_login", data, {
  101. noAuth: true,
  102. });
  103. }
  104. /**
  105. * 获取关注海报
  106. * @returns {*}
  107. */
  108. export function follow() {
  109. return request.get(
  110. "wechat/follow",
  111. {},
  112. {
  113. noAuth: true,
  114. },
  115. );
  116. }
  117. /**
  118. * code生成用户
  119. * @returns {*}
  120. */
  121. export function authType(data) {
  122. return request.get("v2/routine/auth_type", data, {
  123. noAuth: true,
  124. });
  125. }
  126. /**
  127. * 授权登录
  128. * @returns {*}
  129. */
  130. export function authLogin(data) {
  131. return request.get("v2/routine/auth_login", data, {
  132. noAuth: true,
  133. });
  134. }
  135. /**
  136. * 获取图片base64
  137. * @retins {*}
  138. * */
  139. export function imageBase64(image, code) {
  140. return request.post(
  141. "image_base64",
  142. {
  143. image: image,
  144. code: code,
  145. },
  146. {
  147. noAuth: true,
  148. },
  149. );
  150. }
  151. /**
  152. * 自动复制口令功能
  153. * @returns {*}
  154. */
  155. export function copyWords() {
  156. return request.get(
  157. "copy_words",
  158. {},
  159. {
  160. noAuth: true,
  161. },
  162. );
  163. }
  164. /**
  165. * 获取商城是否强制绑定手机号
  166. */
  167. export function getShopConfig() {
  168. return request.get(
  169. "v2/bind_status",
  170. {},
  171. {
  172. noAuth: true,
  173. },
  174. );
  175. }
  176. /**
  177. * 小程序绑定手机号
  178. * @param {Object} data
  179. */
  180. export function routineBindingPhone(data) {
  181. return request.post("v2/routine/auth_binding_phone", data, {
  182. noAuth: true,
  183. });
  184. }
  185. /**
  186. * 小程序绑定手机号
  187. * @param {Object} data
  188. */
  189. export function wechatBindingPhone(data) {
  190. return request.post("v2/wechat/auth_binding_phone", data, {
  191. noAuth: true,
  192. });
  193. }
  194. /**
  195. * 小程序手机号登录
  196. * @param {Object} data
  197. */
  198. export function phoneLogin(data) {
  199. return request.post("v2/routine/phone_login", data, {
  200. noAuth: true,
  201. });
  202. }
  203. /**
  204. * 小程序用户登录
  205. * @param data object 小程序用户登录信息
  206. */
  207. export function routineLogin(data) {
  208. return request.get("v2/wechat/routine_auth", data, {
  209. noAuth: true,
  210. });
  211. }
  212. /**
  213. * 获取微信sdk配置
  214. * @returns {*}
  215. */
  216. export function wechatAuthV2(code, spread) {
  217. return request.get(
  218. "v2/wechat/auth",
  219. {
  220. code,
  221. spread,
  222. },
  223. {
  224. noAuth: true,
  225. },
  226. );
  227. }
  228. /**
  229. * 获取组件底部菜单
  230. * @param data object 获取组件底部菜单
  231. */
  232. export function getNavigation(data) {
  233. return request.get("theme/navigation", data, {
  234. noAuth: true,
  235. });
  236. }
  237. export function getSubscribe() {
  238. return request.get(
  239. "subscribe",
  240. {},
  241. {
  242. noAuth: true,
  243. },
  244. );
  245. }
  246. /**
  247. * 获取版本信息
  248. * @param 系统类型
  249. */
  250. export function getUpdateInfo(type) {
  251. return request.get(
  252. "get_new_app/" + type,
  253. {},
  254. {
  255. noAuth: true,
  256. },
  257. );
  258. }
  259. /**
  260. * 获取首页DIY数据版本号
  261. *
  262. */
  263. export function getVersion(name) {
  264. return request.get(
  265. `v2/diy/get_version/${name}`,
  266. {},
  267. {
  268. noAuth: true,
  269. },
  270. );
  271. }
  272. /**
  273. * 获取商品分类版本号
  274. *
  275. */
  276. export function getCategoryVersion(name) {
  277. return request.get(
  278. `category_version`,
  279. {},
  280. {
  281. noAuth: true,
  282. },
  283. );
  284. }
  285. /**
  286. * 配置信息
  287. *
  288. */
  289. export function basicConfig(name) {
  290. return request.get(
  291. `basic_config`,
  292. {},
  293. {
  294. noAuth: true,
  295. },
  296. );
  297. }
  298. /**
  299. * 后台版本信息
  300. *
  301. */
  302. export function getSystemVersion() {
  303. return request.get(
  304. `version`,
  305. {},
  306. {
  307. noAuth: true,
  308. },
  309. );
  310. }
  311. /**
  312. * iframe登录
  313. *
  314. */
  315. export function remoteRegister(data) {
  316. return request.get(`remote_register`, data, {
  317. noAuth: true,
  318. });
  319. }