index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <!-- 场馆漫游 -->
  2. <template>
  3. <div class="root">
  4. <div class="layout" v-if="!isMobile">
  5. <div class="title">{{ detail.name }}</div>
  6. <div class="container">
  7. <img class="pic" :src="detail.detailImg" alt="" />
  8. <div class="content">
  9. <div class="txt" v-html="detail.content">
  10. <!-- {{ detail.content }} -->
  11. </div>
  12. <div class="btns">
  13. <div
  14. class="btn left-btn"
  15. @click="handleClickEvent('travelAround', detail)"
  16. >
  17. VR云游
  18. </div>
  19. <div
  20. class="btn center-btn"
  21. @click="handleClickEvent('overLook', detail)"
  22. >
  23. VR俯瞰
  24. </div>
  25. <div
  26. class="btn right-btn"
  27. @click="handleClickEvent('intensiveReading', detail)"
  28. >
  29. 党史精读
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="goBack" @click="goBack()">
  35. <img src="../../assets/images/goback.png" alt="" />
  36. </div>
  37. </div>
  38. <div v-if="isMobile" class="mobile-layout">
  39. <div class="mobile-card">
  40. <div class="mobile-content">
  41. <div class="pic">
  42. <img :src="detail.detailImg" alt="" />
  43. </div>
  44. <div class="txt">
  45. <div class="title">{{ detail.name }}</div>
  46. <div class="con" v-html="detail.content">
  47. <!-- {{ detail.content }} -->
  48. </div>
  49. </div>
  50. <div class="btns">
  51. <div
  52. class="btn left-btn"
  53. @click="handleClickEvent('travelAround', detail)"
  54. >
  55. VR云游
  56. </div>
  57. <div
  58. class="btn center-btn"
  59. @click="handleClickEvent('overLook', detail)"
  60. >
  61. VR俯瞰
  62. </div>
  63. <div
  64. class="btn right-btn"
  65. @click="handleClickEvent('intensiveReading', detail)"
  66. >
  67. 党史精读
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. import browser from "@/utils/browser.js";
  77. export default {
  78. components: {},
  79. data() {
  80. //这里存放数据
  81. return {
  82. detail: null,
  83. isMobile: browser.mobile,
  84. };
  85. },
  86. //监听属性 类似于data概念
  87. computed: {},
  88. //监控data中的数据变化
  89. watch: {},
  90. //方法集合
  91. methods: {
  92. handleClickEvent(type, item) {
  93. switch (type) {
  94. case "travelAround":
  95. this.$router.push({
  96. path: "/travel-around",
  97. query: { travelAround: item.travelAround },
  98. });
  99. break;
  100. case "overLook":
  101. if (item.id == "2") {
  102. window.alert("该红色展馆暂无VR俯瞰");
  103. break;
  104. }
  105. this.$router.push({
  106. path: "/over-look",
  107. query: { overLook: item.overLook },
  108. });
  109. break;
  110. case "intensiveReading":
  111. window.open(item.intensiveReading, "_target");
  112. break;
  113. default:
  114. break;
  115. }
  116. },
  117. goBack() {
  118. history.go(-1)
  119. }
  120. },
  121. //生命周期 - 创建完成(可以访问当前this实例)
  122. created() {
  123. this.detail = this.$route.query || {};
  124. console.log("isMobile", this.isMobile);
  125. },
  126. //生命周期 - 挂载完成(可以访问DOM元素)
  127. mounted() {},
  128. beforeCreate() {}, //生命周期 - 创建之前
  129. beforeMount() {}, //生命周期 - 挂载之前
  130. beforeUpdate() {}, //生命周期 - 更新之前
  131. updated() {}, //生命周期 - 更新之后
  132. beforeDestroy() {}, //生命周期 - 销毁之前
  133. destroyed() {}, //生命周期 - 销毁完成
  134. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  135. };
  136. </script>
  137. <style lang='less' scoped>
  138. //@import url(); 引入公共css类
  139. .root {
  140. width: 100%;
  141. height: 100%;
  142. }
  143. // pc端样式
  144. .layout {
  145. width: 100%;
  146. height: 100%;
  147. background: url("../../assets/images/cards-bg.png") center center no-repeat;
  148. background-size: 100% 100%;
  149. overflow: hidden;
  150. .goBack {
  151. position: absolute;
  152. top: 26px;
  153. left: 20px;
  154. cursor: pointer;
  155. }
  156. .title {
  157. width: 1264px;
  158. text-align: center;
  159. margin: 0 auto;
  160. margin-top: 100px;
  161. box-sizing: border-box;
  162. height: 32px;
  163. font-size: 32px;
  164. font-family: Source Han Sans CN;
  165. font-weight: bold;
  166. line-height: 54px;
  167. color: #c20e23;
  168. opacity: 1;
  169. }
  170. .container {
  171. width: 1264px;
  172. height: 500px;
  173. background: url("../../assets/images/detail-con-bg.png") center center
  174. no-repeat;
  175. background-clip: 100% 100%;
  176. margin: 50px auto;
  177. box-sizing: border-box;
  178. padding: 10px;
  179. font-size: 0;
  180. display: flex;
  181. justify-content: space-between;
  182. .pic {
  183. width: 40%;
  184. height: 100%;
  185. }
  186. .content {
  187. width: 58%;
  188. font-size: 18px;
  189. .txt {
  190. overflow: auto;
  191. height: 80%;
  192. padding: 80px 50px;
  193. font-size: 18px;
  194. font-family: Source Han Sans CN;
  195. font-weight: 500;
  196. line-height: 31px;
  197. color: #ffffff;
  198. opacity: 1;
  199. }
  200. .btns {
  201. height: 20%;
  202. padding: 2vw 6vw;
  203. display: flex;
  204. justify-content: space-around;
  205. .left-btn {
  206. background: url(../../assets/images/left-btn.png) no-repeat center
  207. center;
  208. }
  209. .center-btn {
  210. background: url(../../assets/images/center-btn.png) no-repeat center
  211. center;
  212. }
  213. .right-btn {
  214. background: url(../../assets/images/right-btn.png) no-repeat center
  215. center;
  216. }
  217. .btn {
  218. width: 160px;
  219. height: 36px;
  220. line-height: 36px;
  221. text-align: center;
  222. background-size: 100% 100%;
  223. cursor: pointer;
  224. font-size: 16px;
  225. font-family: Source Han Sans CN;
  226. font-weight: 500;
  227. color: #c20e23;
  228. opacity: 1;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. //移动端样式
  235. @media screen and (max-width: 1024px) {
  236. .mobile-layout {
  237. width: 100%;
  238. height: 100%;
  239. background: #615310;
  240. background-size: cover;
  241. overflow: hidden;
  242. background-clip: 100% 100%;
  243. .mobile-card {
  244. width: 100%;
  245. height: 100%;
  246. padding: 3vw;
  247. .mobile-content {
  248. width: 100%;
  249. background: url("../../assets/images/mobile-detail-card-bg.png")
  250. no-repeat center center;
  251. height: 100%;
  252. display: flex;
  253. flex-direction: column;
  254. .pic {
  255. width: 100%;
  256. height: 40%;
  257. img {
  258. width: 100%;
  259. height: 100%;
  260. }
  261. }
  262. .txt {
  263. width: 100%;
  264. height: 45%;
  265. padding: 3vw;
  266. // background: blue;
  267. .title {
  268. height: 15%;
  269. text-align: center;
  270. font-size: 5vw;
  271. font-family: Source Han Sans CN;
  272. font-weight: bold;
  273. line-height: 10vw;
  274. color: #fcd67b;
  275. opacity: 1;
  276. // margin: 4vw 0;
  277. }
  278. .con {
  279. padding: 3vw;
  280. height: 85%;
  281. font-size: 3.5vw;
  282. font-family: Source Han Sans CN;
  283. font-weight: 300;
  284. line-height: 5.5vw;
  285. color: #ffffff;
  286. opacity: 1;
  287. overflow: auto;
  288. }
  289. }
  290. .btns {
  291. width: 100%;
  292. height: 15%;
  293. padding: 6vw;
  294. display: flex;
  295. justify-content: space-between;
  296. .left-btn {
  297. background: url(../../assets/images/left-btn.png) no-repeat;
  298. }
  299. .center-btn {
  300. background: url(../../assets/images/center-btn.png) no-repeat;
  301. }
  302. .right-btn {
  303. background: url(../../assets/images/right-btn.png) no-repeat;
  304. }
  305. .btn {
  306. width: 32%;
  307. height: 10vw;
  308. line-height: 10vw;
  309. text-align: center;
  310. background-size: 100% 100%;
  311. cursor: pointer;
  312. font-size: 16px;
  313. font-family: Source Han Sans CN;
  314. font-weight: 500;
  315. color: #6a2121;
  316. opacity: 1;
  317. }
  318. }
  319. }
  320. }
  321. }
  322. }
  323. </style>