home.vue
5.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<template>
<div>
<index-Ch
v-if="language ==0" @backNumber="openBackNumber" @pickup="openPickup" @pop="openMaster"
@schSearch="openSchSearch"
/>
<index-En v-else @backNumber="openBackNumber" @pickup="openPickup" @pop="openMaster" @schSearch="openSchSearch" />
<div v-if="showgg" class="fixed_gg">
<!--天气-->
<el-icon class="cclose" @click.stop="showgg=false">
<circle-close />
</el-icon>
<div class="bg-lineg pd20">
<div class="smallToday" @click="popWeather">
<div>
<div class="type">
<weather-icon :type="weatherObj.forecast[0]?.type" :width="50" />
</div>
</div>
<div>
<h3 v-if="language == 0">无锡</h3>
<h3 v-else>WUXI</h3>
<div class="wd_p">{{ weatherObj.forecast[0]?.low.slice(2) }}~{{ weatherObj.forecast[0]?.high.slice(2) }}
</div>
</div>
</div>
</div>
<el-dialog
v-model="weatherdialog" :close-on-click-modal="true" style="--el-dialog-padding-primary:0;--el-dialog-border-radius:15px;
--el-dialog-bg-color:transparent;overflow: hidden;"
width="540"
>
<div class="bg-lineg pd20">
<div class="weatherbox">
<div class="today">
<div class="mr50">
<h1 v-if="language == 0">无锡</h1>
<h1 v-else>WUXI</h1>
</div>
<div>
<div class="wd">{{ weatherObj.wendu }}°c</div>
<div class="wd_p">
{{ weatherObj.forecast[0]?.low.slice(2) }}~{{ weatherObj.forecast[0]?.high.slice(2) }}
</div>
<div class="week">{{ weatherObj.forecast[0]?.week }}</div>
</div>
<div>
<div class="type">
<weather-icon :type="weatherObj.forecast[0].type" :width="64" />
</div>
</div>
</div>
<ul class="wlist">
<li v-for="n in weatherObj.forecast.slice(1,6)">
<div class="type">
<weather-icon :type="n.type||n.wea" :width="32" />
</div>
<div v-if="n.low" class="wd">{{ n.low.slice(2, -1) }}/{{ n.high.slice(2) }}</div>
<div v-if="n.tem_night" class="wd">{{ n.tem_night }}/{{ n.tem_day }}</div>
<div v-if="language==1" class="week">
{{
n.week == '星期一' ? 'Mon' : n.week == '星期二' ? 'Tue' : n.week == '星期三' ? 'Wed' : n.week == '星期四' ? 'Thu' : n.week == '星期五' ? 'Fri' : n.week == '星期六' ? 'Sat' : n.week == '星期日' ? 'Sun' : ''
}}
</div>
<div v-else class="week">
{{ n.week }}
</div>
<div v-if="n.ymd" class="date mt10">{{ n.ymd.slice(5, 10) }}</div>
<div v-else class="date mt10">{{ n.date.slice(5, 10) }}</div>
</li>
</ul>
</div>
</div>
</el-dialog>
</div>
<!-- <div class="poCode">-->
<!-- <el-image :preview-src-list="['/img/code.jpg']" hide-on-click-modal="true" style="width: 120px;height: 120px;" src="/img/code.jpg"/>-->
<!-- </div>-->
<dialog-master-class ref="masterClassRef" />
<pick-up ref="pickupRef" />
<back-number ref="backNumberRef" />
<sch-search ref="schSearchRef" />
</div>
</template>
<script setup>
import IndexCh from '/src/viewsPc/index'
import IndexEn from '/src/viewsPc/index_en'
import WeatherIcon from '@/viewsPc/components/weatherIcon'
import DialogMasterClass from '@/viewsPc/components/masterClass'
import PickUp from '@/viewsPc/components/pickup'
import BackNumber from '@/viewsPc/components/querybackNumber'
import SchSearch from '@/viewsPc/components/schSearch'
import { useStorage } from '@vueuse/core/index'
import { ref } from 'vue'
import { getWeather } from '@/apiPc/webSite'
import { getCurrentInstance } from '@vue/runtime-core'
const { proxy } = getCurrentInstance()
const showgg = ref(false)
const language = useStorage('language', 0)
const weatherObj = ref({
forecast: []
})
const weatherdialog = ref(false)
// init()
function init() {
getWeather().then(res => {
weatherObj.value = JSON.parse(res.data).data
showgg.value = true
}).catch(err => {
showgg.value = false
})
}
const popWeather = () => {
weatherdialog.value = true
}
const openMaster = (params) => {
console.log(params)
var obj = {
title: '大师课申请',
cptId: params.cptId
}
proxy.$refs['masterClassRef'].open(obj)
}
const openPickup = (params) => {
console.log(params)
const obj = {
title: '接送机服务',
cptId: params.cptId
}
proxy.$refs['pickupRef'].open(obj)
}
const openBackNumber = (params) => {
console.log(params)
const obj = {
title: '背号查询',
cptId: params.cptId
}
proxy.$refs['backNumberRef'].open(obj)
}
const openSchSearch = (params) => {
console.log(params)
const obj = {
title: '日程查询',
cptId: params.cptId
}
proxy.$refs['schSearchRef'].open(obj)
}
</script>
<style lang="scss" scoped>
.poCode {
position: fixed;
right: 0;
top: 40%;
background: #fff;
padding: 10px 0 0;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 2px 8px #aaa;
z-index: 99;
}
@media screen and (max-width: 768px) {
:deep(.zn-Box .zn-btn) {
margin-top: 10px;
font-size: 14px
}
:deep(.bgbg) {
padding: 3% 5% 0 !important;
h1 {
font-size: 22px;
margin: 20px 0 0;
}
}
.fixed_gg {
transform: scale(0.7);
transform-origin: right;
}
}
</style>