HotspotDetail1.vue 7.5 KB

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