Coder Social home page Coder Social logo

liuwenhao19960508 / natsuha-weather Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yanceyofficial/natsuha-weather

1.0 1.0 1.0 1.42 MB

Natsuha Weather for WeChat Mini Program.

License: MIT License

JavaScript 13.83% TypeScript 65.36% CSS 19.55% HTML 1.26%

natsuha-weather's Introduction

☁️ Natsuha Weather

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.3) 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);
      },
    );
  });

TODOs

  • 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

Change Logs

v1.0.3

Fix bug of Wind Component. (2019-04-18)

v1.0.2

Add Serach Component. (2019-03-11)

v1.0.1

Optimization code. (2019-03-07)

v1.0.0

Publish the first version. (2019-03-01)

License

Natsuha Weather is MIT licensed.

FOSSA Status

natsuha-weather's People

Contributors

yanceyofficial avatar codacy-badger avatar fossabot avatar

Stargazers

周礼飞 avatar

Watchers

James Cloos avatar

Forkers

zhoulifei

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.