diff --git a/app/controllers/wechats/js_sdk_signatures_controller.rb b/app/controllers/wechats/js_sdk_signatures_controller.rb index e4ee0da27..6d7b3d87d 100644 --- a/app/controllers/wechats/js_sdk_signatures_controller.rb +++ b/app/controllers/wechats/js_sdk_signatures_controller.rb @@ -1,7 +1,10 @@ class Wechats::JsSdkSignaturesController < ApplicationController def create - signature = Util::Wechat.js_sdk_signature(params[:url], params[:noncestr], params[:timestamp]) - render_ok(signature: signature) + timestamp = (Time.now.to_f * 1000).to_i + noncestr = ('A'..'z').to_a.sample(8).join + signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp) + + render_ok(appid: Util::Wechat.appid, timestamp: timestamp, noncestr: noncestr, signature: signature) rescue Util::Wechat::Error => ex render_error(ex.message) end diff --git a/config/routes.rb b/config/routes.rb index 5a1590afc..8085765b4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -776,6 +776,10 @@ Rails.application.routes.draw do end post 'callbacks/aliyun_vod', to: 'callbacks/aliyun_vods#create' + + namespace :wechats do + resource :js_sdk_signature, only: [:create] + end end namespace :admins do @@ -884,10 +888,6 @@ Rails.application.routes.draw do end end - namespace :wechats do - resource :js_sdk_signature, only: [:create] - end - #git 认证回调 match 'gitauth/*url', to: 'gits#auth', via: :all diff --git a/public/react/src/common/Env.js b/public/react/src/common/Env.js index bdd4584f4..283e82c48 100644 --- a/public/react/src/common/Env.js +++ b/public/react/src/common/Env.js @@ -1,3 +1,6 @@ export function isDev() { return window.location.port === "3007"; -} \ No newline at end of file +} + +// const isMobile +export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); \ No newline at end of file diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 1d7c66dbb..5b1d7ac28 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -20,8 +20,7 @@ export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, ap downloadFile, sortDirections } from './TextUtil' export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil' - -export { isDev as isDev } from './Env' +export { isDev as isDev, isMobile } from './Env' export { toStore as toStore, fromStore as fromStore } from './Store' diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index ae246197c..836b520cc 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -383,12 +383,12 @@ class Comments extends Component { {/* |*/} - this.initReply(item) } > - + } {/* |*/} diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index 542157bfb..8ecc85565 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -527,6 +527,7 @@ class TopicDetail extends Component { // TODO 图片上传地址 const courseId=this.props.match.params.coursesId; const boardId = this.props.match.params.boardId + const isCourseEnd = this.props.isCourseEnd() return (
{/* fl with100 */}