Skip to content
Natsuha Weather for WeChat Mini Program.
Branch: master
Clone or download
Latest commit 430ea15 Mar 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
functions
src
.babelrc
.editorconfig init repo Feb 21, 2019
.eslintrc
.gitignore
.prettierrc.json
.travis.yml
LICENSE
README.md Update README.md Mar 13, 2019
global.d.ts
jest.config.js
package-lock.json
package.json
project.config.json 解封app id Mar 9, 2019
tsconfig.json

README.md

Natsuha Weather for WeChat Mini Program

Codacy Badge License: MIT Build Status Version Node PRs Welcome FOSSA Status

Introduction

Natsuha is a weather app that created with Taro and Yahoo Weather API for WeChat Mini Program. Now the stable version(v1.0.2) is released, welcome to experience and fork.

Natsuha Weather

effects image

Features

  • Pull down to refresh
  • Swtich temperature between Fahrenheit and Celsius
  • Display the weather condition by hour
  • Display the weather condition by day
  • Display the wind direction and speed
  • Display the sun and moon
  • Display the precipitation forecast
  • Search weather information by city name

Available Scripts

⚠️ Because of the unknown bugs of Taro, you must use npm instead of yarn.

npm i -g @tarojs/cli@latest

Firstly you should install the @tarojs/cli globally.

npm install

Install dependencies.

npm run dev:weapp

Runs the app in the development mode. Open the developer tools of WeChat to view it. The app will be deployed if you make edits. You will also see any lint errors in the console.

npm run build:weapp

Builds the app for production to the dist folder. It correctly bundles the app in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes. The app is ready to be deployed!

Privacy

The following files are not uploaded to GitHub because of private key, you must create them manually.

getWoeid

You need apply a key in Yahoo Weather API at first.

yahoo key

Then create a file index.js in functions/getWoeid, and insert the following codes with your keys.

/* eslint-disable */

const cloud = require('wx-server-sdk')
const OAuth = require('oauth')

cloud.init()

const header = {
  'Yahoo-App-Id': YOUR_APP_ID,
}

const request = new OAuth.OAuth(
  null,
  null,
  YOUR_CLIENT_ID,
  YOUR_CLIENT_SECRET,
  '1.0',
  null,
  'HMAC-SHA1',
  null,
  header
)

exports.main = async (event, context) => new Promise((resolve, reject) => {
  const lat = event.lat;
  const lon = event.lon;
  const lang = event.lang;
  request.get(
    `https://weather-ydn-yql.media.yahoo.com/forecastrss?lang=${lang}&format=json&lat=${lat}&lon=${lon}`,
    null,
    null,
    (err, data, result) => {
      resolve(data);
    }
  )
})

TODO

  • Support multiple languages
  • Optimize performance
  • Optimize image loading
  • Support Test
  • Move the search component to a new page
  • Drag and Drop
  • Display multi city by swipe

License

Natsuha Weather is MIT licensed.

FOSSA Status

You can’t perform that action at this time.