jSignature做手动签名,canvas支持触摸屏的签名涂鸦插件
整理的前面可以用的:
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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | <! doctype html> < html lang="en"> < head > < meta charset="UTF-8"> < title >签名记录</ title > < meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"> < script src="__PUBLIC__/mob/js/jquery-1.9.1.min.js"></ script > < script src="__PUBLIC__/mob/js/jq-signature.js"></ script > </ head > < style > *{padding:0;margin:0;} body{background:#eee;} .contents{padding:10px; background:#fff; font-size:13px; color:#333; line-height:24px;} .form-label{line-height:40px; padding:5px;} .form-field{background:#fff;} .butt{padding:5px 10px;} .butt button{padding:10px 20px; background:#eee; border:none; border-radius:5px;} .inputsu{padding-bottom:10px;} .inputsu input{height:50px;line-height:50px;margin-left:10px; border:1px solid #c3c3c3; padding-left:5px;border-radius:5px; width:290px;} .subdiv input{width:98%;margin-left:1%;background:#0a8ddf;text-align:center;height:44px;line-height:44px; border:none;margin-top:10px;border-radius:5px;color:#fff;font-size:16px;} .wentitle{line-height:32px;font-size:14px;color:#333;text-align:center;background:#fff;border-bottom:1px solid #eee;} .headtop{height:10px;width:100%;background:#0a8ddf;} .bodybj{background:#000;height:100%;width:100%;position:fixed;opacity:.3;display:none;} .contents img{width:100% !important;height: auto !important;} .loading{ width: 100%; height: 15px; margin: 0 auto; text-align: center; position:absolute; bottom:60px; } .loading span{ display: inline-block; width: 15px; height: 100%; margin-right: 5px; background: lightgreen; -webkit-animation: load 1.04s ease infinite; } .loading span:last-child{ margin-right: 0px; } @-webkit-keyframes load{ 0%{ opacity: 1; } 100%{ opacity: 0; } } .loading span:nth-child(1){ -webkit-animation-delay:0.13s; } .loading span:nth-child(2){ -webkit-animation-delay:0.26s; } .loading span:nth-child(3){ -webkit-animation-delay:0.39s; } .loading span:nth-child(4){ -webkit-animation-delay:0.52s; } .loading span:nth-child(5){ -webkit-animation-delay:0.65s; } </ style > < body > < div class="bodybj"> < div class="loading"> < span ></ span > < span ></ span > < span ></ span > < span ></ span > < span ></ span > </ div > </ div > < div class="headtop"> </ div > < div class="wentitle">{$info["title"]}</ div > < div class="contents"> {$info["content"]} </ div > < label class="form-label">签名区(请在以下虚框区域内签名)</ label > < div class="form-field"> < div class="container"> < div class="js-signature" style="margin-left:10px; width:300px;" data-width="100" data-height="100px" data-border="1px dashed #ccc" data-background="#fff" data-line-color="#000" data-auto-fit="true"> </ div > < div class="butt"> < button id="clearBtn" onclick="clearCanvas();">重签</ button > < button id="saveBtn" onclick="saveSignature();" disabled>确认</ button > </ div > < div class="inputsu">< input type="text" name="username" placeholder="输入姓名"></ div > < div class="inputsu">< input type="text" name="depart" placeholder="所在部门"></ div > < input type="hidden" name="img" id="imgpic" > < input type="hidden" name="signid" value="{$info['id']}" > < input type="hidden" name="type" value="{$type}" > < div id="signature" style="background:red;"> </ div > </ div > </ div > < div class="subdiv">< input type="button" class="submit" value="提交"></ div > < script type="text/javascript"> $(document).on('ready', function() { $('.js-signature').jqSignature(); }); function clearCanvas() { $('#signature').html('< p >< em >Your signature will appear here when you click "Save Signature"</ em ></ p >'); $('.js-signature').jqSignature('clearCanvas'); $('#saveBtn').attr('disabled', true); } function saveSignature() { } $('.js-signature').on('jq.signature.changed', function() { $('#saveBtn').attr('disabled', false); }); $(".submit").click(function() { $(".bodybj").show(); $('#signature').empty(); var dataUrl = $('.js-signature').jqSignature('getDataURL'); $.ajax({ type: "post", url: "/Mob/index/uploadimg", data: {file:dataUrl}, dataType: "json", success: function(data){ if(data.code==1){ var img=data.msg; var username=$("input[name=username]").val(); var depart=$("input[name=depart]").val(); var signid=$("input[name=signid]").val(); var type=$("input[name=type]").val(); if(username.length< 1 ){ alert("请填写姓名"); $(".bodybj").hide(); return false; } if(depart.length<1){ alert("请填写部分"); $(".bodybj").hide(); return false; } $.ajax({ type: "post", url: "/Mob/index/addsig", data: {img:img,username:username,signid:signid,type:type,depart:depart}, dataType: "json", success: function(data){ $(".bodybj").hide(); alert("签名成功!"); window.location.reload(); } }); }else{ $(".bodybj").hide(); alert("签名失败") } } }); }) </script> </ body > </ html > |
可以借鉴:https://www.cnblogs.com/zhuyupingit/p/6650550.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现