From 4aa6a469aa0bb434c0ca3a092c71bd497663f9e9 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 28 Mar 2026 18:16:40 +1000 Subject: [PATCH] + --- src/components/Stat.vue | 50 +++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/components/Stat.vue b/src/components/Stat.vue index e63822d..008ef36 100644 --- a/src/components/Stat.vue +++ b/src/components/Stat.vue @@ -25,8 +25,18 @@ const localStatus = ref(props.status); // Следим за изменениями props и обновляем локальные значения import { watch } from "vue"; -watch(() => props.viewed, (val) => { localViewed.value = val; }); -watch(() => props.status, (val) => { localStatus.value = val; }); +watch( + () => props.viewed, + (val) => { + localViewed.value = val; + }, +); +watch( + () => props.status, + (val) => { + localStatus.value = val; + }, +); // Тема const isDarkMode = ref(document.documentElement.classList.contains("dark")); @@ -61,12 +71,12 @@ const viewed_b = async () => { const newValue = !localViewed.value; localViewed.value = newValue; // Локальное обновление сразу emit("update:viewed", { url: props.url, viewed: newValue }); - + try { await axios.post( "https://allowlgroup.ru/api/8002/update_viewed_status", null, - { params: { url: props.url, viewed: newValue } } + { params: { url: props.url, viewed: newValue } }, ); } catch (err) { console.log(err); @@ -79,12 +89,12 @@ const status_b = async () => { const newValue = !localStatus.value; localStatus.value = newValue; // Локальное обновление сразу emit("update:status", { url: props.url, status: newValue }); - + try { await axios.post( "https://allowlgroup.ru/api/8002/update_status_status", null, - { params: { url: props.url, status: newValue } } + { params: { url: props.url, status: newValue } }, ); } catch (err) { console.log(err); @@ -94,13 +104,16 @@ const status_b = async () => { const download = async () => { try { - const rez = await axios.get("https://allowlgroup.ru/api/8001/file_download", { - params: { - path: props.article_date.split(" ")[0], - title: props.title, + const rez = await axios.get( + "https://allowlgroup.ru/api/8001/file_download", + { + params: { + path: props.article_date.split(" ")[0], + title: props.title, + }, + responseType: "blob", }, - responseType: "blob", - }); + ); const blobUrl = window.URL.createObjectURL( new Blob([rez.data], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", @@ -113,12 +126,21 @@ const download = async () => { if (disposition) { const match = disposition.match(/filename\*?=([^;\n]+)/i); if (match) { - let name = match[1].replace(/UTF-8''/, "").replace(/"/g, ""); + let name = match[1]; + // Убираем префикс utf-8'' (case insensitive) + const prefix = "utf-8''"; + if (name.toLowerCase().startsWith(prefix)) { + name = name.substring(prefix.length); + } + // Убираем кавычки и декодируем + name = decodeURIComponent(name.replace(/"/g, "")); if (!name.endsWith(".docx")) name += ".docx"; filename = name; } } - } catch (e) { /* ignore */ } + } catch (e) { + /* ignore */ + } link.href = blobUrl; link.setAttribute("download", filename); document.body.appendChild(link);