Skip to content

Commit d1ca71c

Browse files
committed
feat: dashboard init
1 parent 2002696 commit d1ca71c

File tree

4 files changed

+1063
-1
lines changed

4 files changed

+1063
-1
lines changed

frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12+
"lodash": "^4.17.21",
1213
"vue": "^3.5.13",
1314
"vue-router": "^4.5.0",
1415
"web-storage-cache": "^1.1.1"
1516
},
1617
"devDependencies": {
1718
"@element-plus/icons-vue": "^2.3.1",
1819
"@types/crypto-js": "^4.2.2",
19-
"crypto-js": "^4.2.0",
2020
"@types/node": "^22.14.1",
2121
"@vitejs/plugin-vue": "^5.2.2",
2222
"@vue/tsconfig": "^0.7.0",
2323
"axios": "^1.8.4",
24+
"crypto-js": "^4.2.0",
2425
"element-plus": "^2.9.7",
2526
"less": "^4.3.0",
2627
"pinia": "^3.0.2",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<script setup lang="ts">
2+
import DsCanvasCore from '@/views/dashboard/canvas/DsCanvasCore.vue'
3+
import { nextTick, onMounted, ref } from 'vue'
4+
const cyGridster = ref(null)
5+
const baseWidth = ref(0)
6+
const baseHeight = ref(0)
7+
const baseMarginLeft = ref(0)
8+
const baseMarginTop = ref(0)
9+
const componentData = [
10+
{
11+
id: 4,
12+
x: 1,
13+
y: 1,
14+
sizex: 2,
15+
sizey: 2
16+
},
17+
{
18+
id: 10,
19+
x: 2,
20+
y: 1,
21+
sizex: 2,
22+
sizey: 2
23+
},
24+
{
25+
id: 7,
26+
x: 1,
27+
y: 2,
28+
sizex: 2,
29+
sizey: 3
30+
}
31+
]
32+
33+
onMounted(() => {
34+
const screenWidth = window.innerWidth
35+
const screenHeight = window.innerHeight
36+
baseWidth.value = 90.8333 * (screenWidth / 1366)
37+
baseHeight.value = 100 * (screenHeight / 638)
38+
baseMarginLeft.value = 20 * (screenWidth / 1366)
39+
baseMarginTop.value = 20 * (screenHeight / 638)
40+
41+
nextTick(() => {
42+
if (cyGridster.value) {
43+
cyGridster.value.init()
44+
}
45+
})
46+
})
47+
</script>
48+
49+
<template>
50+
<DsCanvasCore ref="cyGridster" :canvas-component-data="componentData"></DsCanvasCore>
51+
</template>
52+
53+
<style scoped lang="less"></style>

0 commit comments

Comments
 (0)