qrcode.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <div class="qrcode">
  3. <svg height="0" width="0">
  4. <defs>
  5. <clipPath id="svgPathdaka">
  6. <path
  7. d="M2601-173.034h-39.568l4.886-19.115h-19l-4.886,19.115h-9.773l4.886-19.115h-19l-4.886,19.115h-9.773l4.886-19.115h-19l-4.886,19.115h-12.454l4.886-19.115h-19l-4.886,19.115h-9.773l4.886-19.115h-19l-4.886,19.115h-9.773l4.886-19.115h-19l-4.886,19.115H1571.815L1505-239.851V-889.034h53.886L1554-869.919h19l4.886-19.115h9.773l-4.886,19.115h19l4.886-19.115h9.773l-4.887,19.115h19l4.887-19.115h12.454L1643-869.919h19l4.886-19.115h9.773l-4.886,19.115h19l4.886-19.115h9.773l-4.886,19.115h19l4.887-19.115h767.752L2601-780.219v607.184Z"
  8. transform="translate(-1505 889.034)"
  9. />
  10. </clipPath>
  11. </defs>
  12. </svg>
  13. <div class="downloadQrcon">
  14. <qrcodetl v-if="tmpPano" :id="'qrpg_' + tmpPano.panoId" :data="tmpPano" />
  15. <qrcodetl v-if="currentItem" :id="'qrpgc_' + currentItem.id" :data="currentItem" />
  16. </div>
  17. <div class="qrcodecon">
  18. <h3>扫描二维码,手机观展</h3>
  19. <div class="ul" :style="{ backgroundImage: `url(${require(`@/assets/images/proj2022/pc/bg_r_s.png`)})` }">
  20. <div class="li" v-if="tmpPano.name">
  21. <template v-if="tmpPano.name">
  22. <p v-if="!currentPanoArr" v-html="tmpPano.name || ''"></p>
  23. <div v-else class="xiala">
  24. <span :title="tmpPano.name" @click="isShowUl = !isShowUl">
  25. {{ tmpPano.name }}
  26. <img :src="require(`@/assets/images/project/icon/jiantour.png`)" alt="" />
  27. </span>
  28. <ul class="brightness" v-if="isShowUl">
  29. <li v-html="item.name" @click="(isShowUl = false), (tmpPano = item)" v-for="(item, i) in currentPanoArr" :key="i"></li>
  30. </ul>
  31. </div>
  32. </template>
  33. <p v-else></p>
  34. <img v-if="tmpPano.panoId" :src="require(`@/assets/images/project/qrcode/${tmpPano.panoId}.jpg`)" alt="" />
  35. <!-- <img :src="require(`@/assets/images/project/qrcode/11.jpg`)" alt="" /> -->
  36. <div @click="download(tmpPano.panoId, 'qrpg_')" class="download">下载二维码</div>
  37. </div>
  38. <div class="li" v-if="currentItem.id">
  39. <p v-html="currentItem.desc"></p>
  40. <img :src="require(`@/assets/images/project/qrcode/${currentItem.id}.jpg`)" alt="" />
  41. <div @click="download(currentItem.id, 'qrpgc_')" class="download">下载二维码</div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import { Booth } from "@/data/booth.js";
  49. let all_booth = [];
  50. Booth.forEach((item) => {
  51. all_booth = all_booth.concat(item.company);
  52. });
  53. console.log(all_booth);
  54. import qrcodetl from "@/components/qrcodetl/index.vue";
  55. import domtoimage from "dom-to-image";
  56. export default {
  57. props: ["currentPano", "currentItem"],
  58. data() {
  59. return {
  60. isShowUl: false,
  61. tmpPano: this.currentPano,
  62. };
  63. },
  64. components: { qrcodetl },
  65. computed: {
  66. currentPanoArr: function() {
  67. let tmp1 = all_booth.filter((item) => item.panoId == this.currentPano.panoId);
  68. let tmp = tmp1.map((item, idx) => {
  69. return {
  70. ...item,
  71. panoId: idx > 0 ? `${item.panoId}_${idx}` : item.panoId,
  72. };
  73. });
  74. return tmp && tmp.length > 1 ? tmp : "";
  75. },
  76. },
  77. methods: {
  78. download(id = null, type = "") {
  79. var node = document.getElementById(type + id);
  80. domtoimage
  81. .toPng(node)
  82. .then(function(dataUrl) {
  83. let elink = document.createElement("a");
  84. elink.href = dataUrl;
  85. elink.download = `poster.png`;
  86. elink.click();
  87. document.body.removeChild(elink);
  88. })
  89. .catch(function(error) {
  90. console.error("oops, something went wrong!", error);
  91. });
  92. },
  93. },
  94. };
  95. </script>
  96. <style lang="less" scoped>
  97. @w: 1096px;
  98. @fixw: 8px;
  99. .qrcode {
  100. width: @w;
  101. position: relative;
  102. height: 716px;
  103. pointer-events: none;
  104. > svg {
  105. opacity: 0;
  106. }
  107. .downloadQrcon {
  108. position: fixed;
  109. top: 0;
  110. left: -100vw;
  111. }
  112. @supports (backdrop-filter: brightness(60%)) {
  113. .qrcodecon {
  114. backdrop-filter: blur(50px) brightness(60%) !important;
  115. background-color: rgba(0, 0, 0, 0) !important;
  116. }
  117. }
  118. .qrcodecon {
  119. pointer-events: auto;
  120. position: absolute;
  121. top: 0;
  122. left: 0;
  123. width: 100%;
  124. height: 100%;
  125. text-align: center;
  126. padding: 34px 0 0;
  127. background-color: rgba(0, 0, 0, 0.5);
  128. clip-path: url(#svgPathdaka);
  129. > h3 {
  130. margin: 0 auto 20px;
  131. font-size: 30px;
  132. font-family: "pangmen";
  133. font-weight: normal;
  134. }
  135. .ul {
  136. background-color: rgba(0, 0, 0, 0.4);
  137. width: 90%;
  138. margin: 0 auto;
  139. padding: 66px 30px 86px;
  140. display: flex;
  141. justify-content: center;
  142. background-repeat: no-repeat;
  143. background-position: bottom center;
  144. background-size: 100% auto;
  145. .li {
  146. text-align: center;
  147. width: 220px;
  148. margin: 0 7%;
  149. > p,
  150. .xiala {
  151. font-size: 18px;
  152. line-height: 1.5;
  153. height: 80px;
  154. display: flex;
  155. align-items: center;
  156. justify-content: center;
  157. }
  158. .xiala {
  159. position: relative;
  160. > span {
  161. border: 1px solid #fff;
  162. display: inline-block;
  163. border-radius: 4px;
  164. width: 100%;
  165. padding: 10px 30px 10px 10px;
  166. position: relative;
  167. cursor: pointer;
  168. overflow: hidden;
  169. text-overflow: ellipsis;
  170. white-space: nowrap;
  171. > img {
  172. position: absolute;
  173. right: 12px;
  174. transform: rotate(90deg);
  175. top: 33%;
  176. width: 8px;
  177. }
  178. }
  179. > ul {
  180. position: absolute;
  181. top: 90%;
  182. padding: 0 10px;
  183. width: 100%;
  184. z-index: 99;
  185. clip-path: none !important;
  186. border-radius: 4px;
  187. overflow: hidden;
  188. height: auto;
  189. > li {
  190. text-align: left;
  191. line-height: 1.5;
  192. border-bottom: dashed 1px #fff;
  193. padding: 10px 0;
  194. cursor: pointer;
  195. font-size: 16px;
  196. &:last-of-type {
  197. border-bottom: none;
  198. }
  199. }
  200. }
  201. }
  202. > img {
  203. width: 100%;
  204. margin: 10px 0 40px;
  205. }
  206. .download {
  207. border: 1px solid #fff;
  208. background-color: rgba(255, 255, 255, 0.4);
  209. line-height: 60px;
  210. height: 60px;
  211. width: 100%;
  212. border-radius: 4px;
  213. cursor: pointer;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. </style>