multiple.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <div class="multiple">
  3. <div class="images">
  4. <div class="img-con">
  5. <span v-if="hotspot[type].length > 1" @click="handlePage('prev')">
  6. <img :src="require('@/assets/images/pano/hotspot/left.png')" alt="" />
  7. </span>
  8. <img v-if="type == 'images'" v-viewer :src="g_dealUrl(hotspot[type][active])" alt="" />
  9. <iframe
  10. v-else
  11. :src="g_dealUrl(hotspot[type][active])"
  12. frameborder="0"
  13. ></iframe>
  14. <span v-if="hotspot[type].length > 1" @click="handlePage('next')">
  15. <img :src="require('@/assets/images/pano/hotspot/right.png')" alt="" />
  16. </span>
  17. <ul class="pagna" v-if="hotspot[type].length > 1">
  18. <li
  19. v-for="(item, i) in hotspot[type]"
  20. :class="{ active: i == active }"
  21. :key="i"
  22. ></li>
  23. </ul>
  24. </div>
  25. <div class="title" v-html="hotspot.title" v-show="0"></div>
  26. <div
  27. class="desc"
  28. v-html="
  29. handleContent(hotspot.contents[contentactive] || hotspot.contents[0], 16)
  30. "
  31. ></div>
  32. </div>
  33. <ul class="btnlist">
  34. <li @click="type = item.id" :class="{liactive:type == item.id}" v-for="(item,i) in btnlist" :key="i">
  35. <span>{{item.title}}</span>
  36. </li>
  37. </ul>
  38. </div>
  39. </template>
  40. <script>
  41. let btntype = {
  42. images:{
  43. id:'images',
  44. title:'图片',
  45. img:''
  46. },
  47. iframe:{
  48. id:'iframe',
  49. title:'电子书',
  50. img:''
  51. },
  52. model:{
  53. id:'model',
  54. title:'模型',
  55. img:''
  56. }
  57. }
  58. export default {
  59. props: ["hotspot",'count'],
  60. data() {
  61. let btnlist = this.count.map(item=>{
  62. return btntype[item]
  63. })
  64. return {
  65. active: 0,
  66. to: null,
  67. contentactive:0,
  68. type:this.count[0],
  69. mbactive: 0,
  70. btnlist
  71. };
  72. },
  73. watch: {
  74. type(newVal){
  75. if(newVal == this.count[0]){
  76. this.contentactive = 0
  77. }
  78. else{
  79. this.contentactive += this.hotspot[this.type].length
  80. }
  81. this.active = 0
  82. },
  83. active() {
  84. setTimeout(() => {
  85. this.$showLoading();
  86. });
  87. if (this.to) {
  88. clearTimeout(this.to);
  89. this.to = null;
  90. }
  91. this.to = setTimeout(() => {
  92. this.$hideLoading();
  93. }, 1500);
  94. },
  95. },
  96. beforeDestroy() {
  97. this.$hideLoading();
  98. },
  99. methods: {
  100. handlePage(type) {
  101. if (type === "next") {
  102. if (this.active >= this.hotspot[this.type].length - 1) {
  103. this.active = 0;
  104. return;
  105. }
  106. this.active += 1;
  107. this.contentactive += 1;
  108. } else {
  109. if (this.active == 0) {
  110. this.active = this.hotspot[this.type].length - 1;
  111. return;
  112. }
  113. this.active -= 1;
  114. this.contentactive -= 1;
  115. }
  116. },
  117. },
  118. mounted() {
  119. this.$showLoading();
  120. if (this.TO) {
  121. clearTimeout(this.TO);
  122. this.TO = null;
  123. }
  124. this.TO = setTimeout(() => {
  125. this.$hideLoading();
  126. }, 800);
  127. },
  128. };
  129. </script>
  130. <style lang="less" scoped>
  131. .noshow {
  132. opacity: 0 !important;
  133. pointer-events: none !important;
  134. }
  135. .multiple {
  136. width: 100%;
  137. height: 100%;
  138. position: relative;
  139. .images {
  140. width: 1410px;
  141. height: 760px;
  142. text-align: center;
  143. margin: 0 auto;
  144. position: fixed;
  145. top: 50%;
  146. left: 50%;
  147. transform: translate(-50%, -50%);
  148. border-radius: 5px;
  149. text-align: left;
  150. color: #fff;
  151. .img-con {
  152. display: flex;
  153. justify-content: space-around;
  154. align-items: center;
  155. position: relative;
  156. padding-bottom: 40px;
  157. height: calc(100% - 130px);
  158. > span {
  159. @juli: 60px;
  160. display: inline-block;
  161. padding: 0 30px;
  162. box-sizing: content-box;
  163. cursor: pointer;
  164. position: absolute;
  165. left: @juli;
  166. top: 50%;
  167. transform: translateY(-50%);
  168. > img {
  169. width: 20px;
  170. }
  171. &:last-of-type {
  172. left: unset;
  173. right: @juli;
  174. }
  175. }
  176. > img {
  177. max-width: 82%;
  178. max-height: 520px;
  179. cursor: pointer;
  180. }
  181. >iframe{
  182. width: 100%;
  183. height: 100%;
  184. }
  185. .pagna {
  186. position: absolute;
  187. bottom: 0;
  188. text-align: center;
  189. z-index: 999;
  190. > li {
  191. width: 10px;
  192. border-radius: 50%;
  193. height: 10px;
  194. background: rgba(51, 143, 123, 0.24);
  195. display: inline-block;
  196. margin: 0 4px;
  197. &.active {
  198. background: #338f7b;
  199. }
  200. }
  201. }
  202. }
  203. .title {
  204. font-weight: bold;
  205. font-size: 30px;
  206. width: 100%;
  207. padding: 0 50px;
  208. margin-bottom: 10px;
  209. text-align: center;
  210. }
  211. .desc {
  212. margin: 0 auto;
  213. width: 70%;
  214. color: #fff;
  215. text-align: justify;
  216. line-height: 1.8;
  217. max-height: 120px;
  218. overflow-y: auto;
  219. font-size: 16px;
  220. padding-right: 10px;
  221. }
  222. }
  223. .btnlist{
  224. position: absolute;
  225. right: 50px;
  226. bottom: 50px;
  227. display: inline-block;
  228. @color: #e2c59a;
  229. >li{
  230. display: inline-block;
  231. padding: 10px 20px;
  232. min-width: 150px;
  233. border-radius: 4px;
  234. margin-left: 20px;
  235. text-align: center;
  236. color: @color;
  237. border: 1px solid @color;
  238. cursor: pointer;
  239. &.liactive{
  240. background: @color;
  241. color: #fff;
  242. }
  243. }
  244. }
  245. }
  246. </style>