From 949ebf420a2d18a38e54fae443b4666d174fa66f Mon Sep 17 00:00:00 2001 From: Dustella Date: Thu, 23 Jan 2025 22:23:24 +0800 Subject: [PATCH] small refac --- src/pages/saber/day_cycle_power_wave_plot.vue | 7 ++++--- src/pages/saber/day_fft_ifft_plot.vue | 10 +++++++--- src/pages/saber/month_power_wave_plot.vue | 4 ++-- src/pages/saber/plot_wave_fitting.vue | 7 ++++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/pages/saber/day_cycle_power_wave_plot.vue b/src/pages/saber/day_cycle_power_wave_plot.vue index cb981b7..8e5d4c1 100644 --- a/src/pages/saber/day_cycle_power_wave_plot.vue +++ b/src/pages/saber/day_cycle_power_wave_plot.vue @@ -20,9 +20,10 @@ const selected = reactive({ }) const urll = computed(() => { - const path = encodeURIComponent(selected.path) - const day = encodeURIComponent(selected.day) - const query = `path=${path}&day=${day}&cycle_no=${selected.cycle_no}` + const query = new URLSearchParams() + query.set('path', selected.path) + query.set('day', selected.day) + query.set('cycle_no', selected.cycle_no.toString()) return `${API_BASE_URL}/saber/render/day_cycle_power_wave_plot?${query}` }) diff --git a/src/pages/saber/day_fft_ifft_plot.vue b/src/pages/saber/day_fft_ifft_plot.vue index 11b7463..336e4c9 100644 --- a/src/pages/saber/day_fft_ifft_plot.vue +++ b/src/pages/saber/day_fft_ifft_plot.vue @@ -20,9 +20,13 @@ const selected = reactive({ }) const urll = computed(() => { - const path = encodeURIComponent(selected.path) - const day = encodeURIComponent(selected.day) - const query = `path=${path}&day=${day}&cycle_no=${selected.cycle_no}` + // const path = encodeURIComponent(selected.path) + // const day = encodeURIComponent(selected.day) + // const query = `path=${path}&day=${day}&cycle_no=${selected.cycle_no}` + const query = new URLSearchParams() + query.set('path', selected.path) + query.set('day', selected.day) + query.set('cycle_no', selected.cycle_no.toString()) return `${API_BASE_URL}/saber/render/day_fft_ifft_plot?${query}` }) diff --git a/src/pages/saber/month_power_wave_plot.vue b/src/pages/saber/month_power_wave_plot.vue index 323854f..0165a61 100644 --- a/src/pages/saber/month_power_wave_plot.vue +++ b/src/pages/saber/month_power_wave_plot.vue @@ -18,8 +18,8 @@ const selected = reactive({ }) const urll = computed(() => { - const path = encodeURIComponent(selected.path) - const query = `path=${path}` + const query = new URLSearchParams() + query.set('path', selected.path) return `${API_BASE_URL}/saber/render/month_power_wave_plot?${query}` }) diff --git a/src/pages/saber/plot_wave_fitting.vue b/src/pages/saber/plot_wave_fitting.vue index 3fbdffc..a3fb60e 100644 --- a/src/pages/saber/plot_wave_fitting.vue +++ b/src/pages/saber/plot_wave_fitting.vue @@ -20,9 +20,10 @@ const selected = reactive({ }) const urll = computed(() => { - const path = encodeURIComponent(selected.path) - const day = encodeURIComponent(selected.day) - const query = `path=${path}&day=${day}&height=${selected.height_no}` + const query = new URLSearchParams() + query.set('path', selected.path) + query.set('day', selected.day) + query.set('height_no', selected.height_no.toString()) return `${API_BASE_URL}/saber/render/plot_wave_fitting?${query}` })