如何在SAP UI5主从模板中开发数字签名?

2020-09-14 15:41发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)专家们, 我有一个要求,即在主...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


专家们,

我有一个要求,即在主从模板上进行数字签名。

能否请您分享一些有关该开发的代码

我使用了此链接

https://blogs.sap.com/2017/05/31/sapui5-digital-signature-pad/在Eclipse视图和Web ide index.html文件上都可以正常工作。 但无法在网络视图上使用,请给我一些建议。

7条回答
小灯塔
2020-09-14 16:28

我有上述问题的解决方案,请找到

在Xml视图中
 
 
 <!-->

 
  
 
 
 

 
 <!-->
 
 
 

 <!-
 <!-change =" onChange" uploadComplete =" handleUploadComplete"/>->

 <!- ->

 
 

 在控制器中:

 onInit:function(){
 调试器;
 this.getView()。byId(" html")。setContent("  ");

 },

///****************** Signature Pad Draw ************************/
 onSign:function(oEvent){
 var canvas = document.getElementById(" signature-pad");
 var context = canvas.getContext(" 2d");
 canvas.width = 300;
 canvas.height = 200;
 context.fillStyle ="#F0FFFF";
 context.strokeStyle ="#444";
 context.lineWidth = 1.5;
 context.lineCap ="圆形";
 context.fillRect(0,0,canvas.width,canvas.height);
 var disableSave = true;
 var pixel = [];
 var cpixels = [];
 var xyLast = {};
 var xyAddLast = {};
 var compute = false;  {//功能
 函数remove_event_listeners(){
 canvas.removeEventListener('mousemove',on_mousemove,false);
 canvas.removeEventListener('mouseup',on_mouseup,false);
 canvas.removeEventListener('touchmove',on_mousemove,false);
 canvas.removeEventListener('touchend',on_mouseup,false);
 document.body.removeEventListener('mouseup',on_mouseup,false);
 document.body.removeEventListener('touchend',on_mouseup,false);
 }
 函数get_coords(e){
 var x,y;
 如果(e.changedTouches && e.changedTouches [0]){
 var offsety = canvas.offsetTop ||  0;
 var offsetx = canvas.offsetLeft ||  0;
 x = e.changedTouches [0] .pageX-offsetx;
 y = e.changedTouches [0] .pageY-偏移量;
 } else if(e.layerX || 0 == e.layerX){
 x = e.layerX;
 y = e.layerY;
 } else if(e.offsetX || 0 == e.offsetX){
 x = e.offsetX;
 y = e.offsetY;
 }
 返回{
 x:x,
 y:y
 };
 };
 函数on_mousedown(e){
 e.preventDefault();
 e.stopPropagation();
 canvas.addEventListener('mouseup',on_mouseup,false);
 canvas.addEventListener('mousemove',on_mousemove,false);
 canvas.addEventListener('touchend',on_mouseup,false);
 canvas.addEventListener('touchmove',on_mousemove,false);
 document.body.addEventListener('mouseup',on_mouseup,false);
 document.body.addEventListener('touchend',on_mouseup,false);
 var empty = false;
 var xy = get_coords(e);
 context.beginPath();
 pixel.push('moveStart');
 context.moveTo(xy.x,xy.y);
 pixel.push(xy.x,xy.y);
 xyLast = xy;
 };
 函数on_mousemove(e,finish){
 e.preventDefault();
 e.stopPropagation();
 var xy = get_coords(e);
 var xyAdd = {
 x:(xyLast.x + xy.x)/2,
 y:(xyLast.y + xy.y)/2
 };
 如果(计算){
 var xLast =(xyAddLast.x + xyLast.x + xyAdd.x)/3;
 var yLast =(xyAddLast.y + xyLast.y + xyAdd.y)/3;
 pixel.push(xLast,yLast);
 }其他{
 计算=真;
 }
 context.quadraticCurveTo(xyLast.x,xyLast.y,xyAdd.x,xyAdd.y);
 pixel.push(xyAdd.x,xyAdd.y);
 context.stroke();
 context.beginPath();
 context.moveTo(xyAdd.x,xyAdd.y);
 xyAddLast = xyAdd;
 xyLast = xy;
 };
 函数on_mouseup(e){
 remove_event_listeners();
 disableSave = false;
 context.stroke();
 pixel.push('e');
 计算=假;
 };
 canvas.addEventListener('touchstart',on_mousedown,false);
 canvas.addEventListener('mousedown',on_mousedown,false);
 }
 },
 

一周热门 更多>