From d72482e4f8e6d4c3345aff6843c61ea04b0ceb53 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, 29 Jan 2020 19:19:11 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 133 +++++++++--------- .../react/src/modules/paths/statics/index.js | 62 ++++---- public/react/src/services/wxcodeService.js | 26 ++-- 3 files changed, 109 insertions(+), 112 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index ec709135c..22a618141 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -12,6 +12,7 @@ const opens ="79e33abd4b6588941ab7622aed1e67e8"; let timestamp; let checkSubmitFlg = false; let message501=false; + broadcastChannelOnmessage('refreshPage', () => { window.location.reload() }) @@ -25,21 +26,11 @@ function locationurl(list){ } -function setCookier(){ - const _params = window.location.search; - if (_params) { - let _search = _params.split('?')[1]; - _search.split('&').forEach(item => { - console.log(item); - const _arr = item.split('='); - cookie.save('_educoder_session',_arr[0]); - cookie.save('autologin_trustie',_arr[1]); - }); - } -} + + // TODO 开发期多个身份切换 -let debugType ="" + let debugType ="" if (isDev) { const _search = window.location.search; let parsed = {}; @@ -56,69 +47,71 @@ if (isDev) { //debugType="teacher"; // 学生 //debugType="student"; + + + + + +function clearAllCookie() { + cookie.remove('_educoder_session', {path: '/'}); + cookie.remove('autologin_trustie', {path: '/'}); + setpostcookie() +} +clearAllCookie(); function setpostcookie() { - try { - const str =window.location.pathname; - let newdomain=".educoder.net" - if(window.location.origin==="https://www.educoder.net"){ - newdomain=".educoder.net"; - }else{ + const str =window.location.pathname; + console.log(str.indexOf("/wxcode")) + let newdomain=".educoder.net" + if(str.indexOf("/wxcode") !== -1){ + console.log("123") + cookie.remove('_educoder_session', {path: '/'}); + cookie.remove('autologin_trustie', {path: '/'}); + // console.log("开始重写cookis"); + const _params = window.location.search; + // console.log("1111"); + if (_params) { + // console.log("22222"); + let _search = _params.split('?')[1]; + let _educoder_sessions= _search.split('&')[0].split('='); + cookie.save('_educoder_session',_educoder_sessions[1], { domain:'.educoder.net', path: '/'}); + let autologin_trusties=_search.split('&')[1].split('='); + cookie.save('autologin_trustie',autologin_trusties[1], { domain:'.educoder.net', path: '/'}); - newdomain="test-newweb.educoder.net"; } - if(str.indexOf("/wxcode") !== -1){ - // console.log("开始重写cookis"); - const _params = window.location.search; - // console.log("1111"); - if (_params) { - // console.log("22222"); - let _search = _params.split('?')[1]; - _search.split('&').forEach(item => { - const _arr = item.split('='); - if(_arr[0]==='_educoder_session'){ - console.log(newdomain) - cookie.save('_educoder_session',_arr[1],{ path: '/' }); - cookie.save('_educoder_session',_arr[1], { domain: newdomain, path: '/'}); - - }else{ - console.log(newdomain) - cookie.save('autologin_trustie',_arr[1],{ path: '/' }); - cookie.save('autologin_trustie',_arr[1], { domain: newdomain, path: '/'}); - } - }); - } - } - }catch (e) { - } } +setpostcookie(); function railsgettimes(proxy) { - if(timestamp&&checkSubmitFlg===false){ - $.ajax({url:proxy,async:false,success:function(data){ - if(data.status===0){ - timestamp=data.message; - setpostcookie(); - } - }}) - checkSubmitFlg=true - window.setTimeout(function () { - checkSubmitFlg=false; - }, 2000); - }else if(checkSubmitFlg===false){ - $.ajax({url:proxy,async:false,success:function(data){ - if(data.status===0){ - timestamp=data.message; - setpostcookie(); - } - }}) - checkSubmitFlg=true - window.setTimeout(function () { - checkSubmitFlg=false; - }, 2000); - } + + clearAllCookie() + + if(timestamp&&checkSubmitFlg===false){ + $.ajax({url:proxy,async:false,success:function(data){ + if(data.status===0){ + timestamp=data.message; + setpostcookie(); + } + }}) + checkSubmitFlg=true + window.setTimeout(()=>{ + checkSubmitFlg=false; + }, 2000); + }else if(checkSubmitFlg===false){ + $.ajax({url:proxy,async:false,success:function(data){ + if(data.status===0){ + timestamp=data.message; + setpostcookie(); + } + }}) + checkSubmitFlg=true + window.setTimeout( ()=>{ + checkSubmitFlg=false; + }, 2000); + } + } @@ -157,6 +150,8 @@ export function initAxiosInterceptors(props) { //响应前的设置 axios.interceptors.request.use( config => { + setpostcookie() + clearAllCookie() // config.headers['Content-Type']= 'no-cache' // if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了 // config.headers.Authorization = token; @@ -259,6 +254,7 @@ export function initAxiosInterceptors(props) { config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; } } + setpostcookie(); } // // console.log(config); @@ -285,6 +281,7 @@ export function initAxiosInterceptors(props) { }); axios.interceptors.response.use(function (response) { + // console.log(".............") if(response===undefined){ return @@ -386,7 +383,7 @@ export function initAxiosInterceptors(props) { // } requestMap[response.config.url] = false; - + setpostcookie(); return response; }, function (error) { return Promise.reject(error); diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index 37cc44df3..c2e541804 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -1,7 +1,7 @@ /* * @Description: 实践课程统计页面 * @Author: tangjiang - * @Github: + * @Github: * @Date: 2020-01-10 09:33:45 * @LastEditors : tangjiang * @LastEditTime : 2020-01-14 17:01:32 @@ -25,7 +25,7 @@ const App = (props) => { changeParams, initTotal } = props; - // const [datas, setDatas] = useState([]); + // const [datas, setDatas] = useState([]); // const [sortedInfo, setSortedInfo] = useState({}); // console.log(props); const {pathId} = props.match.params; @@ -213,14 +213,14 @@ const App = (props) => { } const { - study_count, - course_study_count, - initiative_study, - passed_count, - course_used_count, + study_count, + course_study_count, + initiative_study, + passed_count, + course_used_count, school_used_count } = subject_info; - + const maps = { 1: 'subject_info', // 实践课程使用情况 2: 'shixun_info', // 实训使用情况 @@ -251,32 +251,32 @@ const App = (props) => {
- - - - - @@ -285,32 +285,32 @@ const App = (props) => {
- - - - -
+ +
@@ -321,7 +321,7 @@ const mapStateToProps = (state) => { const { staticReducer: {subject_info, other_info, total} } = state; return { subject_info, - other_info, + other_info, total } }; diff --git a/public/react/src/services/wxcodeService.js b/public/react/src/services/wxcodeService.js index 3b281bee0..84bd6cfa3 100644 --- a/public/react/src/services/wxcodeService.js +++ b/public/react/src/services/wxcodeService.js @@ -12,19 +12,19 @@ import cookie from 'react-cookies' const setCookier = () => { - const _params = window.location.search; - if (_params) { - let _search = _params.split('?')[1]; - _search.split('&').forEach(item => { - // console.log(item); - const _arr = item.split('='); - cookie.remove(_arr[0], { - path: '/', - domain: '.educoder.net' - }); - cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'}); - }); - } + // const _params = window.location.search; + // if (_params) { + // let _search = _params.split('?')[1]; + // _search.split('&').forEach(item => { + // // console.log(item); + // const _arr = item.split('='); + // cookie.remove(_arr[0], { + // path: '/', + // domain: '.educoder.net' + // }); + // cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'}); + // }); + // } } // 获取代码块 From babb7711922a7fc8a91e2c159047b8e424da5f0f 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, 29 Jan 2020 19:33:11 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/paths/statics/index.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index c2e541804..46689311d 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -212,14 +212,14 @@ const App = (props) => { pathId && staticList(pathId); } - const { - study_count, - course_study_count, - initiative_study, - passed_count, - course_used_count, - school_used_count - } = subject_info; + // const { + // study_count, + // course_study_count, + // initiative_study, + // passed_count, + // course_used_count, + // school_used_count + // } = subject_info; const maps = { 1: 'subject_info', // 实践课程使用情况 @@ -251,32 +251,32 @@ const App = (props) => {
From 16c757f6c28293fb6c98d2192517f4f3fa095769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 1 Feb 2020 20:49:56 +0800 Subject: [PATCH 3/5] =?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/modules/tpm/TPMBanner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 137a68a66..9ba752827 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -863,7 +863,7 @@ class TPMBanner extends Component { }; // // console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter) - + // console.log(this.state) return ( @@ -1256,7 +1256,7 @@ class TPMBanner extends Component { {this.state.Senttothevcaluetype === true ?
请选择你要发送的课堂
: ""}
12 ? "block" : "none"}}>
From 25be475c076d4d3f9a5f62404614a74faf565bf1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 2 Feb 2020 20:36:31 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=AC=A6=E5=90=88=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=B8=A6=E4=B8=8A=E5=85=AC=E5=BC=80?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/subjects/copy_subject_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/subjects/copy_subject_service.rb b/app/services/subjects/copy_subject_service.rb index 4715a8bad..d0a1f34b8 100644 --- a/app/services/subjects/copy_subject_service.rb +++ b/app/services/subjects/copy_subject_service.rb @@ -60,7 +60,7 @@ class Subjects::CopySubjectService < ApplicationService shixun = stage_shixun.shixun to_shixun = Shixun.new to_shixun.attributes = shixun.attributes.dup.except('id', 'user_id', 'identifier', 'homepage_show', - 'use_scope', 'averge_star', 'myshixuns_count', 'challenges_count', "public") + 'use_scope', 'averge_star', 'myshixuns_count', 'challenges_count') to_shixun.identifier = Util::UUID.generate_identifier(Shixun, 8) to_shixun.user_id = user.id if laboratory From 393c69177b5f9c6771b0a2d99780f4e38244f090 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 3 Feb 2020 15:41:20 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BA=91=E4=B8=8A=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AE=A4=E7=AE=A1=E7=90=86=E5=91=98=E6=A0=87=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/cooperative.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/cooperative.html.erb b/app/views/layouts/cooperative.html.erb index baa0c7565..b186c6245 100644 --- a/app/views/layouts/cooperative.html.erb +++ b/app/views/layouts/cooperative.html.erb @@ -1,7 +1,7 @@ - <%= current_laboratory.school&.name || 'EduCoder' %>-后台管理 + <%= current_laboratory.laboratory_setting&.name || 'EduCoder' %>-后台管理