App.vue 8.7 KB

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