utils.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. function getQueryParams(name) {
  2. var url = window.location.href
  3. var parts = url.split('?')
  4. var query = parts[1]
  5. if (!query) return null
  6. var pairs = query.split('&')
  7. for (var i = 0; i < pairs.length; i++) {
  8. var pair = pairs[i].split('=')
  9. // 解码键和值
  10. var key = decodeURIComponent(pair[0])
  11. var value = decodeURIComponent(pair[1])
  12. if (key === name) {
  13. return value
  14. }
  15. }
  16. return null
  17. }
  18. function getOrgOptions(base, token) {
  19. $.ajax({
  20. url: base + '/client/c/mobileInfo/selection/selectionOrg',
  21. type: 'GET',
  22. headers: {
  23. 'token': token
  24. },
  25. success: function(response) {
  26. if (response.code === 200) {
  27. const dropdown = $('#orgSelect');
  28. response.data.forEach(item => {
  29. const option = $('<option></option>').val(item.orgId).text(item.orgName);
  30. dropdown.append(option);
  31. });
  32. } else {
  33. console.error('Error:', response);
  34. }
  35. },
  36. error: function(error) {
  37. console.error('Request failed:', error);
  38. }
  39. });
  40. }
  41. function getPlayUrl(base, token, orgId, cb) {
  42. $.ajax({
  43. url: base + '/client/c/mobileInfo/selection/selectionOrg',
  44. type: 'GET',
  45. headers: {
  46. 'token': token
  47. },
  48. success: function(response) {
  49. if (response.code === 200) {
  50. var data = response.data
  51. cb(data)
  52. } else {
  53. console.error('Error:', response);
  54. }
  55. },
  56. error: function(error) {
  57. console.error('Request failed:', error);
  58. }
  59. });
  60. }
  61. function createPlayer(id) {
  62. var myPalyer = new window.JSPlugin({
  63. szId: id,
  64. szBasePath: "./",
  65. iMaxSplit: 1,
  66. iCurrentSplit: 1,
  67. openDebug: true,
  68. oStyle: {
  69. borderSelect: '#000',
  70. }
  71. })
  72. myPlayer.myId = id
  73. return myPlayer
  74. }