HotspotDetail1.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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: 50%;
  202. transform: translateY(-47%);
  203. left: 20%;
  204. width: 150px;
  205. height: 252px;
  206. }
  207. .HD1_2 {
  208. position: absolute;
  209. z-index: 11;
  210. top: 45%;
  211. left: 40%;
  212. transform: translate(-50%, -50%);
  213. width: 30px;
  214. display: flex;
  215. flex-direction: column;
  216. pointer-events: none;
  217. transition: opacity 1s;
  218. opacity: 1;
  219. & > img {
  220. width: 40px;
  221. }
  222. & > div {
  223. margin-top: 10px;
  224. position: relative;
  225. line-height: 20px;
  226. left: 9px;
  227. font-weight: 400;
  228. font-family: KaiTi;
  229. color: #fff;
  230. text-align: center;
  231. }
  232. }
  233. .HD1_2Hide {
  234. opacity: 0;
  235. }
  236. .HD1_3 {
  237. position: absolute;
  238. z-index: 10;
  239. transition: bottom 1s;
  240. width: 25%;
  241. & > img {
  242. width: 100%;
  243. }
  244. }
  245. .HD1_3_1 {
  246. right: -60%;
  247. z-index: 1;
  248. bottom: 8%;
  249. }
  250. .HD1_3_2 {
  251. right: 18%;
  252. z-index: 2;
  253. bottom: -20%;
  254. }
  255. .HD1_3_3 {
  256. right: 20%;
  257. z-index: 3;
  258. bottom: -34%;
  259. }
  260. .HD1_3Ac {
  261. bottom: -5px;
  262. right: 0;
  263. opacity: 1;
  264. .HD1_3AcMove {
  265. position: absolute;
  266. bottom: 0;
  267. left: 0;
  268. width: 100%;
  269. height: 100%;
  270. display: flex;
  271. justify-content: center;
  272. align-items: center;
  273. padding-top: 30%;
  274. }
  275. }
  276. .HD1_3HideLeft {
  277. right: 100%;
  278. bottom: -8%;
  279. opacity: 0;
  280. pointer-events: none;
  281. }
  282. .HD1_3HideRight {
  283. right: -100%;
  284. bottom: -8%;
  285. opacity: 0;
  286. pointer-events: none;
  287. }
  288. .HD1_3AcBottom {
  289. bottom: -50px;
  290. transition: right 1s, opacity 0.8s;
  291. }
  292. .HD1_4 {
  293. position: absolute;
  294. z-index: 11;
  295. left: 50%;
  296. bottom: 100%;
  297. transform: translateX(-50%);
  298. font-family: KaiTi;
  299. font-weight: 400;
  300. color: #5e715d;
  301. width: 70%;
  302. height: 26%;
  303. opacity: 0;
  304. pointer-events: none;
  305. transition: bottom 1s, opacity 0.5s;
  306. h3 {
  307. font-weight: 700;
  308. text-align: center;
  309. font-size: 30px;
  310. }
  311. p {
  312. font-size: 16px;
  313. position: absolute;
  314. top: 50px;
  315. left: 50%;
  316. transform: translateX(-50%);
  317. letter-spacing: 2px;
  318. height: calc(100% - 50px);
  319. writing-mode: vertical-rl;
  320. line-height: 120%;
  321. }
  322. }
  323. .HD1_4Ac {
  324. opacity: 1;
  325. bottom: 65%;
  326. }
  327. }
  328. .hotspot-detail-2 {
  329. background-image: url("../assets/images/HD1/bg_paper.jpg");
  330. }
  331. </style>