api.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 apiVerfExchange = apiServer + 'VerfExchange';
  9. // 商家系统已核销记录查询
  10. export const apiVerfExchangedListQuery = apiServer + 'VerfExchangedListQuery';
  11. // 商家系统获取微信JsConfig
  12. export const apiGetWxJsSdkConfig = apiServer + 'GetWxJsSdkConfig';
  13. // 检测request的返回值
  14. export function checkResCode(res) {
  15. if (res.data.code == 0) {
  16. return true;
  17. } else if (res.statusCode == 401) { // 未登录
  18. uni.showToast({
  19. title: `您尚未登录`,
  20. icon: 'none',
  21. duration: 3000
  22. });
  23. // window.location.href = `action://to_login/`;
  24. uni.navigateTo({
  25. url: '/pages/login/login'
  26. });
  27. return false;
  28. } else {
  29. uni.showToast({
  30. title: `${res.data.message}`,
  31. icon: 'none',
  32. duration: 3000
  33. });
  34. return false;
  35. }
  36. };