my.js 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // 获取地址栏 参数
  2. const urlParameter = (data) => {
  3. if (data) {
  4. const query = data.substring(data.indexOf("?") + 1);
  5. const arr = query.split("&");
  6. const params = {};
  7. arr.forEach((v) => {
  8. const key = v.substring(0, v.indexOf("="));
  9. const val = v.substring(v.indexOf("=") + 1);
  10. params[key] = val;
  11. });
  12. return params;
  13. } else return {};
  14. };
  15. const searchUrl = window.location.search;
  16. const {
  17. m: param
  18. } = urlParameter(searchUrl);
  19. if (!param) alert("参数错误!");
  20. const m_obj = {
  21. 1: {
  22. counts: 375,
  23. houzui: "jpg",
  24. },
  25. };
  26. const m_info = m_obj[param];
  27. if (!m_info) alert("参数错误!");
  28. let imgURL =''
  29. // oss路径问题
  30. if(window.location.href.includes('http://127.0.0.1:')) {
  31. // 本地环境
  32. imgURL = `/image/${param}`
  33. }else {
  34. // oss环境
  35. imgURL = `/project/videoDemo/image/${param}`;
  36. }
  37. // 图片数量
  38. let imgCounts = m_info.counts;
  39. // 图片后最
  40. let imgLastStr = m_info.houzui;