meansprint.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // $scope.printDiv = function() {
  2. // $(".qrcanvas").empty();
  3. // angular.forEach(selected.items,function(item){
  4. function $(selector) {
  5. return document.querySelector(selector);
  6. }
  7. var q= $('.qrcanvas');
  8. var canvas;
  9. var colorIn = "#191970";
  10. var colorOut = "#cd5c5c";
  11. var colorFore = "#4169e1";
  12. var colorBack = "#ffffff";
  13. var options = {
  14. cellSize: 4,
  15. foreground: [
  16. // foreground color
  17. {style: colorFore},
  18. // outer squares of the positioner
  19. {row: 0, rows: 7, col: 0, cols: 7, style: colorOut},
  20. {row: -7, rows: 7, col: 0, cols: 7, style: colorOut},
  21. {row: 0, rows: 7, col: -7, cols: 7, style: colorOut},
  22. // inner squares of the positioner
  23. {row: 2, rows: 3, col: 2, cols: 3, style: colorIn},
  24. {row: -5, rows: 3, col: 2, cols: 3, style: colorIn},
  25. {row: 2, rows: 3, col: -5, cols: 3, style: colorIn},
  26. ],
  27. background: colorBack,
  28. data: "1232",
  29. typeNumber: 1,
  30. };
  31. var effect = 'none';
  32. if (effect !== 'none') {
  33. options.effect = {key: effect, value: 1};
  34. if (effect === 'image') {
  35. options.background = [colorBack, effectImg];
  36. }
  37. }
  38. // $scope.q.tital=item.uuid;
  39. // $scope.q.textContent=item.uuid;
  40. options.reuseCanvas = canvas;
  41. canvas = qrgen.canvas(options);
  42. // canvas.outerText=item.uuid;
  43. // $scope.q.innerHTML=$scope.q.innerHTML+"<div class='col-md-2'>"+item.uuid+"</div>"
  44. q.appendChild(canvas);
  45. angular.element("canvas").addClass("canvasclass")
  46. // })
  47. // }