From d34f4a300276f1e3115fb12d2da5ecc5157f55d5 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 4 Sep 2019 10:52:21 +0800 Subject: [PATCH 1/3] js sdk api --- app/controllers/wechats/js_sdk_signatures_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 From 308e582d8d851b2d1ebc1695a964628461a32e03 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 4 Sep 2019 13:39:29 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8F=AA=E8=83=BD=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/tpm/TPMsettings/TPMsettings.js | 18 ++++++++++++------ .../src/modules/tpm/newshixuns/Newshixuns.js | 18 +++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index e277ad85f..f1184e7b7 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -15,7 +15,7 @@ import axios from 'axios'; import './css/TPMsettings.css'; -import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll} from 'educoder'; +import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; let origin = getUrl(); @@ -1372,15 +1372,18 @@ export default class TPMsettings extends Component { }) } + handleChange = (info) => { + let {fileList}=this.state; + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { console.log("handleChange1"); - let {fileList}=this.state; - if(fileList.length===0){ + + // if(fileList.length===0){ let fileLists = info.fileList; this.setState({ fileList:fileLists, deleteisnot:false}); - } + // } } } @@ -1497,10 +1500,13 @@ export default class TPMsettings extends Component { // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { + beforeUpload: (file, fileList) => { + if (this.state.fileList.length >= 1) { + return false + } // console.log('beforeUpload', file.name); const isLt150M = file.size / 1024 / 1024 < 50; if (!isLt150M) { diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index cc178dbe0..d7b2b7d26 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -2,7 +2,7 @@ import React, {Component} from 'react'; import {TPMIndexHOC} from '../TPMIndexHOC'; -import {SnackbarHOC,appendFileSizeToUploadFileAll} from 'educoder'; +import {SnackbarHOC,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; import {Input, Select, Radio, Checkbox, Modal, Icon, DatePicker,Upload,Button,message,Form,notification,Tooltip} from 'antd'; @@ -757,19 +757,19 @@ class Newshixuns extends Component { }) } - // 附件相关 START handleChange = (info) => { + let {fileList}=this.state; + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let {fileList}=this.state; console.log("handleChange1"); - if(fileList.length===0){ + // if(fileList.length===0){ let fileLists = info.fileList; this.setState({ // fileList:appendFileSizeToUploadFileAll(fileList), fileList:fileLists, deleteisnot:false}); - } + // } } } @@ -872,10 +872,14 @@ class Newshixuns extends Component { // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { + beforeUpload: (file, fileList) => { + + if (this.state.fileList.length >= 1) { + return false + } // console.log('beforeUpload', file.name); const isLt150M = file.size / 1024 / 1024 < 50; if (!isLt150M) { From c4756cde6711df13cbfafec211673886426bbaad Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 4 Sep 2019 14:03:52 +0800 Subject: [PATCH 3/3] https://www.trustie.net/issues/23867 --- public/react/src/modules/comment/Comments.js | 4 ++-- .../src/modules/courses/boards/TopicDetail.js | 8 +++++--- public/react/src/modules/courses/boards/index.js | 5 +++-- .../modules/courses/coursesDetail/CoursesBanner.js | 14 +++++++------- .../src/modules/courses/members/studentsList.js | 3 ++- public/react/src/modules/tpm/TPMIndexHOC.js | 6 ++++++ 6 files changed, 25 insertions(+), 15 deletions(-) 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 */}