Files
2025-02-20 14:58:55 +08:00

79 行
2.3 KiB
Plaintext

<style>
body{ text-align:center}
.div{ margin:0 auto; width:600px; height:300px; border:5px solid #F00}
</style>
<script>
function doCancel()
{//取消
Z("#divImg").remove()
}
function doSubmit(type)
{
var data = Z("#imgData").text()
if (Z.Validates.isEmpty(data))
{
Z.alert("请截图后,在提交")
return;
}
parent.doUploadOcrImage(data, "png", function(){parent.Z.Dialog.close();});
}
(function(){
var imgReader = function( item ){
var blob = item.getAsFile(),
reader = new FileReader();
// 读取文件后将其显示在网页中
reader.onload = function(e){
var img = new Image();
var result = e.target.result;
Z("#imgData").text(result);
img.src = result;
img.id = "divImg";
Z("#imgSrc").append(img);
};
// 读取文件
reader.readAsDataURL(blob);
};
window.addEventListener( 'paste', function(e){
// 添加到事件对象中的访问系统剪贴板的接口
var clipboardData = e.clipboardData,
i = 0,
items, item, types;
if(clipboardData){
items = clipboardData.items;
if( !items ){
return;
}
item = items[0];
// 保存在剪贴板中的数据类型
types = clipboardData.types || [];
for( ; i < types.length; i++ ){
if( types[i] === 'Files' ){
item = items[i];
break;
}
}
// 判断是否为图片数据
if( item && item.kind === 'file' && item.type.match(/^image\//i) ){
imgReader( item );
}
}
});
})();
</script>
${zhiqim_manager_content()}
<div style="display:none" id="imgData"></div>
<div id="imgSrc"></div>
<div style="position:fixed;bottom:0px;height:50px;width:100%;background-color:#EFEFEF;border-top: solid 1px #ededed">
<div style="margin-top:10px">
<button type="button" class="z-button z-w100 ${zmr_color_class}" id="designOrderDraft" onclick="doSubmit('${type}');">提交</button>&nbsp;&nbsp;&nbsp;
<button type="button" class="z-button z-red" onclick="doCancel();">清空</button>&nbsp;
</div>
</div>
<br><br>
${zhiqim_manager_content_end()}
</html>