diff --git a/app/controllers/wechats/js_sdk_signatures_controller.rb b/app/controllers/wechats/js_sdk_signatures_controller.rb index 6d7b3d87d..0b66cc263 100644 --- a/app/controllers/wechats/js_sdk_signatures_controller.rb +++ b/app/controllers/wechats/js_sdk_signatures_controller.rb @@ -1,6 +1,6 @@ class Wechats::JsSdkSignaturesController < ApplicationController def create - timestamp = (Time.now.to_f * 1000).to_i + timestamp = Time.now.to_i noncestr = ('A'..'z').to_a.sample(8).join signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp) diff --git a/app/libs/util/wechat.rb b/app/libs/util/wechat.rb index 069322f18..1b064ba94 100644 --- a/app/libs/util/wechat.rb +++ b/app/libs/util/wechat.rb @@ -7,7 +7,8 @@ module Util::Wechat attr_accessor :appid, :secret def js_sdk_signature(url, noncestr, timestamp) - str = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }.to_query + data = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url } + str = data.map { |k, v| "#{k}=#{v}" }.join('&') Digest::SHA1.hexdigest(str) end diff --git a/public/react/src/App.js b/public/react/src/App.js index 3013eca7b..af9e33bd6 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -286,8 +286,9 @@ class App extends Component { const wx = window.wx const url = '/wechats/js_sdk_signature.json' const currentUrl = window.location.href.split('#')[0] + // window.encodeURIComponent() axios.post(url, { - url: currentUrl, + url: window.__testUrl || currentUrl, }).then((response) => { console.log('got res') const data = response.data; @@ -295,7 +296,7 @@ class App extends Component { debug: false, appId: data.appid, timestamp: data.timestamp, - nonceStr: data.nonceStr, + nonceStr: data.noncestr, signature: data.signature, jsApiList: [ 'onMenuShareTimeline',// diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index 20343c870..f8042d476 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -227,7 +227,7 @@ class commonWork extends Component{ } clearSelection = () => { - this.setState({ checkBoxValues: [] }) + this.setState({ checkBoxValues: [], checkAll: false }) } // onSetPublic = () => {