ShuangGouSheSeDetail.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <script setup>
  2. import { onMounted, ref, computed, inject } from "vue"
  3. import { useRouter } from "vue-router"
  4. import useSizeAdapt from "@/useFunctions/useSizeAdapt"
  5. import HotspotComp from "@/components/HotspotComp.vue"
  6. const router = useRouter()
  7. const $env = inject("$env")
  8. const goBack = () => {
  9. router.replace({
  10. name: "MoreContent",
  11. query: {
  12. anchorIdx: 0,
  13. },
  14. })
  15. }
  16. const { windowSizeInCssForRef, windowSizeWhenDesignForRef } = useSizeAdapt()
  17. const reverseArray = (array) => {
  18. return array.slice().reverse()
  19. }
  20. const goPaintingDetail = () => {
  21. router.replace(`/shuanggou-painting-detail?idx=0&&m=${curIndex.value}`)
  22. }
  23. const x = window.innerWidth / window.innerHeight
  24. onMounted(() => {
  25. console.log("shuchubili", x)
  26. })
  27. const text = [
  28. [
  29. "双钩,中国画技法名。用线条钩描",
  30. "物象的轮廓,通称“勾勒”,因基本上",
  31. "是用左右或上下两笔钩描合拢,故亦",
  32. "称“双钩”。大部用于工笔花鸟画。又",
  33. "旧时摹搨法书。沿字的笔迹两边用细",
  34. "劲的墨线线钩出轮廓,也叫“双钩”;",
  35. "双钩后填墨的称为“双钩”",
  36. ],
  37. [
  38. "设色,国画中晕染彩色的意思,“廓",
  39. "填”。画面中只要出现彩色就可以说",
  40. "是设色作品。与设色相反的是“水墨”,",
  41. "指画面中不出现彩色,或者极少出现",
  42. "彩色的,以墨色为主绘制的作品。",
  43. ],
  44. ]
  45. const text2 = [
  46. "双钩,中国画技法名。用线条钩描物象的轮廓,通称“勾勒”,因基本上是用左右或上下两笔钩描合拢,故亦称“双钩”。大部用于工笔花鸟画。又旧时摹搨法书。沿字的笔迹两边用细劲的墨线钩出轮廓,也叫“双钩”;双钩后填墨的称为“双钩廓填”。",
  47. "设色,国画中晕染彩色的意思,画面中只要出现彩色就可以说是设色作品。与设色相反的是“水墨”,指画面中不出现彩色,或者极少出现彩色的,以墨色为主绘制的作品。",
  48. ]
  49. const curIndex = ref(0)
  50. const lastX = ref(0)
  51. const isShowOperationTip = ref(true)
  52. // 开始滑动
  53. const handletouchstart = (event) => {
  54. lastX.value = event.changedTouches[0].pageX
  55. isShowOperationTip.value = false
  56. }
  57. // 监听活动
  58. const touchEnd = (event) => {
  59. let currentX = event.changedTouches[0].pageX
  60. let tx = currentX - lastX.value
  61. if (tx < 0) {
  62. if (curIndex.value == 0) {
  63. curIndex.value = 1
  64. }
  65. } else if (tx > 0) {
  66. if (curIndex.value == 1) {
  67. curIndex.value = 0
  68. }
  69. }
  70. }
  71. const isShowVideoBox = ref(false)
  72. const goToSlide = (index) => {
  73. curIndex.value = index
  74. }
  75. const openVideoBox = () => {
  76. isShowVideoBox.value = true
  77. // 背景音乐打开
  78. const audioEl = document.getElementById('bg-music')
  79. audioEl.pause()
  80. }
  81. const closeVieoBox = () => {
  82. isShowVideoBox.value = false
  83. // 背景音乐打开
  84. const audioEl = document.getElementById('bg-music')
  85. audioEl.play()
  86. }
  87. const curPercentage = computed(() => {
  88. return curIndex.value
  89. })
  90. </script>
  91. <template>
  92. <div
  93. class="home"
  94. @touchstart="handletouchstart($event)"
  95. @touchend="touchEnd($event)"
  96. >
  97. <div class="title">
  98. <span :style="{ color: curIndex == 1 ? 'rgba(71, 71, 71, 0.50)' : '' }">双钩</span>
  99. <span :style="{ color: curIndex == 0 ? 'rgba(71, 71, 71, 0.50)' : '' }">设色</span>
  100. <img
  101. src="@/assets/images/icon_video.png"
  102. class="icon-video"
  103. @click="openVideoBox"
  104. >
  105. </div>
  106. <div class="shuanggou-yezi">
  107. <img
  108. src="@/assets/images/shuanggou-top-left.png"
  109. alt=""
  110. >
  111. <HotspotComp
  112. v-show="true"
  113. class="hotspot-1"
  114. @click="goPaintingDetail"
  115. />
  116. </div>
  117. <!-- 视频box -->
  118. <div
  119. v-if="isShowVideoBox"
  120. class="video-box"
  121. >
  122. <img
  123. v-show="curIndex == 1"
  124. class="bg-img"
  125. src="@/assets/images/img_shese.jpg"
  126. alt=""
  127. >
  128. <img
  129. v-show="curIndex == 0"
  130. class="bg-img"
  131. src="@/assets/images/img_shuanggou.jpg"
  132. alt=""
  133. >
  134. <video
  135. playsinline
  136. webkit-playsinline="true"
  137. x5-video-player-type="h5"
  138. :poster="`${$env.BASE_URL}configMultiMedia/video/${curIndex == 0 ? 'shuanggou' : 'shese'}.png`"
  139. :src="`${$env.BASE_URL}configMultiMedia/video/${
  140. curIndex == 0 ? 'shuanggou' : 'shese'
  141. }.mp4`"
  142. controls
  143. />
  144. <div>{{ curIndex == 0 ? "双钩" : "设色" }}</div>
  145. <BtnBack
  146. class="video-box-close"
  147. @click="closeVieoBox"
  148. />
  149. </div>
  150. <!-- <img
  151. class="text"
  152. src="@/assets/images/shuanggou-text.png"
  153. alt=""
  154. > -->
  155. <!-- <div
  156. class="text"
  157. :style="{ top: x > 0.5 ? 'auto' : '', bottom: x > 0.5 ? '15vh' : 'auto' }"
  158. >
  159. <div
  160. v-for="(item, index) in reverseArray(text[curIndex])"
  161. :key="index"
  162. >
  163. {{ item }}
  164. </div>
  165. </div> -->
  166. <div
  167. class="text"
  168. :style="{ top: x > 0.5 ? 'auto' : '', bottom: x > 0.5 ? '15vh' : 'auto' }"
  169. >
  170. {{ text2[curIndex] }}
  171. </div>
  172. <ProgressBar
  173. class="progress-bar"
  174. :totle-unit="2"
  175. :cur-percentage="curPercentage"
  176. color-ac="#7B916B"
  177. color="#7B916B60"
  178. :type="1"
  179. @go-to-slide="goToSlide"
  180. />
  181. <img
  182. class="right-bottom"
  183. src="@/assets/images/right-bottom.png"
  184. alt=""
  185. >
  186. <div class="system-btns">
  187. <BtnBack
  188. color="green"
  189. @click="goBack"
  190. />
  191. <OperationTip
  192. id="operationH"
  193. class="operation-h"
  194. text=""
  195. direction="h"
  196. :is-show="isShowOperationTip"
  197. />
  198. <!-- <OperationTip
  199. class="operation-h"
  200. color="green"
  201. text=""
  202. direction="h"
  203. /> -->
  204. </div>
  205. </div>
  206. </template>
  207. <style lang="less" scoped>
  208. * {
  209. transition: all 1s ease;
  210. }
  211. .home {
  212. width: 100%;
  213. height: 100%;
  214. position: relative;
  215. background: #ffffff;
  216. .title {
  217. color: #474747;
  218. font-size: calc(
  219. 48 / v-bind("windowSizeWhenDesignForRef") *
  220. v-bind("windowSizeInCssForRef")
  221. );
  222. line-height: calc(
  223. 48 / v-bind("windowSizeWhenDesignForRef") *
  224. v-bind("windowSizeInCssForRef")
  225. );
  226. writing-mode: vertical-rl;
  227. font-family: "KingHwa_OldSong";
  228. position: absolute;
  229. right: 13%;
  230. top: 26%;
  231. letter-spacing: 10px;
  232. z-index: 10;
  233. .icon-video {
  234. width: calc(
  235. 48 / v-bind("windowSizeWhenDesignForRef") *
  236. v-bind("windowSizeInCssForRef")
  237. );
  238. height: calc(
  239. 48 / v-bind("windowSizeWhenDesignForRef") *
  240. v-bind("windowSizeInCssForRef")
  241. );
  242. }
  243. }
  244. .shuanggou-yezi {
  245. width: 100%;
  246. animation: fade-in 2s forwards;
  247. position: relative;
  248. z-index: 2;
  249. @keyframes fade-in {
  250. 0% {
  251. opacity: 0;
  252. }
  253. 100% {
  254. opacity: 1;
  255. }
  256. }
  257. > img {
  258. width: 100%;
  259. margin-top: -3%;
  260. }
  261. > .hotspot-1 {
  262. position: absolute;
  263. bottom: 28%;
  264. left: 17%;
  265. pointer-events: initial;
  266. z-index: 3;
  267. }
  268. }
  269. .video-box {
  270. width: 100%;
  271. height: 100%;
  272. position: absolute;
  273. top: 0;
  274. left: 0;
  275. z-index: 10;
  276. .video-box-close {
  277. position: absolute;
  278. bottom: calc(
  279. 15 / v-bind(windowSizeWhenDesignForRef) * v-bind(windowSizeInCssForRef)
  280. );
  281. left: 25px;
  282. }
  283. > .bg-img {
  284. width: 100%;
  285. height: 100%;
  286. object-fit: cover;
  287. position: absolute;
  288. top: 0;
  289. left: 0;
  290. }
  291. > video {
  292. width: 100%;
  293. position: absolute;
  294. top: 50%;
  295. transform: translateY(-50%);
  296. }
  297. > div {
  298. color: #ffffff;
  299. position: absolute;
  300. bottom: 10%;
  301. font-size: calc(
  302. 24 / v-bind("windowSizeWhenDesignForRef") *
  303. v-bind("windowSizeInCssForRef")
  304. );
  305. line-height: calc(
  306. 29 / v-bind("windowSizeWhenDesignForRef") *
  307. v-bind("windowSizeInCssForRef")
  308. );
  309. font-family: "KingHwa_OldSong";
  310. left: 50%;
  311. transform: translateX(-50%);
  312. }
  313. }
  314. .text {
  315. display: flex;
  316. position: absolute;
  317. right: 30%;
  318. top: 40vh;
  319. // top: calc(50 /v-bind('windowSizeWhenDesignForRef')/v-bind('windowSizeInCssForRef'));
  320. color: #707f48;
  321. font-size: calc(
  322. 18 / v-bind("windowSizeWhenDesignForRef") *
  323. v-bind("windowSizeInCssForRef")
  324. );
  325. line-height: calc(
  326. 26 / v-bind("windowSizeWhenDesignForRef") *
  327. v-bind("windowSizeInCssForRef")
  328. );
  329. font-family: "KaiTi";
  330. writing-mode: vertical-rl;
  331. letter-spacing: 2px;
  332. text-align: justify;
  333. height: 40vh;
  334. }
  335. .right-bottom {
  336. width: 100%;
  337. position: absolute;
  338. bottom: 0;
  339. right: 0;
  340. }
  341. .progress-bar {
  342. position: absolute;
  343. left: 0;
  344. bottom: 15px;
  345. left: 50%;
  346. transform: translateX(-50%);
  347. width: 90%;
  348. height: 15px;
  349. z-index: 3;
  350. color: #e1edd95d;
  351. transition: all 1s;
  352. z-index: 1;
  353. }
  354. .system-btns {
  355. width: 100%;
  356. padding: 0
  357. calc(
  358. 20 / v-bind(windowSizeWhenDesignForRef) * v-bind(windowSizeInCssForRef)
  359. );
  360. display: flex;
  361. // flex-direction: column;
  362. justify-content: flex-end;
  363. position: absolute;
  364. bottom: calc(
  365. 60 / v-bind(windowSizeWhenDesignForRef) * v-bind(windowSizeInCssForRef)
  366. );
  367. z-index: 2;
  368. .operation-h {
  369. width: calc(
  370. 36 / v-bind("windowSizeWhenDesignForRef") *
  371. v-bind("windowSizeInCssForRef")
  372. );
  373. transition: opacity 0.5s ease-in-out;
  374. }
  375. }
  376. }
  377. </style>
  378. import { transform } from 'lodash';import { transform } from 'lodash';