Project

wxjsapi

0.0
No commit activity in last 3 years
No release in over 3 years
所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA的web app可在每次url变化时进行调用,目前Android微信客户端不支持pushState的H5新特性,所以使用pushState来实现web app的页面会导致签名失败,此问题会在Android6.2中修复)。wx.config({ debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: '', // 必填,公众号的唯一标识 timestamp: , // 必填,生成签名的时间戳 nonceStr: '', // 必填,生成签名的随机串 signature: '',// 必填,签名,见附录1 jsApiList: [] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 });
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0
 Project Readme

Wxjsapi::Config

Installation

gem 'wxjsapi-config'

And then execute:

$ bundle

Or install it yourself as:

$ gem install wxjsapi-config

Usage

require 'wechat_config'
wx_config = WechatConfig([appId], [appSecret], [jsapilist]) # jsapilist 需要使用微信jsapi的功能,如 "onMenuShareTimeline,onMenuShareAppMessage"
wx_config.wxJsSDKSign([url])  # 生成微信jsapi需要的参数。使用微信jsapi页面的url
wx_config 可以使用的微信jsapi参数有 :appId, :timestamp, :nonceStr, :signature, :jsApiList

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/VitalYoung/wxjsapi-config. This project is intended to be a safe, welcoming space for collaboration.