App.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <div class="app-wrap">
  3. <Transition
  4. name="fade-out"
  5. >
  6. <StartUp
  7. v-show="!store.state.haveShownStartUp"
  8. @loading-over="store.commit('recordShowStartUp')"
  9. />
  10. </Transition>
  11. <div class="top-bar">
  12. <img
  13. class="logo"
  14. src="@/assets/images/logo.png"
  15. alt=""
  16. draggable="false"
  17. >
  18. <menu class="tab-bar">
  19. <button
  20. :class="{
  21. active: $route.meta.tabIdx === 1
  22. }"
  23. @click="$router.push({
  24. name: 'HomeView'
  25. })"
  26. >
  27. 要素地图
  28. </button>
  29. <button
  30. :class="{
  31. active: $route.meta.tabIdx === 2
  32. }"
  33. @click="$router.push({
  34. name: 'CityOfXishan'
  35. })"
  36. >
  37. 锡善之城
  38. </button>
  39. <button
  40. :class="{
  41. active: $route.meta.tabIdx === 3
  42. }"
  43. @click="$router.push({
  44. name: 'MuseumView'
  45. })"
  46. >
  47. 慈善博物馆
  48. </button>
  49. <button
  50. :class="{
  51. active: $route.meta.tabIdx === 4
  52. }"
  53. @click="$router.push({
  54. name: 'CloudSchool'
  55. })"
  56. >
  57. 慈善云学校
  58. </button>
  59. <button
  60. :class="{
  61. active: $route.meta.tabIdx === 5
  62. }"
  63. @click="$router.push({
  64. name: 'SquareView'
  65. })"
  66. >
  67. 慈善广场
  68. </button>
  69. <button
  70. :class="{
  71. active: $route.meta.tabIdx === 6
  72. }"
  73. @click="onClickLoveForest"
  74. >
  75. 爱心林场
  76. </button>
  77. <button
  78. :class="{
  79. active: $route.meta.tabIdx === 7
  80. }"
  81. @click=" router.push({
  82. name: 'CharityHall'
  83. })"
  84. >
  85. 慈善堂
  86. </button>
  87. <button
  88. :class="{
  89. active: $route.meta.tabIdx === 8
  90. }"
  91. @click="onClickFeedBack"
  92. >
  93. 留言反馈
  94. </button>
  95. </menu>
  96. <div class="right-button-wrap">
  97. <button
  98. class="shop"
  99. :class="{
  100. active: $route.meta.tabIdx === 9
  101. }"
  102. @click="onClickShop"
  103. />
  104. <button
  105. class="user"
  106. @click="router.push({
  107. name: 'CityOfXishan',
  108. query: {
  109. scene: 4,
  110. }
  111. })"
  112. />
  113. </div>
  114. </div>
  115. <FeedBack
  116. v-if="isShowFeedBack"
  117. @close="isShowFeedBack = false"
  118. />
  119. <div class="content-area">
  120. <router-view />
  121. </div>
  122. </div>
  123. </template>
  124. <script setup>
  125. import { ref, computed, watch, onMounted } from "vue"
  126. import { useRoute, useRouter } from "vue-router"
  127. import { useStore } from "vuex"
  128. import StartUp from '@/components/StartUp.vue'
  129. import FeedBack from "@/components/FeedBack.vue"
  130. import { ElMessageBox } from 'element-plus'
  131. import { checkLoginStatusAndProcess, getUserFromStorageIfNeed } from '@/api.js'
  132. const route = useRoute()
  133. const router = useRouter()
  134. const store = useStore()
  135. window.navigateBack = function() {
  136. router.go(-1)
  137. }
  138. store.commit('getPageVisitRecordFromStorage')
  139. // checkLoginStatusAndProcess()
  140. getUserFromStorageIfNeed()
  141. if (store.state.loginStatus === store.getters.loginStatusEnum.notLogin && route.name !== 'LoginView') {
  142. router.push({
  143. name: 'LoginView',
  144. query: {
  145. redirect: encodeURI(route.fullPath)
  146. }
  147. })
  148. }
  149. const isShowFeedBack = ref(false)
  150. function onClickFeedBack() {
  151. if (store.state.loginStatus === store.getters.loginStatusEnum.wxUser) {
  152. isShowFeedBack.value = true
  153. } else {
  154. ElMessageBox.confirm(
  155. '需登录后才能体验',
  156. '提示',
  157. {
  158. confirmButtonText: '去登录',
  159. cancelButtonText: '取消',
  160. type: 'message',
  161. }
  162. ).then(() => {
  163. isShowFeedBack.value = true
  164. }).catch(() => {
  165. })
  166. }
  167. }
  168. function onClickShop() {
  169. if (store.state.loginStatus === store.getters.loginStatusEnum.wxUser) {
  170. router.push({
  171. name: 'ShopView'
  172. })
  173. } else {
  174. ElMessageBox.confirm(
  175. '需登录后才能体验',
  176. '提示',
  177. {
  178. confirmButtonText: '去登录',
  179. cancelButtonText: '取消',
  180. type: 'message',
  181. }
  182. ).then(() => {
  183. router.push({
  184. name: 'ShopView'
  185. })
  186. }).catch(() => {
  187. })
  188. }
  189. }
  190. function onClickLoveForest() {
  191. if (store.state.loginStatus === store.getters.loginStatusEnum.wxUser) {
  192. router.push({
  193. name: 'LoveForest'
  194. })
  195. } else {
  196. ElMessageBox.confirm(
  197. '需登录后才能体验',
  198. '提示',
  199. {
  200. confirmButtonText: '去登录',
  201. cancelButtonText: '取消',
  202. type: 'message',
  203. }
  204. ).then(() => {
  205. router.push({
  206. name: 'LoveForest'
  207. })
  208. }).catch(() => {
  209. })
  210. }
  211. }
  212. </script>
  213. <style lang="less">
  214. html, body {
  215. // overscroll-behavior: none;
  216. // overflow: hidden;
  217. height: 100%;
  218. }
  219. // * {
  220. // user-select: none;
  221. // -webkit-touch-callout: none;
  222. // }
  223. #app {
  224. height: 100%;
  225. }
  226. // // 360浏览器不支持not()
  227. // input, textarea {
  228. // user-select: initial;
  229. // }
  230. // 字体
  231. @font-face {
  232. font-family: 'Source Han Sans CN';
  233. src: url('@/assets/style/SOURCEHANSANSCN-LIGHT.OTF');
  234. // src: url('@/assets/style/SourceHanSansCN-Regular.otf');
  235. }
  236. // @font-face {
  237. // font-family: 'Source Han Serif CN-Bold';
  238. // src: url('@/assets/style/SourceHanSerifCN-Bold.otf');
  239. // }
  240. // i {
  241. // font-style: italic;
  242. // }
  243. // 滚动条,只设置某一项可能导致不生效。
  244. &::-webkit-scrollbar { background: transparent; width: 6px; height: 0; }
  245. &::-webkit-scrollbar-thumb { background: #589498; opacity: 0.5; border-radius: 3px;}
  246. // vue组件过渡效果
  247. .fade-out-leave-active {
  248. transition: opacity 1s;
  249. pointer-events: none;
  250. }
  251. .fade-out-leave-to {
  252. opacity: 0;
  253. }
  254. // vue组件过渡效果
  255. .fade-in-enter-active {
  256. transition: opacity 1s;
  257. }
  258. .fade-in-enter-from {
  259. opacity: 0;
  260. }
  261. .fade-in-out-enter-active {
  262. transition: opacity 2s;
  263. }
  264. .fade-in-out-leave-active {
  265. transition: opacity 2s;
  266. pointer-events: none;
  267. }
  268. .fade-in-out-enter-from {
  269. opacity: 0;
  270. }
  271. .fade-in-out-leave-to {
  272. opacity: 0;
  273. }
  274. // 不断渐变显隐 animation
  275. .animation-show-hide {
  276. animation: show-hide 1.8s infinite;
  277. }
  278. @keyframes show-hide {
  279. 0% {
  280. opacity: 0;
  281. }
  282. 50% {
  283. opacity: 1;
  284. }
  285. 100% {
  286. opacity: 0;
  287. }
  288. }
  289. // // vue-viewer
  290. // .viewer-container {
  291. // background-color: rgba(0, 0, 0, 80%) !important;
  292. // }
  293. // 或者
  294. // .viewer-backdrop {
  295. // background-color: rgba(0, 0, 0, 90%) !important;
  296. // }
  297. </style>
  298. <style lang="less" scoped>
  299. .app-wrap{
  300. height: 100%;
  301. display: flex;
  302. flex-direction: column;
  303. background-image: url(@/assets/images/bg.jpg);
  304. background-size: cover;
  305. background-repeat: no-repeat;
  306. background-position: center center;
  307. >.top-bar{
  308. flex: 0 0 auto;
  309. height: 89px;
  310. background: linear-gradient( 180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.3) 100%);
  311. border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  312. display: flex;
  313. align-items: center;
  314. justify-content: space-around;
  315. >img.logo{
  316. flex: 0 0 auto;
  317. }
  318. >menu.tab-bar{
  319. flex: 0 0 auto;
  320. display: flex;
  321. align-items: center;
  322. gap: 55px;
  323. @media only screen and (max-width: 1500px) {
  324. gap: 20px;
  325. }
  326. @media only screen and (max-width: 1250px) {
  327. gap: 10px;
  328. }
  329. >button{
  330. font-family: Source Han Sans CN, Source Han Sans CN;
  331. font-weight: 400;
  332. font-size: 22px;
  333. color: #FFFFFF;
  334. line-height: 26px;
  335. position: relative;
  336. z-index: 0;
  337. &:hover{
  338. font-weight: bold;
  339. color: #589498;
  340. }
  341. &.active{
  342. font-weight: bold;
  343. color: #589498;
  344. perspective: 1000px;
  345. &::before{
  346. content: '';
  347. display: block;
  348. position: absolute;
  349. width: 127px;
  350. height: 8px;
  351. background: #589498;
  352. clip-path: polygon(0 0, 100% 0, 97% 100%, 3% 100%);
  353. left: 50%;
  354. top: -31px;
  355. transform: translate(-50%, 0);
  356. }
  357. &::after{
  358. content: '';
  359. display: block;
  360. position: absolute;
  361. z-index: -1;
  362. width: 100%;
  363. top: 100%;
  364. height: 12px;
  365. background: #FFE794;
  366. filter: blur(15.945178985595703px);
  367. }
  368. }
  369. }
  370. }
  371. >.right-button-wrap{
  372. flex: 0 0 auto;
  373. display: flex;
  374. align-items: center;
  375. gap: 14px;
  376. >button.shop{
  377. width: 42px;
  378. height: 42px;
  379. background-image: url(@/assets/images/icon_shop.png);
  380. background-size: cover;
  381. background-repeat: no-repeat;
  382. background-position: center center;
  383. &:hover, &.active{
  384. background-image: url(@/assets/images/icon_shop-active.png);
  385. background-size: cover;
  386. background-repeat: no-repeat;
  387. background-position: center center;
  388. }
  389. }
  390. >button.user{
  391. width: 42px;
  392. height: 42px;
  393. background-image: url(@/assets/images/icon_user.png);
  394. background-size: cover;
  395. background-repeat: no-repeat;
  396. background-position: center center;
  397. &:hover{
  398. background-image: url(@/assets/images/icon_user-active.png);
  399. background-size: cover;
  400. background-repeat: no-repeat;
  401. background-position: center center;
  402. }
  403. }
  404. }
  405. }
  406. >.content-area{
  407. flex: 1 0 1px;
  408. position: relative;
  409. }
  410. }
  411. </style>