This commit is contained in:
2026-02-25 10:16:14 +08:00
parent fdb913a402
commit aa00b9e7f1
21 changed files with 243 additions and 152 deletions

View File

@@ -1,32 +1,43 @@
<template>
<div class="canvas">
<div class="canvas-main" ref="canvasMain" @mousedown="onMouseDown" @wheel="onMouseWheel">
<fullscreen-dialog v-model="dialogVisible">
<div class="flow-canvas">
<div
class="canvas-content"
:style="{
top: `${data.y}px`,
left: `${data.x}px`,
transform: `scale(${data.scale})`
}"
class="canvas-main"
ref="canvasMain"
@mousedown="onMouseDown"
@wheel="onMouseWheel"
>
<card type="to-real-style" />
<card type="scene-composition" />
<card type="color-palette" />
<card type="to-video" />
<card type="to-3d-model" />
<card type="to-cad" />
<card type="add-print" />
<card type="edit-material" />
<div
class="canvas-content"
:style="{
top: `${data.y}px`,
left: `${data.x}px`,
transform: `scale(${data.scale})`
}"
>
<card type="to-real-style" />
<card type="scene-composition" />
<card type="color-palette" />
<card type="to-video" />
<card type="to-3d-model" />
<card type="to-cad" />
<card type="add-print" />
<card type="edit-material" />
</div>
</div>
</div>
</div>
</fullscreen-dialog>
</template>
<script setup lang="ts">
import FullscreenDialog from '../components/fullscreen-dialog.vue'
import MyInfo from '@/components/MyInfo.vue'
import card from './components/cards/index.vue'
import { computed, ref, markRaw, onMounted, reactive } from 'vue'
import { useGlobalStore } from '@/stores'
const globalStore = useGlobalStore()
const dialogVisible = ref(true)
window.dialogVisible = dialogVisible
const data = reactive({
x: 100,
y: 200,
@@ -65,14 +76,9 @@
</script>
<style lang="less" scoped>
.canvas {
// overflow-y: auto;
// display: flex;
// flex-wrap: wrap;
// align-content: flex-start;
// align-items: flex-start;
// padding: 2rem;
// gap: 2rem;
.flow-canvas {
width: 100%;
height: 100%;
background-color: #fcf8f1;
position: relative;
overflow: hidden;

View File

@@ -0,0 +1,70 @@
<template>
<div
class="fullscreen-dialog"
to="body"
v-if="hideDestroy ? show || show_ : true"
v-show="show"
:class="{ show: show_ }"
:style="{
'--transition-time': transitionTime + 'ms'
}"
>
<slot></slot>
<my-info />
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import MyInfo from '@/components/MyInfo.vue'
const props = defineProps({
modelValue: { default: false, type: Boolean },
transitionTime: { default: 300, type: Number },
hideDestroy: { default: false, type: Boolean }
})
const emit = defineEmits(['update:modelValue', 'closed'])
const show = ref(props.modelValue)
const show_ = ref(props.modelValue)
console.log(props.modelValue)
const timeout = ref(null)
watch(
() => props.modelValue,
(v) => {
if (v) {
show.value = v
clearTimeout(timeout.value)
timeout.value = setTimeout(() => (show_.value = v), 10)
} else {
show_.value = v
clearTimeout(timeout.value)
timeout.value = setTimeout(() => {
show.value = v
emit('closed')
}, props.transitionTime)
}
}
)
</script>
<style lang="less" scoped>
.fullscreen-dialog {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow: hidden;
z-index: 1000;
background-color: rgba(0, 0, 0, 0);
transition: opacity var(--transition-time);
opacity: 0;
&.show {
opacity: 1;
}
> .my-info {
position: absolute;
top: 3rem;
right: 3rem;
}
}
</style>

138
src/components/MyInfo.vue Normal file
View File

@@ -0,0 +1,138 @@
<template>
<div class="my-info">
<div class="credits-box">
<span class="credits">{{ $t('Home.creditsNum', { num: 6000 }) }}</span>
<span class="icon" @click="onRefresh" :class="{ loading }">
<svg-icon name="refresh" size="21" />
</span>
<span class="link"></span>
<span class="icon" @click="onShop"><svg-icon name="shop" size="21" /></span>
</div>
<el-popover
placement="bottom-end"
popper-style="width:auto; min-width: 22rem; padding: 0.8rem; border-radius: 1.4rem;"
>
<template #reference>
<img class="pic" src="@/assets/images/pic.jpg" />
</template>
<div class="menu-box">
<div>
<span class="label">{{ email }}</span>
</div>
<p></p>
<div class="btn" @click="onSetting">
<span class="icon"><svg-icon name="setting" size="18" /></span>
<span class="label">Settings</span>
</div>
<div class="btn" @click="onLogout">
<span class="icon"><svg-icon name="logout" size="18" /></span>
<span class="label">Log out</span>
</div>
</div>
</el-popover>
</div>
</template>
<script setup lang="ts">
import MyEvent from '@/utils/myEvent'
import { computed, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useUserInfoStore } from '@/stores'
const userInfoStore = useUserInfoStore()
const email = computed(() => userInfoStore.state.userInfo.email || '------')
const router = useRouter()
const loading = ref(false)
const onShop = () => {
console.log('onShop')
// router.push({ name: 'shop' })
}
const onRefresh = () => {
console.log('onRefresh')
loading.value = true
setTimeout(() => {
loading.value = false
}, 1500)
}
const onSetting = () => {
MyEvent.emit('openSettingDialog')
}
const onLogout = () => {
userInfoStore.logOut()
}
</script>
<style lang="less" scoped>
.my-info {
display: flex;
align-items: center;
> .credits-box {
display: flex;
align-items: center;
justify-content: center;
min-width: 18rem;
height: 4.3rem;
margin-right: 1rem;
background-color: rgba(255, 252, 244, 1);
border: 1px solid #ffcf90;
border-radius: 0.8rem;
> .credits {
flex: 1;
font-size: 1.3rem;
margin-left: 1rem;
}
> .link {
height: 100%;
width: 0;
border-right: 1px solid #ffcf90;
}
> .icon {
cursor: pointer;
margin: 0 1rem;
}
> .loading {
animation: loading 0.6s linear infinite;
}
}
.pic {
width: 4.65rem;
height: 4.65rem;
border-radius: 50%;
}
}
.menu-box {
user-select: none;
> * {
margin-bottom: 0.4rem;
&:last-child {
margin-bottom: 0;
}
}
> div {
height: 3.7rem;
display: flex;
align-items: center;
// justify-content: center;
&.btn {
cursor: pointer;
}
&.btn:hover {
background-color: rgba(0, 0, 0, 0.06);
}
> .label {
font-size: 1.4rem;
color: #000;
margin-left: 0.8rem;
}
> .icon {
margin-left: 1rem;
--svg-icon-color: #000;
}
}
> p {
width: 100%;
height: 0;
border-bottom: 0.1rem solid #e5e5e5;
}
}
</style>

View File

@@ -56,12 +56,6 @@ const router = createRouter({
name: 'mainInput',
component: () => import('../views/home/mainInput.vue')
},
{
path: 'canvas',
name: 'canvas',
component: () => import('../views/canvas/index.vue'),
meta: { topNavStyle: '2' }
},
{
path: 'agent',
name: 'agent',

View File

@@ -16,6 +16,7 @@
</div>
</div>
<setting />
<flow-canvas />
</template>
<script setup lang="ts">
@@ -26,6 +27,7 @@
import { useGlobalStore } from '@/stores'
const globalStore = useGlobalStore()
const loading = computed(() => globalStore.state.loading)
import FlowCanvas from '@/components/Canvas/FlowCanvas/index.vue'
</script>
<style lang="less" scoped>

View File

@@ -4,70 +4,20 @@
<svg-icon name="back" size="18" />
</span>
<p class="division"></p>
<div class="credits-box">
<span class="credits">{{ $t('Home.creditsNum', { num: 6000 }) }}</span>
<span class="icon" @click="onRefresh" :class="{ loading }">
<svg-icon name="refresh" size="21" />
</span>
<span class="link"></span>
<span class="icon" @click="onShop"><svg-icon name="shop" size="21" /></span>
</div>
<el-popover
placement="bottom-end"
popper-style="width:auto; min-width: 22rem; padding: 0.8rem; border-radius: 1.4rem;"
>
<template #reference>
<img class="pic" src="@/assets/images/pic.jpg" />
</template>
<div class="menu-box">
<div>
<span class="label">{{ email }}</span>
</div>
<p></p>
<div class="btn" @click="onSetting">
<span class="icon"><svg-icon name="setting" size="18" /></span>
<span class="label">Settings</span>
</div>
<div class="btn" @click="onLogout">
<span class="icon"><svg-icon name="logout" size="18" /></span>
<span class="label">Log out</span>
</div>
</div>
</el-popover>
<my-info />
</div>
</template>
<script setup lang="ts">
import MyEvent from '@/utils/myEvent'
import MyInfo from '@/components/MyInfo.vue'
import { computed, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useUserInfoStore } from '@/stores'
const userInfoStore = useUserInfoStore()
const email = computed(() => userInfoStore.state.userInfo.email || '------')
const route = useRoute()
const topNavStyle = computed(() => route.meta.topNavStyle)
const router = useRouter()
const loading = ref(false)
const onBack = () => {
router.back()
}
const onShop = () => {
console.log('onShop')
// router.push({ name: 'shop' })
}
const onRefresh = () => {
console.log('onRefresh')
loading.value = true
setTimeout(() => {
loading.value = false
}, 1500)
}
const onSetting = () => {
MyEvent.emit('openSettingDialog')
}
const onLogout = () => {
userInfoStore.logOut()
}
</script>
<style lang="less" scoped>
@@ -91,74 +41,5 @@
width: 2.4rem;
height: 2.4rem;
}
> .credits-box {
display: flex;
align-items: center;
justify-content: center;
min-width: 18rem;
height: 4.3rem;
margin-right: 1rem;
background-color: rgba(255, 252, 244, 1);
border: 1px solid #ffcf90;
border-radius: 0.8rem;
> .credits {
flex: 1;
font-size: 1.3rem;
margin-left: 1rem;
}
> .link {
height: 100%;
width: 0;
border-right: 1px solid #ffcf90;
}
> .icon {
cursor: pointer;
margin: 0 1rem;
}
> .loading {
animation: loading 0.6s linear infinite;
}
}
.pic {
width: 4.65rem;
height: 4.65rem;
border-radius: 50%;
}
}
.menu-box {
user-select: none;
> * {
margin-bottom: 0.4rem;
&:last-child {
margin-bottom: 0;
}
}
> div {
height: 3.7rem;
display: flex;
align-items: center;
// justify-content: center;
&.btn {
cursor: pointer;
}
&.btn:hover {
background-color: rgba(0, 0, 0, 0.06);
}
> .label {
font-size: 1.4rem;
color: #000;
margin-left: 0.8rem;
}
> .icon {
margin-left: 1rem;
--svg-icon-color: #000;
}
}
> p {
width: 100%;
height: 0;
border-bottom: 0.1rem solid #e5e5e5;
}
}
</style>