info.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <!-- -->
  2. <template>
  3. <div class="EventsInfo">
  4. <!-- 回到顶部 -->
  5. <div class="topBtn" @click="toTop">
  6. <img src="/data/About/Events/toTop.jpg" alt="" />
  7. </div>
  8. <div class="conten">
  9. <img class="topBan" :src="`/data/About/Events/${info.id}.jpg`" alt="" />
  10. <div class="main">
  11. <div class="pos">
  12. <span>Your Position:&nbsp;</span>
  13. <Router-link to="/Layout/Home">Home></Router-link>
  14. <Router-link to="/Layout/Events">Events></Router-link>
  15. </div>
  16. <div class="title">
  17. <div class="left">
  18. <h3 v-html="info.h3"></h3>
  19. <div class="txt" v-html="info.txt"></div>
  20. </div>
  21. <div class="right">
  22. <div>Date:</div>
  23. <p>{{ info.i }}</p>
  24. </div>
  25. </div>
  26. <div class="txtMain" v-html="info.main"></div>
  27. </div>
  28. </div>
  29. <!-- 底部的更多 -->
  30. <div class="other">
  31. <h2>View Other Events</h2>
  32. <ul>
  33. <li
  34. v-for="(item, index) in other"
  35. :key="index"
  36. @click="cutOther(item.id)"
  37. >
  38. <img :src="`/data/About/Events/${item.id}.jpg`" alt="" />
  39. <div class="txt" v-html="item.h3"></div>
  40. </li>
  41. </ul>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. // <p class='xx'>111111111</p> <p>111111111</p> <img src='/data/About/Events/in/00.png'/>
  47. import { About } from "../dataAll";
  48. export default {
  49. name: "EventsInfo",
  50. components: {},
  51. data() {
  52. //这里存放数据
  53. return {
  54. info: {},
  55. other: [],
  56. };
  57. },
  58. //监听属性 类似于data概念
  59. computed: {},
  60. //监控data中的数据变化
  61. watch: {},
  62. //方法集合
  63. methods: {
  64. // 点击其他更多
  65. cutOther(id) {
  66. this.$router.push(`/Layout/EventsInfo/${id}`);
  67. this.getData();
  68. },
  69. // 点击回到顶部
  70. toTop() {
  71. window.scrollTo({ top: 0, behavior: "smooth" });
  72. },
  73. // 封装获取id和改变数据的方法
  74. getData() {
  75. let id = this.$route.params.id;
  76. id = Number(id);
  77. About.Events.forEach((v) => {
  78. if (v.id === id) this.info = v;
  79. });
  80. // 底部更多模块
  81. this.other = About.Events.filter((v) => {
  82. return v.id !== id;
  83. });
  84. },
  85. },
  86. //生命周期 - 创建完成(可以访问当前this实例)
  87. created() {
  88. this.getData();
  89. },
  90. //生命周期 - 挂载完成(可以访问DOM元素)
  91. mounted() {},
  92. beforeCreate() {}, //生命周期 - 创建之前
  93. beforeMount() {}, //生命周期 - 挂载之前
  94. beforeUpdate() {}, //生命周期 - 更新之前
  95. updated() {}, //生命周期 - 更新之后
  96. beforeDestroy() {}, //生命周期 - 销毁之前
  97. destroyed() {}, //生命周期 - 销毁完成
  98. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  99. };
  100. </script>
  101. <style lang='less' scoped>
  102. .EventsInfo {
  103. .topBtn {
  104. margin-left: 450px;
  105. position: fixed;
  106. left: 50%;
  107. bottom: 100px;
  108. z-index: 9999;
  109. cursor: pointer;
  110. }
  111. .conten {
  112. clear: both;
  113. width: 100%;
  114. padding-top: 240px;
  115. .topBan {
  116. position: absolute;
  117. left: 50%;
  118. top: 40px;
  119. transform: translateX(-50%);
  120. width: 1180px;
  121. height: 450px;
  122. object-fit: cover;
  123. z-index: -1;
  124. }
  125. .main {
  126. width: 900px;
  127. margin: 0 auto;
  128. .pos {
  129. font-size: 12px;
  130. background: #fff;
  131. padding: 5px 0 5px 30px;
  132. }
  133. .title {
  134. width: 100%;
  135. display: flex;
  136. .left {
  137. background-color: #f4f4f4;
  138. width: 606px;
  139. & > h3 {
  140. font-weight: 700;
  141. font-family: helvetica;
  142. font-size: 36px;
  143. color: #000;
  144. line-height: 36px;
  145. padding: 40px 30px 15px 30px;
  146. /deep/ span {
  147. color: rgb(255, 0, 0);
  148. }
  149. }
  150. .txt {
  151. font-family: Georgia;
  152. font-size: 16px;
  153. line-height: 20px;
  154. padding: 0 30px 20px 30px;
  155. /deep/ p {
  156. width: 350px;
  157. text-align: left;
  158. color: #000;
  159. margin: 0 auto;
  160. }
  161. }
  162. }
  163. .right {
  164. background-color: #353535;
  165. width: 294px;
  166. font-family: Georgia;
  167. font-size: 30px;
  168. color: #fff;
  169. line-height: 30px;
  170. padding: 40px 20px;
  171. & > div {
  172. font-size: 36px;
  173. line-height: 40px;
  174. margin-bottom: 30px;
  175. }
  176. }
  177. }
  178. .txtMain {
  179. background-color: #fff;
  180. font-family: arial, helvetica, sans-serif;
  181. font-size: 16px;
  182. color: #000;
  183. line-height: 2em;
  184. text-align: justify;
  185. box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
  186. clear: both;
  187. padding: 40px 30px;
  188. /deep/ p {
  189. margin-bottom: 30px;
  190. }
  191. /deep/ .xx {
  192. font-weight: 700;
  193. text-align: center;
  194. }
  195. /deep/img {
  196. display: block;
  197. margin: 0px auto 30px;
  198. }
  199. }
  200. }
  201. }
  202. .other {
  203. width: 900px;
  204. overflow: hidden;
  205. margin: 60px auto;
  206. & > h2 {
  207. font-weight: 700;
  208. font-family: Helvetica;
  209. font-size: 30px;
  210. line-height: 54px;
  211. text-align: center;
  212. border-bottom: 5px solid #bb1b21;
  213. margin-bottom: 20px;
  214. }
  215. & > ul {
  216. width: 930px;
  217. display: flex;
  218. flex-wrap: wrap;
  219. & > li {
  220. cursor: pointer;
  221. background-color: #fff;
  222. width: 435px;
  223. margin-right: 30px;
  224. margin-bottom: 30px;
  225. & > img {
  226. width: 100%;
  227. height: 210px;
  228. object-fit: cover;
  229. }
  230. .txt {
  231. font-weight: 700;
  232. font-family: Helvetica;
  233. font-size: 24px;
  234. color: #000;
  235. line-height: 30px;
  236. padding: 30px 20px 20px 20px;
  237. /deep/ span {
  238. color: rgb(255, 0, 0);
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. </style>