123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <title>签名</title>
- <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
- <script type="text/javascript" src="js/layer/layer.js"></script>
- <script type="text/javascript" src="js/Signature/jSignature.js"></script>
- <style type="text/css">
- body {
- position: absolute;
- top: 0;
- bottom: 0;
- right: 0;
- left: 0;
- }
- h3 {
- margin: 5px auto;
- font-size: 22px;
- color: #515e7e;
- word-break: break-all;
- }
- .inputbtn {
- display: inline-block;
- width: 100px;
- height: 52px;
- border-radius: 5px;
- font-size: 16px;
- font-weight: bold;
- vertical-align: middle;
- line-height: 52px;
- text-align: center;
- margin-top: 10px;
- border: none;
- background-color: #108EE9;
- color: #FFFFFF;
- }
- .inputbtn:hover {
- cursor: pointer;
- background-color: crimson;
- }
- </style>
- </head>
- <body>
- <h3>请在下方签名</h3>
- <div id="signature" style="border: 1px dashed #000; width: calc(100%); height: calc(100% - 150px);"></div>
- <div id="tools" style="text-align: center; width: 100%;">
- <input id="clear" class="inputbtn " type="button" value="清除">
- <input id="btnSignConfirm" class="inputbtn " type="button" value="确认完成">
- </div>
- <script type="text/javascript" charset="utf-8">
- $(document).ready(function () {
- $("#signature").jSignature({
- 'width': '100%',
- 'height': '100%'
- });
- });
- $("#clear").bind('click', function () {
- $("#signature").jSignature("reset");
- });
- $("#btnSignConfirm").bind('click', function () {
- var datapair = $("#signature").jSignature("getData", "image");
- var array = datapair.splice(",");
- var data = $("#signature").jSignature('getData', 'image');
- var hasimg = $("#signature").jSignature('getData', 'native').length;
- var signbase64 = "";
- if (hasimg == 0) {
- var strdivyy = '<div ><p class="auto-close">未签字,请先签字!</p></div>';
- layer.open({
- type: 1,
- title: "温馨提示",
- area: ['400px', '200px'],
- content: strdivyy,
- skin: 'layer-ext-iframe',
- move: false,
- btn: "",
- time: 2000
- });
- } else {
- //获取签字图片的base64
- if (typeof data === 'string') {
- signbase64 = data.replace('image/png;base64,', '');
- } else if ($.isArray(data) && data.length === 2) {
- signbase64 = data.join(',').replace('image/png;base64,', '');
- } else {
- signbase64 = "";
- }
- if (successfunc) {
- successfunc(signbase64);
- }
- }
- });
- function successfunc(signbase64) {
- var load = layer.msg("提交中,请稍等", {
- icon: 16,
- shade: [0.1, '#fff'],
- time: false //取消自动关闭
- });
- $.ajax({
- url: '../DataHandle.ashx',
- type: 'POST',
- async: false,
- data: {
- "InitType": "updateSign",
- "RowGuid": "b8a694b2-984e-4a3c-9961-a300a8e13f0f",
- "tno": "794027",
- "Sign": signbase64
- },
- dataType: 'json',
- contentType: "application/x-www-form-urlencoded; charset=utf-8",
- success: function (data) {
- if (data.Flag) {
- layer.closeAll();
- layer.alert("签名成功,请关闭!");
- $("#clear").unbind('click');
- $("#btnSignConfirm").unbind('click');
- }
- else {
- layer.alert(data.Message);
- }
- },
- error: function (err) {
- layer.alert('系统异常!');
- console.error(err);
- }
- });
- }
- </script>
- </body>
- </html>
|