Skip to content

Commit

Permalink
fix: Configuration picture is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxiaobo1010 committed Aug 29, 2022
1 parent 0d68db5 commit 72efcfc
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 3 deletions.
Binary file added public/assets/images/topo/screen/card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title><%= VUE_APP_TITLE %></title>
<meta charset="utf-8" />
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta name="referrer" content="no-referrer" />
<meta content="width=device-width,initial-scale=1.0" name="viewport" />
<meta content="<%= VUE_APP_Keywords %>" name="keywords" />
<meta content="<%= VUE_APP_Description %>" name="description" />
Expand Down
10 changes: 10 additions & 0 deletions src/store/modules/topo.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ const mutations = {
if (
canvas.contextmenu.attrs.name == 'evidence' ||
canvas.contextmenu.attrs.name == 'konvaimage' ||
canvas.contextmenu.attrs.name == 'staticimage' ||
canvas.contextmenu.attrs.name == 'sprite' ||
canvas.contextmenu.attrs.name == 'vuecomponent'
) {
Expand Down Expand Up @@ -290,6 +291,7 @@ const mutations = {
console.log('thing内容', thing, x, y)
if (
thing.type == 'knovaimage' ||
thing.type == 'staticimage' ||
thing.type == 'gifimage' ||
thing.type == 'vuecomponent'
) {
Expand All @@ -306,6 +308,14 @@ const mutations = {
productid: thing.productid,
})
)
} else if (thing.type == 'staticimage') {
simpleImage = addNodeEvent(
_.merge(canvas.handlerArgs, {
type: 'createStaticImage',
image: thing.image,
productid: thing.productid,
})
)
} else if (thing.type == 'vuecomponent') {
simpleImage = addNodeEvent(
_.merge(canvas.handlerArgs, {
Expand Down
3 changes: 3 additions & 0 deletions src/utils/konva/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ function addNodeEvent(args) {
case 'createImage':
return topoBasic.createImage(args)
break
case 'createStaticImage':
return topoBasic.createStaticImage(args)
break
case 'gifImage':
return topoBasic.createGifImage(args)
break
Expand Down
38 changes: 38 additions & 0 deletions src/utils/konva/core/topoBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,44 @@ const topoBasic = {

return simpleImage
},
createStaticImage(args) {
console.info(
'src/utils/konva/core/topoBasic.js',
'createdEvidence',
// args.path,
args
)
const Axis = {
x: 10 + args.path.index * 100 + canvas.randomXy(60, 10),
y: 400 + canvas.randomXy(40, 10),
}
let simpleImage = ''
const topoId = uuid(5)
// if (args.type == 'createImage') {
var imageObj = new Image()
imageObj.src = args.image
// imageObj.onload = () => {
simpleImage = new Konva.Image({
name: 'staticimage',
id: args.productid + '_staticimage' + topoId,
x: Axis.x,
y: Axis.y,
image: imageObj,
width: 106,
height: 118,
type: 'staticimage',
// handler: 'dblclick',
draggable: true,
})
simpleImage.setAttrs({
src: args.image,
})
// } else if (args.type == 'gifimage') {

// }

return simpleImage
},
createGifImage(args) {
console.info(
'src/utils/konva/core/topoBasic.js',
Expand Down
7 changes: 7 additions & 0 deletions src/utils/konva/core/topoStage.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,13 @@ const topoStage = {
// layer.batchDraw()
// stage.batchDraw()
}
if (node.attrs.type == 'staticimage') {
let image = new Image()
node.setAttrs({
image: image,
})
image.src = node.attrs.src
}
node.on('contextmenu', (e) => {
canvas.contextmenu = e.target
console.log('contextmenu', e.target)
Expand Down
30 changes: 28 additions & 2 deletions src/views/CloudFunction/topo/components/TopoTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,18 @@
静态文本框
</el-button>
<el-divider />
<div style="text-align: left; margin: 10px; font-weight: 600">动图</div>
<img
draggable="true"
size="mini"
src="http://dev.iotn2n.com/dgiot_file/topo/png/pump.gif"
src="https://prod.dgiotcloud.cn/dgiot_file/topo/png/pump.gif"
style="width: 40px; height: 40px; display: inline-block"
type="primary"
@click="
createBasicThing({
productid: $route.query.productid,
type: 'knovaimage',
image: 'http://dev.iotn2n.com/dgiot_file/topo/png/pump.gif',
image: 'https://prod.dgiotcloud.cn/dgiot_file/topo/png/pump.gif',
hidden: false,
})
"
Expand All @@ -137,6 +138,31 @@
"
/>
<el-divider />
<div style="text-align: left; margin: 10px; font-weight: 600">
静态图
</div>
<img
draggable="true"
size="mini"
src="https://mp0.usr.cn/uploads/drawimg/1612317616625_0334.png"
style="
width: 40px;
height: 40px;
display: inline-block;
margin-left: 20px;
"
type="primary"
@click="
createBasicThing({
productid: $route.query.productid,
type: 'staticimage',
image:
'https://mp0.usr.cn/uploads/drawimg/1612317616625_0334.png',
hidden: false,
})
"
/>
<el-divider />
<el-button
draggable="true"
size="mini"
Expand Down
2 changes: 1 addition & 1 deletion src/views/DeviceCloud/manage/home_index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class="wrap_konva"
footer-hide
:query="routerInfo.query"
width="1400"
width="1200"
@on-cancel="closeModal"
>
<span slot="title" v-if="false"></span>
Expand Down

0 comments on commit 72efcfc

Please sign in to comment.