Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
note-library
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d673f9c8
authored
May 12, 2020
by
肖康
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
x
parent
f088f2e0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
4 deletions
public/css/style.css
public/img/bc.jpg
resources/views/web/design.blade.php
resources/views/web/record.blade.php
resources/views/web/showPage.blade.php
public/css/style.css
View file @
d673f9c8
...
...
@@ -8679,9 +8679,11 @@ body.md-skin {
.edit-box
{
background
:
#fff
;
border
:
1px
solid
#000
;
padding
:
30
px
;
padding
:
43
px
;
margin-top
:
20px
;
box-sizing
:
initial
;
background
:
url(../img/bc.jpg)
no-repeat
;
background-position
:
0px
0px
;
}
.edit-con
{
...
...
public/img/bc.jpg
0 → 100644
View file @
d673f9c8
31.3 KB
resources/views/web/design.blade.php
View file @
d673f9c8
...
...
@@ -53,7 +53,7 @@
</div>
</div>
<div
class=
"fztip"
>
每个辅助格子20px*20px,从左上角开始,横向为X轴,纵向为Y轴
</div>
<div
class=
"fztip"
>
每个辅助格子20px*20px,从左上角开始,横向为X轴,纵向为Y轴
,标尺每个刻度10px,标尺实际像素需要刻度值*10
</div>
<div
class=
"fztip"
style=
"color:red;"
>
双击删除编辑区域内标签工具
</div>
<div
class=
"fztip"
><span
style=
"color:red;"
>
颜色选择器,复制此处颜色可用
</span><input
type=
"text"
id=
"colorpicker"
/></div>
...
...
resources/views/web/record.blade.php
View file @
d673f9c8
...
...
@@ -53,7 +53,7 @@
<script
type=
"text/html"
id=
"action"
>
<
a
class
=
"btn btn-xs btn-outline btn-info"
href
=
"/web/showPage?tmpl_relation_id=@{{ d.id }}"
target
=
"_blank"
lay
-
event
=
"offline"
>
预览
<
/a>
<
a
class
=
"btn btn-xs btn-outline btn-success"
href
=
"/web/
editLabel?t
_id=@{{ d.id }}"
target
=
"_blank"
>
下载
<
/a>
<
a
class
=
"btn btn-xs btn-outline btn-success"
href
=
"/web/
showPage?tmpl_relation
_id=@{{ d.id }}"
target
=
"_blank"
>
下载
<
/a>
{{
--
@{{
#
if
(
d
.
status
==
-
1
)
{
}}
--
}}
{{
--<
a
class
=
"btn btn-xs btn-outline layui-btn-primary"
lay
-
event
=
"enable"
>
启用
<
/a>--}}
{{
--
@{{
#
}
else
{
}}
--
}}
...
...
resources/views/web/showPage.blade.php
View file @
d673f9c8
{
!!
$html
!!
}
<
br
/>
<
div
style
=
"border-top:1px solid #ccc;margin-top:20px;margin-bottom:20px;"
></
div
>
<
a
class
="
downpng
layui
-
btn
" target="
_blank
" href="" download="
downImg
">下载</a>
<script src="
https
://
cdn
.
bootcdn
.
net
/
ajax
/
libs
/
html2canvas
/
0.5
.
0
-
beta4
/
html2canvas
.
js
"></script>
<script>
// alert(567)
//创建一个新的canvas
var canvas2 = document.createElement("
canvas
");
var _canvas = document.querySelector('.edit-con');
var w = parseInt(window.getComputedStyle(_canvas).width);
var h = parseInt(window.getComputedStyle(_canvas).height);
//将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了
canvas2.width = w+Number($("
.
edit
-
con
").css("
borderWidth
").split("
px
")[0])*2;
canvas2.height = h+Number($("
.
edit
-
con
").css("
borderWidth
").split("
px
")[0])*2;
// canvas2.style.width = w + "
px
";
// canvas2.style.height = h + "
px
";
//可以按照自己的需求,对context的参数修改,translate指的是偏移量
var context = canvas2.getContext("
2
d
");
context.translate(-$("
.
edit
-
con
").offset().left,-$("
.
edit
-
con
").offset().top);
// var context = canvas2.getContext("
2
d
");
// context.scale(2, 2);
html2canvas(document.querySelector('.edit-con'), { canvas: canvas2 }).then(function(canvas) {
//document.body.appendChild(canvas);
//canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载
document.querySelector("
.
downpng
").setAttribute('href', canvas.toDataURL());
});
</script>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment