|
@@ -943,25 +943,28 @@
|
|
<t-tab-panel :value="2" label="动画">
|
|
<t-tab-panel :value="2" label="动画">
|
|
<PenAnimates :pen="data.pen" />
|
|
<PenAnimates :pen="data.pen" />
|
|
</t-tab-panel>
|
|
</t-tab-panel>
|
|
- <t-tab-panel :value="3" label="数据"> </t-tab-panel>
|
|
|
|
|
|
+ <t-tab-panel :value="3" label="数据">
|
|
|
|
+ <PenDatas :pen="data.pen" />
|
|
|
|
+ </t-tab-panel>
|
|
<t-tab-panel :value="4" label="交互"> </t-tab-panel>
|
|
<t-tab-panel :value="4" label="交互"> </t-tab-panel>
|
|
</t-tabs>
|
|
</t-tabs>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { onBeforeMount, onUnmounted, reactive, ref } from "vue";
|
|
|
|
-import { getCookie } from "@/services/cookie";
|
|
|
|
-import { useSelection } from "@/services/selections";
|
|
|
|
-import MonacoModal from "./common/MonacoModal.vue";
|
|
|
|
-import { monacoOption } from "./common/MonacoModal.vue";
|
|
|
|
|
|
+import { onBeforeMount, onUnmounted, reactive, ref } from 'vue';
|
|
|
|
+import { getCookie } from '@/services/cookie';
|
|
|
|
+import { useSelection } from '@/services/selections';
|
|
|
|
+import MonacoModal from './common/MonacoModal.vue';
|
|
|
|
+import { monacoOption } from './common/MonacoModal.vue';
|
|
|
|
|
|
import PenAnimates from './PenAnimates.vue';
|
|
import PenAnimates from './PenAnimates.vue';
|
|
|
|
+import PenDatas from './PenDatas.vue';
|
|
|
|
|
|
const headers = {
|
|
const headers = {
|
|
- Authorization: "Bearer " + (localStorage.token || getCookie("token") || ""),
|
|
|
|
|
|
+ Authorization: 'Bearer ' + (localStorage.token || getCookie('token') || ''),
|
|
};
|
|
};
|
|
-const updataData = { directory: "/项目" };
|
|
|
|
|
|
+const updataData = { directory: '/项目' };
|
|
|
|
|
|
const uploadRef = ref();
|
|
const uploadRef = ref();
|
|
|
|
|
|
@@ -972,23 +975,23 @@ const data = reactive<any>({
|
|
});
|
|
});
|
|
|
|
|
|
const fonts = [
|
|
const fonts = [
|
|
- "新宋体",
|
|
|
|
- "微软雅黑",
|
|
|
|
- "黑体",
|
|
|
|
- "楷体",
|
|
|
|
- "-apple-system",
|
|
|
|
- "BlinkMacSystemFont",
|
|
|
|
- "PingFang SC",
|
|
|
|
- "Hiragino Sans GB",
|
|
|
|
- "Microsoft YaHei UI",
|
|
|
|
- "Microsoft YaHei",
|
|
|
|
- "fangsong",
|
|
|
|
- "Source Han Sans CN",
|
|
|
|
- "sans-serif",
|
|
|
|
- "serif",
|
|
|
|
- "Apple Color Emoji",
|
|
|
|
- "Segoe UI Emoji",
|
|
|
|
- "Segoe UI Symbol",
|
|
|
|
|
|
+ '新宋体',
|
|
|
|
+ '微软雅黑',
|
|
|
|
+ '黑体',
|
|
|
|
+ '楷体',
|
|
|
|
+ '-apple-system',
|
|
|
|
+ 'BlinkMacSystemFont',
|
|
|
|
+ 'PingFang SC',
|
|
|
|
+ 'Hiragino Sans GB',
|
|
|
|
+ 'Microsoft YaHei UI',
|
|
|
|
+ 'Microsoft YaHei',
|
|
|
|
+ 'fangsong',
|
|
|
|
+ 'Source Han Sans CN',
|
|
|
|
+ 'sans-serif',
|
|
|
|
+ 'serif',
|
|
|
|
+ 'Apple Color Emoji',
|
|
|
|
+ 'Segoe UI Emoji',
|
|
|
|
+ 'Segoe UI Symbol',
|
|
];
|
|
];
|
|
|
|
|
|
const { selections } = useSelection();
|
|
const { selections } = useSelection();
|
|
@@ -1011,12 +1014,12 @@ onBeforeMount(() => {
|
|
data.pen.dash = 0;
|
|
data.pen.dash = 0;
|
|
}
|
|
}
|
|
if (!data.pen.props.text) {
|
|
if (!data.pen.props.text) {
|
|
- if (data.pen.text || data.pen.name === "text") {
|
|
|
|
|
|
+ if (data.pen.text || data.pen.name === 'text') {
|
|
data.pen.props.text = true;
|
|
data.pen.props.text = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!data.pen.props.image) {
|
|
if (!data.pen.props.image) {
|
|
- if (data.pen.image || data.pen.name === "image") {
|
|
|
|
|
|
+ if (data.pen.image || data.pen.name === 'image') {
|
|
data.pen.props.image = true;
|
|
data.pen.props.image = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1036,27 +1039,27 @@ onBeforeMount(() => {
|
|
|
|
|
|
// 测试代码
|
|
// 测试代码
|
|
data.pen.props.custom = [
|
|
data.pen.props.custom = [
|
|
- { label: "数字", key: "a", type: "number", placeholder: "输入提示" },
|
|
|
|
- { label: "文本", key: "b" },
|
|
|
|
- { label: "布尔", key: "c", type: "bool", placeholder: "输入提示" },
|
|
|
|
- { label: "颜色", key: "d", type: "color", placeholder: "输入提示" },
|
|
|
|
|
|
+ { label: '数字', key: 'a', type: 'number', placeholder: '输入提示' },
|
|
|
|
+ { label: '文本', key: 'b' },
|
|
|
|
+ { label: '布尔', key: 'c', type: 'bool', placeholder: '输入提示' },
|
|
|
|
+ { label: '颜色', key: 'd', type: 'color', placeholder: '输入提示' },
|
|
{
|
|
{
|
|
- label: "下拉框",
|
|
|
|
- key: "d",
|
|
|
|
- type: "select",
|
|
|
|
|
|
+ label: '下拉框',
|
|
|
|
+ key: 'd',
|
|
|
|
+ type: 'select',
|
|
options: [
|
|
options: [
|
|
- { label: "选项1", value: "1" },
|
|
|
|
- { label: "选项2", value: "2" },
|
|
|
|
|
|
+ { label: '选项1', value: '1' },
|
|
|
|
+ { label: '选项2', value: '2' },
|
|
],
|
|
],
|
|
- placeholder: "输入提示",
|
|
|
|
|
|
+ placeholder: '输入提示',
|
|
},
|
|
},
|
|
];
|
|
];
|
|
// end
|
|
// end
|
|
data.pen.shadow = !!data.pen.shadowColor;
|
|
data.pen.shadow = !!data.pen.shadowColor;
|
|
getRect();
|
|
getRect();
|
|
- meta2d.on("translatePens", getRect);
|
|
|
|
- meta2d.on("resizePens", getRect);
|
|
|
|
- meta2d.on("rotatePens", getRect);
|
|
|
|
|
|
+ meta2d.on('translatePens', getRect);
|
|
|
|
+ meta2d.on('resizePens', getRect);
|
|
|
|
+ meta2d.on('rotatePens', getRect);
|
|
});
|
|
});
|
|
|
|
|
|
const getRect = () => {
|
|
const getRect = () => {
|
|
@@ -1077,25 +1080,25 @@ const decimalRound = (val: number) => {
|
|
const changeValue = (prop: string) => {
|
|
const changeValue = (prop: string) => {
|
|
const v: any = { id: data.pen.id };
|
|
const v: any = { id: data.pen.id };
|
|
v[prop] = data.pen[prop];
|
|
v[prop] = data.pen[prop];
|
|
- if (prop === "x") {
|
|
|
|
|
|
+ if (prop === 'x') {
|
|
v.x = data.rect.x;
|
|
v.x = data.rect.x;
|
|
- } else if (prop === "y") {
|
|
|
|
|
|
+ } else if (prop === 'y') {
|
|
v.y = data.rect.y;
|
|
v.y = data.rect.y;
|
|
- } else if (prop === "width") {
|
|
|
|
|
|
+ } else if (prop === 'width') {
|
|
v.height = (data.rect.width / data.pen.width) * data.pen.height;
|
|
v.height = (data.rect.width / data.pen.width) * data.pen.height;
|
|
- } else if (prop === "height") {
|
|
|
|
|
|
+ } else if (prop === 'height') {
|
|
v.width = (data.rect.height / data.pen.height) * data.pen.width;
|
|
v.width = (data.rect.height / data.pen.height) * data.pen.width;
|
|
- } else if (prop === "shadow") {
|
|
|
|
|
|
+ } else if (prop === 'shadow') {
|
|
if (v[prop]) {
|
|
if (v[prop]) {
|
|
!v.shadowOffsetX && (v.shadowOffsetX = 0);
|
|
!v.shadowOffsetX && (v.shadowOffsetX = 0);
|
|
!v.shadowOffsetY && (v.shadowOffsetY = 0);
|
|
!v.shadowOffsetY && (v.shadowOffsetY = 0);
|
|
!v.shadowBlur && (v.shadowBlur = 0);
|
|
!v.shadowBlur && (v.shadowBlur = 0);
|
|
} else {
|
|
} else {
|
|
- v.shadowColor = "";
|
|
|
|
|
|
+ v.shadowColor = '';
|
|
}
|
|
}
|
|
- } else if (prop === "lineGradientColors") {
|
|
|
|
|
|
+ } else if (prop === 'lineGradientColors') {
|
|
//@ts-ignore
|
|
//@ts-ignore
|
|
- if (meta2d.store.active[0].name === "line") {
|
|
|
|
|
|
+ if (meta2d.store.active[0].name === 'line') {
|
|
//@ts-ignore
|
|
//@ts-ignore
|
|
meta2d.store.active[0].calculative.gradientColorStop = null;
|
|
meta2d.store.active[0].calculative.gradientColorStop = null;
|
|
} else {
|
|
} else {
|
|
@@ -1103,7 +1106,7 @@ const changeValue = (prop: string) => {
|
|
meta2d.store.active[0].calculative.lineGradient = null;
|
|
meta2d.store.active[0].calculative.lineGradient = null;
|
|
}
|
|
}
|
|
//不同模式切换不同的系统配色
|
|
//不同模式切换不同的系统配色
|
|
- } else if (prop === "titleFnJs") {
|
|
|
|
|
|
+ } else if (prop === 'titleFnJs') {
|
|
v.titleFn = null;
|
|
v.titleFn = null;
|
|
}
|
|
}
|
|
meta2d.setValue(v);
|
|
meta2d.setValue(v);
|
|
@@ -1116,7 +1119,7 @@ const onFontPopupVisible = (val: boolean) => {
|
|
const onFontFamily = (fontFamily: string) => {
|
|
const onFontFamily = (fontFamily: string) => {
|
|
data.pen.fontFamily = fontFamily;
|
|
data.pen.fontFamily = fontFamily;
|
|
data.fontFamilyPopupVisible = false;
|
|
data.fontFamilyPopupVisible = false;
|
|
- changeValue("fontFamily");
|
|
|
|
|
|
+ changeValue('fontFamily');
|
|
};
|
|
};
|
|
|
|
|
|
const fileSuccessed = async (content: any) => {
|
|
const fileSuccessed = async (content: any) => {
|
|
@@ -1127,7 +1130,7 @@ const fileSuccessed = async (content: any) => {
|
|
};
|
|
};
|
|
|
|
|
|
const fileRemoved = () => {
|
|
const fileRemoved = () => {
|
|
- meta2d.setBackgroundImage("");
|
|
|
|
|
|
+ meta2d.setBackgroundImage('');
|
|
meta2d.store.patchFlagsBackground = true;
|
|
meta2d.store.patchFlagsBackground = true;
|
|
meta2d.render();
|
|
meta2d.render();
|
|
data.background = [];
|
|
data.background = [];
|
|
@@ -1143,22 +1146,22 @@ const onSelectTag = (tag: string) => {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
data.pen.tags.push(tag);
|
|
data.pen.tags.push(tag);
|
|
- changeValue("tags");
|
|
|
|
|
|
+ changeValue('tags');
|
|
};
|
|
};
|
|
|
|
|
|
const onChangeInputTag = (currentTags: any, context: any) => {
|
|
const onChangeInputTag = (currentTags: any, context: any) => {
|
|
const { trigger, index, item } = context;
|
|
const { trigger, index, item } = context;
|
|
- if (["tag-remove", "backspace"].includes(trigger)) {
|
|
|
|
|
|
+ if (['tag-remove', 'backspace'].includes(trigger)) {
|
|
data.pen.tags.splice(index, 1);
|
|
data.pen.tags.splice(index, 1);
|
|
}
|
|
}
|
|
- if (trigger === "enter") {
|
|
|
|
|
|
+ if (trigger === 'enter') {
|
|
onSelectTag(item);
|
|
onSelectTag(item);
|
|
const d = meta2d.store.data as any;
|
|
const d = meta2d.store.data as any;
|
|
if (!d.groups.includes(item)) {
|
|
if (!d.groups.includes(item)) {
|
|
d.groups.push(item);
|
|
d.groups.push(item);
|
|
data.groups = d.groups;
|
|
data.groups = d.groups;
|
|
}
|
|
}
|
|
- data.inputTag = "";
|
|
|
|
|
|
+ data.inputTag = '';
|
|
}
|
|
}
|
|
data.tagPopupVisible = false;
|
|
data.tagPopupVisible = false;
|
|
};
|
|
};
|
|
@@ -1166,42 +1169,42 @@ const onChangeInputTag = (currentTags: any, context: any) => {
|
|
const titleVisible = ref(false);
|
|
const titleVisible = ref(false);
|
|
const titleOptions: monacoOption[] = [
|
|
const titleOptions: monacoOption[] = [
|
|
{
|
|
{
|
|
- key: "title",
|
|
|
|
|
|
+ key: 'title',
|
|
value: 0,
|
|
value: 0,
|
|
- name: "文本",
|
|
|
|
- tip: "支持markdown",
|
|
|
|
- code: "",
|
|
|
|
- language: "markdown",
|
|
|
|
|
|
+ name: '文本',
|
|
|
|
+ tip: '支持markdown',
|
|
|
|
+ code: '',
|
|
|
|
+ language: 'markdown',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- key: "titleFnJs",
|
|
|
|
|
|
+ key: 'titleFnJs',
|
|
value: 1,
|
|
value: 1,
|
|
- name: "高级",
|
|
|
|
- tip: "mark函数",
|
|
|
|
- code: "",
|
|
|
|
- language: "javascript",
|
|
|
|
- example:'//例如: return `${pen.name}<br/>${pen.text}`;'
|
|
|
|
|
|
+ name: '高级',
|
|
|
|
+ tip: 'mark函数',
|
|
|
|
+ code: '',
|
|
|
|
+ language: 'javascript',
|
|
|
|
+ example: '//例如: return `${pen.name}<br/>${pen.text}`;',
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
|
|
const showTitle = () => {
|
|
const showTitle = () => {
|
|
titleOptions.forEach((item) => {
|
|
titleOptions.forEach((item) => {
|
|
- item.code = data.pen[item.key] || "";
|
|
|
|
|
|
+ item.code = data.pen[item.key] || '';
|
|
});
|
|
});
|
|
titleVisible.value = true;
|
|
titleVisible.value = true;
|
|
};
|
|
};
|
|
|
|
|
|
const changeTitleCode = (options: monacoOption[]) => {
|
|
const changeTitleCode = (options: monacoOption[]) => {
|
|
options.forEach((item) => {
|
|
options.forEach((item) => {
|
|
- data.pen[item.key] = item.code || "";
|
|
|
|
|
|
+ data.pen[item.key] = item.code || '';
|
|
changeValue(item.key);
|
|
changeValue(item.key);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
- meta2d.off("translatePens", getRect);
|
|
|
|
- meta2d.off("resizePens", getRect);
|
|
|
|
- meta2d.off("rotatePens", getRect);
|
|
|
|
|
|
+ meta2d.off('translatePens', getRect);
|
|
|
|
+ meta2d.off('resizePens', getRect);
|
|
|
|
+ meta2d.off('rotatePens', getRect);
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
<style lang="postcss" scoped>
|
|
<style lang="postcss" scoped>
|