From 814aa13c21518c8c463761e09e8c993364ed1c98 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 30 Jul 2019 14:05:26 +0800
Subject: [PATCH 1/3] =?UTF-8?q?Mp3=E3=80=81mp4=E7=B1=BB=E5=AE=9E=E8=AE=AD?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 2 +-
app/controllers/myshixuns_controller.rb | 2 +-
app/helpers/games_helper.rb | 8 +++++++-
app/models/challenge.rb | 1 +
4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index b2de6dcad..667d45f2b 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -116,7 +116,7 @@ class GamesController < ApplicationController
@qrcode_str = Base64.encode64( qr.to_img.resize(400,400).to_s )
else
- @type = "image"
+ @type = ""
#conv = Iconv.new("GBK", "utf-8")
@game_challenge = @game.challenge
type = @game_challenge.show_type
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index fa47fd7f6..1d6b15969 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -24,7 +24,7 @@ class MyshixunsController < ApplicationController
ActiveRecord::Base.transaction do
begin
@shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id)
- @myshixun.destroy
+ @myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)
diff --git a/app/helpers/games_helper.rb b/app/helpers/games_helper.rb
index aff05904f..dfc3fb321 100644
--- a/app/helpers/games_helper.rb
+++ b/app/helpers/games_helper.rb
@@ -6,7 +6,7 @@ module GamesHelper
end
# 获取目录下所有文件,返回一个文件名的数组 type是查看文件的类型image表示图片
- # type [[1, "图片"], [2, "apk/exe"], [3, "txt"], [4, "html"]]
+ # type [[1, "图片"], [2, "apk/exe"], [3, "txt"], [4, "html"], [5, "mp3"], [6, "mp4"]]
def get_dir_filename(path, type, game_id)
answer_picture = []
return answer_picture unless File.directory?(path)
@@ -39,6 +39,12 @@ module GamesHelper
end
f.close
@type = 'txt'
+ elsif extension == 'mp3' && type == 5
+ answer_picture << file
+ @type = 'mp3'
+ elsif extension == 'mp4' && type == 6
+ answer_picture << file
+ @type = 'mp4'
end
end
diff --git a/app/models/challenge.rb b/app/models/challenge.rb
index 0bea54eb4..8e4d2ae42 100644
--- a/app/models/challenge.rb
+++ b/app/models/challenge.rb
@@ -1,5 +1,6 @@
class Challenge < ApplicationRecord
# difficulty: 关卡难度: 1.简单 2.中等 3.困难
+ # show_type: 效果展示:-1.无效果 1.图片 2.apk/exe 3.txt 4.html 5.mp3 6.mp4
default_scope { order("challenges.position asc") }
belongs_to :shixun, :touch => true, counter_cache: true
From 400e5c104011c1f593daf97092d230fa4acffc37 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Wed, 31 Jul 2019 10:08:01 +0800
Subject: [PATCH 2/3] export true
---
.../modules/courses/shixunHomework/Trainingjobsetting.js | 8 ++++----
.../courses/shixunHomework/Workquestionandanswer.js | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index 8cbf0402f..99c295c40 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -1766,16 +1766,16 @@ class Trainingjobsetting extends Component {
daochushixunbaogao=()=>{
let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
- this.confirmysl(url + '&export=true');
+ this.confirmysl(url, url + '&export=true');
}
daochuzuoye =() =>{
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
- this.confirmysl(url + '?export=true');
+ this.confirmysl(url, url + '?export=true');
}
- confirmysl(url){
- axios.get(url).then((response) => {
+ confirmysl(url, urlWithExport){
+ axios.get(urlWithExport).then((response) => {
if(response === undefined){
return
}
diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
index 2da08e2ad..4ed45790d 100644
--- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
+++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
@@ -339,16 +339,16 @@ class Workquestionandanswer extends Component {
daochushixunbaogao=()=>{
let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
- this.confirmysl(url + '&export=true');
+ this.confirmysl(url, url + '&export=true');
}
daochuzuoye =() =>{
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
- this.confirmysl(url + '?export=true');
+ this.confirmysl(url, url + '?export=true');
}
- confirmysl(url){
- axios.get(url).then((response) => {
+ confirmysl(url, urlWithExport){
+ axios.get(urlWithExport).then((response) => {
if(response === undefined){
return
}
From 2e889a74e56189c9077fa443a2a267df9cba4a22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 31 Jul 2019 11:20:32 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=A7=E5=88=B6?=
=?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E4=B8=8D=E8=83=BD=E9=80=89=E4=BB=8A?=
=?UTF-8?q?=E5=A4=A9=E4=B9=8B=E5=89=8D=E7=9A=84=E6=97=B6=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/coursesPublic/HomeworkModal.js | 11 ++++++++++-
.../modules/courses/coursesPublic/SelectSetting.js | 8 +++++++-
.../src/modules/courses/coursesPublic/sendResource.js | 8 +++++++-
.../src/modules/courses/exercise/Exercisesetting.js | 8 ++++++++
.../graduation/tasks/GraduationTaskssetting.js | 9 +++++++++
public/react/src/modules/courses/new/CoursesNew.js | 4 ++++
.../modules/courses/poll/PollDetailTabForthRules.js | 8 ++++++++
.../courses/shixunHomework/Trainingjobsetting.js | 6 ++++++
.../react/src/modules/tpm/TPMsettings/TPMsettings.js | 7 ++++++-
public/react/src/modules/tpm/newshixuns/Newshixuns.js | 8 +++++---
10 files changed, 70 insertions(+), 7 deletions(-)
diff --git a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js
index 440d8893c..deb329fb9 100644
--- a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js
+++ b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js
@@ -20,6 +20,14 @@ function disabledDateTime() {
// disabledSeconds: () => [55, 56],
};
}
+
+
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
+
+
+
class HomeworkModal extends Component{
constructor(props){
super(props);
@@ -81,7 +89,7 @@ class HomeworkModal extends Component{
// console.log('startValue',dateString);
this.setState({
- endtime: handleDateString(dateString),
+ endtime: date===null?"":handleDateString(dateString),
})
}
@@ -188,6 +196,7 @@ class HomeworkModal extends Component{
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
showToday={false}
locale={locale}
format={dateFormat}
diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js
index 08e01e28e..fa2e014f9 100644
--- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js
+++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js
@@ -16,12 +16,17 @@ function range(start, end) {
}
return result;
}
+
function disabledDateTime() {
return {
disabledMinutes: () => range(1, 30).concat(range(31, 60)),
// disabledSeconds: () => range(1,60)
}
}
+
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
class Selectsetting extends Component{
constructor(props){
super(props);
@@ -698,6 +703,7 @@ class Selectsetting extends Component{
onChange={(e,index)=>this.onChangeTimepublishs(e,index,key)}
// onChange={ this.onChangeTimepublish }
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
/>
{key!=0?this.deletegrouppublish(key)}>:""}
@@ -730,7 +736,7 @@ class Selectsetting extends Component{
value={datatime===undefined||datatime===""?"":moment(datatime, dateFormat)}
onChange={this.onChangeTimepublish}
disabledTime={disabledDateTime}
-
+ disabledDate={disabledDate}
/>
:""}
diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js
index 397711ca3..8443061dd 100644
--- a/public/react/src/modules/courses/coursesPublic/sendResource.js
+++ b/public/react/src/modules/courses/coursesPublic/sendResource.js
@@ -22,6 +22,11 @@ function disabledDateTime() {
};
}
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
+
+
const dateFormat="YYYY-MM-DD HH:mm";
class Sendresource extends Component{
constructor(props){
@@ -525,6 +530,7 @@ class Sendresource extends Component{
onChange={(e,index)=>this.onChangeTimepublish(e,index,key,2)}
// onChange={ this.onChangeTimepublish }
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
/>
{key!=0?this.deletegrouppublish(key)}>:""}
{key===course_group_publish_times.length-1&&key:""}
@@ -551,7 +557,7 @@ class Sendresource extends Component{
value={datatime===undefined||datatime===""?undefined:moment(datatime, dateFormat)}
onChange={(e,index)=>this.onChangeTimepublish(e,index,undefined,1)}
disabledTime={disabledDateTime}
-
+ disabledDate={disabledDate}
/>
:""}
diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js
index 9b6103fdb..a93aa9942 100644
--- a/public/react/src/modules/courses/exercise/Exercisesetting.js
+++ b/public/react/src/modules/courses/exercise/Exercisesetting.js
@@ -23,6 +23,7 @@ function range(start, end) {
}
return result;
}
+
function disabledDateTime() {
return {
// disabledHours: () => range(0, 24).splice(4, 20),
@@ -30,6 +31,11 @@ function disabledDateTime() {
// disabledSeconds: () => [0, 60],
};
}
+
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
+
const dataformat="YYYY-MM-DD HH:mm";
class Exercisesetting extends Component{
@@ -636,6 +642,7 @@ class Exercisesetting extends Component{
format="YYYY-MM-DD HH:mm"
showToday={false}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
onChange={this.onChangeTimepublish}
value={publish_time && moment(publish_time,"YYYY-MM-DD HH:mm")}
disabled={ publish_timetype===true?true:!flagPageEdit }
@@ -661,6 +668,7 @@ class Exercisesetting extends Component{
width={"240px"}
format="YYYY-MM-DD HH:mm"
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
onChange={this.onChangeTimeEnd}
value={end_time && moment(end_time,"YYYY-MM-DD HH:mm")}
disabled={ end_timetype===true?true:!flagPageEdit}
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
index 5bbbe1a14..59d3dce17 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
@@ -27,6 +27,11 @@ function disabledDateTime() {
};
}
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
+
+
class GraduationTaskssettingapp extends Component{
constructor(props){
@@ -1181,6 +1186,7 @@ class GraduationTaskssettingapp extends Component{
value={publish_time===null||publish_time===""?"":moment(publish_time, dateFormat)}
onChange={this.onChangeTimepublish}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
disabled={this.props.isAdmin()===true?starttimetype===true?true:flagPageEdit===true?false:true:true}
className={ this.state.publishTimetypes===true?"noticeTip":""}
/>
@@ -1218,6 +1224,7 @@ class GraduationTaskssettingapp extends Component{
value={end_time===null||end_time===""?"":moment(end_time, dateFormat)}
onChange={this.onChangeTimeend}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
// disabled={this.props.isSuperAdmin()===true?flagPageEdit===true?false:true:this.props.isAdmin()===true?endtimetype===true?true:flagPageEdit===true?false:true:true}
disabled={this.props.isAdmin()===true?endtimetype===true?true:flagPageEdit===true?false:true:true}
className={this.state.endTimetypes===true||end_timetype===true?"noticeTip":""}
@@ -1269,6 +1276,7 @@ class GraduationTaskssettingapp extends Component{
width={"210px"}
value={latetime===null||latetime===""?"":moment(latetime, dateFormat)}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
onChange={this.onChangeTimelatetime}
disabled={this.props.isAdmin()===true?allowlate===true||allowlate===1?flagPageEdit===true?false:true:true:true}
className={ latetimetype===true?"noticeTip":""}
@@ -1319,6 +1327,7 @@ class GraduationTaskssettingapp extends Component{
width={"210px"}
value={commenttime===null||commenttime=== ""?"":moment(commenttime, dateFormat)}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
onChange={this.onChangeTimecommenttime}
disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}
className={ commenttimetype===true?"noticeTip":""}
diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js
index b817136ed..c5602d285 100644
--- a/public/react/src/modules/courses/new/CoursesNew.js
+++ b/public/react/src/modules/courses/new/CoursesNew.js
@@ -28,6 +28,9 @@ function disabledDateTime() {
};
}
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
class CoursesNew extends Component {
@@ -572,6 +575,7 @@ class CoursesNew extends Component {
width={"210px"}
value={datatime === undefined ? "" :datatime === null ? "" : moment(datatime, dateFormat)}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
dropdownClassName="hideDisable"
onChange={this.onChangeTimepublishs}
/>
diff --git a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
index 292830fb8..8b62dd5e4 100644
--- a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
+++ b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js
@@ -26,6 +26,12 @@ function disabledDateTime() {
// disabledSeconds: () => range(1,60)
}
}
+
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
+
+
class PollDetailTabForthRules extends Component{
constructor(props){
super(props);
@@ -404,6 +410,7 @@ class PollDetailTabForthRules extends Component{
showTime={{ format: 'HH:mm' }}
format="YYYY-MM-DD HH:mm"
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
disabled={ rule.e_timeflag ===undefined?rule.publish_time===null?false:!flagPageEdit:rule.p_timeflag == true ? true : !flagPageEdit}
style={{"height":"42px",width:'100%'}}
>
@@ -429,6 +436,7 @@ class PollDetailTabForthRules extends Component{
showTime={{ format: 'HH:mm' }}
format="YYYY-MM-DD HH:mm"
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
disabled={ rule.e_timeflag ===undefined?rule.publish_time===null?false:!flagPageEdit:rule.e_timeflag == true ? true : !flagPageEdit}
style={{"height":"42px"}}
>
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index b07392153..21f03a819 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -47,6 +47,9 @@ function disabledDateTime() {
}
}
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
class Trainingjobsetting extends Component {
//unifiedsetting 统一设置
@@ -1935,6 +1938,7 @@ class Trainingjobsetting extends Component {
id={"publishtimeid"}
disabledDate={this.disabledStartDatestart}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
className={borreds}
showTime={{ format: 'HH:mm' }}
format="YYYY-MM-DD HH:mm"
@@ -1967,6 +1971,7 @@ class Trainingjobsetting extends Component {
showToday={false}
id={"end_timeid"}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
showTime={{ format: 'HH:mm' }}
className={borredss}
format="YYYY-MM-DD HH:mm"
@@ -2049,6 +2054,7 @@ class Trainingjobsetting extends Component {
showToday={false}
id={"late_timeid"}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
format="YYYY-MM-DD HH:mm"
value={late_time && moment(late_time, dataformat)}
onChange={this.onEndChangeys}
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
index 8eb2c76dd..bb318ba13 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -199,6 +199,10 @@ function disabledDateTime() {
// disabledSeconds: () => [0, 60],
};
}
+
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
export default class TPMsettings extends Component {
constructor(props) {
super(props)
@@ -1144,7 +1148,7 @@ export default class TPMsettings extends Component {
}
onChangeTimePicker =(value, dateString)=> {
this.setState({
- opening_time:moment(handleDateStrings(dateString))
+ opening_time: dateString=== ""?"":moment(handleDateStrings(dateString))
})
}
@@ -1871,6 +1875,7 @@ export default class TPMsettings extends Component {
width={178}
locale={locale}
disabledTime={disabledDateTime}
+ disabledDate={disabledDate}
placeholder="请选择开启时间"
value={opening_time===null||opening_time===""?"":moment(opening_time, dateFormat)}
onChange={this.onChangeTimePicker}
diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
index f9c8f5b10..790402a22 100644
--- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js
+++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
@@ -191,7 +191,9 @@ function disabledDateTime() {
};
}
-
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
class Newshixuns extends Component {
constructor(props) {
super(props)
@@ -743,7 +745,7 @@ class Newshixuns extends Component {
onChangeTimePicker = (value, dateString) => {
this.setState({
- TimePickervalue: moment(handleDateStrings(dateString))
+ TimePickervalue: dateString=== ""?"":moment(handleDateStrings(dateString))
})
}
@@ -1288,7 +1290,7 @@ class Newshixuns extends Component {
placeholder="请选择开启时间"
onChange={this.onChangeTimePicker}
value={TimePickervalue && moment(TimePickervalue, "YYYY-MM-DD HH:mm")}
-
+ disabledDate={disabledDate}
disabledTime={disabledDateTime}
dropdownClassName="hideDisable"
/>