index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. ifShow: true,
  7. val: "二维码",
  8. // 要生成的二维码值
  9. size: 200,
  10. // 二维码大小
  11. unit: "upx",
  12. // 单位
  13. background: "#b4e9e2",
  14. // 背景色
  15. foreground: "#309286",
  16. // 前景色
  17. pdground: "#32dbc6",
  18. // 角标色
  19. icon: "",
  20. // 二维码图标
  21. iconsize: 40,
  22. // 二维码图标大小
  23. lv: 3,
  24. // 二维码容错级别 , 一般不用设置,默认就行
  25. onval: false,
  26. // val值变化时自动重新生成二维码
  27. loadMake: true,
  28. // 组件加载完成后自动生成二维码
  29. src: ""
  30. // 二维码生成后的图片地址或base64
  31. };
  32. },
  33. methods: {
  34. sliderchange(e) {
  35. this.size = e.detail.value;
  36. },
  37. creatQrcode() {
  38. this.$refs.qrcode._makeCode();
  39. },
  40. saveQrcode() {
  41. this.$refs.qrcode._saveCode();
  42. },
  43. qrR(res) {
  44. this.src = res;
  45. },
  46. clearQrcode() {
  47. this.$refs.qrcode._clearCode();
  48. this.val = "";
  49. },
  50. ifQrcode() {
  51. this.ifShow = !this.ifShow;
  52. },
  53. selectIcon() {
  54. let that = this;
  55. common_vendor.index.chooseImage({
  56. count: 1,
  57. //默认9
  58. sizeType: ["original", "compressed"],
  59. //可以指定是原图还是压缩图,默认二者都有
  60. sourceType: ["album"],
  61. //从相册选择
  62. success: function(res) {
  63. that.icon = res.tempFilePaths[0];
  64. setTimeout(() => {
  65. that.creatQrcode();
  66. }, 100);
  67. }
  68. });
  69. }
  70. }
  71. };
  72. if (!Array) {
  73. const _easycom_geek_qrcode2 = common_vendor.resolveComponent("geek-qrcode");
  74. _easycom_geek_qrcode2();
  75. }
  76. const _easycom_geek_qrcode = () => "../../../components/geek-xd/components/geek-qrcode/geek-qrcode.js";
  77. if (!Math) {
  78. _easycom_geek_qrcode();
  79. }
  80. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  81. return common_vendor.e({
  82. a: $data.ifShow
  83. }, $data.ifShow ? {
  84. b: common_vendor.sr("qrcode", "25c1dd0f-0"),
  85. c: common_vendor.o($options.qrR),
  86. d: common_vendor.p({
  87. cid: "qrcode1",
  88. val: $data.val,
  89. size: $data.size,
  90. unit: $data.unit,
  91. background: $data.background,
  92. foreground: $data.foreground,
  93. pdground: $data.pdground,
  94. icon: $data.icon,
  95. iconSize: $data.iconsize,
  96. lv: $data.lv,
  97. onval: $data.onval,
  98. loadMake: $data.loadMake,
  99. usingComponents: true
  100. })
  101. } : {}, {
  102. e: $data.ifShow
  103. }, $data.ifShow ? {
  104. f: common_vendor.sr("qrcode2", "25c1dd0f-1"),
  105. g: common_vendor.o($options.qrR),
  106. h: common_vendor.p({
  107. cid: "qrcode2",
  108. val: "第二个二维码",
  109. size: $data.size,
  110. onval: $data.onval,
  111. loadMake: $data.loadMake,
  112. usingComponents: true
  113. })
  114. } : {}, {
  115. i: $data.val,
  116. j: common_vendor.o(($event) => $data.val = $event.detail.value),
  117. k: $data.size,
  118. l: common_vendor.o((...args) => $options.sliderchange && $options.sliderchange(...args)),
  119. m: common_vendor.o((...args) => $options.selectIcon && $options.selectIcon(...args)),
  120. n: common_vendor.o((...args) => $options.creatQrcode && $options.creatQrcode(...args)),
  121. o: common_vendor.o((...args) => $options.saveQrcode && $options.saveQrcode(...args)),
  122. p: common_vendor.o((...args) => $options.clearQrcode && $options.clearQrcode(...args)),
  123. q: common_vendor.o((...args) => $options.ifQrcode && $options.ifQrcode(...args))
  124. });
  125. }
  126. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "C:/Users/Administrator/Desktop/srcaaa/pages_geek/pages/code/index.vue"]]);
  127. wx.createPage(MiniProgramPage);