feat:对接首页数据
This commit is contained in:
9
src/api/home.js
Normal file
9
src/api/home.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import request from './request'
|
||||||
|
|
||||||
|
// 彩云天气
|
||||||
|
export function getWeatherApi() {
|
||||||
|
return request({
|
||||||
|
url: '/api/largeScreen/source/weather',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="weather">
|
<div class="weather">
|
||||||
<span>25˚C-晴</span>
|
<span>{{ weatherData?.temperature }}-{{ weatherData?.skycon }}</span>
|
||||||
<span class="line">|</span>
|
<span class="line">|</span>
|
||||||
<span>风速:A2-4级</span>
|
<span>风速:{{ weatherData?.windSpeed }}</span>
|
||||||
<span class="line">|</span>
|
<span class="line">|</span>
|
||||||
<span>空气质量:A2-优</span>
|
<span>空气质量:{{ weatherData?.airQuality }}</span>
|
||||||
<span class="ml-20">{{ currentDate }}</span>
|
<span class="ml-20">{{ currentDate }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isBack" class="back" @click="handleBack">
|
<div v-if="isBack" class="back" @click="handleBack">
|
||||||
@@ -45,6 +45,8 @@
|
|||||||
import title2 from '@/assets/images/title-2.png'
|
import title2 from '@/assets/images/title-2.png'
|
||||||
import title2Select from '@/assets/images/title-2-select.png'
|
import title2Select from '@/assets/images/title-2-select.png'
|
||||||
|
|
||||||
|
import { getWeatherApi } from '@/api/home'
|
||||||
|
|
||||||
let props = defineProps({
|
let props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -74,6 +76,7 @@
|
|||||||
const emit = defineEmits(['change'])
|
const emit = defineEmits(['change'])
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
let currentDate = ref('')
|
let currentDate = ref('')
|
||||||
|
let weatherData = ref({})
|
||||||
|
|
||||||
const name = computed(() => {
|
const name = computed(() => {
|
||||||
if (!props.isSkip && props.navLeft.length > 0) {
|
if (!props.isSkip && props.navLeft.length > 0) {
|
||||||
@@ -108,7 +111,13 @@
|
|||||||
emit('on-change', index)
|
emit('on-change', index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const getWeather = async () => {
|
||||||
|
let res = await getWeatherApi()
|
||||||
|
weatherData.value = res.data
|
||||||
|
console.log(res, '====')
|
||||||
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getWeather()
|
||||||
getCurrentDate()
|
getCurrentDate()
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
getCurrentDate()
|
getCurrentDate()
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
() => homeData.value?.userPortrait?.ageRate,
|
() => homeData.value?.userPortrait?.ageRate,
|
||||||
() => {
|
() => {
|
||||||
setOption({
|
setOption({
|
||||||
tooltip: {
|
// tooltip: {
|
||||||
trigger: 'item'
|
// trigger: 'item'
|
||||||
},
|
// },
|
||||||
legend: {
|
legend: {
|
||||||
orient: 'vertical',
|
orient: 'vertical',
|
||||||
left: '60%',
|
left: '60%',
|
||||||
|
|||||||
@@ -198,10 +198,16 @@
|
|||||||
<div>调度</div>
|
<div>调度</div>
|
||||||
<div>空余</div>
|
<div>空余</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cell" v-for="(item, index) in homeData?.carShipData?.car.info" :key="index">
|
<div class="content">
|
||||||
<div>{{ item.scenic_area }}</div>
|
<div
|
||||||
<div>{{ item.started_count }}<span class="unit-1">辆</span></div>
|
class="cell"
|
||||||
<div>{{ item.not_started_count }}<span class="unit-1">辆</span></div>
|
v-for="(item, index) in homeData?.carShipData?.car.info"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<div>{{ item.scenic_area }}</div>
|
||||||
|
<div>{{ item.started_count }}<span class="unit-1">辆</span></div>
|
||||||
|
<div>{{ item.not_started_count }}<span class="unit-1">辆</span></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -218,14 +224,16 @@
|
|||||||
<div>调度</div>
|
<div>调度</div>
|
||||||
<div>空余</div>
|
<div>空余</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="content">
|
||||||
class="cell"
|
<div
|
||||||
v-for="(item, index) in homeData?.carShipData.ship.info"
|
class="cell"
|
||||||
:key="index"
|
v-for="(item, index) in homeData?.carShipData.ship.info"
|
||||||
>
|
:key="index"
|
||||||
<div>白帝城</div>
|
>
|
||||||
<div>{{ item.started_count }}<span class="unit-1">辆</span></div>
|
<div>白帝城</div>
|
||||||
<div>{{ item.not_started_count }}<span class="unit-1">辆</span></div>
|
<div>{{ item.started_count }}<span class="unit-1">辆</span></div>
|
||||||
|
<div>{{ item.not_started_count }}<span class="unit-1">辆</span></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -244,18 +252,19 @@
|
|||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="label">总入住</div>
|
<div class="label">总入住</div>
|
||||||
<countup
|
<countup
|
||||||
class="value"
|
class="value success"
|
||||||
color="#02F9FA"
|
|
||||||
:end-val="homeData?.hotelData.info.total_guest_count || 0"
|
:end-val="homeData?.hotelData.info.total_guest_count || 0"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="label">总入住率</div>
|
<div class="label">总入住率</div>
|
||||||
<countup
|
<div class="flex align-center">
|
||||||
class="value"
|
<countup
|
||||||
color="#02F9FA"
|
class="value success"
|
||||||
:end-val="homeData?.hotelData.info.occupancy_rate || 0"
|
:end-val="homeData?.hotelData.info.occupancy_rate || 0"
|
||||||
/>
|
/>
|
||||||
|
<span class="suffix">%</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -387,7 +396,7 @@
|
|||||||
& > div {
|
& > div {
|
||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: vh(110);
|
height: vh(113);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-image: url('@/assets/images/bg-4.png');
|
background-image: url('@/assets/images/bg-4.png');
|
||||||
@@ -434,6 +443,7 @@
|
|||||||
width: vw(200);
|
width: vw(200);
|
||||||
height: vh(100);
|
height: vh(100);
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
background: rgba(0, 150, 255, 0.17);
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: vh(18);
|
height: vh(18);
|
||||||
@@ -447,6 +457,23 @@
|
|||||||
color: #52b8ff;
|
color: #52b8ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.content {
|
||||||
|
overflow-y: auto;
|
||||||
|
height: vh(82);
|
||||||
|
/* 滚动条整体样式 */
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: vw(4); /* 滚动条的宽度 */
|
||||||
|
}
|
||||||
|
/* 滚动条轨道 */
|
||||||
|
&::-webkit-scrollbar-track {
|
||||||
|
background: 'transparent'; /* 轨道的背景色 */
|
||||||
|
}
|
||||||
|
/* 滚动条滑块 */
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(0, 150, 255, 0.63); /* 滑块的背景色 */
|
||||||
|
border-radius: 5px; /* 滑块的圆角 */
|
||||||
|
}
|
||||||
|
}
|
||||||
.cell {
|
.cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: vh(27);
|
height: vh(27);
|
||||||
@@ -507,13 +534,23 @@
|
|||||||
font-size: vw(24);
|
font-size: vw(24);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
.success {
|
||||||
|
color: #02f9fa;
|
||||||
|
}
|
||||||
|
.suffix {
|
||||||
|
margin-top: vh(10);
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: vw(24);
|
||||||
|
color: #02f9fa;
|
||||||
|
color: #02f9fa;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& > div:nth-child(2) {
|
& > div:nth-child(2) {
|
||||||
padding-top: vh(10);
|
padding-top: vh(10);
|
||||||
margin-top: vh(8);
|
margin-top: vh(6);
|
||||||
width: vw(360);
|
width: vw(360);
|
||||||
height: vh(140);
|
height: vh(156);
|
||||||
background-image: url('@/assets/images/bg-4.png');
|
background-image: url('@/assets/images/bg-4.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
@@ -521,7 +558,7 @@
|
|||||||
}
|
}
|
||||||
.occupancy {
|
.occupancy {
|
||||||
:deep(.title-3) {
|
:deep(.title-3) {
|
||||||
margin-top: vh(10);
|
margin-top: vh(6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.title1 {
|
.title1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user