File tree Expand file tree Collapse file tree 5 files changed +59
-37
lines changed
Expand file tree Collapse file tree 5 files changed +59
-37
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,11 @@ export default {
126126 title: " Валюта" ,
127127 route: " /mainConverter" ,
128128 icon: " trending_up"
129+ },
130+ {
131+ title: " Погода" ,
132+ route: " /weather" ,
133+ icon: " trending_up"
129134 }
130135 ]
131136 : [
@@ -159,6 +164,11 @@ export default {
159164 route: " /mainConverter" ,
160165 icon: " trending_up"
161166 },
167+ {
168+ title: " Погода" ,
169+ route: " /weather" ,
170+ icon: " trending_up"
171+ },
162172 {
163173 title: " ЛК" ,
164174 route: " /pc" ,
Original file line number Diff line number Diff line change 44 class =" card"
55 :style =" {backgroundImage:`url(${require(`@/assets/weather-icons/${dayTime}.jpg`)})`}"
66 >
7- <v-snackbar
8- v-model =" snackbar"
9- :timeout =" timeout"
10- :top =" 'top'"
11- :color = " 'info'"
12- >{{ text }}</v-snackbar >
7+ <v-snackbar v-model =" snackbar" :timeout =" timeout" :top =" 'top'" :color =" 'info'" >{{ text }}</v-snackbar >
138 <v-layout column class =" card__title" >
149 <div class =" card__title_time text-md-center" >Обновлено {{city.time}}</div >
1510 <div class =" card__title_location text-md-center" >{{city.country}}, {{city.city}}</div >
4540 <v-flex xs6 offset-sm4 >
4641 <div >{{city.weatherText}}, Видимость {{city.visibility}}</div >
4742 </v-flex >
48- <v-btn flat small color =" brown darken-4 " @click =" saveToLS" >Сохранить</v-btn >
43+ <v-btn flat small color =" white " @click =" saveToLS" >Сохранить</v-btn >
4944 </v-layout >
5045 </v-layout >
5146</template >
@@ -122,8 +117,8 @@ export default {
122117 font-size : 14px ;
123118 color : wheat ;
124119 }
125- .card__title_location {
126- }
120+ // .card__title_location {
121+ // }
127122 }
128123 .card__center {
129124 .card__center_temp {
@@ -165,6 +160,16 @@ export default {
165160}
166161
167162@media screen and (max-width : 1024px ) {
163+ .card {
164+ width : 95vw ;
165+ .card__center {
166+ font-size : 12px ;
167+ .card__center_icon {
168+ width : 25vw ;
169+ height : 25vh ;
170+ }
171+ }
172+ }
168173}
169174@media screen and (max-width : 600px ) {
170175}
Original file line number Diff line number Diff line change @@ -37,9 +37,15 @@ export default {
3737 cursor : pointer ;
3838 position : absolute ;
3939 max-height : 55vh ;
40- margin-top : 8 vh ;
40+ margin-top : 55 px ;
4141 overflow : auto ;
42- width : 40 % ;
42+ width : 30 % ;
4343 z-index : 1 ;
4444}
45+ @media screen and (max-width : 1024px ) {
46+ .weather__searchList {
47+ width : 55% ;
48+ }
49+
50+ }
4551 </style >
Original file line number Diff line number Diff line change 11<template >
22 <v-layout column class =" weather" >
33 <loading v-show =" isLoading" ></loading >
4- <v-flex xs3 offset-sm3 v-click-outside >
4+ <div v-click-outside >
55 <v-layout v-show =" !isLoading" class =" weather__search" >
66 <v-layout column >
77 <v-text-field label =" Search" clearable v-model =" searchText" ></v-text-field >
1212 </v-btn >
1313 <v-divider ></v-divider >
1414 </v-layout >
15- </v-flex >
15+ </div >
1616 <v-flex xs8 offset-sm3 v-show =" !isLoading" >
1717 <div v-for =" (city, index) in cities" :key =" index" >
1818 <card :city =" city" ></card >
@@ -37,23 +37,6 @@ export default {
3737 searchText: " " ,
3838 selectCityShow: false ,
3939 selectCity: {}
40- // items: [
41- // {
42- // country: "Россия",
43- // city: "Москва"
44- // },
45- // {
46- // country: "Россия",
47- // city: "Москва"
48- // },
49- // {
50- // country: "Россия",
51- // city: "Москва"
52- // }
53- // ],
54- // cities: {
55- // city: "Пермь"
56- // }
5740 }),
5841 computed: {
5942 ... mapActions (" weatherStore" , [
@@ -103,8 +86,18 @@ export default {
10386 </script >
10487<style lang="scss" scoped>
10588.weather {
89+ position : relative ;
90+ .weather__search {
91+ margin-left : 25% ;
92+ width : 750px ;
93+ }
10694}
10795@media screen and (max-width : 1024px ) {
96+ .weather {
97+ .weather__search {
98+ width : 70% ;
99+ }
100+ }
108101}
109102@media screen and (max-width : 600px ) {
110103}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export default {
2323 } ,
2424 } ,
2525 actions : {
26- INIT_STATE ( { dispatch, commit , state } ) {
26+ INIT_STATE ( { dispatch, state } ) {
2727 state . isLoading = true ;
2828 let arr = [ ] ;
2929 if ( localStorage . getItem ( "city" ) != null ) {
@@ -56,6 +56,7 @@ export default {
5656 } else {
5757 /* eslint-disable */
5858 console . error ( "геолокация НЕдоступна" ) ;
59+ alert ( "Геолокация Не доступна" )
5960 }
6061 } ,
6162 async GET_WEATHER_CITY ( { commit } , data ) {
@@ -101,14 +102,21 @@ export default {
101102 let items = [ ]
102103 let cities = { } ;
103104 axios . get ( url ) . then ( response => {
104- response . data . forEach ( el => {
105+ if ( response . data . length > 0 ) {
106+ response . data . forEach ( el => {
107+ cities = {
108+ country : el . Country . LocalizedName ,
109+ city : el . LocalizedName ,
110+ Key : el . Key
111+ } ;
112+ items . push ( cities ) ;
113+ } ) ;
114+ } else {
105115 cities = {
106- country : el . Country . LocalizedName ,
107- city : el . LocalizedName ,
108- Key : el . Key
116+ city : "Ничего не найдено" ,
109117 } ;
110- items . push ( cities ) ;
111- } ) ;
118+ items . push ( cities )
119+ }
112120 } ) ;
113121 commit ( 'SET_ITEM_CITY' , items )
114122 } ,
You can’t perform that action at this time.
0 commit comments