123
This commit is contained in:
@@ -83,6 +83,7 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
const nodeManager = inject('nodeManager') as any
|
const nodeManager = inject('nodeManager') as any
|
||||||
|
const stateManager = inject('stateManager') as any
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
type: String as () =>
|
type: String as () =>
|
||||||
@@ -107,7 +108,9 @@
|
|||||||
const componentRef = ref(null)
|
const componentRef = ref(null)
|
||||||
const onGenerateClick = () => {
|
const onGenerateClick = () => {
|
||||||
const data = { ...componentRef.value.data }
|
const data = { ...componentRef.value.data }
|
||||||
|
const subordNode = stateManager.getSubordNodeByID(attrs.node.id)
|
||||||
if (attrs.node.data) attrs.node.data.data = data
|
if (attrs.node.data) attrs.node.data.data = data
|
||||||
|
if (!subordNode) {
|
||||||
nodeManager.createResultNode({
|
nodeManager.createResultNode({
|
||||||
data: {
|
data: {
|
||||||
superiorID: attrs.node.id,
|
superiorID: attrs.node.id,
|
||||||
@@ -117,6 +120,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} 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(() => {
|
onMounted(() => {
|
||||||
for (const key in props.data) {
|
for (const key in props.data) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onBeforeUnmount, useAttrs, inject } from 'vue'
|
import { reactive, ref, onBeforeUnmount, useAttrs, inject, watch } from 'vue'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -49,9 +49,14 @@
|
|||||||
const showHeader = ref(!!attrs.node?.data?.isHeader)
|
const showHeader = ref(!!attrs.node?.data?.isHeader)
|
||||||
const showMenu = ref(false)
|
const showMenu = ref(false)
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
tier: props.data?.tier || 0,
|
|
||||||
url: props.data?.url || ''
|
url: props.data?.url || ''
|
||||||
})
|
})
|
||||||
|
watch(
|
||||||
|
() => props.data.url,
|
||||||
|
(newVal) => {
|
||||||
|
data.url = newVal
|
||||||
|
}
|
||||||
|
)
|
||||||
const menus = ref([
|
const menus = ref([
|
||||||
{ label: 'Copy', tip: 'Ctrl+C', on: () => {} },
|
{ label: 'Copy', tip: 'Ctrl+C', on: () => {} },
|
||||||
{ label: 'Paste', tip: 'Ctrl+V', on: () => {} },
|
{ label: 'Paste', tip: 'Ctrl+V', on: () => {} },
|
||||||
|
|||||||
@@ -19,5 +19,8 @@ export class FlowManager {
|
|||||||
}
|
}
|
||||||
return null;
|
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) {
|
deleteNode(id: string) {
|
||||||
this.nodes.value = this.nodes.value.filter((node: NodesItem) => node.id !== id)
|
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() {
|
getLastNode() {
|
||||||
return this.nodes.value[this.nodes.value.length - 1]
|
return this.nodes.value[this.nodes.value.length - 1]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import { getUniversalZoomLevel } from '@/utils/tools'
|
|||||||
|
|
||||||
const maxWidth = 1920;
|
const maxWidth = 1920;
|
||||||
const minWidth = 500;
|
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;
|
var doc = document, win = window, docEl = doc.documentElement, remStyle = document.createElement("style"), tid;
|
||||||
function refreshRem() {
|
function refreshRem() {
|
||||||
var width = docEl.getBoundingClientRect().width;
|
var width = docEl.getBoundingClientRect().width;
|
||||||
@@ -11,7 +13,11 @@ let flexible = (designWidth = 1920) => {
|
|||||||
height = getUniversalZoomLevel() * height
|
height = getUniversalZoomLevel() * height
|
||||||
if (width > maxWidth) width = maxWidth;
|
if (width > maxWidth) width = maxWidth;
|
||||||
if (width < minWidth) width = minWidth;
|
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'
|
docEl.style.fontSize = rem + 'px'
|
||||||
}
|
}
|
||||||
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
.retrieve-password > .right,
|
.retrieve-password > .right,
|
||||||
.register > .right,
|
.register > .right,
|
||||||
.login > .right {
|
.login > .right {
|
||||||
width: 99rem;
|
width: 50%;
|
||||||
min-width: 600px;
|
min-width: 600px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -97,7 +97,8 @@
|
|||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
> .title {
|
> .title {
|
||||||
width: 55%;
|
// width: 55%;
|
||||||
|
width: 105.6rem;
|
||||||
height: auto;
|
height: auto;
|
||||||
top: 20.5rem;
|
top: 20.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
>.right {
|
>.right {
|
||||||
width: 99rem;
|
width: 50%;
|
||||||
min-width: 600px;
|
min-width: 600px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
Reference in New Issue
Block a user