httparr.js 625 B

12345678910111213141516171819202122232425262728
  1. import store from '../store'
  2. let list = [
  3. "https://judg.oliug.cn",
  4. "https://ftcfg.oliug.cn",
  5. "https://dfrdc.oliug.cn",
  6. "https://djk.vwetdd.cn",
  7. "https://xk.vwetdd.cn",
  8. "https://xinkong.vwetdd.cn ",
  9. ];
  10. let httpIndex = uni.getStorageSync("httpIndex") || 0;
  11. export default function getIndexHttp () {
  12. console.log(httpIndex,'httpIndex')
  13. const http = list[httpIndex];
  14. uni.request({
  15. url:http +"/api/index",
  16. success() {
  17. console.log(http,'http')
  18. store.commit('setHttp',http);
  19. uni.setStorageSync("httpIndex",httpIndex);
  20. },
  21. fail() {
  22. console.log(res,'失败')
  23. httpIndex++;
  24. getIndexHttp();
  25. }
  26. })
  27. }