Browse Source

feat: 优化时间显示样式

ShangHai_LongXiang
jiannibang 1 year ago
parent
commit
eeb0174b35
  1. 2
      src/base/Temperature/Temperature.vue
  2. 31
      src/base/Time/Time.vue
  3. 3
      src/components/PublicComponent/PublicComponent.vue

2
src/base/Temperature/Temperature.vue

@ -1,5 +1,6 @@
<template> <template>
<div class="Temperature-wrapper"> <div class="Temperature-wrapper">
<Time />
<div class="temperature">{{ weather.temperatureLow }}~{{ weather.temperatureHigh }}°</div> <div class="temperature">{{ weather.temperatureLow }}~{{ weather.temperatureHigh }}°</div>
<i class="iconfont weather-icon" :class="icon.icon"></i> <i class="iconfont weather-icon" :class="icon.icon"></i>
</div> </div>
@ -7,6 +8,7 @@
<script setup> <script setup>
import { useWeather } from '@/composables/useWeather' import { useWeather } from '@/composables/useWeather'
import Time from '../Time/Time.vue'
const { weather, icon } = useWeather() const { weather, icon } = useWeather()
</script> </script>

31
src/base/Time/Time.vue

@ -1,7 +1,11 @@
<template> <template>
<div class="time-wrapper">
<div class="time">{{ currentTime }}</div> <div class="time">{{ currentTime }}</div>
<div>
<div class="month">{{ formatDay(dateRef) }}</div> <div class="month">{{ formatDay(dateRef) }}</div>
<div class="week">{{ whichWeekRef }}</div> <div class="week">{{ whichWeekRef }}</div>
</div>
</div>
</template> </template>
<script setup> <script setup>
@ -14,10 +18,11 @@ const { dateRef, whichWeekRef } = useDay()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.time-wrapper {
display: flex;
margin-right: 42px;
align-items: center;
.time { .time {
position: fixed;
top: 48px;
left: 659px;
font-family: 'Montserrat'; font-family: 'Montserrat';
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
@ -25,11 +30,9 @@ const { dateRef, whichWeekRef } = useDay()
line-height: 44px; line-height: 44px;
color: var(--time-timeColor); color: var(--time-timeColor);
z-index: 11; z-index: 11;
margin-right: 16px;
} }
.month { .month {
position: fixed;
top: 54px;
left: 783px;
font-family: 'Montserrat'; font-family: 'Montserrat';
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
@ -39,9 +42,6 @@ const { dateRef, whichWeekRef } = useDay()
color: var(--time-monthColor); color: var(--time-monthColor);
} }
.week { .week {
position: fixed;
top: 70px;
left: 783px;
font-family: 'Montserrat'; font-family: 'Montserrat';
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
@ -50,18 +50,5 @@ const { dateRef, whichWeekRef } = useDay()
color: var(--time-weekColor); color: var(--time-weekColor);
z-index: 11; z-index: 11;
} }
@media (min-aspect-ratio: 1/1) {
.time {
top: 32px;
left: 1499px;
}
.month {
top: 38px;
left: 1623px;
}
.week {
top: 54px;
left: 1623px;
}
} }
</style> </style>

3
src/components/PublicComponent/PublicComponent.vue

@ -10,7 +10,7 @@
<Search v-if="showSearch" /> <Search v-if="showSearch" />
</Transition> </Transition>
<Temperature /> <Temperature />
<Time></Time>
<SearchBar v-if="path !== '/billboard'" /> <SearchBar v-if="path !== '/billboard'" />
<img v-if="config.projectLogo && config.projectLogo.length" :src="'./static/offline' + config.projectLogo[0]" class="mall-logo" alt="" srcset="" /> <img v-if="config.projectLogo && config.projectLogo.length" :src="'./static/offline' + config.projectLogo[0]" class="mall-logo" alt="" srcset="" />
<Tabs /> <Tabs />
@ -28,7 +28,6 @@ import Map from '@/components/Map/Map.vue'
const AutoBackNotification = defineAsyncComponent(() => import('@/base/AutoBackNotification/AutoBackNotification.vue')) const AutoBackNotification = defineAsyncComponent(() => import('@/base/AutoBackNotification/AutoBackNotification.vue'))
const Search = defineAsyncComponent(() => import('@/components/Search/Search.vue')) const Search = defineAsyncComponent(() => import('@/components/Search/Search.vue'))
const Temperature = defineAsyncComponent(() => import('@/base/Temperature/Temperature.vue')) const Temperature = defineAsyncComponent(() => import('@/base/Temperature/Temperature.vue'))
const Time = defineAsyncComponent(() => import('@/base/Time/Time.vue'))
const SearchBar = defineAsyncComponent(() => import('./SearchBar.vue')) const SearchBar = defineAsyncComponent(() => import('./SearchBar.vue'))
const Tabs = defineAsyncComponent(() => import('./Tabs.vue')) const Tabs = defineAsyncComponent(() => import('./Tabs.vue'))

Loading…
Cancel
Save