From 382df871659b8555235ff6692deba3df62145368 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 31 Dec 2019 17:46:38 +0800
Subject: [PATCH 1/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/AppConfig.js | 2 +-
public/react/src/modules/courses/poll/PollDetailTabForth.js | 4 ++--
.../src/modules/courses/poll/PollDetailTabForthRules.js | 5 +++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index d80795df9..0ab212134 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -42,7 +42,7 @@ if (isDev) {
// 老师
//ebugType="teacher";
// 学生
-//debugType="student";
+debugType="student";
function railsgettimes(proxy) {
diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js
index dbf63451b..44a09adae 100644
--- a/public/react/src/modules/courses/poll/PollDetailTabForth.js
+++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js
@@ -112,6 +112,7 @@ class PollDetailTabForth extends Component{
// 已有设置数据的查询
getSettingInfo=()=>{
+ this.props.getPollInfo();
let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}/poll_setting.json`;
axios.get(url).then((result)=>{
@@ -184,7 +185,6 @@ class PollDetailTabForth extends Component{
}
}
- this.props.getPollInfo();
}).catch((error)=>{
console.log(error);
})
@@ -443,7 +443,7 @@ class PollDetailTabForth extends Component{
})
}else{
this.setState({
- flagPageEdit:true
+ flagPageEdit:this.props.isAdmin()?true:false
})
}
}
diff --git a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
index 9d686fd00..8cc0adc02 100644
--- a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
+++ b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
@@ -343,6 +343,7 @@ class PollDetailTabForthRules extends Component{
render(){
let {rules,course_group,flagPageEdit}=this.state
let isAdmin=this.props.isAdmin();
+ console.log(flagPageEdit)
return(
@@ -477,7 +478,7 @@ class PollDetailTabForthRules extends Component{
{
- flagPageEdit ?
+ flagPageEdit ?this.props.isAdmin()?
{rule.p_timeflag===undefined?r > 0&&rule.publish_time===null?
this.removeRules(`${r}`)}>
@@ -508,7 +509,7 @@ class PollDetailTabForthRules extends Component{
}
- :""
+ :"":""
}
From a6126fc2161d523e2bf193743bcea78d6a76745a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 31 Dec 2019 18:11:23 +0800
Subject: [PATCH 2/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/AppConfig.js | 5 +++--
public/react/src/common/UrlTool.js | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 0ab212134..4f8d5988c 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -42,7 +42,7 @@ if (isDev) {
// 老师
//ebugType="teacher";
// 学生
-debugType="student";
+//debugType="student";
function railsgettimes(proxy) {
@@ -94,9 +94,10 @@ export function initAxiosInterceptors(props) {
requestMap[keyName] = false;
}
+
axios.interceptors.request.use(
config => {
-
+ config.headers['Content-Type']= 'no-cache'
// if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了
// config.headers.Authorization = token;
// }
diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js
index 33a84dc55..8c3317cf6 100644
--- a/public/react/src/common/UrlTool.js
+++ b/public/react/src/common/UrlTool.js
@@ -128,7 +128,7 @@ export function getTaskUrlById(id) {
export function getRandomcode(url) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
- return `${url}?&randomcode=${newtimestamp}&client_key=${anewopens}`
+ return `${url}?randomcode=${newtimestamp}&client_key=${anewopens}`
}
export function htmlEncode(str) {
From b5d951ab0710bdf4f2231df27fb85369dd3e23cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Tue, 31 Dec 2019 18:14:22 +0800
Subject: [PATCH 3/8] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/exercise/new/SingleDisplay.js | 264 +++++++++---------
1 file changed, 135 insertions(+), 129 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
index 7159b0ee6..4b8d9ee95 100644
--- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
@@ -1,129 +1,135 @@
-import React,{ Component } from "react";
-
-import {
- Form, Input, InputNumber, Switch, Radio,
- Slider, Button, Upload, Icon, Rate, Checkbox, message,
- Row, Col, Select, Modal, Tooltip
-} from 'antd';
-import axios from 'axios'
-import QestionDisplayHeader from './QestionDisplayHeader'
-import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder';
-const { TextArea } = Input;
-const confirm = Modal.confirm;
-const $ = window.$
-const { Option } = Select;
-
-const tagArray = [
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
- 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
- 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
-]
-const qNameArray = [
- '单选题',
- '多选题',
- '判断题',
- '填空题',
- '简答题',
- '实训题',
-]
-class SingleDisplay extends Component{
- constructor(props){
- super(props);
-
-
- this.state = {
- question_choices: ['', '', '', ''],
- standard_answers: [false, false, false, false]
- }
- }
- componentDidMount = () => {
- const Id = this.props.match.params.Id
- this.isEdit = !!Id
- if (Id) {
- const url = `/exercises/${Id}/edit.json`
- // axios.get(url)
- // .then((response) => {
- // if (response.data.status == 0) {
-
- // }
- // })
- // .catch(function (error) {
- // console.log(error);
- // });
- }
- }
- render() {
- let { question_title, question_score, question_type, question_choices, standard_answer,
- question_id, question_number, index, displayCount, showActionButton
- } = this.props;
-
- // const { getFieldDecorator } = this.props.form;
-
- const isAdmin = this.props.isAdmin()
- const courseId=this.props.match.params.coursesId;
- const isEdit = this.isEdit
- const qNumber = `question_${index}`;
- // TODO show模式 isNew为false isEdit为false
-
- // [true, false, true] -> [0, 2]
-
- // const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
- let length = 5;
- const qName = qNameArray[question_type]
-
- const isPreviewPage = showActionButton == false
-
- return(
-
-
-
-
-
- {/* 单选 or 多选 */}
-
- { question_choices.map((item, optionIndex) => {
- let prefix = undefined
- // if (!isPreviewPage) {
- prefix = `${tagArray[optionIndex]}.`
- // }
- if (question_type == 0) { // 单选
- return (
-
- {prefix}
-
- {/* */}
-
)
- } else {
-
- return (
-
- {prefix}
-
- {/* */}
-
)
- }
- })}
-
-
-
- )
- }
-}
-// RouteHOC()
-export default (SingleDisplay);
\ No newline at end of file
+import React,{ Component } from "react";
+
+import {
+ Form, Input, InputNumber, Switch, Radio,
+ Slider, Button, Upload, Icon, Rate, Checkbox, message,
+ Row, Col, Select, Modal, Tooltip
+} from 'antd';
+import axios from 'axios'
+import QestionDisplayHeader from './QestionDisplayHeader'
+import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder';
+const { TextArea } = Input;
+const confirm = Modal.confirm;
+const $ = window.$
+const { Option } = Select;
+
+const tagArray = [
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
+ 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
+ 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
+]
+const qNameArray = [
+ '单选题',
+ '多选题',
+ '判断题',
+ '填空题',
+ '简答题',
+ '实训题',
+]
+class SingleDisplay extends Component{
+ constructor(props){
+ super(props);
+
+
+ this.state = {
+ question_choices: ['', '', '', ''],
+ standard_answers: [false, false, false, false]
+ }
+ }
+ componentDidMount = () => {
+ const Id = this.props.match.params.Id
+ this.isEdit = !!Id
+ if (Id) {
+ const url = `/exercises/${Id}/edit.json`
+ // axios.get(url)
+ // .then((response) => {
+ // if (response.data.status == 0) {
+
+ // }
+ // })
+ // .catch(function (error) {
+ // console.log(error);
+ // });
+ }
+ }
+ render() {
+ let { question_title, question_score, question_type, question_choices, standard_answer,
+ question_id, question_number, index, displayCount, showActionButton
+ } = this.props;
+
+ // const { getFieldDecorator } = this.props.form;
+
+ const isAdmin = this.props.isAdmin()
+ const courseId=this.props.match.params.coursesId;
+ const isEdit = this.isEdit
+ const qNumber = `question_${index}`;
+ // TODO show模式 isNew为false isEdit为false
+
+ // [true, false, true] -> [0, 2]
+
+ // const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
+ let length = 5;
+ const qName = qNameArray[question_type]
+
+ const isPreviewPage = showActionButton == false
+
+ return(
+
+
+
+
+
+ {/* 单选 or 多选 */}
+
+ { question_choices.map((item, optionIndex) => {
+ let prefix = undefined
+ // if (!isPreviewPage) {
+ prefix = `${tagArray[optionIndex]}.`
+ // }
+ if (question_type == 0) { // 单选
+ return (
+
+ {prefix}
+
+ {/* */}
+
)
+ } else {
+
+ return (
+
+ {prefix}
+
+ {/* */}
+
)
+ }
+ })}
+
+
+
+ )
+ }
+}
+// RouteHOC()
+export default (SingleDisplay);
From a87ce19c89b55984efb002832202c88ecaf02507 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Tue, 31 Dec 2019 18:30:40 +0800
Subject: [PATCH 4/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/AppConfig.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 4f8d5988c..9d856d899 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -97,7 +97,7 @@ export function initAxiosInterceptors(props) {
axios.interceptors.request.use(
config => {
- config.headers['Content-Type']= 'no-cache'
+ // config.headers['Content-Type']= 'no-cache'
// if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了
// config.headers.Authorization = token;
// }
@@ -138,7 +138,7 @@ export function initAxiosInterceptors(props) {
let newopens=md5(opens+timestamp)
config.url = url;
if (config.url.indexOf('?') == -1) {
- config.url = `${config.url}?&randomcode=${timestamp}&client_key=${newopens}`;
+ config.url = `${config.url}?randomcode=${timestamp}&client_key=${newopens}`;
} else {
config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`;
}
From 38c7854c4df0bddcf21a5f72647cc9a8c74a8491 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 31 Dec 2019 18:33:03 +0800
Subject: [PATCH 5/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f336205cd..396fc8f20 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -12,7 +12,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery prepend: true, unless: -> { request.format.json? }
- before_action :check_sign
+ # before_action :check_sign
before_action :user_setup
#before_action :check_account
From 4d772f0544e3bf18917f5490b4d0443b2a1c6f4e Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 31 Dec 2019 18:34:17 +0800
Subject: [PATCH 6/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 32 +++++++++++------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 396fc8f20..13a88debf 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -12,7 +12,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery prepend: true, unless: -> { request.format.json? }
- # before_action :check_sign
+ before_action :check_sign
before_action :user_setup
#before_action :check_account
@@ -23,21 +23,21 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名
def check_sign
- Rails.logger.info("66666 #{params}")
- suffix = request.url.split(".").last
- suffix_arr = ["xls", "xlsx"] # excel文件先注释
- unless suffix_arr.include?(suffix)
- if params[:client_key].present?
- randomcode = params[:randomcode]
- tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
-
- sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
- Rails.logger.info("2222 #{sign}")
- tip_exception(501, "请求不合理") if sign != params[:client_key]
- else
- tip_exception(501, "请求不合理")
- end
- end
+ # Rails.logger.info("66666 #{params}")
+ # suffix = request.url.split(".").last
+ # suffix_arr = ["xls", "xlsx"] # excel文件先注释
+ # unless suffix_arr.include?(suffix)
+ # if params[:client_key].present?
+ # randomcode = params[:randomcode]
+ # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
+ #
+ # sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
+ # Rails.logger.info("2222 #{sign}")
+ # tip_exception(501, "请求不合理") if sign != params[:client_key]
+ # else
+ # tip_exception(501, "请求不合理")
+ # end
+ # end
end
# 全局配置参数
From d73c4ae3171720033c48b4c8af0d98b0c23ff678 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 31 Dec 2019 18:38:49 +0800
Subject: [PATCH 7/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 30 +++++++++++------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 13a88debf..f336205cd 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -23,21 +23,21 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名
def check_sign
- # Rails.logger.info("66666 #{params}")
- # suffix = request.url.split(".").last
- # suffix_arr = ["xls", "xlsx"] # excel文件先注释
- # unless suffix_arr.include?(suffix)
- # if params[:client_key].present?
- # randomcode = params[:randomcode]
- # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
- #
- # sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
- # Rails.logger.info("2222 #{sign}")
- # tip_exception(501, "请求不合理") if sign != params[:client_key]
- # else
- # tip_exception(501, "请求不合理")
- # end
- # end
+ Rails.logger.info("66666 #{params}")
+ suffix = request.url.split(".").last
+ suffix_arr = ["xls", "xlsx"] # excel文件先注释
+ unless suffix_arr.include?(suffix)
+ if params[:client_key].present?
+ randomcode = params[:randomcode]
+ tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
+
+ sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
+ Rails.logger.info("2222 #{sign}")
+ tip_exception(501, "请求不合理") if sign != params[:client_key]
+ else
+ tip_exception(501, "请求不合理")
+ end
+ end
end
# 全局配置参数
From 7699f3a3111545adf41abb004778c3eb2edbb638 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 31 Dec 2019 18:40:53 +0800
Subject: [PATCH 8/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f336205cd..64d03cbac 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -29,7 +29,7 @@ class ApplicationController < ActionController::Base
unless suffix_arr.include?(suffix)
if params[:client_key].present?
randomcode = params[:randomcode]
- tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
+ # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
Rails.logger.info("2222 #{sign}")