123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <template>
- <div class="app-wrap">
- <Transition
- name="fade-out"
- >
- <StartUp
- v-show="!store.state.haveShownStartUp"
- @loading-over="store.commit('recordShowStartUp')"
- />
- </Transition>
- <div class="top-bar">
- <img
- class="logo"
- src="@/assets/images/logo.png"
- alt=""
- draggable="false"
- >
- <menu class="tab-bar">
- <button
- :class="{
- active: $route.meta.tabIdx === 1
- }"
- @click="$router.push({
- name: 'HomeView'
- })"
- >
- 要素地图
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 2
- }"
- >
- 锡善之城
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 3
- }"
- @click="$router.push({
- name: 'MuseumView'
- })"
- >
- 慈善博物馆
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 4
- }"
- >
- 慈善云学校
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 5
- }"
- >
- 慈善广场
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 6
- }"
- >
- 爱心林场
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 7
- }"
- >
- 慈善堂
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 8
- }"
- @click="onClickFeedBack"
- >
- 留言反馈
- </button>
- </menu>
- <div class="right-button-wrap">
- <button
- class="shop"
- :class="{
- active: $route.meta.tabIdx === 9
- }"
- @click="onClickShop"
- />
- <button class="user" />
- </div>
- </div>
- <FeedBack
- v-if="isShowFeedBack"
- @close="isShowFeedBack = false"
- />
- <div class="content-area">
- <router-view />
- </div>
- </div>
- </template>
- <script setup>
- import { ref, computed, watch, onMounted } from "vue"
- import { useRoute, useRouter } from "vue-router"
- import { useStore } from "vuex"
- import StartUp from '@/components/StartUp.vue'
- import FeedBack from "@/components/FeedBack.vue"
- import { ElMessageBox } from 'element-plus'
- import { checkLoginStatusAndProcess, getUserFromStorageIfNeed } from '@/api.js'
- const route = useRoute()
- const router = useRouter()
- const store = useStore()
- // checkLoginStatusAndProcess()
- getUserFromStorageIfNeed()
- if (store.state.loginStatus === store.getters.loginStatusEnum.notLogin && route.name !== 'LoginView') {
- router.push({
- name: 'LoginView',
- query: {
- redirect: encodeURI(route.fullPath)
- }
- })
- }
- const isShowFeedBack = ref(false)
- function onClickFeedBack() {
- if (store.state.loginStatus === store.getters.loginStatusEnum.wxUser) {
- isShowFeedBack.value = true
- } else {
- ElMessageBox.confirm(
- '需登录后才能体验',
- '提示',
- {
- confirmButtonText: '去登录',
- cancelButtonText: '取消',
- type: 'message',
- }
- ).then(() => {
- isShowFeedBack.value = true
- }).catch(() => {
- })
- }
- }
- function onClickShop() {
- if (store.state.loginStatus === store.getters.loginStatusEnum.wxUser) {
- router.push({
- name: 'ShopView'
- })
- } else {
- ElMessageBox.confirm(
- '需登录后才能体验',
- '提示',
- {
- confirmButtonText: '去登录',
- cancelButtonText: '取消',
- type: 'message',
- }
- ).then(() => {
- router.push({
- name: 'ShopView'
- })
- }).catch(() => {
- })
- }
- }
- </script>
- <style lang="less">
- html, body {
- // overscroll-behavior: none;
- // overflow: hidden;
- height: 100%;
- }
- // * {
- // user-select: none;
- // -webkit-touch-callout: none;
- // }
- #app {
- height: 100%;
- }
- // // 360浏览器不支持not()
- // input, textarea {
- // user-select: initial;
- // }
- // 字体
- @font-face {
- font-family: 'Source Han Sans CN';
- src: url('@/assets/style/SourceHanSansCN-Regular.otf');
- }
- // @font-face {
- // font-family: 'Source Han Serif CN-Bold';
- // src: url('@/assets/style/SourceHanSerifCN-Bold.otf');
- // }
- // i {
- // font-style: italic;
- // }
- // 滚动条,只设置某一项可能导致不生效。
- &::-webkit-scrollbar { background: transparent; width: 6px; height: 0; }
- &::-webkit-scrollbar-thumb { background: #589498; opacity: 0.5; border-radius: 3px;}
- // vue组件过渡效果
- .fade-out-leave-active {
- transition: opacity 1s;
- pointer-events: none;
- }
- .fade-out-leave-to {
- opacity: 0;
- }
- // vue组件过渡效果
- .fade-in-enter-active {
- transition: opacity 1s;
- }
- .fade-in-enter-from {
- opacity: 0;
- }
- .fade-in-out-enter-active {
- transition: opacity 2s;
- }
- .fade-in-out-leave-active {
- transition: opacity 2s;
- pointer-events: none;
- }
- .fade-in-out-enter-from {
- opacity: 0;
- }
- .fade-in-out-leave-to {
- opacity: 0;
- }
- // 不断渐变显隐 animation
- .animation-show-hide {
- animation: show-hide 1.8s infinite;
- }
- @keyframes show-hide {
- 0% {
- opacity: 0;
- }
- 50% {
- opacity: 1;
- }
- 100% {
- opacity: 0;
- }
- }
- // // vue-viewer
- // .viewer-container {
- // background-color: rgba(0, 0, 0, 80%) !important;
- // }
- // 或者
- // .viewer-backdrop {
- // background-color: rgba(0, 0, 0, 90%) !important;
- // }
- </style>
- <style lang="less" scoped>
- .app-wrap{
- height: 100%;
- display: flex;
- flex-direction: column;
- background-image: url(@/assets/images/bg.jpg);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- >.top-bar{
- flex: 0 0 auto;
- height: 89px;
- background: linear-gradient( 180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.3) 100%);
- border-bottom: 1px solid rgba(255, 255, 255, 0.5);
- display: flex;
- align-items: center;
- justify-content: space-around;
- >img.logo{
- flex: 0 0 auto;
- }
- >menu.tab-bar{
- flex: 0 0 auto;
- display: flex;
- align-items: center;
- gap: 55px;
- @media only screen and (max-width: 1500px) {
- gap: 20px;
- }
- @media only screen and (max-width: 1250px) {
- gap: 10px;
- }
- >button{
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: 400;
- font-size: 22px;
- color: #FFFFFF;
- line-height: 26px;
- position: relative;
- z-index: 0;
- &:hover{
- font-weight: bold;
- color: #589498;
- }
- &.active{
- font-weight: bold;
- color: #589498;
- perspective: 1000px;
- &::before{
- content: '';
- display: block;
- position: absolute;
- width: 127px;
- height: 8px;
- background: #589498;
- clip-path: polygon(0 0, 100% 0, 97% 100%, 3% 100%);
- left: 50%;
- top: -31px;
- transform: translate(-50%, 0);
- }
- &::after{
- content: '';
- display: block;
- position: absolute;
- z-index: -1;
- width: 100%;
- top: 100%;
- height: 12px;
- background: #FFE794;
- filter: blur(15.945178985595703px);
- }
- }
- }
- }
- >.right-button-wrap{
- flex: 0 0 auto;
- display: flex;
- align-items: center;
- gap: 14px;
- >button.shop{
- width: 42px;
- height: 42px;
- background-image: url(@/assets/images/icon_shop.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- &:hover, &.active{
- background-image: url(@/assets/images/icon_shop-active.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- }
- }
- >button.user{
- width: 42px;
- height: 42px;
- background-image: url(@/assets/images/icon_user.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- &:hover{
- background-image: url(@/assets/images/icon_user-active.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- }
- }
- }
- }
- >.content-area{
- flex: 1 0 1px;
- position: relative;
- }
- }
- </style>
|