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

dev_new_shixunsrepository
杨树明 5 years ago
commit c99da11a57

@ -41,7 +41,8 @@ module GitHelper
# 更新文件代码 # 更新文件代码
# content 文件内容message提交描述 # content 文件内容message提交描述
def update_file_content(content, repo_path, path, mail, username, message) def update_file_content(content, repo_path, path, mail, username, message)
GitService.update_file(repo_path: repo_path, file_path: path, message: message, content = Base64.encode64(content)
GitService.update_file_base64(repo_path: repo_path, file_path: path, message: message,
content: content, author_name: username, author_email: mail) content: content, author_name: username, author_email: mail)
end end

@ -962,8 +962,11 @@ class GamesController < ApplicationController
shixun = game.myshixun.shixun shixun = game.myshixun.shixun
shixun_tomcat = edu_setting('cloud_bridge') shixun_tomcat = edu_setting('cloud_bridge')
service_host = edu_setting('vnc_url') service_host = edu_setting('vnc_url')
tpiGitURL = "#{edu_setting('git_address_domain')}/#{game.myshixun.repo_path}"
uri = "#{shixun_tomcat}/bridge/vnc/getvnc" uri = "#{shixun_tomcat}/bridge/vnc/getvnc"
params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"} params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}",
tpiGitURL: tpiGitURL}
res = uri_post uri, params res = uri_post uri, params
if res && res['code'].to_i != 0 if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99") raise("实训云平台繁忙繁忙等级99")

@ -76,7 +76,7 @@ class JupytersController < ApplicationController
def active_with_tpi def active_with_tpi
myshixun = Myshixun.find_by(identifier: params[:identifier]) myshixun = Myshixun.find_by(identifier: params[:identifier])
jupyter_active_tpm(myshixun) jupyter_active_tpi(myshixun)
render json: {status: 0} render json: {status: 0}
end end

@ -216,10 +216,11 @@ class MyshixunsController < ApplicationController
old_time = Time.now.to_i old_time = Time.now.to_i
begin begin
shixun_tomcat = edu_setting('tomcat_webssh') shixun_tomcat = edu_setting('tomcat_webssh')
tpiGitURL = "#{edu_setting('git_address_domain')}/#{@myshixun.repo_path}"
uri = "#{shixun_tomcat}/bridge/webssh/getConnectInfo" uri = "#{shixun_tomcat}/bridge/webssh/getConnectInfo"
# 由于中间层采用混合云的方式因为local参数表示在有文件生成的实训是在本地生成还是在其他云端生成评测文件 # 由于中间层采用混合云的方式因为local参数表示在有文件生成的实训是在本地生成还是在其他云端生成评测文件
local = @myshixun.shixun.challenges.where.not(show_type: -1).count == 0 local = @myshixun.shixun.challenges.where.not(show_type: -1).count == 0
params = {tpiID:@myshixun.id, podType:@myshixun.shixun.try(:webssh), local: local, params = {tpiID:@myshixun.id, podType:@myshixun.shixun.try(:webssh), local: local, tpiGitURL: tpiGitURL,
containers:(Base64.urlsafe_encode64(shixun_container_limit @myshixun.shixun))} containers:(Base64.urlsafe_encode64(shixun_container_limit @myshixun.shixun))}
res = uri_post uri, params res = uri_post uri, params
if res && res['code'].to_i != 0 if res && res['code'].to_i != 0

@ -2,16 +2,30 @@
# #
# 文档在 https://www.showdoc.cc/127895880302646?page_id=1077512172693249 # 文档在 https://www.showdoc.cc/127895880302646?page_id=1077512172693249
# #
require 'faraday'
class GitService class GitService
class << self class << self
['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits', 'add_tree', 'delete_file'].each do |method| ['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits',
'add_tree', 'delete_file', 'update_file_base64'].each do |method|
define_method method do |params| define_method method do |params|
post(method, params) post(method, params)
end end
end end
def make_new_multipar_file(full_file_path)
Faraday::FilePart.new(full_file_path, 'application/octet-stream')
end
#上传二进制文件
#参数构造形式
# {a: 'a', file: make_new_multipar_file('1.txt') }
def update_file_binary(params)
post_form('update_file', params)
end
private private
def root_url def root_url
@ -24,6 +38,19 @@ class GitService
Rails.logger Rails.logger
end end
def post_form(action,params)
conn = Faraday.new(root_url) do |f|
f.request :multipart
f.request :url_encoded
f.adapter :net_http
end
resp = conn.post("/api/#{action}", params)
body = resp.body
parse_return(body)
end
def post(action, params) def post(action, params)
uri = URI.parse("#{root_url}/api/#{action}") uri = URI.parse("#{root_url}/api/#{action}")
https = Net::HTTP.new(uri.host, uri.port) https = Net::HTTP.new(uri.host, uri.port)
@ -32,6 +59,11 @@ class GitService
req.body = params.to_json req.body = params.to_json
res = https.request(req) res = https.request(req)
body = res.body body = res.body
parse_return(body)
end
def parse_return(body)
logger.info("--uri_exec: .....res is #{body}") logger.info("--uri_exec: .....res is #{body}")
content = JSON.parse(body) content = JSON.parse(body)

@ -101,6 +101,7 @@
</table> </table>
</div> </div>
<% if @work.myshixun.present? %>
<div class="bor-grey-e mt20"> <div class="bor-grey-e mt20">
<p class="pt10 pb10 pl15 pr15 clearfix bor-bottom-greyE"> <p class="pt10 pb10 pl15 pr15 clearfix bor-bottom-greyE">
<span class="fl font-bd">图形统计</span> <span class="fl font-bd">图形统计</span>
@ -224,6 +225,7 @@
</div> </div>
<% end %> <% end %>
</div> </div>
<% end %>
</div> </div>
</body> </body>
@ -261,6 +263,7 @@
// 基于准备好的dom初始化echarts实例 // 基于准备好的dom初始化echarts实例
if(document.getElementById('shixun_skill_chart')){
var effChart = echarts.init(document.getElementById('shixun_skill_chart')); var effChart = echarts.init(document.getElementById('shixun_skill_chart'));
// 指定图表的配置项和数据 // 指定图表的配置项和数据
var option = { var option = {
@ -357,6 +360,9 @@
// 使用刚指定的配置项和数据显示图表 // 使用刚指定的配置项和数据显示图表
effChart.setOption(option); effChart.setOption(option);
console.debug(<%= @myself_consume %>); console.debug(<%= @myself_consume %>);
}
if(document.getElementById('shixun_skill_chart')) {
var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart')); var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart'));
var dataBJ = <%= @echart_data[:consume_list] %>; var dataBJ = <%= @echart_data[:consume_list] %>;
var schema = [ var schema = [
@ -471,5 +477,6 @@
// 使用刚指定的配置项和数据显示图表。 // 使用刚指定的配置项和数据显示图表。
ablChart.setOption(option1); ablChart.setOption(option1);
} }
}
</script> </script>
</html> </html>

@ -0,0 +1,10 @@
class ModifyViewedCountForSubjects < ActiveRecord::Migration[5.2]
def change
subjects = Subject.where(status: 2).includes(:shixuns)
subjects.find_each do |subject|
subject.update_attribute(:visits, subject.visits + subject.shixuns.pluck(:myshixuns_count).sum)
end
end
end

@ -0,0 +1,7 @@
namespace :print_date do
desc "print date"
task :print => :environment do
Rails.logger.info("#{Time.now}")
end
end

@ -19,13 +19,15 @@ namespace :zip_pack do
student_works = homework.score_student_works student_works = homework.score_student_works
if student_works.size > 0 if student_works.size > 0
pdfs = []
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zip| Zip::File.open(zipfile_name, Zip::File::CREATE) do |zip|
student_works.find_each.map do |student_work| student_works.find_each.map do |student_work|
export = ExportShixunReportService.new(homework, student_work) export = ExportShixunReportService.new(homework, student_work)
pdf = export.to_pdf pdf = export.to_pdf
# pdfs << pdf pdfs << pdf
begin begin
zip.add(export.filename, pdf.path) zip.add(export.filename, pdf.path)
puts "out: #{export.filename}_#{pdf.path}"
rescue => ex rescue => ex
Rails.logger.error(ex.message) Rails.logger.error(ex.message)

@ -0,0 +1,38 @@
/*
* @Description: 填空
* @Author: tangjiang
* @Github:
* @Date: 2020-01-06 09:02:29
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-06 16:04:46
*/
import Quill from 'quill';
let Inline = Quill.import('blots/inline');
class FillBlot extends Inline {
static create (value) {
const node = super.cerate();
node.classList.add('icon icon-bianji2');
node.setAttribute('data-fill', 'fill');
node.addEventListener('DOMNodeRemoved', function () {
alert(123);
}, false);
return node;
}
static value (node) {
return {
dataSet: node.getAttribute('data-fill'),
onDOMNodeRemoved: () => {
alert('123456');
}
}
}
}
FillBlot.blotName = "fill";
FillBlot.tagName = "span";
export default FillBlot;

@ -0,0 +1,94 @@
<!--
* @Description:
* @Author: tangjiang
* @Github:
* @Date: 2020-01-06 16:20:03
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-06 17:13:19
-->
## QuillForEditor 使用 [https://quilljs.com/]
### 导入
- 目录 src/common/quillForEditor (默认加载当前文件夹下的 index.js 文件)
### 参数
| 字段 | 描述 |
| ----- | ----- |
| placeholder | 提示信息 |
| readOnly | 只读(只读取模式时,没有 工具栏且内容不可编辑通常用于展示quill内容) |
| autoFocus | 自动获得焦点 |
| options | 配置参数, 指定工具栏内容 |
| value | 文本编辑器内容 |
| imgAttrs | 指定上传图片的尺寸 |
| style | 指定quill容器样式 |
| wrapStyle | 指定包裹quill容器的样式|
| onContentChange | 当编辑器内容变化时调用此回调函数(注: 此时返回的内容为对象,提交到后台时需要格式成 JSON 字符串: JSON.stringify(xx)) |
| showUploadImage | 点击放大上传成功后的图片, 返回上传成功后的图片 url, (评论时点击图片这么大)|
### 添加工具栏
- 默认所有的
```
const options = [
'bold', // 加粗
'italic', // 斜体
'underline', // 下划线
{size: ['12px', '14px', '16px', '18px', '20px']}, // 字体大小
{align: []}, // 对齐方式
{list: 'ordered'}, // 有序列表
{list: 'bullet'}, // 无序列表
{script: 'sub'}, // 下标 x2
{script: 'super'}, // 上标 平方 (x2)
{ 'color': [] }, // 字体颜色
{ 'background': [] }, // 背景色
{header: [1,2,3,4,5,false]}, // H1,H2 ...
'blockquote', // 文件左边加一个边框样式
'code-block', // 块内容
'link', // 链接
'image', // 图片
'video', // 视频
'formula', // 数学公式
'clean' // 清除
]
```
### 使用
````
import QuillForEditor from 'xxx';
// 指定需要显示的工具栏信息, 不指定加载全部
const options = [
];
/**
* @description 获取编辑器返回的内容
* @params [Object] value 编辑器内容
*/
const handleCtxChange = (value) => {
// 编辑器内容非空判断
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
// 提交到后台的内容需要处理一下;
value = JSON.stringify(value)
}
}
<QuillForEditor
options={options}
onContentChange={handleCtxChange}
>
</QuillForEditor>
````

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-18 08:49:30 * @Date: 2019-12-18 08:49:30
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-31 15:11:37 * @LastEditTime : 2020-01-06 16:45:50
*/ */
import './index.scss'; import './index.scss';
import 'quill/dist/quill.core.css'; // 核心样式 import 'quill/dist/quill.core.css'; // 核心样式
@ -18,8 +18,11 @@ import deepEqual from './deepEqual.js'
import { fetchUploadImage } from '../../services/ojService.js'; import { fetchUploadImage } from '../../services/ojService.js';
import { getImageUrl } from 'educoder' import { getImageUrl } from 'educoder'
import ImageBlot from './ImageBlot'; import ImageBlot from './ImageBlot';
// import Toolbar from 'quill/modules/toolbar';
import FillBlot from './FillBlot';
const Size = Quill.import('attributors/style/size'); const Size = Quill.import('attributors/style/size');
const Font = Quill.import('formats/font'); const Font = Quill.import('formats/font');
// const Color = Quill.import('attributes/style/color'); // const Color = Quill.import('attributes/style/color');
Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false]; Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false];
Font.whitelist = ['SimSun', 'SimHei','Microsoft-YaHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']; Font.whitelist = ['SimSun', 'SimHei','Microsoft-YaHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif'];
@ -29,6 +32,8 @@ window.katex = katex;
Quill.register(ImageBlot); Quill.register(ImageBlot);
Quill.register(Size); Quill.register(Size);
Quill.register(Font, true); Quill.register(Font, true);
// Quill.register({'modules/toolbar': Toolbar});
Quill.register(FillBlot);
// Quill.register(Color); // Quill.register(Color);
function QuillForEditor ({ function QuillForEditor ({
@ -42,6 +47,7 @@ function QuillForEditor ({
wrapStyle = {}, wrapStyle = {},
showUploadImage, showUploadImage,
onContentChange, onContentChange,
// addFill, // 点击填空成功的回调
// getQuillContent // getQuillContent
}) { }) {
// toolbar 默认值 // toolbar 默认值
@ -62,6 +68,8 @@ function QuillForEditor ({
// quill 实例 // quill 实例
const [quill, setQuill] = useState(null); const [quill, setQuill] = useState(null);
const [selection, setSelection] = useState(null); const [selection, setSelection] = useState(null);
const [fillCount, setFillCount] = useState(0);
const [quillCtx, setQuillCtx] = useState({});
// 文本内容变化时 // 文本内容变化时
const handleOnChange = content => { const handleOnChange = content => {
@ -70,18 +78,23 @@ function QuillForEditor ({
}; };
const renderOptions = options || defaultConfig; const renderOptions = options || defaultConfig;
// quill 配置信息 // quill 配置信息
const quillOption = { const quillOption = {
modules: { modules: {
toolbar: renderOptions toolbar: renderOptions
// toolbar: {
// container: renderOptions
// }
}, },
readOnly, readOnly,
placeholder, placeholder,
theme: readOnly ? 'bubble' : 'snow' theme: readOnly ? 'bubble' : 'snow',
}; };
useEffect(() => { useEffect(() => {
const quillNode = document.createElement('div'); const quillNode = document.createElement('div');
editorRef.current.appendChild(quillNode); editorRef.current.appendChild(quillNode);
const _quill = new Quill(editorRef.current, quillOption); const _quill = new Quill(editorRef.current, quillOption);
@ -121,13 +134,20 @@ function QuillForEditor ({
} }
} }
}); });
_quill.getModule('toolbar').addHandler('fill', (e) => {
setFillCount(fillCount + 1);
const range = _quill.getSelection(true);
_quill.insertText(range.index, '▁');
// 点击填空图标时,插入一个下划线
// 1. 获取编辑器内容
});
}, []); }, []);
// 设置值 // 设置值
useEffect(() => { useEffect(() => {
if (!quill) return if (!quill) return
// debugger;
const previous = quill.getContents() const previous = quill.getContents()
if (value && value.hasOwnProperty('ops')) { if (value && value.hasOwnProperty('ops')) {
@ -173,7 +193,36 @@ function QuillForEditor ({
let handler; let handler;
quill.on( quill.on(
'text-change', 'text-change',
(handler = () => { (handler = (delta, oldDelta, source) => {
// let del = false;
// let delLen = 1;
// delta.ops.forEach(o => {
// // 存在删除并且只删除一个
// if (o.delete) {
// del = true;
// }
// });
// 删除编辑器内容
// if (del) {
// delLen = delta.ops[0].retain || 1; // 删除数组的长度
// // 获取删除的内容并判断其它是否有填空内容
// console.log('原编辑器内容', oldDelta);
// console.log('编辑器内容', quillCtx);
// }
// 获取删除的内容
// oldDelta
// if (del) {
// const ops = oldDelta.ops;
// const len = ops.length;
// // if (ops[len - 1] && ops[len - 1].insert) {
// // const str = ops[len - 1].insert;
// // const _len = str.length;
// // const _last = str.substr(_len - 1);
// // console.log('删除的一项', _last);
// // }
// }
const _ctx = quill.getContents();
setQuillCtx(_ctx);
handleOnChange(quill.getContents()); // getContents: 检索编辑器内容 handleOnChange(quill.getContents()); // getContents: 检索编辑器内容
}) })
); );

@ -110,4 +110,21 @@
content: "微软雅黑"; content: "微软雅黑";
font-family: "Microsoft YaHei"; font-family: "Microsoft YaHei";
} }
//
.ql-snow .ql-fill{
display: inline-block;
position: relative;
color: #05101A;
// font-size: 18px;
vertical-align: top;
&::before{
position: absolute;
left: 50%;
top: -1px;
content: '\e709';
font-family: 'iconfont';
margin-left: -7px;
}
}
} }

@ -734,21 +734,20 @@ background:rgba(204,204,204,0.2) !important;
} }
`} `}
</style> </style>
{ excellent===true&&this.props.isAdminOrStudent()===false?"":<Breadcrumb separator="|" className={"mt5"}> <Breadcrumb separator="|" className={"mt5"}>
<Breadcrumb.Item className={excellent === true && this.props.isAdminOrStudent() === false ?"":"pointer"}>
<Breadcrumb.Item className={"pointer"}> <Tooltip getPopupContainer={trigger => trigger.parentNode} visible={excellent === true && this.props.isAdminOrStudent() === false ?false:coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
<Tooltip getPopupContainer={trigger => trigger.parentNode} visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
placement="topLeft" placement="topLeft"
title={<pre className="antsoancss"> title={<pre className="antsoancss">
{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0? {coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?
<span >您有{coursedata.teacher_applies_count}条新的加入申请 <span >您有{coursedata.teacher_applies_count}条新的加入申请
<a className={"daishenp"} onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}> <a className={"daishenp"} onClick={excellent === true && this.props.isAdminOrStudent() === false ?"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>
<span style={{ <span style={{
color:"#FFA804" color:"#FFA804"
}}> }}>
待审批 待审批
</span></a></span>:""}</pre>}> </span></a></span>:""}</pre>}>
<span className="color-grey-c font-16" onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}> <span className="color-grey-c font-16" onClick={excellent === true && this.props.isAdminOrStudent() === false ?"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
<span className={"mr10"}>教师</span> <span className={"mr10"}>教师</span>
<span className={"mr10"}>{coursedata.teacher_count}</span> <span className={"mr10"}>{coursedata.teacher_count}</span>
</span> </span>
@ -756,8 +755,8 @@ background:rgba(204,204,204,0.2) !important;
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item <Breadcrumb.Item
className={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"} className={excellent === true && this.props.isAdminOrStudent() === false ?"":excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"}
onClick={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")} onClick={excellent === true && this.props.isAdminOrStudent() === false ?"":excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}
> >
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span>
</Breadcrumb.Item> </Breadcrumb.Item>
@ -766,7 +765,7 @@ background:rgba(204,204,204,0.2) !important;
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span>
}</Breadcrumb.Item> }</Breadcrumb.Item>
</Breadcrumb>} </Breadcrumb>
{/*<li className={"mt7 teachersbox"} >*/} {/*<li className={"mt7 teachersbox"} >*/}
{/*<Link to={"/courses/"+this.props.match.params.coursesId+"/teachers"}>*/} {/*<Link to={"/courses/"+this.props.match.params.coursesId+"/teachers"}>*/}

@ -157,9 +157,9 @@ class Trainingjobsetting extends Component {
this.props.triggerRef(this); this.props.triggerRef(this);
if (this.props.isAdmin() === false) { // if (this.props.isAdmin() === false) {
this.cancelEdit() // this.cancelEdit()
} // }
} }
// componentWillReceiveProps(nextProps) { // componentWillReceiveProps(nextProps) {
@ -383,6 +383,10 @@ class Trainingjobsetting extends Component {
} }
let max = latedeductiontwos + len; let max = latedeductiontwos + len;
let maxs = max.toFixed(1); let maxs = max.toFixed(1);
// console.log(1)
// console.log(maxs)
this.setState({ this.setState({
CalculateMax: maxs, CalculateMax: maxs,
}) })
@ -1212,7 +1216,8 @@ class Trainingjobsetting extends Component {
} }
//总比分 //总比分
Totalscorecalculation = (value) => { Totalscorecalculation = (value) => {
debugger // console.log(2)
// console.log(value)
this.setState({ this.setState({
CalculateMax: value, CalculateMax: value,
}) })
@ -2168,6 +2173,9 @@ class Trainingjobsetting extends Component {
}) })
this.refs.targetElementTrainingjobsetting.scrollIntoView(); this.refs.targetElementTrainingjobsetting.scrollIntoView();
this.getTrainingjobsetting(false); this.getTrainingjobsetting(false);
// console.log(3)
// console.log(this.state.total_scoretwo)
this.setState({ this.setState({
CalculateMax:this.state.total_scoretwo, CalculateMax:this.state.total_scoretwo,
}) })
@ -2311,7 +2319,7 @@ class Trainingjobsetting extends Component {
// console.log(this.props.isAdmin()) // console.log(this.props.isAdmin())
// console.log(this.state.code_review===false) // console.log(this.state.code_review===false)
// console.log("引入的分值"); // console.log("引入的分值");
// console.log(this.state.work_efficiencys); // console.log(this.state.CalculateMax);
return ( return (

@ -214,7 +214,7 @@ const NewOrEditTask = (props) => {
{ renderQuit() } { renderQuit() }
</div> </div>
<div className="split-pane-area"> <div className="split-pane-area">
<SplitPane split="vertical" minSize={350} maxSize={-350} defaultSize="40%"> <SplitPane className='outer-split-pane' split="vertical" minSize={350} maxSize={-350} defaultSize="40%">
<div className={'split-pane-left'}> <div className={'split-pane-left'}>
<LeftPane /> <LeftPane />
</div> </div>

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 10:35:40 * @Date: 2019-11-20 10:35:40
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-03 19:02:17 * @LastEditTime : 2020-01-06 16:17:22
*/ */
import './index.scss'; import './index.scss';
// import 'katex/dist/katex.css'; // import 'katex/dist/katex.css';

@ -217,3 +217,42 @@
.Resizer.disabled:hover { .Resizer.disabled:hover {
border-color: transparent; border-color: transparent;
} }
.outer-split-pane{
& > .Resizer{
position: relative;
&::before,
&::after{
position: absolute;
right: -12px;
top: 50%;
transition: opacity, background .3s;
}
&::before{
content: '';
border-radius: 50%;
background: rgba(235,235,235,.3);
width: 24px;
height: 24px;
// font-size: 12px;
}
&::after{
content: '\e712';
font-family: 'iconfont';
transform: scale(.7);
color: #666;
margin-top: -2px;
right: -14px;
opacity: .3;
}
&:hover{
&::before{
background: rgba(235,235,235, 1);
}
&::after{
opacity: 1;
}
}
}
}

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-23 10:53:19 * @Date: 2019-11-23 10:53:19
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 16:22:47 * @LastEditTime : 2020-01-06 15:27:34
*/ */
import './index.scss'; import './index.scss';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
@ -144,7 +144,7 @@ function StudentStudy (props) {
</div> </div>
</div> </div>
<div className="split-pane-area"> <div className="split-pane-area">
<SplitPane split="vertical" minSize={350} maxSize={-350} defaultSize="40%"> <SplitPane className="outer-split-pane" split="vertical" minSize={350} maxSize={-350} defaultSize="40%">
<div className={'split-pane-left'}> <div className={'split-pane-left'}>
<LeftPane /> <LeftPane />
</div> </div>

@ -25,16 +25,16 @@ class MemoDetailKEEditor extends Component {
showEditor() { showEditor() {
$("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => { // $("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => {
if (this.keEditor) { // if (this.keEditor) {
const FF = !(window.mozInnerScreenX == null); // const FF = !(window.mozInnerScreenX == null);
if (FF) { // if (FF) {
this.keEditor.focus() // this.keEditor.focus()
} else { // } else {
this.keEditor.edit.win.document.body.focus() // this.keEditor.edit.win.document.body.focus()
} // }
} // }
}); // });
} }
render() { render() {

@ -135,6 +135,13 @@ class TPMBanner extends Component {
this.setState({ this.setState({
openknow:true openknow:true
}) })
setTimeout(()=>{
this.openknow()
this.setState({
openknow:false
})
}, 10000);
}else{ }else{
this.setState({ this.setState({
openknow:false openknow:false
@ -158,6 +165,12 @@ class TPMBanner extends Component {
this.setState({ this.setState({
openshowpublictype: true openshowpublictype: true
}) })
setTimeout(()=>{
this.openshowpublic()
this.setState({
openshowpublictype:false
})
}, 10000);
} else { } else {
this.setState({ this.setState({
openshowpublictype: false openshowpublictype: false

@ -170,7 +170,7 @@ class TPMIndex extends Component {
openknows:false openknows:false
}) })
let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings' let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'
storage.setItem(newTPMsettings,true); storage.setItem(newTPMsettings,false);
} }
@ -181,7 +181,7 @@ class TPMIndex extends Component {
let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) let newTPMsettings=window.localStorage.getItem(getnewTPMsettings)
if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){
this.setState({ this.setState({
openknows:true openknows:false
}) })
}else{ }else{
this.setState({ this.setState({
@ -461,20 +461,20 @@ class TPMIndex extends Component {
{ this.state.is_jupyter===false? <Menu.Item key="8" className={"competitionmr50"}> { this.state.is_jupyter===false? <Menu.Item key="8" className={"competitionmr50"}>
<span className={"tpmbannernavstyler"}>排行榜</span> <span className={"tpmbannernavstyler"}>排行榜</span>
</Menu.Item>:""} </Menu.Item>:""}
{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?<span> {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?<span>*/}
<Popover {/* <Popover*/}
content={ {/* content={*/}
<pre className={"bannerpd201"}> {/* <pre className={"bannerpd201"}>*/}
<div>更多设置在这里点击配置看一看~</div> {/* <div>更多设置在这里,点击“配置”看一看~</div>*/}
<div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openknow} >我知道了</Button></div> {/* <div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openknow} >我知道了</Button></div>*/}
</pre> {/* </pre>*/}
} {/* }*/}
trigger="click" {/* trigger="click"*/}
placement="top" {/* placement="top"*/}
visible={this.state.openknows} {/* visible={this.state.openknows}*/}
> {/* >*/}
</Popover> {/* </Popover>*/}
</span>:""} {/*</span>:""}*/}
{this.state.identity >4||this.state.identity===undefined ? "": {this.state.identity >4||this.state.identity===undefined ? "":
<Menu.Item key="9" className={"competitionmr50"}> <Menu.Item key="9" className={"competitionmr50"}>

@ -107,7 +107,7 @@ class Challengesjupyter extends Component {
} }
gettimeinfo_with_tpm=(datas)=>{ gettimeinfo_with_tpm=(datas,type)=>{
let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json` let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json`
axios.get(timeinfo_with_tpm, {params: datas}).then((response) => { axios.get(timeinfo_with_tpm, {params: datas}).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
@ -128,6 +128,9 @@ class Challengesjupyter extends Component {
endtimes:endsms===0?Date.now()+1000:Date.now() +endsms endtimes:endsms===0?Date.now()+1000:Date.now() +endsms
}) })
},500); },500);
if(type===true){
this.props.showNotification('延长成功!');
}
} }
}else{ }else{
@ -461,19 +464,21 @@ class Challengesjupyter extends Component {
onendhandleClickResetTpi=(id)=>{ onendhandleClickResetTpi=(id)=>{
let datas={
identifier:id,
}
const url = `/jupyters/active_with_tpm.json`; const url = `/jupyters/active_with_tpm.json`;
axios.get(url,{params:{ axios.get(url,{params:{
identifier:id identifier:id
}}).then((response) => { }}).then((response) => {
if(response.data.status===0){ if(response.data.status===0){
this.props.showNotification('延长成功!'); this.gettimeinfo_with_tpm(datas,true)
setTimeout(()=>{ // setTimeout(()=>{
this.setState({ // this.setState({
jupytertime:Date.now() + 900 * 1000, // jupytertime:Date.now() + 900 * 1000,
endtimes:Date.now() + 300 * 1000 // endtimes:Date.now() + 300 * 1000
}) // })
},500); // },500);
} }
}); });
} }

@ -160,7 +160,8 @@ export const active_with_tpi = (identifier, msg) => {
if (status === 0) { if (status === 0) {
message.success(msg); message.success(msg);
// dispatch(addjypertime(Date.now() + 900 * 1000,false)) // dispatch(addjypertime(Date.now() + 900 * 1000,false))
setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800); // setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800);
timeinfo_with_tpi(identifier,dispatch)
} }
} }
}) })

Loading…
Cancel
Save