HotspotDetail1.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <div
  3. :class="`hotspot-detail-1 ${pageLev === 1 ? '' : 'hotspot-detail-2'}`"
  4. @wheel="
  5. ($event) => handleScrollThrottle($event, () => onSwipeChange(-1, curIndex),() => onSwipeChange(1, curIndex))
  6. "
  7. >
  8. <!-- 左上角 -->
  9. <img
  10. class="HD1_1"
  11. :src="require(`@/assets/images/HD1/img_title.png`)"
  12. :style="`opacity:${pageLev === 1 ? '1' : '0'}`"
  13. >
  14. <!-- 中间--点击查看 -->
  15. <div
  16. :class="`HD1_2 ${isLookImg ? '' : 'HD1_2Hide'}`"
  17. @click="ImgClick(imgList[2],2)"
  18. >
  19. <img
  20. class=""
  21. :src="require(`@/assets/images/icon_operation_click_green2.png`)"
  22. alt=""
  23. draggable="false"
  24. >
  25. <div style="color: #7B916B;">
  26. 点击查看
  27. </div>
  28. </div>
  29. <!-- 右边三个画 -->
  30. <div
  31. v-for="(item, index) in imgList"
  32. :key="item.id"
  33. :class="`HD1_3 HD1_3_${index + 1} ${
  34. pageLev === item.id ? 'HD1_3Ac' : ''
  35. } ${imgBottomLoc(pageLev, item.id)} ${pageShow ? 'HD1_3AcBottom' : ''}
  36. `"
  37. @click="ImgClick(item,index)"
  38. >
  39. <div
  40. v-show="pageLev === item.id"
  41. :swipe-options="{ direction: 'horizontal' }"
  42. class="HD1_3AcMove"
  43. >
  44. <!-- :text="`${pageLev===11?'向右':pageLev===13?'向左':'左右'}滑动`" -->
  45. <!-- <OperationTip
  46. v-if="isShowOperationTip"
  47. class="operation-tip"
  48. :direction="'h'"
  49. :is-show="isShowOperationTip"
  50. color="green"
  51. text="左右滑动"
  52. /> -->
  53. <!-- 滑动提示 -->
  54. <OperationTip
  55. v-if="isShowOperationTip"
  56. class="operation-tip"
  57. text="向下滑动"
  58. :is-show="isShowOperationTip"
  59. />
  60. </div>
  61. <img
  62. :src="
  63. require(`@/assets/images/HD1/img${pageShow ? '' : '_list'}_${
  64. item.imgName
  65. }.png`)
  66. "
  67. alt=""
  68. >
  69. </div>
  70. <!-- 顶部文字 -->
  71. <div
  72. :class="`HD1_4 ${pageShow ? 'HD1_4Ac' : ''}`"
  73. :style="`opacity:${swChange && pageShow ? '1' : '0'}`"
  74. >
  75. <p>{{ txtShow.desc }}</p>
  76. <h3
  77. :style="{
  78. transform: `translate(${txtShow.title == '绫' ? '630%' :txtShow.title == '绢' ? '350%': '150%'}, -150%)`
  79. }"
  80. >
  81. {{ txtShow.title }}
  82. </h3>
  83. </div>
  84. <BtnBack @click="backBtnFu" />
  85. </div>
  86. </template>
  87. <script setup>
  88. import { ref } from "vue"
  89. import useRollFu from "../rollFu.js"
  90. import { useWindowSize } from "@vueuse/core"
  91. const { handleScrollThrottle } = useRollFu()
  92. const emit = defineEmits(["close"])
  93. const windowHeightDesign = 1080 - 71 - 37 // 设计稿里视口高度。注意要减去上下边栏
  94. const { width: windowWidth, height: windowHeight } = useWindowSize()
  95. const craftInfo = configText.craft
  96. const imgList = [
  97. {
  98. id: 11,
  99. imgName: "juan",
  100. title: craftInfo[3].title,
  101. desc: craftInfo[3].desc,
  102. },
  103. {
  104. id: 12,
  105. imgName: "ling",
  106. title: craftInfo[5].title,
  107. desc: craftInfo[5].desc,
  108. },
  109. {
  110. id: 13,
  111. imgName: "paper",
  112. title: craftInfo[4].title,
  113. desc: craftInfo[4].desc,
  114. },
  115. ]
  116. const imgListLocObj = {
  117. 11: {
  118. 12: "HD1_3HideRight",
  119. 13: "HD1_3HideLeft",
  120. },
  121. 12: {
  122. 13: "HD1_3HideRight",
  123. 11: "HD1_3HideLeft",
  124. },
  125. 13: {
  126. 11: "HD1_3HideRight",
  127. 12: "HD1_3HideLeft",
  128. },
  129. }
  130. // 当前页面 层级
  131. const pageLev = ref(1)
  132. const pageShow = ref(false)
  133. // 点击返回按钮
  134. const backBtnFu = () => {
  135. if (pageLev.value !== 1) {
  136. // 点击查看回复
  137. isLookImg.value = true
  138. pageShow.value = false
  139. pageLev.value = 1
  140. curIndex.value = -1
  141. } else emit("close")
  142. }
  143. // 点击查看自动消失
  144. const isLookImg = ref(true)
  145. // onMounted(() => {
  146. // setTimeout(() => {
  147. // isLookImg.value = false
  148. // }, 3000)
  149. // })
  150. // 页面展示的文字
  151. const txtShow = ref({
  152. title: "",
  153. desc: "",
  154. })
  155. const isShowOperationTip = ref(false)
  156. const curIndex = ref(-1)
  157. // 点击图片
  158. const ImgClick = (item, index) => {
  159. if (!isShowOperationTip.value) {
  160. isShowOperationTip.value = true
  161. }
  162. curIndex.value = index
  163. pageShow.value = true
  164. isLookImg.value = false
  165. pageLev.value = item.id
  166. txtShow.value = {
  167. title: item.title,
  168. desc: item.desc,
  169. }
  170. }
  171. const swChange = ref(true)
  172. // 左滑右滑
  173. const onSwipeChange = (num, index) => {
  174. if (index == -1) {
  175. return
  176. }
  177. isShowOperationTip.value = false
  178. // let newItem = imgList[index + num]
  179. // curIndex.value = index + num
  180. // if (index === 0 && num === -1) {
  181. // // 第一 还向左滑
  182. // newItem = imgList[imgList.length - 1]
  183. // curIndex.value = imgList.length - 1
  184. // // return
  185. // }
  186. // if (index === imgList.length - 1 && num === 1) {
  187. // newItem = imgList[0]
  188. // curIndex.value = 0
  189. // // return
  190. // }
  191. // if (swChange.value) {
  192. // swChange.value = false
  193. // setTimeout(() => {
  194. // swChange.value = true
  195. // }, 600)
  196. // }
  197. // pageLev.value = newItem.id
  198. // setTimeout(() => {
  199. // txtShow.value = {
  200. // title: newItem.title,
  201. // desc: newItem.desc,
  202. // }
  203. // }, 500)
  204. if (num == -1 ) {
  205. curIndex.value = curIndex.value > 0 ? curIndex.value - 1 : imgList.length - 1
  206. } else if (num == 1) {
  207. curIndex.value = curIndex.value < imgList.length - 1 ? curIndex.value + 1 : 0
  208. }
  209. let newItem = imgList[curIndex.value]
  210. pageLev.value = newItem.id
  211. setTimeout(() => {
  212. txtShow.value = {
  213. title: newItem.title,
  214. desc: newItem.desc,
  215. }
  216. }, 500)
  217. if (swChange.value) {
  218. swChange.value = false
  219. setTimeout(() => {
  220. swChange.value = true
  221. }, 600)
  222. }
  223. }
  224. // 判断画轴的位置 在 左边还是右边
  225. const imgBottomLoc = (nowId, itemId) => {
  226. // nowId:当前选中的id
  227. // itemId 11 12 13
  228. // nowId 11的时候 itemId 12在右边 itemId 13在左边
  229. // nowId 12的时候 itemId 11在左边 itemId 13在右边
  230. // nowId 13的时候 itemId 11在右边 itemId 12在左边
  231. return pageShow.value ? imgListLocObj[nowId][itemId] : ""
  232. }
  233. </script>
  234. <style lang="less" scoped>
  235. .hotspot-detail-1 {
  236. position: absolute;
  237. left: 0;
  238. top: 0;
  239. width: 100%;
  240. height: 100%;
  241. background-image: url("../assets/images/HD1/bg_caizhi.jpg");
  242. background-size: 100% 100%;
  243. background-color: #b6bfb3;
  244. transition: all 1s;
  245. .btn-back {
  246. z-index: 20;
  247. }
  248. .HD1_1 {
  249. transition: all 1s;
  250. position: absolute;
  251. z-index: 10;
  252. top: 50%;
  253. transform: translateY(-47%);
  254. left: 20%;
  255. width: calc(150px / v-bind('windowHeightDesign') * v-bind('windowHeight'));
  256. height: calc(252px / v-bind('windowHeightDesign') * v-bind('windowHeight'));
  257. }
  258. .HD1_2 {
  259. position: absolute;
  260. z-index: 11;
  261. right: calc(26vw);
  262. bottom: calc(30vh);
  263. display: flex;
  264. flex-direction: column;
  265. justify-content: center;
  266. align-items: center;
  267. & > img {
  268. width: calc(50px / v-bind('windowHeightDesign') * v-bind('windowHeight'));
  269. }
  270. & > div {
  271. margin-top: 5px;
  272. font-weight: 400;
  273. font-family: KaiTi;
  274. color: #fff;
  275. white-space: nowrap;
  276. font-size: calc(20px / v-bind('windowHeightDesign') * v-bind('windowHeight'))
  277. }
  278. }
  279. .HD1_2Hide {
  280. opacity: 0;
  281. }
  282. .HD1_3 {
  283. position: absolute;
  284. z-index: 10;
  285. transition: bottom 1s;
  286. height: 95vh;
  287. & > img {
  288. // width: 100%;
  289. height: 100%;
  290. }
  291. }
  292. .HD1_3_1 {
  293. right: 7%;
  294. z-index: 1;
  295. bottom: -16%;
  296. cursor: pointer;
  297. }
  298. .HD1_3_2 {
  299. right: 10%;
  300. z-index: 2;
  301. bottom: -32%;
  302. cursor: pointer;
  303. }
  304. .HD1_3_3 {
  305. right: 12%;
  306. z-index: 3;
  307. bottom: -46%;
  308. cursor: pointer;
  309. }
  310. .HD1_3Ac {
  311. bottom: -5px;
  312. right: -10%;
  313. opacity: 1;
  314. .HD1_3AcMove {
  315. position: absolute;
  316. bottom: 0;
  317. left: 0;
  318. width: 100%;
  319. height: 100%;
  320. display: flex;
  321. justify-content: center;
  322. align-items: center;
  323. padding-top: 30%;
  324. .operation-tip{
  325. top: 10%;
  326. }
  327. }
  328. > img {
  329. width: 60vw;
  330. height: auto;
  331. }
  332. }
  333. .HD1_3HideLeft {
  334. right: 100%;
  335. bottom: -8%;
  336. opacity: 0;
  337. pointer-events: none;
  338. }
  339. .HD1_3HideRight {
  340. right: -100%;
  341. bottom: -8%;
  342. opacity: 0;
  343. pointer-events: none;
  344. }
  345. .HD1_3AcBottom {
  346. bottom: calc(-50px / v-bind('windowHeightDesign') * v-bind('windowHeight'));
  347. transition: right 1s, opacity 0.8s;
  348. height: 80vh;
  349. }
  350. .HD1_4 {
  351. position: absolute;
  352. z-index: 11;
  353. left: 50%;
  354. bottom: 100%;
  355. transform: translateX(-50%);
  356. font-family: KaiTi;
  357. font-weight: 400;
  358. color: #5e715d;
  359. width: 70%;
  360. height: 26%;
  361. opacity: 0;
  362. pointer-events: none;
  363. transition: bottom 1s, opacity 0.5s;
  364. h3 {
  365. font-weight: 700;
  366. text-align: center;
  367. font-size: calc(48px / v-bind('windowHeightDesign') * v-bind('windowHeight'));
  368. position: absolute;
  369. right: 0;
  370. top: 0;
  371. transform: translate(150%, -150%);
  372. }
  373. p {
  374. font-size: calc(30px / v-bind('windowHeightDesign') * v-bind('windowHeight'));
  375. // position: absolute;
  376. // top: 15%;
  377. // left: -250%;
  378. // transform: translateX(-50%);
  379. letter-spacing: calc(2px / v-bind('windowHeightDesign') * v-bind('windowHeight'));
  380. height: 140%;
  381. writing-mode: vertical-rl;
  382. line-height: 122%;
  383. }
  384. }
  385. .HD1_4Ac {
  386. opacity: 1;
  387. bottom: 40%;
  388. width: auto;
  389. left: 20%;
  390. }
  391. }
  392. .hotspot-detail-2 {
  393. background-image: url("../assets/images/HD1/bg_paper.jpg");
  394. }
  395. </style>