canvas.html
4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>签名页</title>
<script src="__CDN__/assets/js/signature.js"></script>
<script src="__CDN__/assets/js/jquery-3.4.1.min.js"></script>
</head>
<body style="margin: 0;">
<div class="popverBox">
<div class="titleBox">项目审核</div>
<div id="signSure" class="signSure">
<input type="hidden" name="id" id="id" value="{$id}">
<div class="topBtnBox">
<div class="topTitle">电子签名</div>
<canvas class="whiteBord" id="whiteBord">
您的浏览器不支持canvas技术,请升级浏览器!
</canvas>
</div>
<div>
<div class="topTitle">审核意见</div>
<textarea class="opinion" placeholder="输入审核意见,不超过200个字" name="opinion" id="opinion"></textarea>
</div>
<div class="bottomBtnBox">
<button class="primaryBtn" id="againWrite">重写</button>
<button class="primaryBtn activeBtn" id="sureWrite">通过</button>
<button class="primaryBtn backBtn" id="back">退回</button>
</div>
</div>
</div>
</body>
<script>
function sureWriteCallback(imageBase64,type){
// 签名完成后的的逻辑代码
$.ajax({
type : "POST", //提交方式
url : "canvas",//路径
data : {
"imgbase64" : imageBase64,
'type' : type,
'id' : $('#id').val(),
'opinion' : $('#opinion').val()
},//数据,这里使用的是Json格式进行传输
success:function (data) {
console.log('成功');
alert(data.msg)
},
error:function (data) {
console.log('失败')
alert(data.msg)
}
})
}
let params = {
whiteBord:'whiteBord',//canvas标签的id名称
againWrite:'againWrite',//重写按钮id名
sureWrite:'sureWrite',//确认按钮id名
back:'back',//退回按钮id名
whiteBordPtions:{},//白板的配置项(空对象时取默认值)
sureWriteCallback,// 签名完成后的回调函数
}
signature(params) // signature.js里封装好的函数,把参数传进去,调用一下即可
</script>
<style>
.popverBox{
background: #f2f2f2;
position: relative;
font-size: 30px;
display: flex;
align-items: center;
flex-direction: column;
height: 100vh;
}
.signSure{
width: 90%;
border-radius: 16px;
padding: 20px 12px 28px 12px;
}
.titleBox{
color: #fff;
background-color: #4285dc;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 7rem;
font-size: 2.5rem;
}
.topTitle{
margin: 20px 0 12px 12px;
font-size: 2.3rem;
}
.whiteBord{
width: 100%;
height: 400px;
border: 1px solid #000;
background: #fff;
margin: 0 auto;
border-radius: 4px;
margin-bottom: 12px;
}
.bottomBtnBox{
padding: 60px 7px;
display: flex;
justify-content: space-between;
}
.primaryBtn{
width: 25%;
height: 80px;
color: #666;
border: 1px solid #ccc;
border-radius: 4px;
background: #fff;
font-size: 30px;
}
.activeBtn{
/*background: #315294;*/
background: rgb(38,198,218);
color: #fff;
border: none;
}
.backBtn{
/*background: #315294;*/
background: rgb(252,75,108);
color: #fff;
border: none;
}
.opinion{
width: 100%;
height: 235px;
font-size: 30px;
border: 1px solid #000;
}
.opinion::-webkit-input-placeholder{
line-height: 235px;text-align: center;
}/* 使用webkit内核的浏览器 */
.opinion:-moz-placeholder{
line-height: 235px;text-align: center;
}/* Firefox版本4-18 */
.opinion::-moz-placeholder{
line-height: 235px;text-align: center;
}/* Firefox版本19+ */
.opinion:-ms-input-placeholder{
line-height: 235px;text-align: center;
}
</style>
</html>