showCollectionMobile.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <div v-if="cItem.entity">
  3. <div class="first" v-show="!isShowDesc">
  4. <p class="title" v-if="cItem.entity.type != 'audio'">
  5. {{ cItem.entity.name }}
  6. </p>
  7. <template v-if="cItem.entity.type == 'img'">
  8. <div class="swcon swiper-container" id="imglist">
  9. <ul class="swiper-wrapper">
  10. <li
  11. class="swiper-slide"
  12. v-for="(sub, index) in cItem.file"
  13. :key="index"
  14. >
  15. <div class="sl-item">
  16. <img :src="sub.filePath" />
  17. </div>
  18. </li>
  19. </ul>
  20. </div>
  21. <template v-if="cItem.file.length > 1">
  22. <img
  23. class="vpagination left"
  24. :src="require('@/assets/images/icon/left.png')"
  25. @click="slide('slidePrev')"
  26. alt=""
  27. />
  28. <img
  29. class="vpagination right"
  30. :src="require('@/assets/images/icon/right.png')"
  31. @click="slide('slideNext')"
  32. alt=""
  33. />
  34. </template>
  35. <!-- <ul class="pagna" v-if="cItem.file.length > 1">
  36. <li
  37. v-for="(sub, i) in cItem.file"
  38. :class="{ active: i == active }"
  39. :key="i"
  40. ></li>
  41. </ul> -->
  42. </template>
  43. <template v-else>
  44. <iframe
  45. v-if="cItem.entity.type == 'model'"
  46. :src="`/model-page/model.html?m=${cItem.entity.filePath}`"
  47. frameborder="0"
  48. ></iframe>
  49. <video
  50. ref="itemvideo"
  51. controlslist="nodownload noplaybackrate"
  52. :disablePictureInPicture="true"
  53. v-else-if="cItem.entity.type == 'video'"
  54. controls
  55. :src="cItem.entity.filePath"
  56. loop
  57. autoplay
  58. ></video>
  59. <vAudio v-else :adata="cItem.entity"></vAudio>
  60. </template>
  61. <div class="bottom-area">
  62. <img
  63. class="desc"
  64. src="@/assets/images/icon/desc-mobile.png"
  65. @click="isShowDesc = true"
  66. />
  67. <img
  68. class="close"
  69. @click.stop="hideBroadcast"
  70. :src="require(`@/assets/images/icon/close.png`)"
  71. />
  72. </div>
  73. </div>
  74. <div class="second" v-show="isShowDesc">
  75. <article>
  76. <h1>
  77. {{item.entity.name}}
  78. </h1>
  79. <span class="age">
  80. {{item.entity.ageName}}
  81. </span>
  82. &nbsp;
  83. <span class="texture">
  84. {{item.entity.textureName}}
  85. </span>
  86. <p>{{item.entity.description}}</p>
  87. </article>
  88. <div class="bottom-area">
  89. <img
  90. class="close"
  91. @click="isShowDesc = false"
  92. :src="require(`@/assets/images/icon/close.png`)"
  93. />
  94. </div>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import emitter from "@/mitt/index";
  100. import vAudio from "@/components/Audio";
  101. export default {
  102. name: "showCollection",
  103. props: ["item",],
  104. data() {
  105. return {
  106. isShowDesc: false,
  107. active: 0,
  108. swInstance: null,
  109. };
  110. },
  111. components: { vAudio },
  112. computed: {
  113. cItem() {
  114. return { ...this.item };
  115. },
  116. },
  117. watch: {
  118. },
  119. methods: {
  120. slide(type) {
  121. this.swInstance[type]();
  122. },
  123. hideBroadcast() {
  124. emitter.emit("closeCollection");
  125. },
  126. },
  127. mounted() {
  128. console.log('item: ', this.item);
  129. let that = this;
  130. this.$nextTick(() => {
  131. let t = setTimeout(() => {
  132. clearTimeout(t);
  133. this.swInstance = new Swiper("#imglist", {
  134. slidesPerView: "auto",
  135. normalizeSlideIndex: false,
  136. on: {
  137. slideChange() {
  138. that.active = this.realIndex;
  139. if (this.realIndex > that.cItem.file.length - 1)
  140. that.active = that.cItem.file.length - 1;
  141. },
  142. },
  143. });
  144. }, 200);
  145. });
  146. },
  147. };
  148. </script>
  149. <style lang="scss" scoped>
  150. .first {
  151. width: 100%;
  152. height: 100%;
  153. position: relative;
  154. color: #fff;
  155. > .title {
  156. position: absolute;
  157. top: 33px;
  158. left: 27px;
  159. font-size: 18px;
  160. line-height: 24px;
  161. font-weight: bold;
  162. width: 45%;
  163. z-index: 1;
  164. word-break: break-all;
  165. }
  166. > .swcon {
  167. position: absolute;
  168. top: 10%;
  169. width: 90%;
  170. height: 66%;
  171. .swiper-wrapper {
  172. padding: 0;
  173. width: 100%;
  174. .swiper-slide {
  175. width: 100%;
  176. transform-style: preserve-3d;
  177. position: relative;
  178. height: 100%;
  179. margin: 0 auto;
  180. transform: translate3d(0, 0, 0);
  181. .sl-item {
  182. width: 100%;
  183. height: 90%;
  184. position: relative;
  185. > img {
  186. width: auto;
  187. max-height: 90vh;
  188. max-width: 100%;
  189. cursor: pointer;
  190. position: absolute;
  191. top: 50%;
  192. left: 50%;
  193. transform: translate(-50%, -50%);
  194. }
  195. }
  196. }
  197. }
  198. }
  199. .vpagination {
  200. position: absolute;
  201. top: 33px;
  202. cursor: pointer;
  203. width: 40px;
  204. }
  205. .left {
  206. right: calc(23px + 40px + 23px);
  207. }
  208. .right {
  209. right: 23px;
  210. }
  211. .pagna {
  212. position: absolute;
  213. bottom: 20px;
  214. left: 50%;
  215. transform: translateX(-50%);
  216. text-align: center;
  217. z-index: 999;
  218. > li {
  219. width: 10px;
  220. border-radius: 50%;
  221. height: 10px;
  222. background: rgba(51, 143, 123, 0.24);
  223. display: inline-block;
  224. margin: 0 4px;
  225. &.active {
  226. background: #338f7b;
  227. }
  228. }
  229. }
  230. iframe,
  231. audio,
  232. video {
  233. position: absolute;
  234. transform: translate(-50%, -50%);
  235. top: 45%;
  236. left: 50%;
  237. width: 90%;
  238. height: 66%;
  239. }
  240. audio {
  241. width: 50%;
  242. height: 20%;
  243. }
  244. > .bottom-area {
  245. position: absolute;
  246. bottom: 54px;
  247. left: 50%;
  248. transform: translateX(-50%);
  249. .desc {
  250. width: 56px;
  251. height: 56px;
  252. cursor: pointer;
  253. z-index: 1;
  254. }
  255. .close {
  256. margin-left: 29px;
  257. width: 56px;
  258. height: 56px;
  259. cursor: pointer;
  260. z-index: 1;
  261. }
  262. }
  263. }
  264. .second {
  265. width: 100%;
  266. height: 100%;
  267. position: relative;
  268. color: #333;
  269. > article {
  270. position: absolute;
  271. top: 62px;
  272. left: 42px;
  273. right: 42px;
  274. bottom: 144px;
  275. background: #FFFEF6;
  276. opacity: 0.95;
  277. border-radius: 4px 4px 4px 4px;
  278. overflow: auto;
  279. padding: 55px 28px 28px 28px;
  280. word-break: break-all;
  281. > h1 {
  282. font-size: 18px;
  283. font-weight: bold;
  284. line-height: 24px;
  285. margin-bottom: 30px;
  286. width: 65%;
  287. }
  288. > .age {
  289. font-weight: bold;
  290. font-size: 15px;
  291. line-height: 30px;
  292. }
  293. > .texture {
  294. font-weight: bold;
  295. font-size: 15px;
  296. line-height: 30px;
  297. margin-bottom: 8px;
  298. }
  299. p {
  300. line-height: 30px;
  301. font-size: 15px;
  302. }
  303. }
  304. > .bottom-area {
  305. position: absolute;
  306. bottom: 54px;
  307. left: 50%;
  308. transform: translateX(-50%);
  309. .close {
  310. width: 56px;
  311. height: 56px;
  312. cursor: pointer;
  313. z-index: 1;
  314. }
  315. }
  316. }
  317. </style>