123
This commit is contained in:
@@ -83,6 +83,7 @@
|
||||
}
|
||||
]
|
||||
const nodeManager = inject('nodeManager') as any
|
||||
const stateManager = inject('stateManager') as any
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String as () =>
|
||||
@@ -107,16 +108,22 @@
|
||||
const componentRef = ref(null)
|
||||
const onGenerateClick = () => {
|
||||
const data = { ...componentRef.value.data }
|
||||
const subordNode = stateManager.getSubordNodeByID(attrs.node.id)
|
||||
if (attrs.node.data) attrs.node.data.data = data
|
||||
nodeManager.createResultNode({
|
||||
data: {
|
||||
superiorID: attrs.node.id,
|
||||
tier: currentComponent.value.tier,
|
||||
if (!subordNode) {
|
||||
nodeManager.createResultNode({
|
||||
data: {
|
||||
url: 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__'
|
||||
superiorID: attrs.node.id,
|
||||
tier: currentComponent.value.tier,
|
||||
data: {
|
||||
url: 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
subordNode.data.data.url =
|
||||
'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__'
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
for (const key in props.data) {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onBeforeUnmount, useAttrs, inject } from 'vue'
|
||||
import { reactive, ref, onBeforeUnmount, useAttrs, inject, watch } from 'vue'
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
@@ -49,9 +49,14 @@
|
||||
const showHeader = ref(!!attrs.node?.data?.isHeader)
|
||||
const showMenu = ref(false)
|
||||
const data = reactive({
|
||||
tier: props.data?.tier || 0,
|
||||
url: props.data?.url || ''
|
||||
})
|
||||
watch(
|
||||
() => props.data.url,
|
||||
(newVal) => {
|
||||
data.url = newVal
|
||||
}
|
||||
)
|
||||
const menus = ref([
|
||||
{ label: 'Copy', tip: 'Ctrl+C', on: () => {} },
|
||||
{ label: 'Paste', tip: 'Ctrl+V', on: () => {} },
|
||||
|
||||
@@ -19,5 +19,8 @@ export class FlowManager {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
getSubordNodeByID(id: string) {
|
||||
return this.vueFlow.value.getNodes?.find((v) => v.data.superiorID === id)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,6 +94,14 @@ export class StateManager {
|
||||
deleteNode(id: string) {
|
||||
this.nodes.value = this.nodes.value.filter((node: NodesItem) => node.id !== id)
|
||||
}
|
||||
/** 获取节点 */
|
||||
getNodeById(id: string) {
|
||||
return this.nodes.value.find((node: NodesItem) => node.id === id)
|
||||
}
|
||||
/** 获取下级节点 */
|
||||
getSubordNodeByID(id: string) {
|
||||
return this.nodes.value.find((node: NodesItem) => node.data.superiorID === id)
|
||||
}
|
||||
getLastNode() {
|
||||
return this.nodes.value[this.nodes.value.length - 1]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ import { getUniversalZoomLevel } from '@/utils/tools'
|
||||
|
||||
const maxWidth = 1920;
|
||||
const minWidth = 500;
|
||||
let flexible = (designWidth = 1920) => {
|
||||
const maxHeight = 1080;
|
||||
const minHeight = 500;
|
||||
let flexible = (designWidth = 1920, designHeight = 1080) => {
|
||||
var doc = document, win = window, docEl = doc.documentElement, remStyle = document.createElement("style"), tid;
|
||||
function refreshRem() {
|
||||
var width = docEl.getBoundingClientRect().width;
|
||||
@@ -11,7 +13,11 @@ let flexible = (designWidth = 1920) => {
|
||||
height = getUniversalZoomLevel() * height
|
||||
if (width > maxWidth) width = maxWidth;
|
||||
if (width < minWidth) width = minWidth;
|
||||
var rem = (width * 10 / designWidth).toFixed(2);
|
||||
if (height > maxHeight) height = maxHeight;
|
||||
if (height < minHeight) height = minHeight;
|
||||
const wrem = (width * 10 / designWidth).toFixed(2);
|
||||
const hrem = (height * 10 / designHeight).toFixed(2);
|
||||
const rem = Math.min(wrem, hrem);
|
||||
docEl.style.fontSize = rem + 'px'
|
||||
}
|
||||
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
.retrieve-password > .right,
|
||||
.register > .right,
|
||||
.login > .right {
|
||||
width: 99rem;
|
||||
width: 50%;
|
||||
min-width: 600px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -97,7 +97,8 @@
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
> .title {
|
||||
width: 55%;
|
||||
// width: 55%;
|
||||
width: 105.6rem;
|
||||
height: auto;
|
||||
top: 20.5rem;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
>.right {
|
||||
width: 99rem;
|
||||
width: 50%;
|
||||
min-width: 600px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user