From 4cb90430e7e5a2b26aeca288b539dd5f229c9ada Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 20 Mar 2020 15:14:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=85=BC=E5=AE=B9edge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/public/js/applications.js | 2 +- public/react/src/AppConfig.js | 4 ++-- .../courses/coursesHome/CoursesHomeCard.js | 15 ++++++++++++++- .../src/modules/user/usersInfo/InfosBanner.js | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/public/react/public/js/applications.js b/public/react/public/js/applications.js index ad46a5aa0..e99bf61cd 100644 --- a/public/react/public/js/applications.js +++ b/public/react/public/js/applications.js @@ -11267,7 +11267,7 @@ Copyright © 2018 Basecamp, LLC type: "GET", dataType: "script", cache: true, - async: false, + async: true, global: false, // Only evaluate the response if it is successful (gh-4126) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index b8f41d349..7beca416a 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -89,7 +89,7 @@ setpostcookie(); clearAllCookie() if(timestamp&&checkSubmitFlg===false){ - $.ajax({url:proxy,async:false,success:function(data){ + $.ajax({url:proxy,async:true,success:function(data){ if(data.status===0){ timestamp=data.message; setpostcookie(); @@ -100,7 +100,7 @@ setpostcookie(); checkSubmitFlg=false; }, 2000); }else if(checkSubmitFlg===false){ - $.ajax({url:proxy,async:false,success:function(data){ + $.ajax({url:proxy,async:true,success:function(data){ if(data.status===0){ timestamp=data.message; setpostcookie(); diff --git a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js index 4d34f1ba2..887b5dabd 100644 --- a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js +++ b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js @@ -92,8 +92,21 @@ class CoursesHomeCard extends Component{ {item.school} -

+ +
+ {item.teacher_users.length===0? + : + 协作老师: + {item.teacher_users&&item.teacher_users.map((iem,idx)=>{ +
{iem[0]}
+ }) + } +
+ } +
+ +
diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index e7d695d71..20393da3a 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -81,7 +81,7 @@ class InfosBanner extends Component{ -

+

From f5fafeb7f18b5238f91f0cd17025faf688d0a303 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 20 Mar 2020 15:19:06 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AE=9E=E8=AE=ADedge=E7=99=BD=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/public/js/applications.js | 2 +- public/react/src/AppConfig.js | 645 +++++++++++++------------ 2 files changed, 325 insertions(+), 322 deletions(-) diff --git a/public/react/public/js/applications.js b/public/react/public/js/applications.js index e99bf61cd..ad46a5aa0 100644 --- a/public/react/public/js/applications.js +++ b/public/react/public/js/applications.js @@ -11267,7 +11267,7 @@ Copyright © 2018 Basecamp, LLC type: "GET", dataType: "script", cache: true, - async: true, + async: false, global: false, // Only evaluate the response if it is successful (gh-4126) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 7beca416a..a3efafdb9 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -3,25 +3,25 @@ import React from "react"; import axios from 'axios'; import md5 from 'md5'; import { requestProxy } from "./indexEduplus2RequestProxy"; -import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; -import { notification } from 'antd'; +import { broadcastChannelOnmessage, SetAppModel, isDev, queryString } from 'educoder'; +import { notification } from 'antd'; import cookie from 'react-cookies'; import './index.css'; const $ = window.$; -const opens ="79e33abd4b6588941ab7622aed1e67e8"; +const opens = "79e33abd4b6588941ab7622aed1e67e8"; let timestamp; let checkSubmitFlg = false; -let message501=false; +let message501 = false; broadcastChannelOnmessage('refreshPage', () => { - window.location.reload() + window.location.reload() }) -function locationurl(list){ +function locationurl(list) { if (window.location.port === "3007") { } else { - window.location.href=list + window.location.href = list } } @@ -30,7 +30,7 @@ function locationurl(list){ // TODO 开发期多个身份切换 - let debugType ="" +let debugType = "" if (isDev) { const _search = window.location.search; let parsed = {}; @@ -42,41 +42,41 @@ if (isDev) { window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' } // 超管 -//debugType="admin"; +debugType = "admin"; // 老师 // debugType="teacher"; // 学生 - debugType="student"; +// debugType="student"; function clearAllCookie() { - cookie.remove('_educoder_session', {path: '/'}); - cookie.remove('autologin_trustie', {path: '/'}); + cookie.remove('_educoder_session', { path: '/' }); + cookie.remove('autologin_trustie', { path: '/' }); setpostcookie() } clearAllCookie(); function setpostcookie() { - const str =window.location.pathname; + const str = window.location.pathname; // console.log(str.indexOf("/wxcode")) - let newdomain=".educoder.net" - if(str.indexOf("/wxcode") !== -1){ + let newdomain = ".educoder.net" + if (str.indexOf("/wxcode") !== -1) { console.log("123") - cookie.remove('_educoder_session', {path: '/'}); - cookie.remove('autologin_trustie', {path: '/'}); + 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: '/'}); + 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: '/' }); } } @@ -84,33 +84,37 @@ function setpostcookie() { setpostcookie(); - function railsgettimes(proxy) { - - clearAllCookie() - - if(timestamp&&checkSubmitFlg===false){ - $.ajax({url:proxy,async:true,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:true,success:function(data){ - if(data.status===0){ - timestamp=data.message; - setpostcookie(); - } - }}) - checkSubmitFlg=true - window.setTimeout( ()=>{ - checkSubmitFlg=false; - }, 2000); - } +function railsgettimes(proxy) { + + 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); + } } @@ -120,292 +124,291 @@ setpostcookie(); window._debugType = debugType; export function initAxiosInterceptors(props) { - initOnlineOfflineListener() - - // TODO 避免重复的请求 https://github.com/axios/axios#cancellation - // https://github.com/axios/axios/issues/1497 - - // TODO 读取到package.json中的配置? - var proxy = "http://localhost:3000" - // proxy = "http://testbdweb.trustie.net" - // proxy = "http://testbdweb.educoder.net" - // proxy = "https://testeduplus2.educoder.net" - //proxy="http://47.96.87.25:48080" - proxy="https://pre-newweb.educoder.net" - proxy="https://test-newweb.educoder.net" - // proxy="https://test-jupyterweb.educoder.net" - // proxy="https://test-newweb.educoder.net" - // proxy="https://test-jupyterweb.educoder.net" - //proxy="https://test-jupyterweb.educoder.net/" - - - // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; - // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 - const requestMap = {}; - - window.setfalseInRequestMap = function(keyName) { - requestMap[keyName] = false; - } - - //响应前的设置 - axios.interceptors.request.use( - config => { - setpostcookie() - clearAllCookie() - // config.headers['Content-Type']= 'no-cache' - // if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了 - // config.headers.Authorization = token; - // } - - // --------------------------------------------- 測試3007连测试服的代码 - // if (url.indexOf('file_update') != -1 || url.indexOf('game_build') != -1 || url.indexOf('game_status') != -1) { - // proxy = 'https://testbdweb.trustie.net' - // } else { - // proxy = 'http://localhost:3000' - // } - // --------------------------------------------- - // console.log("开始请求了"); - // console.log(config.url); - // console.log(window.location.pathname); - // - - // try { - // const str =window.location.pathname; - // 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]; - // var _educoder_sessionmys=""; - // var autologin_trusties=""; - // _search.split('&').forEach(item => { - // const _arr = item.split('='); - // if(_arr[0]==='_educoder_session'){ - // cookie.save('_educoder_session',_arr[1], { domain: '.educoder.net', path: '/'}); - // _educoder_sessionmys=_arr[1]; - // }else{ - // cookie.save('autologin_trustie',_arr[1], { domain: '.educoder.net', path: '/'}); - // autologin_trusties=_arr[1]; - // } - // }); - // try { - // const autlogins= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; - // config.params = {'Cookie': autlogins} - // config.headers['Cookie'] =autlogins; - // // console.log("设置了cookis"); - // } catch (e) { - // - // } - // try { - // const autloginysls= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; - // config.params = {'autloginysls': autloginysls} - // config.headers['Cookie'] =autloginysls; - // // console.log("设置了cookis"); - // }catch (e) { - // - // } - // } - // } - // }catch (e) { - // - // } - - - - if (config.url.indexOf(proxy) != -1 || config.url.indexOf(':') != -1) { - return config - } - requestProxy(config) - - let url = `/api${config.url}`; - - //qq登录去掉api - if(config.params&&config.params.redirect_uri!=undefined){ - if(config.params.redirect_uri.indexOf('otherloginqq')!=-1){ - url = `${config.url}`; - } - } - if(`${config[0]}`!=`true`){ - let timestamp = Date.parse(new Date())/1000; - if (window.location.port === "3007") { - // let timestamp=railsgettimes(proxy); - // console.log(timestamp) - // `https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp` - railsgettimes( `${proxy}/api/main/first_stamp.json`); - let newopens=md5(opens+timestamp) - config.url = `${proxy}${url}`; - if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; - } else { - config.url = `${config.url}&debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; - } - } else { - // 加api前缀 - // railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); - - railsgettimes( `/api/main/first_stamp.json`); - let newopens=md5(opens+timestamp) - config.url = url; - if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?randomcode=${timestamp}&client_key=${newopens}`; - } else { - config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; - } - } - setpostcookie(); - } - // - // console.log(config); - if (requestMap[config.url] === true) { - return false; - } - // // 非file_update请求 - if (config.url.indexOf('update_file') === -1) { - requestMap[config.url] = true; - - window.setTimeout("setfalseInRequestMap('"+config.url+"')", 900) - } - // setTimeout("setfalseInRequestMap(" + config.url + ")", 1200) - return config; - }, - err => { - return Promise.reject(err); - }); + initOnlineOfflineListener() + + // TODO 避免重复的请求 https://github.com/axios/axios#cancellation + // https://github.com/axios/axios/issues/1497 + + // TODO 读取到package.json中的配置? + var proxy = "http://localhost:3000" + // proxy = "http://testbdweb.trustie.net" + // proxy = "http://testbdweb.educoder.net" + // proxy = "https://testeduplus2.educoder.net" + //proxy="http://47.96.87.25:48080" + proxy = "https://pre-newweb.educoder.net" + proxy = "https://test-newweb.educoder.net" + // proxy="https://test-jupyterweb.educoder.net" + // proxy="https://test-newweb.educoder.net" + // proxy="https://test-jupyterweb.educoder.net" + //proxy="https://test-jupyterweb.educoder.net/" + + + // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; + // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 + const requestMap = {}; + + window.setfalseInRequestMap = function (keyName) { + requestMap[keyName] = false; + } - axios.interceptors.response.use(function (response) { - - // console.log(".............") - if(response===undefined){ - return - } - const config = response.config - if (response.data.status === -1) { - // console.error('error:', response.data.message) - // throw new Error() - - // https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=cancel+request+in+response+interceptors+ - // https://github.com/axios/axios/issues/583 - // message.info(response.data.message || '服务端返回status -1,请联系管理员。'); - // props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) - if (window.location.pathname.startsWith('/tasks/')) { - props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) - } else { - notification.open({ - message:"提示", - description: response.data.message || '服务器异常,请联系管理员。', - style: { - zIndex: 99999999 - }, - }); - // notification['error']({ - // message:"提示", - // description: response.data.message || '服务器异常,请联系管理员。', - // }); - } - - throw new axios.Cancel('Operation canceled by the user.'); + //响应前的设置 + axios.interceptors.request.use( + config => { + setpostcookie() + clearAllCookie() + // config.headers['Content-Type']= 'no-cache' + // if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了 + // config.headers.Authorization = token; + // } + + // --------------------------------------------- 測試3007连测试服的代码 + // if (url.indexOf('file_update') != -1 || url.indexOf('game_build') != -1 || url.indexOf('game_status') != -1) { + // proxy = 'https://testbdweb.trustie.net' + // } else { + // proxy = 'http://localhost:3000' + // } + // --------------------------------------------- + // console.log("开始请求了"); + // console.log(config.url); + // console.log(window.location.pathname); + // + + // try { + // const str =window.location.pathname; + // 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]; + // var _educoder_sessionmys=""; + // var autologin_trusties=""; + // _search.split('&').forEach(item => { + // const _arr = item.split('='); + // if(_arr[0]==='_educoder_session'){ + // cookie.save('_educoder_session',_arr[1], { domain: '.educoder.net', path: '/'}); + // _educoder_sessionmys=_arr[1]; + // }else{ + // cookie.save('autologin_trustie',_arr[1], { domain: '.educoder.net', path: '/'}); + // autologin_trusties=_arr[1]; + // } + // }); + // try { + // const autlogins= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; + // config.params = {'Cookie': autlogins} + // config.headers['Cookie'] =autlogins; + // // console.log("设置了cookis"); + // } catch (e) { + // + // } + // try { + // const autloginysls= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `; + // config.params = {'autloginysls': autloginysls} + // config.headers['Cookie'] =autloginysls; + // // console.log("设置了cookis"); + // }catch (e) { + // + // } + // } + // } + // }catch (e) { + // + // } + + + + if (config.url.indexOf(proxy) != -1 || config.url.indexOf(':') != -1) { + return config + } + requestProxy(config) + + let url = `/api${config.url}`; + + //qq登录去掉api + if (config.params && config.params.redirect_uri != undefined) { + if (config.params.redirect_uri.indexOf('otherloginqq') != -1) { + url = `${config.url}`; + } + } + if (`${config[0]}` != `true`) { + let timestamp = Date.parse(new Date()) / 1000; + if (window.location.port === "3007") { + // let timestamp=railsgettimes(proxy); + // console.log(timestamp) + // `https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp` + railsgettimes(`${proxy}/api/main/first_stamp.json`); + let newopens = md5(opens + timestamp) + config.url = `${proxy}${url}`; + if (config.url.indexOf('?') == -1) { + config.url = `${config.url}?debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; + } else { + config.url = `${config.url}&debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; + } } else { - // hash跳转 - // var hash = window.location.hash; - // if (hash) { - // hashTimeout && window.clearTimeout(hashTimeout) - // hashTimeout = setTimeout(() => { - // var element = document.querySelector(hash); - // if (element) { - // element.scrollIntoView(); - // } - // }, 400) - // } + // 加api前缀 + // railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); + + railsgettimes(`/api/main/first_stamp.json`); + let newopens = md5(opens + timestamp) + config.url = url; + if (config.url.indexOf('?') == -1) { + config.url = `${config.url}?randomcode=${timestamp}&client_key=${newopens}`; + } else { + config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; + } } - // if(response.data.status === 401){ - // console.log("401401401") - // } - if (response.data.status === 403||response.data.status === "403") { + setpostcookie(); + } + // 拦截器导致关键的业务数据丢失,先注释 + // if (requestMap[config.url] === true) { + // return false; + // } + // // 非file_update请求 + if (config.url.indexOf('update_file') === -1) { + requestMap[config.url] = true; + + window.setTimeout("setfalseInRequestMap('" + config.url + "')", 900) + } + // setTimeout("setfalseInRequestMap(" + config.url + ")", 1200) + return config; + }, + err => { + return Promise.reject(err); + }); - locationurl('/403'); - } + axios.interceptors.response.use(function (response) { - if (response.data.status === 404) { - locationurl('/nopage'); - } + // console.log(".............") + if (response === undefined) { + return + } + const config = response.config + if (response.data.status === -1) { + // console.error('error:', response.data.message) + // throw new Error() + + // https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=cancel+request+in+response+interceptors+ + // https://github.com/axios/axios/issues/583 + // message.info(response.data.message || '服务端返回status -1,请联系管理员。'); + // props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) + if (window.location.pathname.startsWith('/tasks/')) { + props.showSnackbar(response.data.message || '服务器异常,请联系管理员。') + } else { + notification.open({ + message: "提示", + description: response.data.message || '服务器异常,请联系管理员。', + style: { + zIndex: 99999999 + }, + }); + // notification['error']({ + // message:"提示", + // description: response.data.message || '服务器异常,请联系管理员。', + // }); + } + + throw new axios.Cancel('Operation canceled by the user.'); + } else { + // hash跳转 + // var hash = window.location.hash; + // if (hash) { + // hashTimeout && window.clearTimeout(hashTimeout) + // hashTimeout = setTimeout(() => { + // var element = document.querySelector(hash); + // if (element) { + // element.scrollIntoView(); + // } + // }, 400) + // } + } + // if(response.data.status === 401){ + // console.log("401401401") + // } + if (response.data.status === 403 || response.data.status === "403") { - if (response.data.status === 500) { - locationurl('/500'); - } + locationurl('/403'); + } - if (response.data.status === 501) { - if(message501===false){ - message501=true - notification.open({ - message:"提示", - description:response.data.message || '访问异常,请求不合理', - style: { - zIndex: 99999999 - } - }) + if (response.data.status === 404) { + locationurl('/nopage'); + } + + if (response.data.status === 500) { + locationurl('/500'); + } + + if (response.data.status === 501) { + if (message501 === false) { + message501 = true + notification.open({ + message: "提示", + description: response.data.message || '访问异常,请求不合理', + style: { + zIndex: 99999999 } - window.setTimeout(function () { - message501=false - }, 2000); - } + }) + } + window.setTimeout(function () { + message501 = false + }, 2000); + } - // if (response.data.status === 402) { - // console.log(response.data.status); - // console.log(response.data); - // // locationurl(402); - // } - - // - // if (response.data.status === 401) { - // console.log("161"); - // console.log(config); - // return config; - // } - // if (response.data.status === 407) { - // 在app js 中解决 Trialapplication - // // - // ///在appjs - // notification.open({ - // message:"提示", - // description: "账号未认证", - // }); - // throw new axios.Cancel('Operation canceled by the user.'); - // // - // } - - requestMap[response.config.url] = false; - setpostcookie(); - return response; - }, function (error) { - return Promise.reject(error); - }); -// ----------------------------------------------------------------------------------- + // if (response.data.status === 402) { + // console.log(response.data.status); + // console.log(response.data); + // // locationurl(402); + // } + + // + // if (response.data.status === 401) { + // console.log("161"); + // console.log(config); + // return config; + // } + // if (response.data.status === 407) { + // 在app js 中解决 Trialapplication + // // + // ///在appjs + // notification.open({ + // message:"提示", + // description: "账号未认证", + // }); + // throw new axios.Cancel('Operation canceled by the user.'); + // // + // } + + requestMap[response.config.url] = false; + setpostcookie(); + return response; + }, function (error) { + return Promise.reject(error); + }); + // ----------------------------------------------------------------------------------- } function initOnlineOfflineListener() { - const $ = window.$ - $(window).bind("online", () => { - notification.destroy() - notification.success({ - duration: 2, - message: '网络恢复正常', - description: - '网络恢复正常,感谢使用。', - }) - }); - $(window).bind("offline", () => { - notification.destroy() - - notification.warning({ - duration: null, - message: '网络异常', - description: - '网络异常,请检测网络后重试。', - }) - }); + const $ = window.$ + $(window).bind("online", () => { + notification.destroy() + notification.success({ + duration: 2, + message: '网络恢复正常', + description: + '网络恢复正常,感谢使用。', + }) + }); + $(window).bind("offline", () => { + notification.destroy() + + notification.warning({ + duration: null, + message: '网络异常', + description: + '网络异常,请检测网络后重试。', + }) + }); } From 7dc0c205ea361ad8983389cc5d61623d31fdf88f Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 20 Mar 2020 20:26:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?edge=E7=99=BD=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesHome/CoursesHomeCard.js | 17 +++++++++-------- .../src/modules/user/usersInfo/InfosCourse.js | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js index 887b5dabd..b9925c051 100644 --- a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js +++ b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js @@ -93,18 +93,19 @@ class CoursesHomeCard extends Component{ {item.school}

- -
- {item.teacher_users.length===0? - : - 协作老师: - {item.teacher_users&&item.teacher_users.map((iem,idx)=>{ -
{iem[0]}
+{/* +
+ {item.teacher_users.length===0?'': + 协作老师: + {item.teacher_users.map((iem,idx)=>{ + return( + {iem} + ) }) } } -
+
*/}
diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index c763bc88c..d2ebd70cf 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -343,9 +343,22 @@ class InfosCourse extends Component{

{item.name}

- 用户 + 用户

{item.teacher && item.teacher.real_name}

{item&&item.school}

+ {/*
+ {item.teacher_users.length===0?'': + 协作老师: + {item.teacher_users.map((iem,idx)=>{ + return( + {iem} + ) + }) + } + + } +
*/} +
From e4ea3f9acf1ac91c89acb66c417e7a920138d724 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 20 Mar 2020 20:41:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?edge=E7=99=BD=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/public/js/applications.js | 2 +- public/react/src/AppConfig.js | 4 ++-- .../react/src/modules/courses/coursesHome/CoursesHomeCard.js | 4 ++-- public/react/src/modules/user/usersInfo/InfosCourse.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/public/react/public/js/applications.js b/public/react/public/js/applications.js index ad46a5aa0..e99bf61cd 100644 --- a/public/react/public/js/applications.js +++ b/public/react/public/js/applications.js @@ -11267,7 +11267,7 @@ Copyright © 2018 Basecamp, LLC type: "GET", dataType: "script", cache: true, - async: false, + async: true, global: false, // Only evaluate the response if it is successful (gh-4126) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index a3efafdb9..afed0fa9d 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -90,7 +90,7 @@ function railsgettimes(proxy) { if (timestamp && checkSubmitFlg === false) { $.ajax({ - url: proxy, async: false, success: function (data) { + url: proxy, async: true, success: function (data) { if (data.status === 0) { timestamp = data.message; setpostcookie(); @@ -103,7 +103,7 @@ function railsgettimes(proxy) { }, 2000); } else if (checkSubmitFlg === false) { $.ajax({ - url: proxy, async: false, success: function (data) { + url: proxy, async: true, success: function (data) { if (data.status === 0) { timestamp = data.message; setpostcookie(); diff --git a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js index b9925c051..c021c07e7 100644 --- a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js +++ b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js @@ -93,7 +93,7 @@ class CoursesHomeCard extends Component{ {item.school}

-{/* +
{item.teacher_users.length===0?'': 协作老师: @@ -105,7 +105,7 @@ class CoursesHomeCard extends Component{ } } -
*/} +
diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index d2ebd70cf..4913588b2 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -346,7 +346,7 @@ class InfosCourse extends Component{ 用户

{item.teacher && item.teacher.real_name}

{item&&item.school}

- {/*
+
{item.teacher_users.length===0?'': 协作老师: {item.teacher_users.map((iem,idx)=>{ @@ -357,7 +357,7 @@ class InfosCourse extends Component{ } } -
*/} +