Merge pull request #2 from IliaMiheev/miheev-dev
Merge
This commit was merged in pull request #2.
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Hello World!</title>
|
<title>Probody</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/izitoast@1/dist/css/iziToast.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/izitoast@1/dist/css/iziToast.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Generated
+61
@@ -9,6 +9,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@vueuse/core": "^14.2.1",
|
||||||
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"electron-squirrel-startup": "^1.0.1",
|
"electron-squirrel-startup": "^1.0.1",
|
||||||
"izitoast": "^1.4.0",
|
"izitoast": "^1.4.0",
|
||||||
"vue": "^3.5.28"
|
"vue": "^3.5.28"
|
||||||
@@ -2510,6 +2512,12 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/web-bluetooth": {
|
||||||
|
"version": "0.0.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz",
|
||||||
|
"integrity": "sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/wrap-ansi": {
|
"node_modules/@types/wrap-ansi": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz",
|
||||||
@@ -2652,6 +2660,44 @@
|
|||||||
"integrity": "sha512-cfWa1fCGBxrvaHRhvV3Is0MgmrbSCxYTXCSCau2I0a1Xw1N1pHAvkWCiXPRAqjvToILvguNyEwjevUqAuBQWvQ==",
|
"integrity": "sha512-cfWa1fCGBxrvaHRhvV3Is0MgmrbSCxYTXCSCau2I0a1Xw1N1pHAvkWCiXPRAqjvToILvguNyEwjevUqAuBQWvQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@vueuse/core": {
|
||||||
|
"version": "14.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-14.2.1.tgz",
|
||||||
|
"integrity": "sha512-3vwDzV+GDUNpdegRY6kzpLm4Igptq+GA0QkJ3W61Iv27YWwW/ufSlOfgQIpN6FZRMG0mkaz4gglJRtq5SeJyIQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/web-bluetooth": "^0.0.21",
|
||||||
|
"@vueuse/metadata": "14.2.1",
|
||||||
|
"@vueuse/shared": "14.2.1"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/antfu"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"vue": "^3.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@vueuse/metadata": {
|
||||||
|
"version": "14.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-14.2.1.tgz",
|
||||||
|
"integrity": "sha512-1ButlVtj5Sb/HDtIy1HFr1VqCP4G6Ypqt5MAo0lCgjokrk2mvQKsK2uuy0vqu/Ks+sHfuHo0B9Y9jn9xKdjZsw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/antfu"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@vueuse/shared": {
|
||||||
|
"version": "14.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-14.2.1.tgz",
|
||||||
|
"integrity": "sha512-shTJncjV9JTI4oVNyF1FQonetYAiTBd+Qj7cY89SWbXSkx7gyhrgtEdF2ZAVWS1S3SHlaROO6F2IesJxQEkZBw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/antfu"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"vue": "^3.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@webassemblyjs/ast": {
|
"node_modules/@webassemblyjs/ast": {
|
||||||
"version": "1.14.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz",
|
||||||
@@ -3591,6 +3637,15 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/copy-to-clipboard": {
|
||||||
|
"version": "3.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz",
|
||||||
|
"integrity": "sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"toggle-selection": "^1.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cross-dirname": {
|
"node_modules/cross-dirname": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/cross-dirname/-/cross-dirname-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/cross-dirname/-/cross-dirname-0.1.0.tgz",
|
||||||
@@ -7778,6 +7833,12 @@
|
|||||||
"node": ">=8.0"
|
"node": ">=8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/toggle-selection": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/tr46": {
|
"node_modules/tr46": {
|
||||||
"version": "0.0.3",
|
"version": "0.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
"vite": "^5.4.21"
|
"vite": "^5.4.21"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@vueuse/core": "^14.2.1",
|
||||||
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"electron-squirrel-startup": "^1.0.1",
|
"electron-squirrel-startup": "^1.0.1",
|
||||||
"izitoast": "^1.4.0",
|
"izitoast": "^1.4.0",
|
||||||
"vue": "^3.5.28"
|
"vue": "^3.5.28"
|
||||||
|
|||||||
@@ -44,10 +44,6 @@ class ColorDetect():
|
|||||||
else:
|
else:
|
||||||
self.color = None
|
self.color = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#в MAIN для вызова функции должно быть:
|
#в MAIN для вызова функции должно быть:
|
||||||
# cd = ColorDetect()
|
# cd = ColorDetect()
|
||||||
#color_sub = rospy.Subscriber('main_camera/image_raw', Image,
|
#color_sub = rospy.Subscriber('main_camera/image_raw', Image,
|
||||||
@@ -56,4 +52,3 @@ class ColorDetect():
|
|||||||
# print(cd.getColor())
|
# print(cd.getColor())
|
||||||
#rospy.sleep(2)
|
#rospy.sleep(2)
|
||||||
#color_sub.unregister()
|
#color_sub.unregister()
|
||||||
|
|
||||||
@@ -18,8 +18,6 @@ navigate = rospy.ServiceProxy('navigate', srv.Navigate) #сервис для п
|
|||||||
land = rospy.ServiceProxy('land', Trigger) #сервис для посадки
|
land = rospy.ServiceProxy('land', Trigger) #сервис для посадки
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def navigate_wait(x=0, y=0, z=1, speed=0.5, frame_id='aruco_map', auto_arm=False, tolerance=0.2,sleep=2):
|
def navigate_wait(x=0, y=0, z=1, speed=0.5, frame_id='aruco_map', auto_arm=False, tolerance=0.2,sleep=2):
|
||||||
"""
|
"""
|
||||||
Летит в указанную точку и ждет, пока дрон туда ДОЛЕТИТ.
|
Летит в указанную точку и ждет, пока дрон туда ДОЛЕТИТ.
|
||||||
@@ -36,9 +34,6 @@ def navigate_wait(x=0, y=0, z=1, speed=0.5, frame_id='aruco_map', auto_arm=False
|
|||||||
rospy.sleep(sleep)
|
rospy.sleep(sleep)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def emergency_stop():
|
def emergency_stop():
|
||||||
|
|
||||||
"""Функция экстренной остановки, срабатывает при нажатии Ctrl + C"""
|
"""Функция экстренной остановки, срабатывает при нажатии Ctrl + C"""
|
||||||
@@ -78,8 +73,6 @@ def emergency_stop():
|
|||||||
print(f"Warning: {e}")
|
print(f"Warning: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(sig, frame):
|
def signal_handler(sig, frame):
|
||||||
|
|
||||||
"""Перехват Ctrl+C: вместо аварийного завершения программы
|
"""Перехват Ctrl+C: вместо аварийного завершения программы
|
||||||
@@ -98,9 +91,7 @@ def main():
|
|||||||
#в дальнейшем не передавать переменной auto_arm значение True
|
#в дальнейшем не передавать переменной auto_arm значение True
|
||||||
|
|
||||||
|
|
||||||
# тут будут navigate_wait и подписчики
|
<<navigate_wait>>
|
||||||
# navigate_wait(x=3,z=1,sleep=1)
|
|
||||||
# navigate_wait(y=5,x=2,z=1,sleep = 4)
|
|
||||||
|
|
||||||
|
|
||||||
land() #посадка
|
land() #посадка
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
class QrDetect():
|
||||||
|
def __init__(self):
|
||||||
|
self.qr_data = ''
|
||||||
|
|
||||||
|
def getQrData(self):
|
||||||
|
return self.qr_data
|
||||||
|
|
||||||
|
def qr_detection(self,data):
|
||||||
|
'''сканирование qr кода'''
|
||||||
|
if self.qr_data!= '':
|
||||||
|
return
|
||||||
|
cv_image = bridge.imgmsg_to_cv2(data, 'bgr8')
|
||||||
|
barcodes = pyzbar.decode(cv_image)
|
||||||
|
|
||||||
|
if barcodes:
|
||||||
|
self.qr_data = barcodes[0].data.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
#в MAIN для вызова функции необходимо следующее:
|
||||||
|
#1. создаём и вызываем подписчика, который вызывает функцию чтения кьюаркода
|
||||||
|
qd = QrDetect()
|
||||||
|
qr_sub = rospy.Subscriber('main_camera/image_raw',Image, qd.qr_detection,queue_size=1)
|
||||||
|
#2. задаём время работы подписчика (за 1 секунду примерно 20 раз вызывается функция)
|
||||||
|
rospy.sleep(2)
|
||||||
|
#3. выключаем подписчика
|
||||||
|
qr_sub.unregister()
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
qr_data=''
|
|
||||||
|
|
||||||
def qr_detection(data):
|
|
||||||
'''сканирование qr кода'''
|
|
||||||
global qr_data
|
|
||||||
if qr_data!= '':
|
|
||||||
return
|
|
||||||
cv_image = bridge.imgmsg_to_cv2(data, 'bgr8')
|
|
||||||
barcodes = pyzbar.decode(cv_image)
|
|
||||||
|
|
||||||
if barcodes:
|
|
||||||
qr_data = barcodes[0].data.decode('utf-8')
|
|
||||||
|
|
||||||
return qr_data
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#в MAIN для вызова функции необходимо следующее:
|
|
||||||
#1. создаём и вызываем подписчика, который вызывает функцию чтения кьюаркода
|
|
||||||
qr_sub = rospy.Subscriber('main_camera/image_raw',Image, qr_detection,queue_size=1)
|
|
||||||
#2. задаём время работы подписчика (за 1 секунду примерно 20 раз вызывается функция)
|
|
||||||
rospy.sleep(2)
|
|
||||||
#3. выключаем подписчика
|
|
||||||
qr_sub.unregister()
|
|
||||||
|
|
||||||
+70
-14
@@ -1,14 +1,18 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import izitoast from "./izitoast";
|
import izitoast from "./izitoast";
|
||||||
|
import { useEventListener } from '@vueuse/core';
|
||||||
|
import MyDialog from './components/MyDialog.vue';
|
||||||
|
import copyToclipboard from './copyToclipboard';
|
||||||
|
|
||||||
|
|
||||||
// const numbers = ref(Array(100).fill('')); // Инициализируем массив с пустыми строками
|
|
||||||
const numbers = ref([]); // Инициализируем массив с пустыми строками
|
const numbers = ref([]); // Инициализируем массив с пустыми строками
|
||||||
const clickCount = ref(1); // Счетчик нажатий
|
const clickCount = ref(1); // Счетчик нажатий
|
||||||
const listOfTrips = ref([])
|
const listOfTrips = ref([])
|
||||||
|
const isModalVisible = ref(false)
|
||||||
|
let finallyText = '';
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
|
||||||
for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 100; i++) {
|
||||||
numbers.value.push({
|
numbers.value.push({
|
||||||
variable: [],
|
variable: [],
|
||||||
@@ -35,13 +39,15 @@ function setNumber(item) {
|
|||||||
}
|
}
|
||||||
clickCount.value--;
|
clickCount.value--;
|
||||||
} else {
|
} else {
|
||||||
//если нажимаем на ранее отмеченную клетку (не последнюю), то вывбодится ошибка
|
//если нажимаем на ранее отмеченную клетку (не последнюю), то выводится ошибка
|
||||||
listOfTrips.value.push(item)
|
listOfTrips.value.push(item)
|
||||||
if (numbers.value[item.index].variable.at(-1) === clickCount.value-1) {
|
if (numbers.value[item.index].variable.at(-1) === clickCount.value-1) {
|
||||||
izitoast.error({title:'Ошибка', message:'Нельзя выбирать один и тот же aruco маркер 2 раза подряд'})
|
izitoast.error({
|
||||||
|
title:'Ошибка',
|
||||||
|
message:'Нельзя выбирать один и тот же aruco маркер 2 раза подряд'
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// numbers.value[item.index].variable = `${item.variable}, ${clickCount.value}`
|
|
||||||
numbers.value[item.index].variable.push(clickCount.value)
|
numbers.value[item.index].variable.push(clickCount.value)
|
||||||
clickCount.value++;
|
clickCount.value++;
|
||||||
|
|
||||||
@@ -49,15 +55,16 @@ function setNumber(item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveResult() {
|
function saveResult() {
|
||||||
let finallyText = '';
|
let navigate_waites = ''
|
||||||
for (const item of listOfTrips.value) {
|
for (const item of listOfTrips.value) {
|
||||||
finallyText += `navigate_wait(${item.x}, ${item.y})\n`;
|
navigate_waites += `navigate_wait(${item.x}, ${item.y})\n\t`;
|
||||||
}
|
}
|
||||||
console.log(finallyText);
|
fetch('/shablons/emergency_and_navigate.txt')
|
||||||
izitoast.info({
|
.then(response => response.text())
|
||||||
title: 'Информация',
|
.then(textOfCode => {
|
||||||
message: "Посмотри в консоли путь дрона. Ctrl + Shift + I или F12"
|
finallyText = textOfCode.replace('<<navigate_wait>>', navigate_waites);
|
||||||
});
|
});
|
||||||
|
isModalVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanResult() {
|
function cleanResult() {
|
||||||
@@ -73,6 +80,29 @@ function cleanResult() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Обрабатываем нажатие Ctrl + Z
|
||||||
|
const handleKeydown = (event) => {
|
||||||
|
if (event.ctrlKey && event.code === 'KeyZ' && listOfTrips.value.length ) {
|
||||||
|
event.preventDefault();
|
||||||
|
numbers.value[listOfTrips.value.at(-1).index].variable.pop();
|
||||||
|
listOfTrips.value.pop();
|
||||||
|
|
||||||
|
if (clickCount.value === 1) {
|
||||||
|
return
|
||||||
|
} else{
|
||||||
|
clickCount.value--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
useEventListener('keydown', handleKeydown);
|
||||||
|
|
||||||
|
function copyAndToast(text){
|
||||||
|
copyToclipboard(text)
|
||||||
|
izitoast.success({
|
||||||
|
title:'Успешно',
|
||||||
|
message:'Код скопирован в буфер обмена'
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -93,26 +123,52 @@ function cleanResult() {
|
|||||||
<button
|
<button
|
||||||
@click="cleanResult"
|
@click="cleanResult"
|
||||||
>Очистить</button>
|
>Очистить</button>
|
||||||
|
|
||||||
|
<MyDialog v-show="isModalVisible" @close="isModalVisible = false">
|
||||||
|
<template #header>
|
||||||
|
<strong v-if="listOfTrips.length">Код готов!</strong>
|
||||||
|
<strong v-else>Код не готов!</strong>
|
||||||
|
</template>
|
||||||
|
<template #body>
|
||||||
|
<p v-if="listOfTrips.length">Скопируйте или скачайте ваш код</p>
|
||||||
|
<p v-else>Выстройте маршрут перед сохранением кода.
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
<template #footer>
|
||||||
|
<button type="button" class="btn-green" @click="isModalVisible = false">Скачать код</button>
|
||||||
|
<button type="button" class="btn-green" @click="copyAndToast(finallyText)">Скопировать код</button>
|
||||||
|
<button type="button" class="btn-green" @click="isModalVisible = false">ОК</button>
|
||||||
|
</template>
|
||||||
|
</MyDialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
:root{
|
||||||
|
--side: 70px;
|
||||||
|
}
|
||||||
.grid {
|
.grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(10, 50px);
|
grid-template-columns: repeat(10, var(--side));
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.square {
|
.square {
|
||||||
width: 50px; /* Ширина квадрата */
|
width: var(--side); /* Ширина квадрата */
|
||||||
height: 50px; /* Высота квадрата */
|
height: var(--side); /* Высота квадрата */
|
||||||
background-color: #e0e0e0;
|
background-color: #e0e0e0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background-color 0.3s;
|
transition: background-color 0.3s;
|
||||||
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.square:hover {
|
.square:hover {
|
||||||
background-color: #d0d0d0;
|
background-color: #d0d0d0;
|
||||||
}
|
}
|
||||||
|
.square::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.square[data-key='90'] {
|
.square[data-key='90'] {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<transition name="modal-fade">
|
||||||
|
<div class="modal-backdrop" @click="closeModal">
|
||||||
|
<div class="modal" @click.stop>
|
||||||
|
<header class="modal-header">
|
||||||
|
<slot name="header">
|
||||||
|
<strong>Заголовок по умолчанию</strong>
|
||||||
|
</slot>
|
||||||
|
<button type="button" class="btn-close" @click="closeModal" aria-label="Закрыть модальное окно">
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
<section class="modal-body">
|
||||||
|
<slot name="body">Тело по умолчанию</slot>
|
||||||
|
</section>
|
||||||
|
<footer class="modal-footer">
|
||||||
|
<slot name="footer">
|
||||||
|
<button type="button" class="btn-green" @click="closeModal">Закрыть</button>
|
||||||
|
</slot>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
function closeModal() {
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.modal-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
background: #FFFFFF;
|
||||||
|
box-shadow: 2px 2px 20px 1px;
|
||||||
|
overflow-x: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-width: 500px;
|
||||||
|
width: 90%;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header,
|
||||||
|
.modal-footer {
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
border-bottom: 1px solid #eeeeee;
|
||||||
|
color: #4AAE9B;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
border-top: 1px solid #eeeeee;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
position: relative;
|
||||||
|
padding: 20px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-close {
|
||||||
|
border: none;
|
||||||
|
font-size: 20px;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #4AAE9B;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-green {
|
||||||
|
color: white;
|
||||||
|
background: #4AAE9B;
|
||||||
|
border: 1px solid #4AAE9B;
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 5px;
|
||||||
|
margin: 0 5px;
|
||||||
|
}
|
||||||
|
.btn-green:hover {
|
||||||
|
background-color: #0fa386;
|
||||||
|
}
|
||||||
|
.btn-green:active {
|
||||||
|
background-color: #65ebd2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-fade-enter,
|
||||||
|
.modal-fade-leave-active {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-fade-enter-active,
|
||||||
|
.modal-fade-leave-active {
|
||||||
|
transition: opacity 0.5s ease;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import copy from 'copy-to-clipboard';
|
||||||
|
import iziToast from '@/iziToast.js';
|
||||||
|
|
||||||
|
function copyToclipboard(text) {
|
||||||
|
try {
|
||||||
|
copy(text)
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Ошибка при копировании текста: ", error);
|
||||||
|
iziToast.error({
|
||||||
|
title: 'Ошибка',
|
||||||
|
message: "Ошибка при копировании текста. Подробности смотри в консоли",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default copyToclipboard
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
import { resolve } from 'path';
|
||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
|
|
||||||
// https://vitejs.dev/config
|
// https://vitejs.dev/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()]
|
plugins: [vue()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': resolve(__dirname, 'src'),
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user