HotspotDetail1.vue 7.7 KB

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