123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- <template>
- <div
- v-loading="pageLoading"
- :class="{
- 'app-wrap': showWrap
- }"
- >
- <template v-if="showWrap && route.query.hideTopBar !== '1'">
- <div
- v-show="isShowTopBar"
- class="top-bar"
- >
- <img
- class="logo"
- src="@/assets/images/logo.png"
- alt=""
- draggable="false"
- @click="router.push({name: 'Banner'})"
- >
- <menu
- class="tab-bar"
- >
- <button
- :class="{
- active: $route.meta.tabIdx === 0
- }"
- @click="$router.push({
- name: 'AboutView'
- })"
- >
- 关于博物馆
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 1
- }"
- @click="$router.push({
- name: 'HomeView'
- })"
- >
- 慈善地图
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 2
- }"
- @click="$router.push({
- name: 'CityOfXishan'
- })"
- >
- 锡善云城
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 3
- }"
- @click="$router.push({
- name: 'MuseumView'
- })"
- >
- 慈善博物馆
- </button>
- <!-- <button
- :class="{
- active: $route.meta.tabIdx === 4
- }"
- @click="$router.push({
- name: 'CloudSchool'
- })"
- >
- 慈善云学校
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 5
- }"
- @click="$router.push({
- name: 'SquareView'
- })"
- >
- 慈善广场
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 6
- }"
- @click="onClickLoveForest"
- >
- 爱心林场
- </button>
- <button
- :class="{
- active: $route.meta.tabIdx === 7
- }"
- @click=" router.push({
- name: 'CharityHall'
- })"
- >
- 慈善堂
- </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="hide-top-bar"
- @click="isShowTopBar = false"
- />
- </div>
- </div>
- <button
- v-show="!isShowTopBar"
- class="show-top-bar"
- @click="isShowTopBar = true"
- />
- </template>
- <FeedBack
- v-if="isShowFeedBack"
- @close="isShowFeedBack = false"
- />
- <div class="content-area">
- <router-view />
- </div>
- </div>
- </template>
- <script setup>
- import { computed, ref, watch } from "vue"
- import { useRoute, useRouter } from "vue-router"
- import { useStore } from "vuex"
- import { ElMessage } from 'element-plus'
- import FeedBack from "@/components/FeedBack.vue"
- import {
- // checkLoginStatusAndProcess,
- getUserFromStorageIfNeed,
- getShopContact
- } from '@/api.js'
- import { app } from './main'
- let init = false
- const route = useRoute()
- const router = useRouter()
- const store = useStore()
- const isDev = process.env.VUE_APP_CLI_MODE === 'dev'
- const showWrap = computed(() => route.name && route.name !== 'Banner')
- watch(route, () => {
- if (!init) {
- const cache = Number(localStorage.getItem('$isTablet'))
- const isTablet = cache === 1 || route.query.device === 'tablet'
- app.provide('$isTablet', isTablet)
- if (isTablet) {
- localStorage.setItem('$isTablet', 1)
- }
- init = true
- }
- })
- store.commit('getPageVisitRecordFromStorage')
- // checkLoginStatusAndProcess()
- getUserFromStorageIfNeed()
- const isShowTopBar = ref(true)
- const isShowFeedBack = ref(false)
- function onClickFeedBack() {
- if (process.env.VUE_APP_CLI_MODE === 'dev' || store.state.loginStatus === store.getters.loginStatusEnum.wxUser) {
- isShowFeedBack.value = true
- } else {
- location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=wx3d4f2e0cfc3b8e54&redirect_uri=https%3A%2F%2Fsit-wuxicishan.4dage.com%2F%23%2Flogin-temp&response_type=code&scope=snsapi_login&state=${encodeURIComponent(route.name)}#wechat_redirect`
- }
- }
- const pageLoading = ref(false)
- async function onClickShop() {
- try {
- pageLoading.value = true
- const data = await getShopContact()
- if (data.display === 0) {
- ElMessage({
- message: '商城暂未开启,敬请期待',
- type: 'warning',
- })
- return
- }
- if (isDev || store.state.loginStatus === store.getters.loginStatusEnum.wxUser) {
- router.push({
- name: 'ShopView'
- })
- } else {
- location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=wx3d4f2e0cfc3b8e54&redirect_uri=https%3A%2F%2Fsit-wuxicishan.4dage.com%2F%23%2Flogin-temp&response_type=code&scope=snsapi_login&state=${encodeURIComponent('ShopView')}#wechat_redirect`
- }
- } finally {
- pageLoading.value = false
- }
- }
- </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-LIGHT.OTF');
- // src: url('@/assets/style/SourceHanSansCN-Regular.otf');
- }
- @font-face {
- font-family: 'Source Han Sans CN-Bold';
- src: url('@/assets/style/SourceHanSansSCBold.otf');
- }
- @font-face{
- font-family: 'Source Han Serif CN';
- src: url('@/assets/style/SourceHanSerifCN-Regular.otf');
- }
- // i {
- // font-style: italic;
- // }
- @font-face{
- font-family: 'Alibaba PuHuiTi-Bold';
- src: url('@/assets/style/ALIBABA-PUHUITI-MEDIUM.OTF');
- }
- // 滚动条,只设置某一项可能导致不生效。
- &::-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;
- font-size: 14px;
- >.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;
- width: 131px;
- cursor: pointer;
- }
- >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;
- &.active{
- background-image: url(@/assets/images/icon_shop-active.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- }
- }
- >button.hide-top-bar{
- width: 42px;
- height: 42px;
- background-image: url(@/assets/images/button-hide-top-bar.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- }
- }
- }
- >button.show-top-bar{
- position: fixed;
- top: 0px;
- right: 10px;
- width: 60px;
- height: 60px;
- background-image: url(@/assets/images/button-show-top-bar.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- z-index: 2;
- }
- >.content-area{
- flex: 1 0 1px;
- position: relative;
- z-index: 1;
- }
- }
- </style>
|