Merge branches 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop

dev_video
杨树明 5 years ago
commit f329a9e72c

@ -60,7 +60,7 @@ class Subjects::CopySubjectService < ApplicationService
shixun = stage_shixun.shixun shixun = stage_shixun.shixun
to_shixun = Shixun.new to_shixun = Shixun.new
to_shixun.attributes = shixun.attributes.dup.except('id', 'user_id', 'identifier', 'homepage_show', 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.identifier = Util::UUID.generate_identifier(Shixun, 8)
to_shixun.user_id = user.id to_shixun.user_id = user.id
if laboratory if laboratory

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title><%= current_laboratory.school&.name || 'EduCoder' %>-后台管理</title> <title><%= current_laboratory.laboratory_setting&.name || 'EduCoder' %>-后台管理</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel='shortcut icon' type='image/x-icon' href='<%= current_setting_or_default(:tab_logo_url) %>' /> <link rel='shortcut icon' type='image/x-icon' href='<%= current_setting_or_default(:tab_logo_url) %>' />

@ -12,6 +12,7 @@ const opens ="79e33abd4b6588941ab7622aed1e67e8";
let timestamp; let timestamp;
let checkSubmitFlg = false; let checkSubmitFlg = false;
let message501=false; let message501=false;
broadcastChannelOnmessage('refreshPage', () => { broadcastChannelOnmessage('refreshPage', () => {
window.location.reload() 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 开发期多个身份切换 // TODO 开发期多个身份切换
let debugType ="" let debugType =""
if (isDev) { if (isDev) {
const _search = window.location.search; const _search = window.location.search;
let parsed = {}; let parsed = {};
@ -56,69 +47,71 @@ if (isDev) {
//debugType="teacher"; //debugType="teacher";
// 学生 // 学生
//debugType="student"; //debugType="student";
function clearAllCookie() {
cookie.remove('_educoder_session', {path: '/'});
cookie.remove('autologin_trustie', {path: '/'});
setpostcookie()
}
clearAllCookie();
function setpostcookie() { function setpostcookie() {
try {
const str =window.location.pathname;
let newdomain=".educoder.net"
if(window.location.origin==="https://www.educoder.net"){ const str =window.location.pathname;
newdomain=".educoder.net"; console.log(str.indexOf("/wxcode"))
}else{ 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) { function railsgettimes(proxy) {
if(timestamp&&checkSubmitFlg===false){
$.ajax({url:proxy,async:false,success:function(data){ clearAllCookie()
if(data.status===0){
timestamp=data.message; if(timestamp&&checkSubmitFlg===false){
setpostcookie(); $.ajax({url:proxy,async:false,success:function(data){
} if(data.status===0){
}}) timestamp=data.message;
checkSubmitFlg=true setpostcookie();
window.setTimeout(function () { }
checkSubmitFlg=false; }})
}, 2000); checkSubmitFlg=true
}else if(checkSubmitFlg===false){ window.setTimeout(()=>{
$.ajax({url:proxy,async:false,success:function(data){ checkSubmitFlg=false;
if(data.status===0){ }, 2000);
timestamp=data.message; }else if(checkSubmitFlg===false){
setpostcookie(); $.ajax({url:proxy,async:false,success:function(data){
} if(data.status===0){
}}) timestamp=data.message;
checkSubmitFlg=true setpostcookie();
window.setTimeout(function () { }
checkSubmitFlg=false; }})
}, 2000); checkSubmitFlg=true
} window.setTimeout( ()=>{
checkSubmitFlg=false;
}, 2000);
}
} }
@ -157,6 +150,8 @@ export function initAxiosInterceptors(props) {
//响应前的设置 //响应前的设置
axios.interceptors.request.use( axios.interceptors.request.use(
config => { config => {
setpostcookie()
clearAllCookie()
// config.headers['Content-Type']= 'no-cache' // config.headers['Content-Type']= 'no-cache'
// if (token) { // 每次发送请求之前判断是否存在token如果存在则统一在http请求的header都加上token不用每次请求都手动添加了 // if (token) { // 每次发送请求之前判断是否存在token如果存在则统一在http请求的header都加上token不用每次请求都手动添加了
// config.headers.Authorization = token; // config.headers.Authorization = token;
@ -259,6 +254,7 @@ export function initAxiosInterceptors(props) {
config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`;
} }
} }
setpostcookie();
} }
// //
// console.log(config); // console.log(config);
@ -285,6 +281,7 @@ export function initAxiosInterceptors(props) {
}); });
axios.interceptors.response.use(function (response) { axios.interceptors.response.use(function (response) {
// console.log(".............") // console.log(".............")
if(response===undefined){ if(response===undefined){
return return
@ -386,7 +383,7 @@ export function initAxiosInterceptors(props) {
// } // }
requestMap[response.config.url] = false; requestMap[response.config.url] = false;
setpostcookie();
return response; return response;
}, function (error) { }, function (error) {
return Promise.reject(error); return Promise.reject(error);

@ -212,14 +212,14 @@ const App = (props) => {
pathId && staticList(pathId); pathId && staticList(pathId);
} }
const { // const {
study_count, // study_count,
course_study_count, // course_study_count,
initiative_study, // initiative_study,
passed_count, // passed_count,
course_used_count, // course_used_count,
school_used_count // school_used_count
} = subject_info; // } = subject_info;
const maps = { const maps = {
1: 'subject_info', // 实践课程使用情况 1: 'subject_info', // 实践课程使用情况
@ -251,32 +251,32 @@ const App = (props) => {
</div> </div>
<div className="header-number header-flex"> <div className="header-number header-flex">
<StaticNumberAndTxt <StaticNumberAndTxt
count={study_count} // 总数 count={subject_info===null?0:subject_info.study_count} // 总数
txt={'学习总人数'} // 文字描述 txt={'学习总人数'} // 文字描述
desc={'学习该课程的全部人数(学习总人数=课堂学习人数+自主学习人数)'} desc={'学习该课程的全部人数(学习总人数=课堂学习人数+自主学习人数)'}
/> />
<StaticNumberAndTxt <StaticNumberAndTxt
count={course_study_count} // 总数 count={subject_info===null?0:subject_info.course_study_count} // 总数
txt={'课堂学习人数'} // 文字描述 txt={'课堂学习人数'} // 文字描述
desc={'通过课堂学习该课程的人数'} desc={'通过课堂学习该课程的人数'}
/> />
<StaticNumberAndTxt <StaticNumberAndTxt
count={initiative_study} // 总数 count={subject_info===null?0:subject_info.initiative_study} // 总数
txt={'自主学习人数'} // 文字描述 txt={'自主学习人数'} // 文字描述
desc={'通过自主学习该课程的人数'} desc={'通过自主学习该课程的人数'}
/> />
<StaticNumberAndTxt <StaticNumberAndTxt
count={passed_count} // 总数 count={subject_info===null?0:subject_info.passed_count} // 总数
txt={'通关总人数'} // 文字描述 txt={'通关总人数'} // 文字描述
desc={'通关该课程所有实训的人数去重。一个人数计算1次'} desc={'通关该课程所有实训的人数去重。一个人数计算1次'}
/> />
<StaticNumberAndTxt <StaticNumberAndTxt
count={course_used_count} // 总数 count={subject_info===null?0:subject_info.course_used_count} // 总数
txt={'使用课堂数'} // 文字描述 txt={'使用课堂数'} // 文字描述
desc={'使用该课程的课堂数量'} desc={'使用该课程的课堂数量'}
/> />
<StaticNumberAndTxt <StaticNumberAndTxt
count={school_used_count} // 总数 count={subject_info===null?0:subject_info.school_used_count} // 总数
txt={'使用单位数'} // 文字描述 txt={'使用单位数'} // 文字描述
desc={'使用该课程的单位数量(包括自主学习者所在单位)'} desc={'使用该课程的单位数量(包括自主学习者所在单位)'}
/> />

@ -1256,7 +1256,7 @@ class TPMBanner extends Component {
{this.state.Senttothevcaluetype === true ? <div className={"color-red"}>请选择你要发送的课堂</div> : ""} {this.state.Senttothevcaluetype === true ? <div className={"color-red"}>请选择你要发送的课堂</div> : ""}
<div className="mt10 marginauto" style={{display: courses_count > 12 ? "block" : "none"}}> <div className="mt10 marginauto" style={{display: courses_count > 12 ? "block" : "none"}}>
<Pagination size="small" className="mb20" <Pagination size="small" className="mb20"
showQuickJumper defaultCurrent={1} current={pages} pageSize={12} showQuickJumper defaultCurrent={1} current={pages} pageSize={10}
total={courses_count} onChange={this.onChangesendeSenttothe}/> total={courses_count} onChange={this.onChangesendeSenttothe}/>
</div> </div>

@ -12,19 +12,19 @@ import cookie from 'react-cookies'
const setCookier = () => { const setCookier = () => {
const _params = window.location.search; // const _params = window.location.search;
if (_params) { // if (_params) {
let _search = _params.split('?')[1]; // let _search = _params.split('?')[1];
_search.split('&').forEach(item => { // _search.split('&').forEach(item => {
// console.log(item); // // console.log(item);
const _arr = item.split('='); // const _arr = item.split('=');
cookie.remove(_arr[0], { // cookie.remove(_arr[0], {
path: '/', // path: '/',
domain: '.educoder.net' // domain: '.educoder.net'
}); // });
cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'}); // cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'});
}); // });
} // }
} }
// 获取代码块 // 获取代码块

Loading…
Cancel
Save