api.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. export const apiServer = process.env.API_BASE_URL;
  2. // console.log("apiServer", apiServer);
  3. export const token = '';
  4. // export const token = '5c654da466ad325c6a1121e6d9e18f21';
  5. // 商家系统登录
  6. export const apiVerfSignIn = apiServer + 'VerfSignIn';
  7. // 商家系统退出
  8. export const apiVerfSignOut = apiServer + 'VerfSignOut';
  9. // 商家系统核销
  10. export const apiVerfExchange = apiServer + 'VerfExchange';
  11. // 商家系统已核销记录查询
  12. export const apiVerfExchangedListQuery = apiServer + 'VerfExchangedListQuery';
  13. // 商家系统获取微信JsConfig
  14. export const apiGetWxJsSdkConfig = apiServer + 'GetWxJsSdkConfig';
  15. // 检测request的返回值
  16. export function checkResCode(res) {
  17. if (res.data.code == 0) {
  18. return true;
  19. } else if (res.statusCode == 401) { // 未登录
  20. uni.showToast({
  21. title: `您尚未登录`,
  22. icon: 'none',
  23. duration: 3000
  24. });
  25. // window.location.href = `action://to_login/`;
  26. uni.navigateTo({
  27. url: '/pages/login/login'
  28. });
  29. return false;
  30. } else {
  31. uni.showToast({
  32. title: `${res.data.message}`,
  33. icon: 'none',
  34. duration: 3000
  35. });
  36. return false;
  37. }
  38. };