qrcode.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.id" :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 @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.id" :src="require(`@/assets/images/project/qrcode/${tmpPano.id}.jpg`)" alt="" /> -->
  35. <img :src="require(`@/assets/images/project/qrcode/11.jpg`)" alt="" />
  36. <div @click="download(tmpPano.id, 'qrpg_')" class="download">下载二维码</div>
  37. </div>
  38. <div class="li" v-if="currentItem.id">
  39. <img :src="require(`@/assets/images/project/qrcode/11.jpg`)" alt="" />
  40. <p v-html="currentItem.name"></p>
  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/raw.js";
  49. import qrcodetl from "@/components/qrcodetl/index.vue";
  50. import domtoimage from "dom-to-image";
  51. export default {
  52. props: ["currentPano", "currentItem"],
  53. data() {
  54. return {
  55. isShowUl: false,
  56. tmpPano: this.currentPano,
  57. };
  58. },
  59. components: { qrcodetl },
  60. computed: {
  61. currentPanoArr: function() {
  62. let tmp = Booth.filter((item) => item.panoId == this.currentPano.panoId);
  63. return tmp && tmp.length > 1 ? tmp : "";
  64. },
  65. },
  66. methods: {
  67. download(id = null, type = "") {
  68. var node = document.getElementById(type + id);
  69. domtoimage
  70. .toPng(node)
  71. .then(function(dataUrl) {
  72. let elink = document.createElement("a");
  73. elink.href = dataUrl;
  74. elink.download = `poster.png`;
  75. elink.click();
  76. document.body.removeChild(elink);
  77. })
  78. .catch(function(error) {
  79. console.error("oops, something went wrong!", error);
  80. });
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="less" scoped>
  86. @w: 1096px;
  87. @fixw: 8px;
  88. .qrcode {
  89. width: @w;
  90. position: relative;
  91. height: 716px;
  92. pointer-events: none;
  93. > svg {
  94. opacity: 0;
  95. }
  96. .downloadQrcon {
  97. position: fixed;
  98. top: 0;
  99. left: -100vw;
  100. }
  101. .qrcodecon {
  102. pointer-events: auto;
  103. position: absolute;
  104. top: 0;
  105. left: 0;
  106. width: 100%;
  107. height: 100%;
  108. text-align: center;
  109. padding: 34px 0 0;
  110. backdrop-filter: blur(50px) brightness(60%);
  111. clip-path: url(#svgPathdaka);
  112. > h3 {
  113. margin: 0 auto 20px;
  114. font-size: 30px;
  115. font-family: "pangmen";
  116. font-weight: normal;
  117. }
  118. .ul {
  119. background-color: rgba(0, 0, 0, 0.4);
  120. width: 90%;
  121. margin: 0 auto;
  122. padding: 66px 30px 86px;
  123. display: flex;
  124. justify-content: center;
  125. background-repeat: no-repeat;
  126. background-position: bottom center;
  127. background-size: 100% auto;
  128. .li {
  129. text-align: center;
  130. width: 220px;
  131. margin: 0 7%;
  132. > p,
  133. .xiala {
  134. font-size: 18px;
  135. line-height: 1.5;
  136. height: 80px;
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. }
  141. .xiala {
  142. position: relative;
  143. > span {
  144. border: 1px solid #fff;
  145. display: inline-block;
  146. border-radius: 4px;
  147. width: 100%;
  148. padding: 10px 30px 10px 10px;
  149. position: relative;
  150. cursor: pointer;
  151. overflow: hidden;
  152. text-overflow: ellipsis;
  153. white-space: nowrap;
  154. > img {
  155. position: absolute;
  156. right: 12px;
  157. transform: rotate(90deg);
  158. top: 33%;
  159. width: 8px;
  160. }
  161. }
  162. > ul {
  163. position: absolute;
  164. top: 90%;
  165. padding: 0 10px;
  166. width: 100%;
  167. z-index: 99;
  168. clip-path: none !important;
  169. border-radius: 4px;
  170. overflow: hidden;
  171. height: auto;
  172. > li {
  173. text-align: left;
  174. line-height: 1.5;
  175. border-bottom: dashed 1px #fff;
  176. padding: 10px 0;
  177. cursor: pointer;
  178. font-size: 16px;
  179. &:last-of-type {
  180. border-bottom: none;
  181. }
  182. }
  183. }
  184. }
  185. > img {
  186. width: 100%;
  187. margin: 10px 0 40px;
  188. }
  189. .download {
  190. border: 1px solid #fff;
  191. background-color: rgba(255, 255, 255, 0.4);
  192. line-height: 60px;
  193. height: 60px;
  194. width: 100%;
  195. border-radius: 4px;
  196. cursor: pointer;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. </style>