info.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <!-- -->
  2. <template>
  3. <div class="EventsInfo">
  4. <div class="conten">
  5. <img
  6. class="topBan aria-theme-independent"
  7. :src="`/data/About/Events/${imgInd}Ac.jpg`"
  8. :alt="info.h3"
  9. tabindex="0"
  10. :aria-description="info.h3"
  11. />
  12. <div class="main">
  13. <div
  14. class="pos"
  15. data-aria-viewport-area
  16. tabindex="0"
  17. aria-label="You've reached the path area; this area has two URLs; please use the tab key to go through the content."
  18. >
  19. <span tabindex="0">Your Position:&nbsp;</span>
  20. <Router-link
  21. replace
  22. to="/Layout/Home"
  23. tabindex="0"
  24. aria-description="Home"
  25. >
  26. Home>
  27. </Router-link>
  28. <Router-link
  29. to="/Layout/Events"
  30. tabindex="0"
  31. aria-description="Events"
  32. >
  33. Events>
  34. </Router-link>
  35. </div>
  36. <div
  37. class="mainContent"
  38. data-aria-viewport-area
  39. tabindex="0"
  40. aria-label="You've reached the content area of the Events sub-page, please use the tab key to go through the content."
  41. >
  42. <div class="title">
  43. <div class="left">
  44. <h3 v-html="info.h3" tabindex="0"></h3>
  45. <div class="txt">
  46. <p
  47. @click="skip(val.path)"
  48. @keydown.enter.passive="skip(val.path)"
  49. v-for="(val, index) in info.txt"
  50. :key="index"
  51. tabindex="0"
  52. aria-label="Link"
  53. >
  54. {{ val.name }}
  55. </p>
  56. </div>
  57. </div>
  58. <div class="right">
  59. <div tabindex="0">Date:</div>
  60. <p tabindex="0">{{ info.i }}</p>
  61. </div>
  62. </div>
  63. <div class="txtMain" v-html="info.main" v-if="info.main"></div>
  64. <div
  65. class="txtMain"
  66. v-if="info.mainArr"
  67. v-html="info.mainArr[mainArr]"
  68. ></div>
  69. <!-- 分页 -->
  70. <div class="page" v-if="info.mainArr">
  71. <span
  72. @click="pageCut(i - 1)"
  73. @keydown.enter.passive="pageCut(i - 1)"
  74. v-for="i in 5"
  75. :key="i"
  76. :class="{ active: i === mainArr + 1 }"
  77. tabindex="0"
  78. aria-label="Link"
  79. >
  80. {{ i }}
  81. </span>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <!-- 底部的更多 -->
  87. <div
  88. class="other"
  89. data-aria-viewport-area
  90. tabindex="0"
  91. aria-label="You've reached the View other events section of the Events sub-page; please use the tab key to go through the content."
  92. >
  93. <h2>View Other Events</h2>
  94. <ul>
  95. <li v-for="(item, index) in other" :key="index" @click="skip(item.id)">
  96. <img :src="`/data/About/Events/${item.id}.jpg`" alt="" />
  97. <div class="txt" v-html="item.h3"></div>
  98. </li>
  99. </ul>
  100. </div>
  101. <!-- 回到顶部 -->
  102. <div
  103. class="topBtn"
  104. @click="toTop"
  105. :style="{
  106. bottom: needMagnifyAreaSpace ? '220px' : '100px',
  107. }"
  108. tabindex="0"
  109. aria-label="Button"
  110. aria-description="Back to top"
  111. >
  112. <img src="/data/About/Events/toTop.jpg" alt="" />
  113. </div>
  114. </div>
  115. </template>
  116. <script>
  117. // <p class='xx'>111111111</p> <p>111111111</p> <img src='/data/About/Events/in2/00.png'/>
  118. // <p><i>111111111</i></p>
  119. import { About, AboutOne } from "../dataAll";
  120. export default {
  121. name: "EventsInfo",
  122. components: {},
  123. data() {
  124. //这里存放数据
  125. return {
  126. info: {},
  127. other: [],
  128. // 控制顶部的图片
  129. imgInd: 1,
  130. mainArr: 0,
  131. needMagnifyAreaSpace: false,
  132. };
  133. },
  134. //监听属性 类似于data概念
  135. computed: {},
  136. //监控data中的数据变化
  137. watch: {
  138. $route() {
  139. this.getData();
  140. },
  141. },
  142. //方法集合
  143. methods: {
  144. requestProcessElementInTxtMain() {
  145. this.$nextTick(() => {
  146. const txtMainList = document.getElementsByClassName("txtMain");
  147. for (const iterator of txtMainList) {
  148. this.$eventBus.$emit("request-process-text-element", iterator);
  149. this.$eventBus.$emit("request-process-image-element", iterator);
  150. }
  151. });
  152. },
  153. pageCut(i) {
  154. this.mainArr = i;
  155. this.toTop();
  156. this.requestProcessElementInTxtMain();
  157. },
  158. skip(id) {
  159. this.$router.push(`/Layout/EventsInfo/${id}`).catch(() => {});
  160. this.requestProcessElementInTxtMain();
  161. },
  162. // 点击回到顶部
  163. toTop() {
  164. window.scrollTo({ top: 0, behavior: "smooth" });
  165. },
  166. // 封装获取id和改变数据的方法
  167. getData() {
  168. this.info = {};
  169. let id = this.$route.params.id;
  170. id = Number(id);
  171. // 控制顶部的图片
  172. if (id < 2) this.imgInd = 1;
  173. else if (id < 3) this.imgInd = 2;
  174. else if (id < 4) this.imgInd = 3;
  175. else if (id < 5) this.imgInd = 4;
  176. else this.imgInd = 5;
  177. About.Events.forEach((v) => {
  178. if (v.id === id) this.info = v;
  179. });
  180. // 底部更多模块
  181. let temp = [];
  182. if (id < 2) {
  183. temp.push(AboutOne[1]);
  184. temp.push(AboutOne[2]);
  185. temp.push(AboutOne[3]);
  186. temp.push(AboutOne[4]);
  187. } else if (id < 3) {
  188. temp.push(AboutOne[2]);
  189. temp.push(AboutOne[3]);
  190. temp.push(AboutOne[4]);
  191. } else if (id < 4) {
  192. temp.push(AboutOne[3]);
  193. temp.push(AboutOne[4]);
  194. } else if (id < 5) temp.push(AboutOne[4]);
  195. else temp.push(AboutOne[3]);
  196. this.other = temp;
  197. },
  198. onAriaShowMagnifyArea() {
  199. this.needMagnifyAreaSpace = true;
  200. },
  201. onAriaHideMagnifyArea() {
  202. this.needMagnifyAreaSpace = false;
  203. },
  204. },
  205. //生命周期 - 创建完成(可以访问当前this实例)
  206. created() {
  207. this.getData();
  208. if ([...document.body.classList].includes("aria-magnifying")) {
  209. this.needMagnifyAreaSpace = true;
  210. }
  211. this.$eventBus.$on("aria-show-magnify-area", this.onAriaShowMagnifyArea);
  212. this.$eventBus.$on("aria-hide-magnify-area", this.onAriaHideMagnifyArea);
  213. },
  214. //生命周期 - 挂载完成(可以访问DOM元素)
  215. mounted() {
  216. this.$eventBus.$emit(
  217. "request-read",
  218. `You've reached the sub-page of the Events page.This page contains one navigation section, four window sections, and one interactive section. To choose an section, please hit the shortcut key.`
  219. );
  220. this.requestProcessElementInTxtMain();
  221. },
  222. beforeCreate() {}, //生命周期 - 创建之前
  223. beforeMount() {}, //生命周期 - 挂载之前
  224. beforeUpdate() {}, //生命周期 - 更新之前
  225. updated() {}, //生命周期 - 更新之后
  226. beforeDestroy() {}, //生命周期 - 销毁之前
  227. destroyed() {
  228. this.$eventBus.$off("aria-show-magnify-area", this.onAriaShowMagnifyArea);
  229. this.$eventBus.$off("aria-hide-magnify-area", this.onAriaHideMagnifyArea);
  230. }, //生命周期 - 销毁完成
  231. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  232. };
  233. </script>
  234. <style lang='less' scoped>
  235. .EventsInfo {
  236. .topBtn {
  237. margin-left: 450px;
  238. position: fixed;
  239. left: 50%;
  240. z-index: 9999;
  241. cursor: pointer;
  242. }
  243. .conten {
  244. clear: both;
  245. width: 100%;
  246. padding-top: 240px;
  247. .topBan {
  248. position: absolute;
  249. left: 50%;
  250. top: 40px;
  251. transform: translateX(-50%);
  252. width: 1180px;
  253. height: 450px;
  254. object-fit: cover;
  255. }
  256. .main {
  257. width: 900px;
  258. margin: 0 auto;
  259. position: relative;
  260. z-index: 1;
  261. .pos {
  262. font-size: 12px;
  263. background: #fff;
  264. padding: 5px 0 5px 30px;
  265. }
  266. .title {
  267. width: 100%;
  268. display: flex;
  269. .left {
  270. background-color: #f4f4f4;
  271. width: 606px;
  272. & > h3 {
  273. font-weight: 700;
  274. font-family: helvetica;
  275. font-size: 36px;
  276. color: #000;
  277. line-height: 36px;
  278. padding: 40px 30px 15px 30px;
  279. /deep/ span {
  280. color: rgb(255, 0, 0);
  281. }
  282. }
  283. .txt {
  284. font-family: Georgia;
  285. font-size: 16px;
  286. line-height: 20px;
  287. padding: 0 30px 20px 30px;
  288. /deep/ p {
  289. cursor: pointer;
  290. width: 350px;
  291. text-align: left;
  292. color: #000;
  293. margin: 0 auto;
  294. }
  295. }
  296. }
  297. .right {
  298. background-color: #353535;
  299. width: 294px;
  300. font-family: Georgia;
  301. font-size: 30px;
  302. color: #fff;
  303. line-height: 30px;
  304. padding: 40px 20px;
  305. & > div {
  306. font-size: 36px;
  307. line-height: 40px;
  308. margin-bottom: 30px;
  309. }
  310. }
  311. }
  312. .txtMain {
  313. background-color: #fff;
  314. font-family: arial, helvetica, sans-serif;
  315. font-size: 16px;
  316. color: #000;
  317. line-height: 2em;
  318. text-align: justify;
  319. box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
  320. clear: both;
  321. padding: 40px 30px;
  322. /deep/ i {
  323. font-weight: 700;
  324. }
  325. /deep/ p {
  326. margin-bottom: 30px;
  327. }
  328. /deep/ .xx {
  329. font-weight: 700;
  330. text-align: center;
  331. }
  332. /deep/img {
  333. display: block;
  334. margin: 0px auto 30px;
  335. }
  336. /deep/ video {
  337. width: 600px;
  338. display: block;
  339. margin: 0px auto 30px;
  340. }
  341. /deep/ a {
  342. font-weight: 700;
  343. text-decoration: underline;
  344. }
  345. }
  346. .mainContent {
  347. position: relative;
  348. .page {
  349. position: absolute;
  350. bottom: 10px;
  351. left: 50%;
  352. transform: translateX(-50%);
  353. display: flex;
  354. justify-content: center;
  355. & > span {
  356. width: 30px;
  357. height: 30px;
  358. text-align: center;
  359. line-height: 30px;
  360. margin-right: 15px;
  361. border-radius: 50%;
  362. cursor: pointer;
  363. }
  364. .active {
  365. background-color: #bf2323;
  366. color: #fff;
  367. pointer-events: none;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. .other {
  374. width: 900px;
  375. overflow: hidden;
  376. margin: 60px auto;
  377. & > h2 {
  378. font-weight: 700;
  379. font-family: Helvetica;
  380. font-size: 30px;
  381. line-height: 54px;
  382. text-align: center;
  383. border-bottom: 5px solid #bb1b21;
  384. margin-bottom: 20px;
  385. }
  386. & > ul {
  387. width: 930px;
  388. display: flex;
  389. flex-wrap: wrap;
  390. & > li {
  391. cursor: pointer;
  392. background-color: #fff;
  393. width: 435px;
  394. margin-right: 30px;
  395. margin-bottom: 30px;
  396. & > img {
  397. width: 100%;
  398. height: 210px;
  399. object-fit: cover;
  400. }
  401. .txt {
  402. font-weight: 700;
  403. font-family: Helvetica;
  404. font-size: 24px;
  405. color: #000;
  406. line-height: 30px;
  407. padding: 30px 20px 20px 20px;
  408. /deep/ span {
  409. color: rgb(255, 0, 0);
  410. }
  411. }
  412. }
  413. }
  414. }
  415. }
  416. </style>