diff --git a/static/js/index.js b/static/js/index.js index 31248d1..25b00f9 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -238,7 +238,7 @@ function uploadFile(index, file) { var formData = new FormData(); formData.append('file', file); $.ajax({ - url: 'http://127.0.0.1:8000/upload', + url: `http://${window.location.hostname}:${window.location.port}/upload`, type: 'POST', data: formData, processData: false, // 不处理发送的数据 @@ -284,7 +284,7 @@ function uploadFile(index, file) { */ function playFile(index, file, id) { $('#video-modal').find('.modal-title').text(`预览${file ? file.name : '此视频'}的关键镜头`); - $('#video-modal').find('video').attr('src', `http://127.0.0.1:8000/fetch/${id}`); + $('#video-modal').find('video').attr('src', `http://${window.location.hostname}:${window.location.port}/fetch/${id}`); var player = new Plyr('video'); $('#video-modal').on('hidden.bs.modal', function(event) { player.pause(); @@ -303,7 +303,7 @@ function extractFile(index, file, id) { var formData = new FormData(); formData.append('id', id); $.ajax({ - url: 'http://127.0.0.1:8000/extract', + url: `http://${window.location.hostname}:${window.location.port}/extract`, type: 'POST', data: formData, processData: false, // 不处理发送的数据 @@ -331,7 +331,7 @@ function analyseFile(index, file, id) { var formData = new FormData(); formData.append('id', id); $.ajax({ - url: 'http://127.0.0.1:8000/analyse', + url: `http://${window.location.hostname}:${window.location.port}/analyse`, type: 'POST', data: formData, processData: false, // 不处理发送的数据 @@ -359,7 +359,7 @@ function generateFile(index, file, id) { var formData = new FormData(); formData.append('id', id); $.ajax({ - url: 'http://127.0.0.1:8000/generate', + url: `http://${window.location.hostname}:${window.location.port}/generate`, type: 'POST', data: formData, processData: false, // 不处理发送的数据