переход на бд в настройках
This commit is contained in:
@@ -63,7 +63,7 @@ const auth_my = async () => {
|
|||||||
|
|
||||||
// Обработка глобального нажатия Enter
|
// Обработка глобального нажатия Enter
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter" && !isLoggedIn.value) {
|
||||||
auth_my();
|
auth_my();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -71,7 +71,6 @@ const handleKeyDown = (event) => {
|
|||||||
// Добавляем глобальный слушатель при монтировании
|
// Добавляем глобальный слушатель при монтировании
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener("keydown", handleKeyDown);
|
window.addEventListener("keydown", handleKeyDown);
|
||||||
// Показываем badge reCAPTCHA при монтировании
|
|
||||||
showRecaptchaBadge();
|
showRecaptchaBadge();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -146,13 +146,12 @@ import { ref, onMounted } from "vue";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
const sources = ref([
|
const sources = ref([
|
||||||
{ name: "source1", url: "eee", prompt: "" },
|
{ url: "", name: "", promt: "" },
|
||||||
{ name: "source2", url: "https://example2.com/api", prompt: "" },
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const currentSource = ref(sources.value[0]);
|
const currentSource = ref(sources.value[0]);
|
||||||
const time = ref("");
|
|
||||||
const promt = ref("Начальный текст");
|
const promt = ref("Начальный текст");
|
||||||
|
const promt_url = ref("https://");
|
||||||
const logs = ref([]);
|
const logs = ref([]);
|
||||||
const tasks = ref([]);
|
const tasks = ref([]);
|
||||||
const showLogs = ref(false); // скрыто по умолчанию
|
const showLogs = ref(false); // скрыто по умолчанию
|
||||||
@@ -165,7 +164,6 @@ function toggleLogs() {
|
|||||||
load_log();
|
load_log();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const load_log = async () => {
|
const load_log = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get("https://allowlgroup.ru/api/8001/logs");
|
const response = await axios.get("https://allowlgroup.ru/api/8001/logs");
|
||||||
@@ -218,7 +216,8 @@ const loadSettings = async () => {
|
|||||||
const response = await axios.get("https://allowlgroup.ru/api/8001/settings");
|
const response = await axios.get("https://allowlgroup.ru/api/8001/settings");
|
||||||
sources.value = response.data.sources;
|
sources.value = response.data.sources;
|
||||||
currentSource.value = sources.value[0];
|
currentSource.value = sources.value[0];
|
||||||
promt.value = currentSource.value.prompt;
|
promt.value = currentSource.value.promt;
|
||||||
|
promt_url.value = currentSource.value.url;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Ошибка при загрузке настроек:", error);
|
console.error("Ошибка при загрузке настроек:", error);
|
||||||
}
|
}
|
||||||
@@ -227,16 +226,17 @@ const loadSettings = async () => {
|
|||||||
// Выбор источника
|
// Выбор источника
|
||||||
const selectSource = (index) => {
|
const selectSource = (index) => {
|
||||||
currentSource.value = sources.value[index];
|
currentSource.value = sources.value[index];
|
||||||
promt.value = currentSource.value.prompt;
|
promt.value = currentSource.value.promt;
|
||||||
|
promt_url.value = currentSource.value.url;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Сохранение источников
|
// Сохранение источников
|
||||||
const saveSources = async () => {
|
const saveSources = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.post("https://allowlgroup.ru/api/8001/settings", {
|
await axios.post("https://allowlgroup.ru/api/8001/settings", {
|
||||||
|
url: currentSource.value.url,
|
||||||
name: currentSource.value.name,
|
name: currentSource.value.name,
|
||||||
url: "",
|
promt: promt.value,
|
||||||
prompt: promt.value,
|
|
||||||
});
|
});
|
||||||
// Здесь можно отправить на сервер, если нужно
|
// Здесь можно отправить на сервер, если нужно
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
// ✅ Добавляем emit для уведомления родителя об изменениях
|
// Добавляем emit для уведомления родителя об изменениях
|
||||||
const emit = defineEmits(["update:viewed", "update:status"]);
|
const emit = defineEmits(["update:viewed", "update:status"]);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -19,7 +19,7 @@ const props = defineProps({
|
|||||||
status: Boolean,
|
status: Boolean,
|
||||||
});
|
});
|
||||||
|
|
||||||
// ✅ Делаем viewed и status реактивными для локального обновления
|
// Делаем viewed и status реактивными для локального обновления
|
||||||
const localViewed = ref(props.viewed);
|
const localViewed = ref(props.viewed);
|
||||||
const localStatus = ref(props.status);
|
const localStatus = ref(props.status);
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ function handleClickOutside(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ Обновляем локально + отправляем emit
|
// Обновляем локально + отправляем emit
|
||||||
const viewed_b = async () => {
|
const viewed_b = async () => {
|
||||||
const newValue = !localViewed.value;
|
const newValue = !localViewed.value;
|
||||||
localViewed.value = newValue; // Локальное обновление сразу
|
localViewed.value = newValue; // Локальное обновление сразу
|
||||||
|
|||||||
Reference in New Issue
Block a user