Поправил package и отображение картинок в продакшене

This commit is contained in:
Ilia Miheev
2026-06-06 08:44:45 +03:00
parent f43c22d636
commit 26a207d61e
6 changed files with 27 additions and 10 deletions
+9 -4
View File
@@ -1,10 +1,15 @@
{ {
"name": "SkyVue", "name": "skyvue",
"productName": "SkyVue", "productName": "SkyVue",
"version": "1.0.0", "version": "1.0.0",
"description": "My Electron application description", "description": "Визуальное планирование полёта дрона и генерация Python-кода для Clover/ROS",
"main": ".vite/build/main.js", "main": ".vite/build/main.js",
"private": true, "private": true,
"homepage": "https://github.com/IliaMiheev/probody",
"repository": {
"type": "git",
"url": "https://github.com/IliaMiheev/probody.git"
},
"scripts": { "scripts": {
"start": "electron-forge start", "start": "electron-forge start",
"package": "electron-forge package", "package": "electron-forge package",
@@ -12,8 +17,8 @@
"publish": "electron-forge publish", "publish": "electron-forge publish",
"lint": "echo \"No linting configured\"" "lint": "echo \"No linting configured\""
}, },
"keywords": [], "keywords": ["drone", "clover", "ros", "electron", "flight-planning"],
"author": "Student", "author": "Clovers (https://github.com/IliaMiheev/probody)",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@electron-forge/cli": "^7.11.1", "@electron-forge/cli": "^7.11.1",
+3 -2
View File
@@ -1,7 +1,8 @@
<script setup> <script setup>
import { computed } from 'vue' import { computed } from 'vue'
import { publicPath } from '@/shared/publicPath'
const APP_LOGO = '/images/drone.png' const APP_LOGO = 'images/drone.png'
const props = defineProps({ const props = defineProps({
title: { title: {
@@ -24,7 +25,7 @@ const props = defineProps({
defineEmits(['click']) defineEmits(['click'])
const imageSrc = computed(() => props.image || APP_LOGO) const imageSrc = computed(() => publicPath(props.image || APP_LOGO))
</script> </script>
<template> <template>
+8
View File
@@ -0,0 +1,8 @@
export function publicPath(relativePath) {
if (!relativePath) {
return relativePath
}
const path = relativePath.replace(/^\.\//, '').replace(/^\//, '')
return `${import.meta.env.BASE_URL}${path}`
}
+3 -2
View File
@@ -17,6 +17,7 @@ import Back from "@/components/UI/svg/Back.vue";
import { NTooltip } from 'naive-ui' import { NTooltip } from 'naive-ui'
import { useFlightCode } from '@/composables/useFlightCode' import { useFlightCode } from '@/composables/useFlightCode'
import { usePlannerState } from '@/composables/usePlannerState' import { usePlannerState } from '@/composables/usePlannerState'
import { publicPath } from '@/shared/publicPath'
const router = useRouter() const router = useRouter()
@@ -256,7 +257,7 @@ function deletePointMap(item) {
function createIcon(src) { function createIcon(src) {
return h('img', { return h('img', {
src: src, src: publicPath(src),
style: { style: {
width: '20px', width: '20px',
height: '20px', height: '20px',
@@ -328,7 +329,7 @@ function onContextMenu(e, item) {
<div class="wraper"> <div class="wraper">
<div class="grid"> <div class="grid">
<div class="square" v-for="(item, index) in numbers" :data-key="index" :key="index" @click="setNumber(item)" <div class="square" v-for="(item, index) in numbers" :data-key="index" :key="index" @click="setNumber(item)"
@contextmenu.prevent="onContextMenu($event, item)" :style="{ backgroundImage: `url(${item.BgImg})` }"> @contextmenu.prevent="onContextMenu($event, item)" :style="{ backgroundImage: `url(${publicPath(item.BgImg)})` }">
{{ numbers[index].variable.join(", ") }} {{ numbers[index].variable.join(", ") }}
</div> </div>
</div> </div>
+3 -2
View File
@@ -4,8 +4,9 @@ import { useRoute, useRouter } from 'vue-router'
import { resolveTopic } from '@/composables/useTopicResolver' import { resolveTopic } from '@/composables/useTopicResolver'
import MyDropMenu from "@/components/MyDropMenu.vue"; import MyDropMenu from "@/components/MyDropMenu.vue";
import CustomButton from '@/components/UI/CustomButton.vue' import CustomButton from '@/components/UI/CustomButton.vue'
import { publicPath } from '@/shared/publicPath'
const APP_LOGO = '/images/drone.png' const APP_LOGO = 'images/drone.png'
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@@ -13,7 +14,7 @@ const topic = ref(null)
const dropMenu = ref(null); const dropMenu = ref(null);
provide('dropMenu', dropMenu); provide('dropMenu', dropMenu);
const topicImage = computed(() => topic.value?.image || APP_LOGO) const topicImage = computed(() => publicPath(topic.value?.image || APP_LOGO))
async function loadTopic() { async function loadTopic() {
topic.value = await resolveTopic(route.params.source, route.params.id) topic.value = await resolveTopic(route.params.source, route.params.id)
+1
View File
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue';
// https://vitejs.dev/config // https://vitejs.dev/config
export default defineConfig({ export default defineConfig({
base: './',
plugins: [vue()], plugins: [vue()],
resolve: { resolve: {
alias: { alias: {