You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
4.7 KiB
Vue

<template>
<!-- <vueImg /> -->
<div class="w-1/1 h-100vh">
<mt-edit
:use-thumbnail="true"
@on-preview-click="onPreviewClick"
@on-return-click="onReturnClick"
@on-save-click="onSaveClick"
@on-thumbnail-click="onThumbnailClick"
></mt-edit>
</div>
</template>
<script setup lang="ts">
import type { IExportJson } from '@/views/teacher/teacherStatistics/components/mt-edit/components/types';
import { useGenThumbnail } from '@/views/teacher/teacherStatistics/components/mt-edit/composables/thumbnail';
import MtEdit from '@/views/teacher/teacherStatistics/components/mt-edit';
import {getCurrentInstance, onBeforeUnmount} from 'vue';
import vueSignalGaudy from '@/views/teacher/teacherStatistics/components/vue-xq-test/vue-signal-gaudy.vue';
import {leftAsideStore} from "@/views/teacher/teacherStatistics/components/mt-edit/store/left-aside";
const instance = getCurrentInstance();
instance?.appContext.app.component('vue-my-signal-gaudy', vueSignalGaudy);
leftAsideStore.registerConfig('vue四遥组件', [
{
id: 'vue-my-signal-gaudy',
title: 'vue遥信02',
type: 'vue',
thumbnail: `${import.meta.env.BASE_URL}svgs/signal-gaudy.svg`,
// thumbnail:"/svgs/signal-gaudy.svg",
props: {
moduleType: {
type: 'inputTypeTag',
val: '遥信',
title: '四遥类型'
},
moduleId: {
type: 'inputSelectId',
val: '',
title: '绑定ID'
},
location: {
type: 'select',
val: 'bottom',
title: '名称位置',
options: [
{
value: 'top',
label: '上'
},
{
value: 'bottom',
label: '下'
},
{
value: 'left',
label: '左'
},
{
value: 'right',
label: '右'
}
]
}
}
},
]);
const electrical_modules_files = import.meta.glob('./assets/svgs/electrical/**.svg', {
eager: true,
as: 'raw'
});
const electrical_stroke_modules_files = import.meta.glob('./assets/svgs/electrical/stroke/**.svg', {
eager: true,
as: 'raw'
});
const electrical_register_config: any = [];
for (const key in electrical_modules_files) {
//根据路径获取svg文件名
const name = key.split('/').pop()!.split('.')[0];
electrical_register_config.push({
id: name,
title: name,
type: 'svg',
thumbnail: 'data:image/svg+xml;utf8,' + encodeURIComponent(electrical_modules_files[key] as string),
svg: electrical_modules_files[key],
props: {
fill: {
type: 'color',
val: '#FF0000',
title: '填充色'
}
}
});
}
for (const key in electrical_stroke_modules_files) {
//根据路径获取svg文件名
const name = key.split('/').pop()!.split('.')[0];
electrical_register_config.push({
id: name,
title: name,
type: 'svg',
thumbnail:
'data:image/svg+xml;utf8,' + encodeURIComponent(electrical_stroke_modules_files[key]),
svg: electrical_stroke_modules_files[key],
props: {
stroke: {
type: 'color',
val: '#00ff00',
title: '边框色'
}
}
});
}
const onPreviewClick = (exportJson: IExportJson) => {
sessionStorage.setItem('exportJson', JSON.stringify(exportJson));
// const routeUrl = router.resolve({
// name: 'preview'
// });
// window.open(routeUrl.href, '_blank');
};
const onSaveClick = (e: IExportJson) => {
console.log(e, '这是要保存的数据');
};
const onReturnClick = () => {
// router.go(-1);
};
const onThumbnailClick = () => {
useGenThumbnail();
};
</script>
<style scoped>
.common-layout {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.layout-container {
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
}
.header-part {
height: calc(100vh * 240 / 1280);
background-color: #b3c0d1;
display: flex;
align-items: center;
justify-content: center;
font-size: 36px;
font-weight: bold;
color: #333;
}
.main-part {
height: calc(100vh * 950 / 1280);
background-color: #e9eef3;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
color: #333;
}
.footer-part {
height: calc(100vh * 90 / 1280);
background-color: #d3dce6;
padding: 0 !important; /* 移除默认内边距 */
margin: 0 !important; /* 移除默认外边距 */
/* display: flex; */
/* align-items: center;
justify-content: center; */
/* font-size: 18px; */
color: #333;
margin-top: 0;
}
.footer-part-col {
height: 100%;
background-color: #333;
color: #606266;
border: 3px solid rgb(206, 12, 12);
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: bold;
}
</style>