Нет описания

palyAudio.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>黑名单管理</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <script src="../../Script/Common/huayi.load.js"></script>
  8. <script src="../../Script/Common/huayi.config.js"></script>
  9. <script src="../../Script/Common/huayi.http.js"></script>
  10. <style>
  11. * {
  12. margin: 0;
  13. padding: 0;
  14. box-sizing: border-box;
  15. font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  16. }
  17. body {
  18. justify-content: center;
  19. align-items: center;
  20. min-height: 100vh;
  21. padding: 20px;
  22. }
  23. .modal-header {
  24. text-align: center;
  25. margin-bottom: 25px;
  26. position: relative;
  27. }
  28. .modal-header h2 {
  29. font-size: 28px;
  30. font-weight: 600;
  31. background: linear-gradient(90deg, #00c9ff, #92fe9d);
  32. -webkit-background-clip: text;
  33. -webkit-text-fill-color: transparent;
  34. letter-spacing: 0.5px;
  35. text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  36. }
  37. .audio-container {
  38. background: rgba(255, 255, 255, 0.08);
  39. border-radius: 12px;
  40. padding: 20px;
  41. margin-bottom: 25px;
  42. }
  43. .audio-info {
  44. display: flex;
  45. align-items: center;
  46. margin-bottom: 20px;
  47. padding-bottom: 15px;
  48. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  49. }
  50. .audio-icon {
  51. width: 60px;
  52. height: 60px;
  53. background: linear-gradient(135deg, #3498db, #8e44ad);
  54. border-radius: 50%;
  55. display: flex;
  56. align-items: center;
  57. justify-content: center;
  58. margin-right: 15px;
  59. animation: pulse 2s infinite;
  60. }
  61. .audio-icon i {
  62. font-size: 28px;
  63. color: white;
  64. }
  65. .audio-details {
  66. flex: 1;
  67. }
  68. .audio-title {
  69. font-size: 18px;
  70. font-weight: 500;
  71. margin-bottom: 5px;
  72. white-space: nowrap;
  73. overflow: hidden;
  74. text-overflow: ellipsis;
  75. }
  76. .audio-artist {
  77. font-size: 14px;
  78. color: #aaa;
  79. }
  80. .progress-container {
  81. margin-bottom: 20px;
  82. }
  83. .progressBar {
  84. height: 6px;
  85. background: rgba(0, 0, 0, 0.1);
  86. border-radius: 3px;
  87. overflow: hidden;
  88. margin-bottom: 5px;
  89. cursor: pointer;
  90. width: 100%;
  91. display: inline-block;
  92. }
  93. .progress {
  94. height: 100%;
  95. background: linear-gradient(90deg, #00c9ff, #92fe9d);
  96. border-radius: 3px;
  97. width: 0%;
  98. transition: width 0.1s;
  99. }
  100. .time-info {
  101. display: flex;
  102. justify-content: space-between;
  103. font-size: 12px;
  104. color: #aaa;
  105. }
  106. .controls {
  107. display: flex;
  108. justify-content: space-between;
  109. align-items: center;
  110. margin-top: 20px;
  111. width: 300px;
  112. margin: 0 auto;
  113. }
  114. .play-btn {
  115. width: 60px;
  116. height: 60px;
  117. border-radius: 50%;
  118. background: linear-gradient(135deg, #3498db, #8e44ad);
  119. display: flex;
  120. align-items: center;
  121. justify-content: center;
  122. cursor: pointer;
  123. box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  124. transition: all 0.3s;
  125. }
  126. .play-btn:hover {
  127. transform: scale(1.05);
  128. box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
  129. }
  130. .play-btn i {
  131. font-size: 28px;
  132. color: white;
  133. }
  134. .volume-container {
  135. display: flex;
  136. align-items: center;
  137. width: 120px;
  138. }
  139. .volume-container i {
  140. margin-right: 10px;
  141. color: #aaa;
  142. }
  143. .volume-slider {
  144. flex: 1;
  145. height: 5px;
  146. background: rgba(255, 255, 255, 0.1);
  147. border-radius: 3px;
  148. position: relative;
  149. cursor: pointer;
  150. }
  151. .volume-level {
  152. height: 100%;
  153. background: linear-gradient(90deg, #3498db, #8e44ad);
  154. border-radius: 3px;
  155. width: 80%;
  156. }
  157. .download-section {
  158. display: flex;
  159. justify-content: space-between;
  160. align-items: center;
  161. background: rgba(255, 255, 255, 0.08);
  162. padding: 15px;
  163. border-radius: 12px;
  164. margin-top: 10px;
  165. }
  166. .toggle-container {
  167. display: flex;
  168. align-items: center;
  169. }
  170. .toggle-label {
  171. margin-right: 10px;
  172. font-size: 14px;
  173. color: #aaa;
  174. }
  175. .toggle-switch {
  176. position: relative;
  177. width: 50px;
  178. height: 24px;
  179. }
  180. .toggle-switch input {
  181. opacity: 0;
  182. width: 0;
  183. height: 0;
  184. }
  185. .slider {
  186. position: absolute;
  187. cursor: pointer;
  188. top: 0;
  189. left: 0;
  190. right: 0;
  191. bottom: 0;
  192. background: rgba(255, 255, 255, 0.1);
  193. transition: .4s;
  194. border-radius: 34px;
  195. }
  196. .slider:before {
  197. position: absolute;
  198. content: "";
  199. height: 18px;
  200. width: 18px;
  201. left: 3px;
  202. bottom: 3px;
  203. background-color: #3498db;
  204. transition: .4s;
  205. border-radius: 50%;
  206. }
  207. input:checked+.slider {
  208. background: rgba(52, 152, 219, 0.3);
  209. }
  210. input:checked+.slider:before {
  211. transform: translateX(26px);
  212. background: #92fe9d;
  213. }
  214. .download-btn {
  215. padding: 10px 25px;
  216. background: linear-gradient(90deg, #00c9ff, #92fe9d);
  217. color: #1a1a2e;
  218. border: none;
  219. border-radius: 30px;
  220. font-weight: 600;
  221. cursor: pointer;
  222. display: flex;
  223. align-items: center;
  224. transition: all 0.3s;
  225. opacity: 1;
  226. transform: scale(1);
  227. }
  228. .download-btn.hidden {
  229. opacity: 0;
  230. transform: scale(0.8);
  231. pointer-events: none;
  232. }
  233. .download-btn i {
  234. margin-right: 8px;
  235. font-size: 16px;
  236. }
  237. .download-btn:hover {
  238. box-shadow: 0 0 15px rgba(146, 254, 157, 0.5);
  239. transform: translateY(-2px);
  240. }
  241. .url-input {
  242. margin-top: 20px;
  243. text-align: center;
  244. }
  245. .url-input input {
  246. width: 100%;
  247. padding: 12px 15px;
  248. background: rgba(255, 255, 255, 0.08);
  249. border: 1px solid rgba(255, 255, 255, 0.1);
  250. border-radius: 8px;
  251. color: #000000;
  252. font-size: 14px;
  253. }
  254. .url-input input::placeholder {
  255. /*color: rgba(255, 255, 255, 0.4);*/
  256. }
  257. @keyframes pulse {
  258. 0% {
  259. box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
  260. }
  261. 70% {
  262. box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
  263. }
  264. 100% {
  265. box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
  266. }
  267. }
  268. .wave {
  269. position: absolute;
  270. bottom: 0;
  271. left: 0;
  272. width: 100%;
  273. height: 100px;
  274. background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1200 120" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" fill="rgba(255,255,255,0.03)" /><path d="M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z" fill="rgba(255,255,255,0.05)" /></svg>');
  275. background-size: cover;
  276. opacity: 0.5;
  277. }
  278. </style>
  279. </head>
  280. <body>
  281. <div>
  282. <div class="audio-container">
  283. <div class="progress-container">
  284. <div class="progressBar">
  285. <div class="progress" id="progress"></div>
  286. </div>
  287. <div class="time-info">
  288. <span id="current-time">0:00</span>
  289. <span id="duration">0:00</span>
  290. </div>
  291. </div>
  292. <div class="controls">
  293. <div class="play-btn" id="play-btn">
  294. <i id="play-icon">▶</i>
  295. </div>
  296. <div class="volume-container">
  297. <i>🔊</i>
  298. <div class="volume-slider">
  299. <div class="volume-level" id="volume-level"></div>
  300. </div>
  301. </div>
  302. <button class="download-btn" style="display: none;">
  303. <i>↓</i> 下载音频
  304. </button>
  305. </div>
  306. <div class="url-input" style="display: none;">
  307. <div id="audio-url" placeholder="输入音频URL地址" value="">
  308. </div>
  309. </div>
  310. <a id="downloadLink" style="display: none;"></a>
  311. </div>
  312. <script>
  313. var audioUrl = helper.request.queryString("audioUrl");
  314. var roleCode = localStorage.getItem('roleCode')
  315. // JCRY 稽查角色 JCLD 稽查领导
  316. $(".download-btn").click(function(){
  317. downloadFile(audioUrl)
  318. })
  319. $(document).ready(function() {
  320. console.log('roleCode',roleCode)
  321. if (roleCode !== 'JCRY' ) {
  322. $(".download-btn").show()
  323. $(".url-input").show()
  324. }
  325. $("#audio-url").text(audioUrl)
  326. // 创建音频元素
  327. const audio = new Audio();
  328. let isPlaying = false;
  329. // DOM元素
  330. const playBtn = $("#play-btn");
  331. const playIcon = $("#play-icon");
  332. const progressBar = $("#progress");
  333. const currentTimeEl = $("#current-time");
  334. const durationEl = $("#duration");
  335. const volumeSlider = $(".volume-slider");
  336. const volumeLevel = $("#volume-level");
  337. const toggleDownload = $("#toggle-download");
  338. // 设置初始音量
  339. audio.volume = 0.8;
  340. // 播放/暂停功能
  341. playBtn.click(function() {
  342. if(audio.src) {
  343. if(isPlaying) {
  344. audio.pause();
  345. playIcon.text("▶");
  346. } else {
  347. audio.play();
  348. playIcon.text("❚❚");
  349. }
  350. isPlaying = !isPlaying;
  351. } else {
  352. loadAudio();
  353. }
  354. });
  355. // 加载音频
  356. function loadAudio() {
  357. const url = audioUrl;
  358. if(url) {
  359. audio.src = url;
  360. audio.load();
  361. // 当音频加载后更新信息
  362. audio.addEventListener('loadedmetadata', function() {
  363. durationEl.text(formatTime(audio.duration));
  364. });
  365. audio.play();
  366. playIcon.text("❚❚");
  367. isPlaying = true;
  368. } else {
  369. alert("请输入有效的音频URL");
  370. }
  371. }
  372. // 更新进度条
  373. audio.addEventListener('timeupdate', function() {
  374. const currentTime = audio.currentTime;
  375. const duration = audio.duration;
  376. if(duration) {
  377. const progressPercent = (currentTime / duration) * 100;
  378. progressBar.css('width', progressPercent + '%');
  379. currentTimeEl.text(formatTime(currentTime));
  380. }
  381. });
  382. // 点击进度条跳转
  383. $(".progressBar").click(function(e) {
  384. const width = $(this).width();
  385. const clickX = e.offsetX;
  386. const duration = audio.duration;
  387. audio.currentTime = (clickX / width) * duration;
  388. });
  389. // 音量控制
  390. volumeSlider.click(function(e) {
  391. const width = $(this).width();
  392. const clickX = e.offsetX;
  393. const volume = clickX / width;
  394. audio.volume = volume;
  395. volumeLevel.css('width', volume * 100 + '%');
  396. });
  397. // 格式化时间 (秒 -> MM:SS)
  398. function formatTime(seconds) {
  399. const min = Math.floor(seconds / 60);
  400. const sec = Math.floor(seconds % 60);
  401. return `${min}:${sec < 10 ? '0' : ''}${sec}`;
  402. }
  403. // 初始加载音频
  404. // loadAudio();
  405. });
  406. function downloadFile(url, filename) {
  407. fetch(url).then(response => response.blob()) .then(blob => {
  408. const url = window.URL.createObjectURL(blob);
  409. const a = document.createElement('a');
  410. a.style.display = 'none';
  411. a.href = url;
  412. // 如果没有提供文件名,尝试从URL中提取
  413. const inferredFilename = url.substring(url.lastIndexOf('/') + 1);
  414. a.download = filename || inferredFilename;
  415. document.body.appendChild(a);
  416. a.click();
  417. document.body.removeChild(a);
  418. window.URL.revokeObjectURL(url);
  419. })
  420. .catch(() => alert('下载失败'));
  421. }
  422. </script>
  423. </body>
  424. </html>