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}") diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index d80795df9..9d856d899 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -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; // } @@ -137,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}`; } 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) { 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( -
@@ -477,7 +478,7 @@ class PollDetailTabForthRules extends Component{