HotspotDetail1.vue 6.9 KB

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