HotspotDetail1.vue 8.5 KB

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