Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
add feature: more city for weather
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonxiang committed Jun 6, 2017
1 parent 0d2b4b9 commit 3d74008
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 23 deletions.
2 changes: 1 addition & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: true,
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
Expand Down
8 changes: 4 additions & 4 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ export const toggleCity = makeAction(types.TOGGLE_CITY);

export const updateDirction = makeAction(types.UPDATE_DIRECTION);

export const loadNowWeather = ({ commit }) => {
export const loadNowWeather = ({ commit, state }) => {
getNowWeather({
location: 'shenzhen',
location: state.now.cityName,
language: 'zh-Hans',
unit: 'c',
}).then((res) => {
commit('SET_NOW_WEATHER', res.data.results[0].now);
});
};

export const loadDailyWeather = ({ commit }) => {
export const loadDailyWeather = ({ commit, state }) => {
getFutureWeather({
location: 'shenzhen',
location: state.now.cityName,
language: 'zh-Hans',
unit: 'c',
start: 0,
Expand Down
5 changes: 4 additions & 1 deletion src/views/More.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export default {
},
mounted() {
this.SET_HEADER({title:this.$t('More')})
this.SET_HEADER({
title:this.$t('More'),
leftOption:{showBack: true}
})
},
methods: {
Expand Down
14 changes: 11 additions & 3 deletions src/views/Weather.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ export default {
},
created(){
const fetch = [this.loadNowWeather(), this.loadDailyWeather()]
Promise.all(fetch)
this.fetchWeather()
},
watch: {
'now': 'fetchWeather'
},
mounted() {
Expand All @@ -43,7 +46,12 @@ export default {
methods: {
...mapMutations(['SET_HEADER']),
...mapActions(['loadNowWeather','loadDailyWeather'])
...mapActions(['loadNowWeather','loadDailyWeather']),
fetchWeather(){
const fetch = [this.loadNowWeather(), this.loadDailyWeather()]
Promise.all(fetch)
}
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html data-rem=375><head><title></title><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><link href=/app/static/css/app.dfb28a15e39cd70404ac9660b972aa1a.css rel=stylesheet></head><body ontouchstart><div id=app></div><script type=text/javascript src=/app/static/js/manifest.71263ae393119dd3fc1c.js></script><script type=text/javascript src=/app/static/js/vendor.6b1f8100e9a852707370.js></script><script type=text/javascript src=/app/static/js/app.d30d5c1363387a0c7ed9.js></script></body></html>
<!DOCTYPE html><html data-rem=375><head><title></title><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><link href=/app/static/css/app.dfb28a15e39cd70404ac9660b972aa1a.css rel=stylesheet></head><body ontouchstart><div id=app></div><script type=text/javascript src=/app/static/js/manifest.9252d1a0abcc2124153e.js></script><script type=text/javascript src=/app/static/js/vendor.6b1f8100e9a852707370.js></script><script type=text/javascript src=/app/static/js/app.dad4a648ed6428094a5b.js></script></body></html>
2 changes: 1 addition & 1 deletion www/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/* eslint-disable indent, no-unused-vars, no-multiple-empty-lines, max-nested-callbacks, space-before-function-paren, quotes, comma-spacing */
'use strict';

var precacheConfig = [["/app/static/css/app.dfb28a15e39cd70404ac9660b972aa1a.css","78bf261ea371a8dccdb20616a76e98ed"],["/app/static/css/app.dfb28a15e39cd70404ac9660b972aa1a.css.gz","40ad4488d3cc57b148ad18636fd4092e"],["/app/static/img/qrcode.4c602f0.jpg","4c602f01a62e56e4851fa9b2b47e37b8"],["/app/static/js/0.dff303bb9ca83648f67b.js","6dfdf74c175fcf23b628477dbcd23238"],["/app/static/js/0.dff303bb9ca83648f67b.js.gz","e0100b8bb4482b2d7b88dc817160c98c"],["/app/static/js/1.ed8c4cf8d7e72a69a434.js","dd37d8ec04cf03e16012495b23698202"],["/app/static/js/1.ed8c4cf8d7e72a69a434.js.gz","69777328f3541c74c6b09a5383c8c6f8"],["/app/static/js/2.52be9cbcc9162b56b999.js","fbc3a747942eb8356218cf09dcd49a2d"],["/app/static/js/2.52be9cbcc9162b56b999.js.gz","09aef53e23385fec15abf104157119ea"],["/app/static/js/3.518060faa7e44bcd1462.js","abb8c6fbbcc46c632ab6cfa9eee1faeb"],["/app/static/js/3.518060faa7e44bcd1462.js.gz","71a08d177ae200e6810506a3bfdaba9b"],["/app/static/js/4.93065c2f7249bdcca2b8.js","5cddba7deda78b8506d074578e85cec5"],["/app/static/js/4.93065c2f7249bdcca2b8.js.gz","37d981782f067254ff2398c7e6850ff0"],["/app/static/js/5.142bd69e28087ea0fa47.js","31f150b22e5b58fca55727f2d5fd8ee3"],["/app/static/js/5.142bd69e28087ea0fa47.js.gz","bf63e27c1c0d3ee4d62a86159621e62f"],["/app/static/js/6.2e36cd74c356aba3ecb6.js","80e4b5c99c10debf014178ae9c4e157e"],["/app/static/js/6.2e36cd74c356aba3ecb6.js.gz","d24360c63352057c5ce0b801133c4aec"],["/app/static/js/app.d30d5c1363387a0c7ed9.js","e52cad7eca5d9df4d764326f8ed42f8d"],["/app/static/js/app.d30d5c1363387a0c7ed9.js.gz","d63e385d18f3c9d6fe0bfb83fd4afa7f"],["/app/static/js/manifest.71263ae393119dd3fc1c.js","e095a93dc8de3d3196789a422654bf0a"],["/app/static/js/vendor.6b1f8100e9a852707370.js","fb77d65c598b93bb64e79c760f2a066c"],["/app/static/js/vendor.6b1f8100e9a852707370.js.gz","38e693ba4b52a9ef2b2d6c3992aad83a"]];
var precacheConfig = [["/app/static/css/app.dfb28a15e39cd70404ac9660b972aa1a.css","78bf261ea371a8dccdb20616a76e98ed"],["/app/static/css/app.dfb28a15e39cd70404ac9660b972aa1a.css.gz","40ad4488d3cc57b148ad18636fd4092e"],["/app/static/img/qrcode.4c602f0.jpg","4c602f01a62e56e4851fa9b2b47e37b8"],["/app/static/js/0.dff303bb9ca83648f67b.js","6dfdf74c175fcf23b628477dbcd23238"],["/app/static/js/0.dff303bb9ca83648f67b.js.gz","e0100b8bb4482b2d7b88dc817160c98c"],["/app/static/js/1.0413c25b08dc9f0eee0f.js","59728827f57bd4fd44fcd94bcd435183"],["/app/static/js/1.0413c25b08dc9f0eee0f.js.gz","fc29a2cb8df24d26c990de8c936509ca"],["/app/static/js/2.52be9cbcc9162b56b999.js","fbc3a747942eb8356218cf09dcd49a2d"],["/app/static/js/2.52be9cbcc9162b56b999.js.gz","09aef53e23385fec15abf104157119ea"],["/app/static/js/3.518060faa7e44bcd1462.js","abb8c6fbbcc46c632ab6cfa9eee1faeb"],["/app/static/js/3.518060faa7e44bcd1462.js.gz","71a08d177ae200e6810506a3bfdaba9b"],["/app/static/js/4.489956e6457b6e364a35.js","176c1bd4309a59e70659984966e527c1"],["/app/static/js/4.489956e6457b6e364a35.js.gz","30ffc3adbc0d659d5441da4be61e710d"],["/app/static/js/5.142bd69e28087ea0fa47.js","31f150b22e5b58fca55727f2d5fd8ee3"],["/app/static/js/5.142bd69e28087ea0fa47.js.gz","bf63e27c1c0d3ee4d62a86159621e62f"],["/app/static/js/6.2e36cd74c356aba3ecb6.js","80e4b5c99c10debf014178ae9c4e157e"],["/app/static/js/6.2e36cd74c356aba3ecb6.js.gz","d24360c63352057c5ce0b801133c4aec"],["/app/static/js/app.dad4a648ed6428094a5b.js","c783e57ba0e51cc897a9a585dbc91af6"],["/app/static/js/app.dad4a648ed6428094a5b.js.gz","30cfed895e7e74698a42f7e8a239ae86"],["/app/static/js/manifest.9252d1a0abcc2124153e.js","c3dcc27f991e84158255af97ebf4f0e2"],["/app/static/js/vendor.6b1f8100e9a852707370.js","fb77d65c598b93bb64e79c760f2a066c"],["/app/static/js/vendor.6b1f8100e9a852707370.js.gz","38e693ba4b52a9ef2b2d6c3992aad83a"]];
var cacheName = 'sw-precache-v3-vue-hn-' + (self.registration ? self.registration.scope : '');


Expand Down
2 changes: 2 additions & 0 deletions www/static/js/1.0413c25b08dc9f0eee0f.js

Large diffs are not rendered by default.

Binary file added www/static/js/1.0413c25b08dc9f0eee0f.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions www/static/js/1.0413c25b08dc9f0eee0f.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions www/static/js/1.ed8c4cf8d7e72a69a434.js

This file was deleted.

Binary file removed www/static/js/1.ed8c4cf8d7e72a69a434.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion www/static/js/1.ed8c4cf8d7e72a69a434.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions www/static/js/4.489956e6457b6e364a35.js

Large diffs are not rendered by default.

Binary file added www/static/js/4.489956e6457b6e364a35.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions www/static/js/4.489956e6457b6e364a35.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions www/static/js/4.93065c2f7249bdcca2b8.js

This file was deleted.

Binary file removed www/static/js/4.93065c2f7249bdcca2b8.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion www/static/js/4.93065c2f7249bdcca2b8.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions www/static/js/app.d30d5c1363387a0c7ed9.js

This file was deleted.

Binary file removed www/static/js/app.d30d5c1363387a0c7ed9.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion www/static/js/app.d30d5c1363387a0c7ed9.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions www/static/js/app.dad4a648ed6428094a5b.js

Large diffs are not rendered by default.

Binary file added www/static/js/app.dad4a648ed6428094a5b.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions www/static/js/app.dad4a648ed6428094a5b.js.map

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3d74008

Please sign in to comment.