diff --git a/app/assets/javascripts/bootstrap-notify.js b/app/assets/javascripts/bootstrap-notify.js old mode 100755 new mode 100644 diff --git a/app/assets/javascripts/bootstrap-notify.min.js b/app/assets/javascripts/bootstrap-notify.min.js old mode 100755 new mode 100644 diff --git a/app/assets/javascripts/i18n/select2-i18n.zh-CN.js b/app/assets/javascripts/i18n/select2-i18n.zh-CN.js old mode 100755 new mode 100644 diff --git a/app/assets/javascripts/jquery.cxselect.js b/app/assets/javascripts/jquery.cxselect.js old mode 100755 new mode 100644 index 9bd674664..aeb3c17dd --- a/app/assets/javascripts/jquery.cxselect.js +++ b/app/assets/javascripts/jquery.cxselect.js @@ -1,403 +1,403 @@ -/*! - * jQuery cxSelect - * @name jquery.cxselect.js - * @version 1.4.1 - * @date 2016-11-02 - * @author ciaoca - * @email ciaoca@gmail.com - * @site https://github.com/ciaoca/cxSelect - * @license Released under the MIT license - */ -(function(factory) { - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } else { - factory(window.jQuery || window.Zepto || window.$); - }; -}(function($) { - var cxSelect = function() { - var self = this; - var dom, settings, callback; - - // 分配参数 - for (var i = 0, l = arguments.length; i < l; i++) { - if (cxSelect.isJquery(arguments[i]) || cxSelect.isZepto(arguments[i])) { - dom = arguments[i]; - } else if (cxSelect.isElement(arguments[i])) { - dom = $(arguments[i]); - } else if (typeof arguments[i] === 'function') { - callback = arguments[i]; - } else if (typeof arguments[i] === 'object') { - settings = arguments[i]; - }; - }; - - var api = new cxSelect.init(dom, settings); - - if (typeof callback === 'function') { - callback(api); - }; - - return api; - }; - - cxSelect.isElement = function(o){ - if (o && (typeof HTMLElement === 'function' || typeof HTMLElement === 'object') && o instanceof HTMLElement) { - return true; - } else { - return (o && o.nodeType && o.nodeType === 1) ? true : false; - }; - }; - - cxSelect.isJquery = function(o){ - return (o && o.length && (typeof jQuery === 'function' || typeof jQuery === 'object') && o instanceof jQuery) ? true : false; - }; - - cxSelect.isZepto = function(o){ - return (o && o.length && (typeof Zepto === 'function' || typeof Zepto === 'object') && Zepto.zepto.isZ(o)) ? true : false; - }; - - cxSelect.getIndex = function(n, required) { - return required ? n : n - 1; - }; - - cxSelect.getData = function(data, space) { - if (typeof space === 'string' && space.length) { - space = space.split('.'); - for (var i = 0, l = space.length; i < l; i++) { - data = data[space[i]]; - }; - }; - return data; - }; - - cxSelect.init = function(dom, settings) { - var self = this; - - if (!cxSelect.isJquery(dom) && !cxSelect.isZepto(dom)) {return}; - - var theSelect = { - dom: { - box: dom - } - }; - - self.attach = cxSelect.attach.bind(theSelect); - self.detach = cxSelect.detach.bind(theSelect); - self.setOptions = cxSelect.setOptions.bind(theSelect); - self.clear = cxSelect.clear.bind(theSelect); - - theSelect.changeEvent = function() { - cxSelect.selectChange.call(theSelect, this.className); - }; - - theSelect.settings = $.extend({}, $.cxSelect.defaults, settings, { - url: theSelect.dom.box.data('url'), - emptyStyle: theSelect.dom.box.data('emptyStyle'), - required: theSelect.dom.box.data('required'), - firstTitle: theSelect.dom.box.data('firstTitle'), - firstValue: theSelect.dom.box.data('firstValue'), - jsonSpace: theSelect.dom.box.data('jsonSpace'), - jsonName: theSelect.dom.box.data('jsonName'), - jsonValue: theSelect.dom.box.data('jsonValue'), - jsonSub: theSelect.dom.box.data('jsonSub') - }); - - var _dataSelects = theSelect.dom.box.data('selects'); - - if (typeof _dataSelects === 'string' && _dataSelects.length) { - theSelect.settings.selects = _dataSelects.split(','); - }; - - self.setOptions(); - self.attach(); - - // 使用独立接口获取数据 - if (!theSelect.settings.url && !theSelect.settings.data) { - cxSelect.start.apply(theSelect); - - // 设置自定义数据 - } else if ($.isArray(theSelect.settings.data)) { - cxSelect.start.call(theSelect, theSelect.settings.data); - - // 设置 URL,通过 Ajax 获取数据 - } else if (typeof theSelect.settings.url === 'string' && theSelect.settings.url.length) { - $.getJSON(theSelect.settings.url, function(json) { - cxSelect.start.call(theSelect, json); - }); - }; - }; - - // 设置参数 - cxSelect.setOptions = function(opts) { - var self = this; - - if (opts) { - $.extend(self.settings, opts); - }; - - // 初次或重设选择器组 - if (!$.isArray(self.selectArray) || !self.selectArray.length || (opts && opts.selects)) { - self.selectArray = []; - - if ($.isArray(self.settings.selects) && self.settings.selects.length) { - var _tempSelect; - - for (var i = 0, l = self.settings.selects.length; i < l; i++) { - _tempSelect = self.dom.box.find('select.' + self.settings.selects[i]); - - if (!_tempSelect || !_tempSelect.length) {break}; - - self.selectArray.push(_tempSelect); - }; - }; - }; - - if (opts) { - if (!$.isArray(opts.data) && typeof opts.url === 'string' && opts.url.length) { - $.getJSON(self.settings.url, function(json) { - cxSelect.start.call(self, json); - }); - - } else { - cxSelect.start.call(self, opts.data); - }; - }; - }; - - // 绑定 - cxSelect.attach = function() { - var self = this; - - if (!self.attachStatus) { - self.dom.box.on('change', 'select', self.changeEvent); - }; - - if (typeof self.attachStatus === 'boolean') { - cxSelect.start.call(self); - }; - - self.attachStatus = true; - }; - - // 移除绑定 - cxSelect.detach = function() { - var self = this; - self.dom.box.off('change', 'select', self.changeEvent); - self.attachStatus = false; - }; - - // 清空选项 - cxSelect.clear = function(index) { - var self = this; - var _style = { - display: '', - visibility: '' - }; - - index = isNaN(index) ? 0 : index; - - // 清空后面的 select - for (var i = index, l = self.selectArray.length; i < l; i++) { - self.selectArray[i].empty().prop('disabled', true); - - if (self.settings.emptyStyle === 'none') { - _style.display = 'none'; - } else if (self.settings.emptyStyle === 'hidden') { - _style.visibility = 'hidden'; - }; - - self.selectArray[i].css(_style); - }; - }; - - cxSelect.start = function(data) { - var self = this; - - if ($.isArray(data)) { - self.settings.data = cxSelect.getData(data, self.settings.jsonSpace); - }; - - if (!self.selectArray.length) {return}; - - // 保存默认值 - for (var i = 0, l = self.selectArray.length; i < l; i++) { - if (typeof self.selectArray[i].attr('data-value') !== 'string' && self.selectArray[i][0].options.length) { - self.selectArray[i].attr('data-value', self.selectArray[i].val()); - }; - }; - - if (self.settings.data || (typeof self.selectArray[0].data('url') === 'string' && self.selectArray[0].data('url').length)) { - cxSelect.getOptionData.call(self, 0); - } else { - self.selectArray[0].prop('disabled', false).css({ - 'display': '', - 'visibility': '' - }); - }; - }; - - // 获取选项数据 - cxSelect.getOptionData = function(index) { - var self = this; - - if (typeof index !== 'number' || isNaN(index) || index < 0 || index >= self.selectArray.length) {return}; - - var _indexPrev = index - 1; - var _select = self.selectArray[index]; - var _selectData; - var _valueIndex; - var _dataUrl = _select.data('url'); - var _jsonSpace = typeof _select.data('jsonSpace') === 'undefined' ? self.settings.jsonSpace : _select.data('jsonSpace'); - var _query = {}; - var _queryName; - var _selectName; - var _selectValue; - - cxSelect.clear.call(self, index); - - // 使用独立接口 - if (typeof _dataUrl === 'string' && _dataUrl.length) { - if (index > 0) { - for (var i = 0, j = 1; i < index; i++, j++) { - _queryName = self.selectArray[j].data('queryName'); - _selectName = self.selectArray[i].attr('name'); - _selectValue = self.selectArray[i].val(); - - if (typeof _queryName === 'string' && _queryName.length) { - _query[_queryName] = _selectValue; - } else if (typeof _selectName === 'string' && _selectName.length) { - _query[_selectName] = _selectValue; - }; - }; - }; - - $.getJSON(_dataUrl, _query, function(json) { - _selectData = cxSelect.getData(json, _jsonSpace); - - cxSelect.buildOption.call(self, index, _selectData); - }); - - // 使用整合数据 - } else if (self.settings.data && typeof self.settings.data === 'object') { - _selectData = self.settings.data; - - for (var i = 0; i < index; i++) { - _valueIndex = cxSelect.getIndex(self.selectArray[i][0].selectedIndex, typeof self.selectArray[i].data('required') === 'boolean' ? self.selectArray[i].data('required') : self.settings.required); - - if (typeof _selectData[_valueIndex] === 'object' && $.isArray(_selectData[_valueIndex][self.settings.jsonSub]) && _selectData[_valueIndex][self.settings.jsonSub].length) { - _selectData = _selectData[_valueIndex][self.settings.jsonSub]; - } else { - _selectData = null; - break; - }; - }; - - cxSelect.buildOption.call(self, index, _selectData); - }; - }; - - // 构建选项列表 - cxSelect.buildOption = function(index, data) { - var self = this; - - var _select = self.selectArray[index]; - var _required = typeof _select.data('required') === 'boolean' ? _select.data('required') : self.settings.required; - var _firstTitle = typeof _select.data('firstTitle') === 'undefined' ? self.settings.firstTitle : _select.data('firstTitle'); - var _firstValue = typeof _select.data('firstValue') === 'undefined' ? self.settings.firstValue : _select.data('firstValue'); - var _jsonName = typeof _select.data('jsonName') === 'undefined' ? self.settings.jsonName : _select.data('jsonName'); - var _jsonValue = typeof _select.data('jsonValue') === 'undefined' ? self.settings.jsonValue : _select.data('jsonValue'); - - if (!$.isArray(data)) {return}; - - var _html = !_required ? '' : ''; - - // 区分标题、值的数据 - if (typeof _jsonName === 'string' && _jsonName.length) { - // 无值字段时使用标题作为值 - if (typeof _jsonValue !== 'string' || !_jsonValue.length) { - _jsonValue = _jsonName; - }; - - for (var i = 0, l = data.length; i < l; i++) { - _html += ''; - }; - - // 数组即为值的数据 - } else { - for (var i = 0, l = data.length; i < l; i++) { - _html += ''; - }; - }; - - _select.html(_html).prop('disabled', false).css({ - 'display': '', - 'visibility': '' - }); - - // 初次加载设置默认值 - if (typeof _select.attr('data-value') === 'string') { - _select.val(String(_select.attr('data-value'))).removeAttr('data-value'); - - if (_select[0].selectedIndex < 0) { - _select[0].options[0].selected = true; - }; - }; - - if (_required || _select[0].selectedIndex > 0) { - _select.trigger('change'); - }; - - }; - - // 改变选择时的处理 - cxSelect.selectChange = function(name) { - var self = this; - - if (typeof name !== 'string' || !name.length) {return}; - - var index; - - name = name.replace(/\s+/g, ','); - name = ',' + name + ','; - - // 获取当前 select 位置 - for (var i = 0, l = self.selectArray.length; i < l; i++) { - if (name.indexOf(',' + self.settings.selects[i] + ',') > -1) { - index = i; - break; - }; - }; - - if (typeof index === 'number' && index > -1) { - index += 1; - cxSelect.getOptionData.call(self, index); - }; - }; - - $.cxSelect = function() { - return cxSelect.apply(this, arguments); - }; - - // 默认值 - $.cxSelect.defaults = { - selects: [], // 下拉选框组 - url: null, // 列表数据文件路径(URL)或数组数据 - data: null, // 自定义数据 - emptyStyle: null, // 无数据状态显示方式 - required: false, // 是否为必选 - firstTitle: '请选择', // 第一个选项的标题 - firstValue: '', // 第一个选项的值 - jsonSpace: '', // 数据命名空间 - jsonName: 'n', // 数据标题字段名称 - jsonValue: '', // 数据值字段名称 - jsonSub: 's' // 子集数据字段名称 - }; - - $.fn.cxSelect = function(settings, callback) { - this.each(function(i) { - $.cxSelect(this, settings, callback); - }); - return this; - }; -})); +/*! + * jQuery cxSelect + * @name jquery.cxselect.js + * @version 1.4.1 + * @date 2016-11-02 + * @author ciaoca + * @email ciaoca@gmail.com + * @site https://github.com/ciaoca/cxSelect + * @license Released under the MIT license + */ +(function(factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } else { + factory(window.jQuery || window.Zepto || window.$); + }; +}(function($) { + var cxSelect = function() { + var self = this; + var dom, settings, callback; + + // 分配参数 + for (var i = 0, l = arguments.length; i < l; i++) { + if (cxSelect.isJquery(arguments[i]) || cxSelect.isZepto(arguments[i])) { + dom = arguments[i]; + } else if (cxSelect.isElement(arguments[i])) { + dom = $(arguments[i]); + } else if (typeof arguments[i] === 'function') { + callback = arguments[i]; + } else if (typeof arguments[i] === 'object') { + settings = arguments[i]; + }; + }; + + var api = new cxSelect.init(dom, settings); + + if (typeof callback === 'function') { + callback(api); + }; + + return api; + }; + + cxSelect.isElement = function(o){ + if (o && (typeof HTMLElement === 'function' || typeof HTMLElement === 'object') && o instanceof HTMLElement) { + return true; + } else { + return (o && o.nodeType && o.nodeType === 1) ? true : false; + }; + }; + + cxSelect.isJquery = function(o){ + return (o && o.length && (typeof jQuery === 'function' || typeof jQuery === 'object') && o instanceof jQuery) ? true : false; + }; + + cxSelect.isZepto = function(o){ + return (o && o.length && (typeof Zepto === 'function' || typeof Zepto === 'object') && Zepto.zepto.isZ(o)) ? true : false; + }; + + cxSelect.getIndex = function(n, required) { + return required ? n : n - 1; + }; + + cxSelect.getData = function(data, space) { + if (typeof space === 'string' && space.length) { + space = space.split('.'); + for (var i = 0, l = space.length; i < l; i++) { + data = data[space[i]]; + }; + }; + return data; + }; + + cxSelect.init = function(dom, settings) { + var self = this; + + if (!cxSelect.isJquery(dom) && !cxSelect.isZepto(dom)) {return}; + + var theSelect = { + dom: { + box: dom + } + }; + + self.attach = cxSelect.attach.bind(theSelect); + self.detach = cxSelect.detach.bind(theSelect); + self.setOptions = cxSelect.setOptions.bind(theSelect); + self.clear = cxSelect.clear.bind(theSelect); + + theSelect.changeEvent = function() { + cxSelect.selectChange.call(theSelect, this.className); + }; + + theSelect.settings = $.extend({}, $.cxSelect.defaults, settings, { + url: theSelect.dom.box.data('url'), + emptyStyle: theSelect.dom.box.data('emptyStyle'), + required: theSelect.dom.box.data('required'), + firstTitle: theSelect.dom.box.data('firstTitle'), + firstValue: theSelect.dom.box.data('firstValue'), + jsonSpace: theSelect.dom.box.data('jsonSpace'), + jsonName: theSelect.dom.box.data('jsonName'), + jsonValue: theSelect.dom.box.data('jsonValue'), + jsonSub: theSelect.dom.box.data('jsonSub') + }); + + var _dataSelects = theSelect.dom.box.data('selects'); + + if (typeof _dataSelects === 'string' && _dataSelects.length) { + theSelect.settings.selects = _dataSelects.split(','); + }; + + self.setOptions(); + self.attach(); + + // 使用独立接口获取数据 + if (!theSelect.settings.url && !theSelect.settings.data) { + cxSelect.start.apply(theSelect); + + // 设置自定义数据 + } else if ($.isArray(theSelect.settings.data)) { + cxSelect.start.call(theSelect, theSelect.settings.data); + + // 设置 URL,通过 Ajax 获取数据 + } else if (typeof theSelect.settings.url === 'string' && theSelect.settings.url.length) { + $.getJSON(theSelect.settings.url, function(json) { + cxSelect.start.call(theSelect, json); + }); + }; + }; + + // 设置参数 + cxSelect.setOptions = function(opts) { + var self = this; + + if (opts) { + $.extend(self.settings, opts); + }; + + // 初次或重设选择器组 + if (!$.isArray(self.selectArray) || !self.selectArray.length || (opts && opts.selects)) { + self.selectArray = []; + + if ($.isArray(self.settings.selects) && self.settings.selects.length) { + var _tempSelect; + + for (var i = 0, l = self.settings.selects.length; i < l; i++) { + _tempSelect = self.dom.box.find('select.' + self.settings.selects[i]); + + if (!_tempSelect || !_tempSelect.length) {break}; + + self.selectArray.push(_tempSelect); + }; + }; + }; + + if (opts) { + if (!$.isArray(opts.data) && typeof opts.url === 'string' && opts.url.length) { + $.getJSON(self.settings.url, function(json) { + cxSelect.start.call(self, json); + }); + + } else { + cxSelect.start.call(self, opts.data); + }; + }; + }; + + // 绑定 + cxSelect.attach = function() { + var self = this; + + if (!self.attachStatus) { + self.dom.box.on('change', 'select', self.changeEvent); + }; + + if (typeof self.attachStatus === 'boolean') { + cxSelect.start.call(self); + }; + + self.attachStatus = true; + }; + + // 移除绑定 + cxSelect.detach = function() { + var self = this; + self.dom.box.off('change', 'select', self.changeEvent); + self.attachStatus = false; + }; + + // 清空选项 + cxSelect.clear = function(index) { + var self = this; + var _style = { + display: '', + visibility: '' + }; + + index = isNaN(index) ? 0 : index; + + // 清空后面的 select + for (var i = index, l = self.selectArray.length; i < l; i++) { + self.selectArray[i].empty().prop('disabled', true); + + if (self.settings.emptyStyle === 'none') { + _style.display = 'none'; + } else if (self.settings.emptyStyle === 'hidden') { + _style.visibility = 'hidden'; + }; + + self.selectArray[i].css(_style); + }; + }; + + cxSelect.start = function(data) { + var self = this; + + if ($.isArray(data)) { + self.settings.data = cxSelect.getData(data, self.settings.jsonSpace); + }; + + if (!self.selectArray.length) {return}; + + // 保存默认值 + for (var i = 0, l = self.selectArray.length; i < l; i++) { + if (typeof self.selectArray[i].attr('data-value') !== 'string' && self.selectArray[i][0].options.length) { + self.selectArray[i].attr('data-value', self.selectArray[i].val()); + }; + }; + + if (self.settings.data || (typeof self.selectArray[0].data('url') === 'string' && self.selectArray[0].data('url').length)) { + cxSelect.getOptionData.call(self, 0); + } else { + self.selectArray[0].prop('disabled', false).css({ + 'display': '', + 'visibility': '' + }); + }; + }; + + // 获取选项数据 + cxSelect.getOptionData = function(index) { + var self = this; + + if (typeof index !== 'number' || isNaN(index) || index < 0 || index >= self.selectArray.length) {return}; + + var _indexPrev = index - 1; + var _select = self.selectArray[index]; + var _selectData; + var _valueIndex; + var _dataUrl = _select.data('url'); + var _jsonSpace = typeof _select.data('jsonSpace') === 'undefined' ? self.settings.jsonSpace : _select.data('jsonSpace'); + var _query = {}; + var _queryName; + var _selectName; + var _selectValue; + + cxSelect.clear.call(self, index); + + // 使用独立接口 + if (typeof _dataUrl === 'string' && _dataUrl.length) { + if (index > 0) { + for (var i = 0, j = 1; i < index; i++, j++) { + _queryName = self.selectArray[j].data('queryName'); + _selectName = self.selectArray[i].attr('name'); + _selectValue = self.selectArray[i].val(); + + if (typeof _queryName === 'string' && _queryName.length) { + _query[_queryName] = _selectValue; + } else if (typeof _selectName === 'string' && _selectName.length) { + _query[_selectName] = _selectValue; + }; + }; + }; + + $.getJSON(_dataUrl, _query, function(json) { + _selectData = cxSelect.getData(json, _jsonSpace); + + cxSelect.buildOption.call(self, index, _selectData); + }); + + // 使用整合数据 + } else if (self.settings.data && typeof self.settings.data === 'object') { + _selectData = self.settings.data; + + for (var i = 0; i < index; i++) { + _valueIndex = cxSelect.getIndex(self.selectArray[i][0].selectedIndex, typeof self.selectArray[i].data('required') === 'boolean' ? self.selectArray[i].data('required') : self.settings.required); + + if (typeof _selectData[_valueIndex] === 'object' && $.isArray(_selectData[_valueIndex][self.settings.jsonSub]) && _selectData[_valueIndex][self.settings.jsonSub].length) { + _selectData = _selectData[_valueIndex][self.settings.jsonSub]; + } else { + _selectData = null; + break; + }; + }; + + cxSelect.buildOption.call(self, index, _selectData); + }; + }; + + // 构建选项列表 + cxSelect.buildOption = function(index, data) { + var self = this; + + var _select = self.selectArray[index]; + var _required = typeof _select.data('required') === 'boolean' ? _select.data('required') : self.settings.required; + var _firstTitle = typeof _select.data('firstTitle') === 'undefined' ? self.settings.firstTitle : _select.data('firstTitle'); + var _firstValue = typeof _select.data('firstValue') === 'undefined' ? self.settings.firstValue : _select.data('firstValue'); + var _jsonName = typeof _select.data('jsonName') === 'undefined' ? self.settings.jsonName : _select.data('jsonName'); + var _jsonValue = typeof _select.data('jsonValue') === 'undefined' ? self.settings.jsonValue : _select.data('jsonValue'); + + if (!$.isArray(data)) {return}; + + var _html = !_required ? '' : ''; + + // 区分标题、值的数据 + if (typeof _jsonName === 'string' && _jsonName.length) { + // 无值字段时使用标题作为值 + if (typeof _jsonValue !== 'string' || !_jsonValue.length) { + _jsonValue = _jsonName; + }; + + for (var i = 0, l = data.length; i < l; i++) { + _html += ''; + }; + + // 数组即为值的数据 + } else { + for (var i = 0, l = data.length; i < l; i++) { + _html += ''; + }; + }; + + _select.html(_html).prop('disabled', false).css({ + 'display': '', + 'visibility': '' + }); + + // 初次加载设置默认值 + if (typeof _select.attr('data-value') === 'string') { + _select.val(String(_select.attr('data-value'))).removeAttr('data-value'); + + if (_select[0].selectedIndex < 0) { + _select[0].options[0].selected = true; + }; + }; + + if (_required || _select[0].selectedIndex > 0) { + _select.trigger('change'); + }; + + }; + + // 改变选择时的处理 + cxSelect.selectChange = function(name) { + var self = this; + + if (typeof name !== 'string' || !name.length) {return}; + + var index; + + name = name.replace(/\s+/g, ','); + name = ',' + name + ','; + + // 获取当前 select 位置 + for (var i = 0, l = self.selectArray.length; i < l; i++) { + if (name.indexOf(',' + self.settings.selects[i] + ',') > -1) { + index = i; + break; + }; + }; + + if (typeof index === 'number' && index > -1) { + index += 1; + cxSelect.getOptionData.call(self, index); + }; + }; + + $.cxSelect = function() { + return cxSelect.apply(this, arguments); + }; + + // 默认值 + $.cxSelect.defaults = { + selects: [], // 下拉选框组 + url: null, // 列表数据文件路径(URL)或数组数据 + data: null, // 自定义数据 + emptyStyle: null, // 无数据状态显示方式 + required: false, // 是否为必选 + firstTitle: '请选择', // 第一个选项的标题 + firstValue: '', // 第一个选项的值 + jsonSpace: '', // 数据命名空间 + jsonName: 'n', // 数据标题字段名称 + jsonValue: '', // 数据值字段名称 + jsonSub: 's' // 子集数据字段名称 + }; + + $.fn.cxSelect = function(settings, callback) { + this.each(function(i) { + $.cxSelect(this, settings, callback); + }); + return this; + }; +})); diff --git a/app/assets/javascripts/jquery.cxselect.min.js b/app/assets/javascripts/jquery.cxselect.min.js old mode 100755 new mode 100644 index 54549a920..9aabba447 --- a/app/assets/javascripts/jquery.cxselect.min.js +++ b/app/assets/javascripts/jquery.cxselect.min.js @@ -1,11 +1,11 @@ -/*! - * jQuery cxSelect - * @name jquery.cxselect.js - * @version 1.4.1 - * @date 2016-11-02 - * @author ciaoca - * @email ciaoca@gmail.com - * @site https://github.com/ciaoca/cxSelect - * @license Released under the MIT license - */ +/*! + * jQuery cxSelect + * @name jquery.cxselect.js + * @version 1.4.1 + * @date 2016-11-02 + * @author ciaoca + * @email ciaoca@gmail.com + * @site https://github.com/ciaoca/cxSelect + * @license Released under the MIT license + */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery||window.Zepto||window.$)}(function(a){var b=function(){var d,e,f,g,h,i;for(g=0,h=arguments.length;h>g;g++)b.isJquery(arguments[g])||b.isZepto(arguments[g])?d=arguments[g]:b.isElement(arguments[g])?d=a(arguments[g]):"function"==typeof arguments[g]?f=arguments[g]:"object"==typeof arguments[g]&&(e=arguments[g]);return i=new b.init(d,e),"function"==typeof f&&f(i),i};b.isElement=function(a){return a&&("function"==typeof HTMLElement||"object"==typeof HTMLElement)&&a instanceof HTMLElement?!0:a&&a.nodeType&&1===a.nodeType?!0:!1},b.isJquery=function(a){return a&&a.length&&("function"==typeof jQuery||"object"==typeof jQuery)&&a instanceof jQuery?!0:!1},b.isZepto=function(a){return a&&a.length&&("function"==typeof Zepto||"object"==typeof Zepto)&&Zepto.zepto.isZ(a)?!0:!1},b.getIndex=function(a,b){return b?a:a-1},b.getData=function(a,b){if("string"==typeof b&&b.length){b=b.split(".");for(var c=0,d=b.length;d>c;c++)a=a[b[c]]}return a},b.init=function(c,d){var f,g,e=this;(b.isJquery(c)||b.isZepto(c))&&(f={dom:{box:c}},e.attach=b.attach.bind(f),e.detach=b.detach.bind(f),e.setOptions=b.setOptions.bind(f),e.clear=b.clear.bind(f),f.changeEvent=function(){b.selectChange.call(f,this.className)},f.settings=a.extend({},a.cxSelect.defaults,d,{url:f.dom.box.data("url"),emptyStyle:f.dom.box.data("emptyStyle"),required:f.dom.box.data("required"),firstTitle:f.dom.box.data("firstTitle"),firstValue:f.dom.box.data("firstValue"),jsonSpace:f.dom.box.data("jsonSpace"),jsonName:f.dom.box.data("jsonName"),jsonValue:f.dom.box.data("jsonValue"),jsonSub:f.dom.box.data("jsonSub")}),g=f.dom.box.data("selects"),"string"==typeof g&&g.length&&(f.settings.selects=g.split(",")),e.setOptions(),e.attach(),f.settings.url||f.settings.data?a.isArray(f.settings.data)?b.start.call(f,f.settings.data):"string"==typeof f.settings.url&&f.settings.url.length&&a.getJSON(f.settings.url,function(a){b.start.call(f,a)}):b.start.apply(f))},b.setOptions=function(c){var e,f,g,d=this;if(c&&a.extend(d.settings,c),(!a.isArray(d.selectArray)||!d.selectArray.length||c&&c.selects)&&(d.selectArray=[],a.isArray(d.settings.selects)&&d.settings.selects.length))for(f=0,g=d.settings.selects.length;g>f&&(e=d.dom.box.find("select."+d.settings.selects[f]),e&&e.length);f++)d.selectArray.push(e);c&&(!a.isArray(c.data)&&"string"==typeof c.url&&c.url.length?a.getJSON(d.settings.url,function(a){b.start.call(d,a)}):b.start.call(d,c.data))},b.attach=function(){var a=this;a.attachStatus||a.dom.box.on("change","select",a.changeEvent),"boolean"==typeof a.attachStatus&&b.start.call(a),a.attachStatus=!0},b.detach=function(){var a=this;a.dom.box.off("change","select",a.changeEvent),a.attachStatus=!1},b.clear=function(a){var d,e,b=this,c={display:"",visibility:""};for(a=isNaN(a)?0:a,d=a,e=b.selectArray.length;e>d;d++)b.selectArray[d].empty().prop("disabled",!0),"none"===b.settings.emptyStyle?c.display="none":"hidden"===b.settings.emptyStyle&&(c.visibility="hidden"),b.selectArray[d].css(c)},b.start=function(c){var e,f,d=this;if(a.isArray(c)&&(d.settings.data=b.getData(c,d.settings.jsonSpace)),d.selectArray.length){for(e=0,f=d.selectArray.length;f>e;e++)"string"!=typeof d.selectArray[e].attr("data-value")&&d.selectArray[e][0].options.length&&d.selectArray[e].attr("data-value",d.selectArray[e].val());d.settings.data||"string"==typeof d.selectArray[0].data("url")&&d.selectArray[0].data("url").length?b.getOptionData.call(d,0):d.selectArray[0].prop("disabled",!1).css({display:"",visibility:""})}},b.getOptionData=function(c){var f,g,h,i,j,k,l,m,n,o,p,d=this;if(!("number"!=typeof c||isNaN(c)||0>c||c>=d.selectArray.length))if(f=d.selectArray[c],i=f.data("url"),j="undefined"==typeof f.data("jsonSpace")?d.settings.jsonSpace:f.data("jsonSpace"),k={},b.clear.call(d,c),"string"==typeof i&&i.length){if(c>0)for(o=0,p=1;c>o;o++,p++)l=d.selectArray[p].data("queryName"),m=d.selectArray[o].attr("name"),n=d.selectArray[o].val(),"string"==typeof l&&l.length?k[l]=n:"string"==typeof m&&m.length&&(k[m]=n);a.getJSON(i,k,function(a){g=b.getData(a,j),b.buildOption.call(d,c,g)})}else if(d.settings.data&&"object"==typeof d.settings.data){for(g=d.settings.data,o=0;c>o;o++){if(h=b.getIndex(d.selectArray[o][0].selectedIndex,"boolean"==typeof d.selectArray[o].data("required")?d.selectArray[o].data("required"):d.settings.required),"object"!=typeof g[h]||!a.isArray(g[h][d.settings.jsonSub])||!g[h][d.settings.jsonSub].length){g=null;break}g=g[h][d.settings.jsonSub]}b.buildOption.call(d,c,g)}},b.buildOption=function(b,c){var k,l,m,d=this,e=d.selectArray[b],f="boolean"==typeof e.data("required")?e.data("required"):d.settings.required,g="undefined"==typeof e.data("firstTitle")?d.settings.firstTitle:e.data("firstTitle"),h="undefined"==typeof e.data("firstValue")?d.settings.firstValue:e.data("firstValue"),i="undefined"==typeof e.data("jsonName")?d.settings.jsonName:e.data("jsonName"),j="undefined"==typeof e.data("jsonValue")?d.settings.jsonValue:e.data("jsonValue");if(a.isArray(c)){if(k=f?"":'","string"==typeof i&&i.length)for("string"==typeof j&&j.length||(j=i),l=0,m=c.length;m>l;l++)k+='";else for(l=0,m=c.length;m>l;l++)k+='";e.html(k).prop("disabled",!1).css({display:"",visibility:""}),"string"==typeof e.attr("data-value")&&(e.val(String(e.attr("data-value"))).removeAttr("data-value"),e[0].selectedIndex<0&&(e[0].options[0].selected=!0)),(f||e[0].selectedIndex>0)&&e.trigger("change")}},b.selectChange=function(a){var d,e,f,c=this;if("string"==typeof a&&a.length){for(a=a.replace(/\s+/g,","),a=","+a+",",e=0,f=c.selectArray.length;f>e;e++)if(a.indexOf(","+c.settings.selects[e]+",")>-1){d=e;break}"number"==typeof d&&d>-1&&(d+=1,b.getOptionData.call(c,d))}},a.cxSelect=function(){return b.apply(this,arguments)},a.cxSelect.defaults={selects:[],url:null,data:null,emptyStyle:null,required:!1,firstTitle:"请选择",firstValue:"",jsonSpace:"",jsonName:"n",jsonValue:"",jsonSub:"s"},a.fn.cxSelect=function(b,c){return this.each(function(){a.cxSelect(this,b,c)}),this}}); \ No newline at end of file diff --git a/app/assets/javascripts/jquery.validate.js b/app/assets/javascripts/jquery.validate.js index 70297bd5c..d025319db 100644 --- a/app/assets/javascripts/jquery.validate.js +++ b/app/assets/javascripts/jquery.validate.js @@ -1,21 +1,21 @@ -/*! - * jQuery Validation Plugin v1.19.1 - * - * https://jqueryvalidation.org/ - * - * Copyright (c) 2019 Jörn Zaefferer - * Released under the MIT license - */ -(function( factory ) { - if ( typeof define === "function" && define.amd ) { - define( ["jquery"], factory ); - } else if (typeof module === "object" && module.exports) { - module.exports = factory( require( "jquery" ) ); - } else { - factory( jQuery ); - } -}(function( $ ) { - +/*! + * jQuery Validation Plugin v1.19.1 + * + * https://jqueryvalidation.org/ + * + * Copyright (c) 2019 Jörn Zaefferer + * Released under the MIT license + */ +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + define( ["jquery"], factory ); + } else if (typeof module === "object" && module.exports) { + module.exports = factory( require( "jquery" ) ); + } else { + factory( jQuery ); + } +}(function( $ ) { + $.extend( $.fn, { // https://jqueryvalidation.org/validate/ @@ -1610,7 +1610,7 @@ $.extend( $.validator, { } } ); - + // Ajax mode: abort // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() @@ -1646,5 +1646,5 @@ if ( $.ajaxPrefilter ) { return ajax.apply( this, arguments ); }; } -return $; +return $; })); \ No newline at end of file diff --git a/app/assets/javascripts/select2.js b/app/assets/javascripts/select2.js old mode 100755 new mode 100644 diff --git a/app/assets/javascripts/select2.min.js b/app/assets/javascripts/select2.min.js old mode 100755 new mode 100644 diff --git a/app/assets/stylesheets/select2-bootstrap4.min.scss b/app/assets/stylesheets/select2-bootstrap4.min.scss old mode 100755 new mode 100644 diff --git a/app/assets/stylesheets/select2.min.scss b/app/assets/stylesheets/select2.min.scss old mode 100755 new mode 100644 diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 510bcaa4f..f126bc363 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -30,7 +30,8 @@ module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", - // 开启调试 + // 开启调试 + devtool: "source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index 022e8074f..419450dae 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -195,7 +195,30 @@ function generateNewIndexJsp() { let cdnHost = 'https://shixun.educoder.net' cdnHost = 'https://ali-cdn.educoder.net' cdnHost = '' - var result = data.replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) + + + var mainRegex = / + ` + var jsMinAllRegex = / + var result = data + .replace(jsMinAllRegex, code) + // .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) // ${cdnHost} 加了cdn后,这个文件里的字体文件加载会有跨域的报错 ../fonts/fontawesome-webfont.eot @@ -204,10 +227,11 @@ function generateNewIndexJsp() { .replace('/css/iconfont.css', `${cdnHost}/react/build/css/iconfont.css?v=${newVersion}`) .replace(/\/js\/create_kindeditor.js/g, `${cdnHost}/react/build/js/create_kindeditor.js?v=${newVersion}`) + .replace(mainRegex, '') // .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`) // .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`) - .replace(/https:\/\/testeduplus2.educoder.net/g, ''); + // .replace(/https:\/\/testeduplus2.educoder.net/g, ''); // .replace(/http:\/\/testbdweb.educoder.net/g, ''); // .replace('/css/css_min_all.css', '/react/build/css/css_min_all.css'); diff --git a/public/react/src/App.css b/public/react/src/App.css index a6f1d45e7..2b3d8d08c 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -55,6 +55,10 @@ html, body { .markdown-body p { white-space: pre-wrap; } +/* https://www.educoder.net/courses/2346/group_homeworks/34405/question */ +.renderAsHtml.markdown-body p { + white-space: inherit; +} /* resize */ .editormd .CodeMirror { border-right: none !important; diff --git a/public/react/src/App.js b/public/react/src/App.js index e6f55f5d2..b40af3e0b 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -1,4 +1,5 @@ import React, {Component} from 'react'; +import './public-path'; import logo from './logo.svg'; import './App.css'; import {LocaleProvider} from 'antd' diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index 4c83131f1..74cdef3e6 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -9,6 +9,7 @@ export function markdownToHTML(oldContent, selector) { window.$('#md_div').html('') // markdown to html if (selector && oldContent && oldContent.startsWith('{ return(

- + { item.is_pdf && item.is_pdf == true ? - {item.title} + 30 }> + {item.title} + : - {item.title} + 30 }> + {item.title} + } {item.filesize}

diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 925bcc817..b06ab3dc1 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -129,12 +129,16 @@ class Fileslistitem extends Component{ .catch(function (error) { console.log(error); }); - } + } + + eventStop = (event) =>{ + event.stopPropagation() + } render(){ const { checkBox, - discussMessage, + discussMessage,index } = this.props; return( @@ -190,9 +194,9 @@ class Fileslistitem extends Component{ white-space:nowrap } `} -
-
- +
window.$(`.sourceitem${index} input`).click() }> +
this.eventStop(event)}> + {checkBox} { @@ -283,16 +287,15 @@ class Fileslistitem extends Component{ {this.props.isAdmin? - - + this.eventStop(event)}> - this.settingList()}>设置 - + this.settingList()}>设置 + :""} {this.props.isStudent===true&&this.props.current_user.login===discussMessage.author.login? - + this.eventStop(event)}> { + const checkBoxValues = this.state.checkBoxValues.slice(0); + const index = checkBoxValues.indexOf(item.id); + if (index != -1) { + _.remove(checkBoxValues, (listItem)=> listItem === item.id) + } else { + checkBoxValues.push(item.id); + } + this.onCheckBoxChange(checkBoxValues) + } PaginationTask=(page)=>{ let {search,order,selectpage,checkAllValue,checkBoxValues}=this.state; @@ -787,7 +798,7 @@ class Fileslists extends Component{ showSearchInput={true} > - {this.props.isAdmin()?
+ {this.props.isAdmin()? files===undefined?'' :files.length===0? "":
{this.props.isAdmin()? 已选 {checkBoxValues.length} 个:""}
@@ -897,7 +908,7 @@ class Fileslists extends Component{ { files&&files.map((item, index) => { return ( -
+
this.onItemClick(item)}>
:""} Settingtypes={(id)=>this.Settingtypes(id)} coursesId={this.props.match.params.coursesId} - updatafiledfun={()=>this.updatafiled()} + updatafiledfun={()=>this.updatafiled()} + index={index} >
@@ -948,21 +960,23 @@ class Fileslists extends Component{ />:""}
-
-
- -

暂时还没有相关数据哦!

-
- - + { + files===undefined?'' :files.length===0?:"" + } ) } } -export default Fileslists; \ No newline at end of file +export default Fileslists; + +{/*
*/} + {/*
*/} + {/**/} + {/*

暂时还没有相关数据哦!

*/} +{/*
*/} \ No newline at end of file diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 2df6270c2..0b27ea8b8 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -376,10 +376,15 @@ class BoardsNew extends Component{ dropdownRender={menu => (
{menu} - -
this.refs['addDirModal'].open()}> - 添加目录 -
+ { + isAdmin && + + +
this.refs['addDirModal'].open()}> + 添加目录 +
+
+ }
)} > diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index 432c597ee..542157bfb 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -24,7 +24,7 @@ import '../../forums/RightSection.css' import './TopicDetail.css' import '../common/courseMessage.css' import { Pagination, Tooltip } from 'antd' -import { bytesToSize, ConditionToolTip, markdownToHTML, MarkdownToHtml } from 'educoder' +import { bytesToSize, ConditionToolTip, markdownToHTML, MarkdownToHtml , setImagesUrl } from 'educoder' import SendToCourseModal from '../coursesPublic/modal/SendToCourseModal' import CBreadcrumb from '../common/CBreadcrumb' import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment @@ -57,6 +57,7 @@ class TopicDetail extends Component { pageCount: 1, comments: [], goldRewardDialogOpen: false, + author:undefined } } componentDidMount() { @@ -85,7 +86,8 @@ class TopicDetail extends Component { memo: Object.assign({}, { ...response.data.data, replies_count: response.data.data.total_replies_count - }, {...this.state.memo}) + }, {...this.state.memo}), + author:response.data.data.author }, () => { }) @@ -514,7 +516,7 @@ class TopicDetail extends Component { render() { const { match, history } = this.props const { recommend_shixun, current_user,author_info } = this.props; - const { memo, comments, hasMoreComments, goldRewardDialogOpen, pageCount, total_count } = this.state; + const { memo, comments, hasMoreComments, goldRewardDialogOpen, pageCount, total_count , author } = this.state; const messageId = match.params.topicId if (this.state.memoLoading || !current_user) { return
@@ -599,51 +601,54 @@ class TopicDetail extends Component { }
-
- {moment(memo.created_on).fromNow()} 发布 -
- -
-
- -
- - {/* { current_user.admin && - - - - } */} - - - - {memo.visits || '1'} - - - { !!memo.total_replies_count && - - - - { memo.total_replies_count } - - - } - {!!memo.praises_count && - - - - { memo.praises_count } +
+ +
+
+ {author && author.name} + {moment(memo.created_on).fromNow()} 发布 +
+ +
+ + {/* { current_user.admin && + + - + } */} + + + + {memo.visits || '1'} + + + { !!memo.total_replies_count && + + + + { memo.total_replies_count } + + } - - + {!!memo.total_praises_count && + + + + { memo.total_praises_count } + + + } + + +
+
diff --git a/public/react/src/modules/courses/boards/index.js b/public/react/src/modules/courses/boards/index.js index db3232b23..60d327799 100644 --- a/public/react/src/modules/courses/boards/index.js +++ b/public/react/src/modules/courses/boards/index.js @@ -363,9 +363,9 @@ class Boards extends Component{ */} - {isAdmin &&
-
- {isAdmin && 已选 {checkBoxValues.length} 个} + {messages&&messages.length == 0?"": isAdmin &&
+
+ {isAdmin&&已选 {checkBoxValues.length} 个}
{ !!isAdmin && diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index 3a7e25fcd..ae40fedda 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -15,7 +15,7 @@ import WorkDetailPageHeader from './common/WorkDetailPageHeader' import CommonWorkAppraiseReply from './reply/CommonWorkAppraiseReply' import Example from './TestHooks' import CommonWorkAppraiseReviseAttachments from './CommonWorkAppraiseReviseAttachments' - +import LeaderIcon from './common/LeaderIcon' const { Option} = Select; const CheckboxGroup = Checkbox.Group; const confirm = Modal.confirm; @@ -88,6 +88,14 @@ class CommonWorkAppraise extends Component{ console.log(error) }) } + componentDidUpdate(prevProps, prevState) { + if (this.props.match.params.studentWorkId != prevProps.match.params.studentWorkId) { + this.getWork(); + this.getReviseAttachments() + this.commonWorkAppraiseReply && this.commonWorkAppraiseReply.fetchAllComments() + } + } + componentDidMount() { this.getWork(); this.getReviseAttachments() @@ -156,12 +164,13 @@ class CommonWorkAppraise extends Component{ attachments, homework_id, project_info, work_members, is_evaluation, description, update_user_name, update_time, commit_time, author_name, revise_attachments, revise_reason, atta_update_user, atta_update_time, atta_update_user_login, - Modalstype,Modalstopval,ModalCancel,ModalSave,loadtype + Modalstype,Modalstopval,ModalCancel,ModalSave,loadtype, is_leader_work } =this.state; let courseId=this.props.match.params.coursesId; let category_id=this.props.match.params.category_id; let studentWorkId=this.props.match.params.studentWorkId; + const isAdmin = this.props.isAdmin() return(
- 其他组员 + 全部组员
-
- {work_members.map((item, index) => { - return item.user_name + ' ' - })} +
+
+ 当前组员:{author_name} {is_leader_work && } +
+
+ 其他组员: + {work_members.map((item, index) => { + return + {isAdmin ? + this.props.toWorkDetailPage(this.props.match.params, null, item.work_id)} + > + {item.user_name} + : {item.user_name}} + {item.is_leader && } + + })} +
+
} @@ -266,6 +290,7 @@ class CommonWorkAppraise extends Component{ {/* task_type={datalist&&datalist.task_type} */} {this.commonWorkAppraiseReply = ref}} >
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 528aa1d9e..28e54fff3 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -15,7 +15,7 @@ import WorkDetailPageHeader from './common/WorkDetailPageHeader' import PublishRightnow from './PublishRightnow' import ModulationModal from "../coursesPublic/ModulationModal"; import AccessoryModal from "../coursesPublic/AccessoryModal"; - +import LeaderIcon from './common/LeaderIcon' const { Option} = Select; const CheckboxGroup = Checkbox.Group; const confirm = Modal.confirm; @@ -97,7 +97,12 @@ function buildColumns(that, student_works, studentData) { }} title={text && text.length > 5 ? text : ''}> {/* */} - {text} + {record.is_leader ? +
+
{text}
+ +
+ : {text}}
), }] diff --git a/public/react/src/modules/courses/busyWork/common/LeaderIcon.js b/public/react/src/modules/courses/busyWork/common/LeaderIcon.js new file mode 100644 index 000000000..526e165c5 --- /dev/null +++ b/public/react/src/modules/courses/busyWork/common/LeaderIcon.js @@ -0,0 +1,19 @@ +import React,{Component} from "React"; + +export default function LeaderIcon(props = {}) { + let icon = null; + if (props.small) { + icon =
组长
+ } else { + icon =
组长
+ + } + return icon +} \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js index a092c5066..4177be8a4 100644 --- a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js +++ b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js @@ -85,8 +85,7 @@ class WorkDetailPageHeader extends Component{ background: #fff; } .workDetailPageHeader .summaryname { - line-height: 20px; - margin-top: 13px; + line-height:30px } `} -
- +
+ {homework_name} {/* {homework_name} */} - {category && 返回} + {category && 返回} {this.props.update_atta && diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index f9c34cfcf..d5ac0be68 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -143,7 +143,9 @@ class commonWork extends Component{ this.setState({ order:e.key==="all"?"":e.key, page:1, - isSpin:true + isSpin:true, + checkBoxValues:[], + checkAll:false }) let {search}=this.state; this.getList(1,search,e.key==="all"?"":e.key); diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index af2d115fc..fa45f1502 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -750,7 +750,7 @@ class Coursesleftnav extends Component{ {/*分班*/} {item.type==="course_group"?
this.Navmodalnames(e,2,"course_group",item.id)}>添加分班
:""} {/*分班*/} - {item.type==="course_group"?
this.Navmodalnames(e,5,"editname",item.id,item.name)}>重命名
:
this.Navmodalnames(e,3,"editname",item.id,item.name)}>重命名
} + {item.type==="course_group"?
this.Navmodalnames(e,3,"editname",item.id,item.name)}>重命名
:""}
this.edithidden(e,item.id)}>隐藏
this.editSetup(e,item.id)}>置顶
diff --git a/public/react/src/modules/courses/coursesPublic/NoneData.js b/public/react/src/modules/courses/coursesPublic/NoneData.js index 73406ab5c..35d7a5271 100644 --- a/public/react/src/modules/courses/coursesPublic/NoneData.js +++ b/public/react/src/modules/courses/coursesPublic/NoneData.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import {getImageUrl} from 'educoder'; +import { getImageUrl , getUrl } from 'educoder'; class NoneData extends Component{ constructor(props) { @@ -9,7 +9,20 @@ class NoneData extends Component{ const { style } = this.props; return(
- + +

暂时还没有相关数据哦!

) diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js index 07ce55024..33a2cb68d 100644 --- a/public/react/src/modules/courses/coursesPublic/PathModal.js +++ b/public/react/src/modules/courses/coursesPublic/PathModal.js @@ -180,11 +180,13 @@ class PathModal extends Component{ }else{ // this.homeworkstart //调用立即发布弹窗 + // this.props.showNotification(response.data.message) this.props.hidecouseShixunModal(); - this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + this.props.updataleftNavfun() + // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) // this.props.showNotification("选用成功") // this.props.showNotification(response.data.message) - // this.props.homeworkupdatalists(Coursename,page,order); + this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); } // if(response.status===200) { diff --git a/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js b/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js index af3fc1a30..c4c306a12 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js +++ b/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js @@ -1,209 +1,209 @@ -import React, { Component } from "react"; -import { Modal, Checkbox, Input, Spin} from "antd"; -import axios from 'axios' -import ModalWrapper from "../../common/ModalWrapper" -import InfiniteScroll from 'react-infinite-scroller'; - -const Search = Input.Search -const pageCount = 15; -class SendToCourseModal extends Component{ - constructor(props){ - super(props); - this.state={ - checkBoxValues: [], - course_lists: [], - course_lists_after_filter: [], - searchValue: '', - hasMore: true, - loading: false, - page: 1 - } - } - fetchCourseList = (arg_page) => { - const page = arg_page || this.state.page; - // search=''& - let url = `/courses/mine.json?page=${page}&page_size=${pageCount}` - const searchValue = this.state.searchValue.trim() - if (searchValue) { - url += `&search=${searchValue}` - } - this.setState({ loading: true }) - axios.get(url, { - }) - .then((response) => { - if (!response.data.data || response.data.data.length == 0) { - this.setState({ - course_lists: page == 1 ? [] : this.state.course_lists, - page, - loading: false, - hasMore: false, - }) - } else { - this.setState({ - course_lists: page == 1 ? response.data.data : this.state.course_lists.concat(response.data.data), - course_lists_after_filter: response.data.data, - page, - loading: false, - hasMore: response.data.data.length == pageCount - }) - } - - }) - .catch(function (error) { - console.log(error); - }); - } - componentDidMount() { - setTimeout(() => { - this.fetchCourseList() - }, 500) - - } - setVisible = (visible) => { - this.refs.modalWrapper.setVisible(visible) - if (visible == false) { - this.setState({ - checkBoxValues: [] - }) - } - } - - onSendOk = () => { - if (!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) { - this.props.showNotification('请先选择要发送至的课堂') - return; - } - if(this.props.url==="/files/bulk_send.json"){ - axios.post("/files/bulk_send.json", { - course_id:this.props.match.params.coursesId, - ids: this.props.selectedMessageIds, - to_course_ids: this.state.checkBoxValues - }) - .then((response) => { - if (response.data.status == 0) { - this.setVisible(false) - this.props.gobackonSend(response.data.message) - } - }) - .catch(function (error) { - console.log(error); - }); - }else{ - const bid = this.props.match.params.boardId - const url = `/boards/${bid}/messages/bulk_send.json` - axios.post(url, { - ids: this.props.selectedMessageIds, - to_course_ids: this.state.checkBoxValues - }) - .then((response) => { - if (response.data.status == 0) { - this.setVisible(false) - this.props.showNotification('发送成功') - } - }) - .catch(function (error) { - console.log(error); - }); - } - - } - - onOk = () => { - const { course_lists, checkBoxValues } = this.state - this.onSendOk() - // this.props.onOk && this.props.onOk(checkBoxValues) - - // this.refs.modalWrapper.setVisible(false) - } - - onCheckBoxChange = (checkBoxValues) => { - this.setState({ - checkBoxValues: checkBoxValues - }) - } - - onSearchChange = (e) => { - this.setState({ - searchValue: e.target.value - }) - } - handleInfiniteOnLoad = () => { - console.log('loadmore...') - this.fetchCourseList(this.state.page + 1) - } - - onSearch = () => { - // const course_lists_after_filter = this.state.course_lists.filter( item => item.name.indexOf(this.state.searchValue) != -1 ) - // this.setState({ course_lists_after_filter }) - this.fetchCourseList(1) - } - render(){ - const { course_lists, checkBoxValues, searchValue, loading, hasMore } = this.state - const { moduleName } = this.props - return( - - -

选择的{moduleName}发送到指定课堂

- - - -
- {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} -
- - - - { course_lists && course_lists.map( course => { - return ( -

- - -

- ) - }) } -
- {loading && hasMore && ( -
- -
- )} - {/* TODO */} - {/* { - !hasMore &&
没有更多了。。
- } */} -
-
-
-
- ) - } -} -export default SendToCourseModal; - - +import React, { Component } from "react"; +import { Modal, Checkbox, Input, Spin} from "antd"; +import axios from 'axios' +import ModalWrapper from "../../common/ModalWrapper" +import InfiniteScroll from 'react-infinite-scroller'; + +const Search = Input.Search +const pageCount = 15; +class SendToCourseModal extends Component{ + constructor(props){ + super(props); + this.state={ + checkBoxValues: [], + course_lists: [], + course_lists_after_filter: [], + searchValue: '', + hasMore: true, + loading: false, + page: 1 + } + } + fetchCourseList = (arg_page) => { + const page = arg_page || this.state.page; + // search=''& + let url = `/courses/mine.json?page=${page}&page_size=${pageCount}` + const searchValue = this.state.searchValue.trim() + if (searchValue) { + url += `&search=${searchValue}` + } + this.setState({ loading: true }) + axios.get(url, { + }) + .then((response) => { + if (!response.data.data || response.data.data.length == 0) { + this.setState({ + course_lists: page == 1 ? [] : this.state.course_lists, + page, + loading: false, + hasMore: false, + }) + } else { + this.setState({ + course_lists: page == 1 ? response.data.data : this.state.course_lists.concat(response.data.data), + course_lists_after_filter: response.data.data, + page, + loading: false, + hasMore: response.data.data.length == pageCount + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } + componentDidMount() { + setTimeout(() => { + this.fetchCourseList() + }, 500) + + } + setVisible = (visible) => { + this.refs.modalWrapper.setVisible(visible) + if (visible == false) { + this.setState({ + checkBoxValues: [] + }) + } + } + + onSendOk = () => { + if (!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) { + this.props.showNotification('请先选择要发送至的课堂') + return; + } + if(this.props.url==="/files/bulk_send.json"){ + axios.post("/files/bulk_send.json", { + course_id:this.props.match.params.coursesId, + ids: this.props.selectedMessageIds, + to_course_ids: this.state.checkBoxValues + }) + .then((response) => { + if (response.data.status == 0) { + this.setVisible(false) + this.props.gobackonSend(response.data.message) + } + }) + .catch(function (error) { + console.log(error); + }); + }else{ + const bid = this.props.match.params.boardId + const url = `/boards/${bid}/messages/bulk_send.json` + axios.post(url, { + ids: this.props.selectedMessageIds, + to_course_ids: this.state.checkBoxValues + }) + .then((response) => { + if (response.data.status == 0) { + this.setVisible(false) + this.props.showNotification('发送成功') + } + }) + .catch(function (error) { + console.log(error); + }); + } + + } + + onOk = () => { + const { course_lists, checkBoxValues } = this.state + this.onSendOk() + // this.props.onOk && this.props.onOk(checkBoxValues) + + // this.refs.modalWrapper.setVisible(false) + } + + onCheckBoxChange = (checkBoxValues) => { + this.setState({ + checkBoxValues: checkBoxValues + }) + } + + onSearchChange = (e) => { + this.setState({ + searchValue: e.target.value + }) + } + handleInfiniteOnLoad = () => { + console.log('loadmore...') + this.fetchCourseList(this.state.page + 1) + } + + onSearch = () => { + // const course_lists_after_filter = this.state.course_lists.filter( item => item.name.indexOf(this.state.searchValue) != -1 ) + // this.setState({ course_lists_after_filter }) + this.fetchCourseList(1) + } + render(){ + const { course_lists, checkBoxValues, searchValue, loading, hasMore } = this.state + const { moduleName } = this.props + return( + + +

选择的{moduleName}发送到指定课堂

+ + + +
+ {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} +
+ + + + { course_lists && course_lists.map( course => { + return ( +

+ + +

+ ) + }) } +
+ {loading && hasMore && ( +
+ +
+ )} + {/* TODO */} + {/* { + !hasMore &&
没有更多了。。
+ } */} +
+
+
+
+ ) + } +} +export default SendToCourseModal; + + diff --git a/public/react/src/modules/courses/css/members.css b/public/react/src/modules/courses/css/members.css index ff6f0d99d..df3f884d9 100644 --- a/public/react/src/modules/courses/css/members.css +++ b/public/react/src/modules/courses/css/members.css @@ -1,80 +1,80 @@ -.studentList_operation_ul{ - color: #999; - font-size: 12px; - float: right; - margin-top: 2px; -} -.studentList_operation_ul li{ - float: left; - padding:0px 20px; - position: relative; - cursor: pointer; - flex: 0 0 26px; - line-height: 26px; -} -.studentList_operation_ul li.li_line:after{ - position: absolute; - content: ''; - width: 1px; - height: 12px; - background-color: #EDEDED; - right: 0px; - top:6px; -} -.studentList_operation_ul li:last-child{ - padding-right: 0px; -} -.studentList_operation_ul li:last-child:after{ - width: 0px; -} - -/* 基础的下拉列表、列如排序等 */ -.drop_down_normal li{ - padding: 0px 20px; - height: 34px; - line-height: 34px; - min-width: 96px; - color: #333; - font-size: 14px; - cursor: pointer; - width: 100%; -} - -.stu_table table{ - line-height: 1.2; -} -.stu_table .classesName{ - display: block; - max-width: 428px; -} -.stu_table .ant-table-thead > tr > th{ - padding:21px 16px; - border-bottom: none; -} -.stu_table .ant-table-tbody tr:last-child td{ - border-bottom: none; -} -.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{ - background-color: #fff; -} - -.stu_head{ - padding-bottom: 15px; -} -.ant-modal-body{ - padding:30px 40px; -} -.color-dark-21{ - color: #212121; -} -.tabletd { - background-color:#E6F7FF; -} - -.yslminheigth{ - min-height: 20px; -} - -.yslminheigths{ - min-height: 21px; +.studentList_operation_ul{ + color: #999; + font-size: 12px; + float: right; + margin-top: 2px; +} +.studentList_operation_ul li{ + float: left; + padding:0px 20px; + position: relative; + cursor: pointer; + flex: 0 0 26px; + line-height: 26px; +} +.studentList_operation_ul li.li_line:after{ + position: absolute; + content: ''; + width: 1px; + height: 12px; + background-color: #EDEDED; + right: 0px; + top:6px; +} +.studentList_operation_ul li:last-child{ + padding-right: 0px; +} +.studentList_operation_ul li:last-child:after{ + width: 0px; +} + +/* 基础的下拉列表、列如排序等 */ +.drop_down_normal li{ + padding: 0px 20px; + height: 34px; + line-height: 34px; + min-width: 96px; + color: #333; + font-size: 14px; + cursor: pointer; + width: 100%; +} + +.stu_table table{ + line-height: 1.2; +} +.stu_table .classesName{ + display: block; + max-width: 428px; +} +.stu_table .ant-table-thead > tr > th{ + padding:21px 16px; + border-bottom: none; +} +.stu_table .ant-table-tbody tr:last-child td{ + border-bottom: none; +} +.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{ + background-color: #fff; +} + +.stu_head{ + padding-bottom: 15px; +} +.ant-modal-body{ + padding:30px 40px; +} +.color-dark-21{ + color: #212121; +} +.tabletd { + background-color:#E6F7FF; +} + +.yslminheigth{ + min-height: 20px; +} + +.yslminheigths{ + min-height: 21px; } \ No newline at end of file diff --git a/public/react/src/modules/courses/exercise/Exercise.js b/public/react/src/modules/courses/exercise/Exercise.js index 4331bdc6f..83227fb5a 100644 --- a/public/react/src/modules/courses/exercise/Exercise.js +++ b/public/react/src/modules/courses/exercise/Exercise.js @@ -171,7 +171,20 @@ class Exercise extends Component{ checkAllValue: checkedValues.length == exercises.length }) } - // 全选or反选 + + + onItemClick = (item) => { + const checkBoxValues = this.state.checkBoxValues.slice(0); + const index = checkBoxValues.indexOf(item.id); + if (index != -1) { + _.remove(checkBoxValues, (listItem)=> listItem === item.id) + } else { + checkBoxValues.push(item.id) + } + this.onCheckBoxChange(checkBoxValues) + } + + // 全选or反选 onCheckAll = (e) => { this.setState({ checkAllValue: e.target.checked @@ -507,7 +520,7 @@ class Exercise extends Component{
- {this.props.isAdmin()?
+ {this.props.isAdmin()?exercises && exercises.length ===0?"":
已选 {checkBoxValues.length} 个
@@ -559,9 +572,9 @@ class Exercise extends Component{ {...this.props} {...this.state} item={item} - key={key} - checkBox={ this.onItemClick(item)} + index={key} + onItemClick={this.onItemClick} + checkBox={} > ) diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index e890b92ef..5248f4c1a 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -52,17 +52,17 @@ class ExerciseListItem extends Component{ }) } render(){ - let{item,checkBox}=this.props; + let{item,checkBox,index}=this.props; let {coursesId,Id}=this.props.match.params const IsAdmin =this.props.isAdmin(); const IsStudent =this.props.isStudent(); // console.log(this.props.current_user.user_id) return( -
+
window.$(`.exerciseitem${index} input`).click() }> { - IsAdmin && - + IsAdmin && + {checkBox} } @@ -96,20 +96,20 @@ class ExerciseListItem extends Component{ {/*{item.exercise_name}*/} { - this.props.isAdmin()? {item.exercise_name}:"" + to={`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`}>{item.exercise_name}:"" } { this.props.isStudent()? - {item.exercise_name}:"" + {item.exercise_name}:"" } { this.props.isNotMember()? item.lock_status === 0 ? {item.exercise_name} - : {item.exercise_name}:"" + : {item.exercise_name}:"" } { @@ -165,8 +165,8 @@ class ExerciseListItem extends Component{ { IsAdmin &&
- 编辑 - 设置 + 编辑 + 设置
}

@@ -193,7 +193,7 @@ class ExerciseListItem extends Component{
{item.current_status ===0&&item.exercise_status>1?
  • 继续答题
  • : item.current_status ===1&&item.exercise_status>1?
  • 查看答题
  • : - item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""} + item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""}
    }
    diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index cdbc7218b..f38ad7435 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -541,6 +541,18 @@ class ExerciseReviewAndAnswer extends Component{ .inputNumber30 .ant-input-number-input-wrap .ant-input-number-input{ height: 28px; } + .setRadioStyle{ + width:100%; + cursor:pointer; + } + .setRadioStyle span:last-child{ + flex:1; + display:flex; + } + .setRadioStyle .ant-radio,.setRadioStyle .ant-checkbox{ + height:16px; + margin-top:2px; + } `} {/*

    */} - + { questionType.question_choices && questionType.question_choices.map((item,key)=>{ let prefix = `${tagArray[key]}.` return(

    - {prefix} - {/* */} - {/* */} - + + {prefix} + +

    ) }) diff --git a/public/react/src/modules/courses/exercise/question/single.js b/public/react/src/modules/courses/exercise/question/single.js index a879bad74..5156019d4 100644 --- a/public/react/src/modules/courses/exercise/question/single.js +++ b/public/react/src/modules/courses/exercise/question/single.js @@ -40,18 +40,18 @@ class single extends Component{ let isJudge = questionType.question_type == 2 return(
    - + { questionType.question_choices && questionType.question_choices.map((item,key)=>{ let prefix = isJudge ? undefined : `${tagArray[key]}.` return( -

    - {prefix} - {/* */} - {/* */} - +

    + + {prefix} + +

    ) }) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index d30944ef0..92a4832db 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -151,16 +151,12 @@ class GraduateTaskItem extends Component{ coursesId, categoryid, taskid, - + index, + isAdmin } = this.props; - // console.log(discussMessage) - - - - return( -
    +
    window.$(`.taskitem${index} input`).click() }> - { checkBox } - + + { checkBox } + {/* style={{borderTop:data===undefined?"":data.course_identity<4?'1px solid #EBEBEB':'1px solid transparent'}} */} diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index b54815b2f..bae85807a 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -13,6 +13,7 @@ import Modals from '../../../modals/Modals'; import UseBank from "../../busyWork/UseBank"; import '../../css/members.css'; import '../style.css'; +import NoneData from "../../coursesPublic/NoneData"; class GraduationTasks extends Component{ @@ -350,8 +351,6 @@ class GraduationTasks extends Component{ checkBoxValues: checkedValues, checkAllValue:type }) - - } @@ -384,7 +383,9 @@ class GraduationTasks extends Component{ this.setState({ order: e.key, - isSpin:true + isSpin:true, + checkBoxValues:[], + checkAllValue:false }); let newkey=e.key; @@ -696,7 +697,7 @@ class GraduationTasks extends Component{ */} - {this.props.isAdmin()?
    + {this.props.isAdmin()?all_count===undefined?'' :all_count===0?"":
    已选 {checkBoxValues.length} 个
    @@ -726,10 +727,10 @@ class GraduationTasks extends Component{ } `} - { tasks.map((item, index) => { + { tasks&&tasks.map((item, index) => { // console.log(item) return ( -
    +
    @@ -770,18 +772,11 @@ class GraduationTasks extends Component{ />
    } -
    -
    - -

    暂时还没有相关数据哦!

    -
    + + { + all_count===undefined?'' :all_count===0? :"" + }
    @@ -790,4 +785,16 @@ class GraduationTasks extends Component{ ) } } -export default GraduationTasks; \ No newline at end of file +export default GraduationTasks; + +{/*
    */} + {/*
    */} + {/**/} + {/*

    暂时还没有相关数据哦!

    */} +{/*
    */} diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js index 0c76cd9de..9ba334421 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js @@ -6,7 +6,7 @@ import '../style.css' import axios from "axios"; import GraduateTopicReply from './GraduateTopicReply' -import { ConditionToolTip,MarkdownToHtml } from 'educoder' +import { ConditionToolTip , MarkdownToHtml , AttachmentList } from 'educoder' const $=window.$; const type={1: "设计",2: "论文", 3: "创作"} @@ -60,9 +60,10 @@ class GraduateTopicDetailTable extends Component{ { topicInfo && topicInfo.attachment_list.length>0 &&

    - { + {/* { topicInfo.attachment_list.map((item,key)=>{ return( +

  • 30 }> @@ -72,7 +73,8 @@ class GraduateTopicDetailTable extends Component{
  • ) }) - } + } */} +

    }
    diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js index 9f61e69d4..bac04c699 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js @@ -47,7 +47,7 @@ class GraduateTopicItem extends Component{ } -
    +
    window.$(`.topicItem${index} input`).click() }> - { isAdmin ? checkBox : ""} + { isAdmin ? {checkBox} : ""}
    -
    - 姓名: - {this.setState({name: e.target.value})}} - style={{ width: '221px'}} - > - 单位: - {/* {this.setState({school_name: e.target.value})}} - style={{ width: '200px'}}> - */} - {this.setState({school_name: value})}} - > - this.fetchMemberList(1)} - style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} - >搜索 -
    - {/* */} - - -

    - - - - - - -

    - - { loading || users.length ?
    - {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} -
    - - - - { users.map( candidate => { - return ( -

    - - - 12 }> - - - - - 12 }> - - - - - - -

    - ) - }) } -
    - {loading && hasMore && ( -
    - -
    - )} - -
    -
    - {course_groups && course_groups.length &&
    - 所选学生分班至(选填): - -
    } -
    : } -
    - - ) - } -} - -AddStudentModal.contextType = ThemeContext; -export default AddStudentModal; +import React, { Component } from "react"; +import { Modal, Checkbox, Input, Spin, Select, Divider } from "antd"; +import axios from 'axios' +import ModalWrapper from "../../common/ModalWrapper" +import InfiniteScroll from 'react-infinite-scroller'; +import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common' +import NoneData from '../../coursesPublic/NoneData' +import { ConditionToolTip, ThemeContext } from 'educoder' +import SchoolSelect from '../../coursesPublic/form/SchoolSelect' + +const Option = Select.Option; +const pageCount = 15; +class AddStudentModal extends Component{ + constructor(props){ + super(props); + this.state={ + checkBoxValues: [], + users: [], + hasMore: true, + loading: false, + courseGroup: '', + page: 1, + isSpin:false + } + } + fetchMemberList = (arg_page) => { + const courseId = this.props.match.params.coursesId + const page = arg_page || this.state.page; + const { name, school_name } = this.state + let url = `/courses/${courseId}/search_users.json?page=${page}&limit=${pageCount}&school_name=${school_name || ''}&name=${name || ''}` + this.setState({ loading: true }) + axios.get(url) + .then((response) => { + if (!response.data.users || response.data.users.length == 0) { + this.setState({ + users: page == 1 ? response.data.users : this.state.users, + page, + loading: false, + hasMore: false, + }) + } else { + this.setState({ + users: page == 1 ? response.data.users : this.state.users.concat(response.data.users), + page, + loading: false, + hasMore: response.data.users.length == pageCount + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } + componentDidMount() { + + + } + fetchOptions = () => { + // add_teacher_popup + const courseId = this.props.match.params.coursesId + + let url = `/courses/${courseId}/all_course_groups.json` + + axios.get(url, { + }) + .then((response) => { + if (response.data.course_groups && response.data.course_groups.length) { + this.setState({ + course_groups: response.data.course_groups, + courseGroup: response.data.course_groups[0].id + }) + } else { + // showNotification('') + } + }) + .catch(function (error) { + console.log(error); + }); + } + setVisible = (visible) => { + if (visible) { + this.setState({school_name: this.props.user.user_school}) + this.fetchMemberList() + this.fetchOptions() + } + this.refs.modalWrapper.setVisible(visible) + if (visible == false) { + this.setState({ + checkBoxValues: [] + }) + } + } + + onSendOk = () => { + + if(!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) { + this.props.showNotification('请从列表中先选择用户。') + return; + } + this.setState({ + isSpin:true + }) + const courseId = this.props.match.params.coursesId + const url = `/courses/${courseId}/add_students_by_search.json` + const params = { + "user_ids": this.state.checkBoxValues + } + const { courseGroup } = this.state + if (courseGroup) { + params.course_group_id = courseGroup + } + axios.post(url, params) + .then((response) => { + if (response.data.status == 0) { + this.setVisible(false) + this.props.showNotification('添加成功') + this.props.addStudentSuccess && this.props.addStudentSuccess(params) + this.setState({ + isSpin:false + }) + } + }) + .catch(function (error) { + console.log(error); + }); + } + + onOk = () => { + this.onSendOk() + } + + onCheckBoxChange = (checkBoxValues) => { + this.setState({ + checkBoxValues: checkBoxValues + }) + } + + handleInfiniteOnLoad = () => { + this.fetchMemberList(this.state.page + 1) + } + + onSearch = () => { + this.fetchMemberList(1) + } + handleCourseGroupChange = (value) => { + this.setState({ + courseGroup: value + }) + } + render(){ + const { users, checkBoxValues, loading, hasMore, name, school_name + , courseGroup, course_groups,isSpin } = this.state + const { moduleName } = this.props + let theme = this.context; + return( + + +
    + 姓名: + {this.setState({name: e.target.value})}} + style={{ width: '221px'}} + > + 单位: + {/* {this.setState({school_name: e.target.value})}} + style={{ width: '200px'}}> + */} + {this.setState({school_name: value})}} + > + this.fetchMemberList(1)} + style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} + >搜索 +
    + {/* */} + + +

    + + + + + + +

    + + { loading || users.length ?
    + {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} +
    + + + + { users.map( candidate => { + return ( +

    + + + 12 }> + + + + + 12 }> + + + + + + +

    + ) + }) } +
    + {loading && hasMore && ( +
    + +
    + )} + +
    +
    + {course_groups && course_groups.length &&
    + 所选学生分班至(选填): + +
    } +
    : } +
    +
    + ) + } +} + +AddStudentModal.contextType = ThemeContext; +export default AddStudentModal; diff --git a/public/react/src/modules/courses/members/modal/AddTeacherModal.js b/public/react/src/modules/courses/members/modal/AddTeacherModal.js index 21902a782..b397f7838 100644 --- a/public/react/src/modules/courses/members/modal/AddTeacherModal.js +++ b/public/react/src/modules/courses/members/modal/AddTeacherModal.js @@ -1,355 +1,355 @@ -import React, { Component } from "react"; -import { Modal, Checkbox, Input, Spin, Select, Divider, Icon } from "antd"; -import axios from 'axios' -import ModalWrapper from "../../common/ModalWrapper" -import InfiniteScroll from 'react-infinite-scroller'; -import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common' -import { ConditionToolTip, ActionBtn } from 'educoder' -import NoneData from '../../coursesPublic/NoneData' -import AddGraduationGroupModal from './AddGraduationGroupModal' -import SchoolSelect from '../../coursesPublic/form/SchoolSelect' - -const Option = Select.Option; -const pageCount = 15; -let timeout, currentValue -class AddTeacherModal extends Component{ - constructor(props){ - super(props); - this.state={ - school_names: [], - checkBoxValues: [], - candidates: [], - hasMore: true, - loading: false, - page: 1 - } - } - fetchMemberList = (arg_page) => { - const courseId = this.props.match.params.coursesId - const page = arg_page || this.state.page; - const { name, school_name } = this.state - let url = `/courses/${courseId}/search_teacher_candidate.json` - this.setState({ loading: true }) - axios.post(url, { - page: page, - limit: pageCount, - school_name: school_name || '', - name: name || '' - }) - .then((response) => { - if (!response.data.candidates || response.data.candidates.length == 0) { - this.setState({ - candidates: page == 1 ? response.data.candidates : this.state.candidates, - page, - loading: false, - hasMore: false, - }) - } else { - this.setState({ - candidates: page == 1 ? response.data.candidates : this.state.candidates.concat(response.data.candidates), - page, - loading: false, - hasMore: response.data.candidates.length == pageCount - }) - } - - }) - .catch(function (error) { - console.log(error); - }); - } - componentDidMount() { - - - } - onAddGraduationGroupOk = () => { - this.fetchOptions() - } - fetchOptions = () => { - // add_teacher_popup - const courseId = this.props.match.params.coursesId - - let url = `/courses/${courseId}/add_teacher_popup.json` - - axios.get(url, { - }) - .then((response) => { - - if (response.data.school_name) { - this.setState({ - school_name: response.data.school_name - }, () => this.fetchMemberList()) - } else { - this.fetchMemberList() - - } - if (response.data.graduation_groups) { - this.setState({ - graduation_groups: response.data.graduation_groups - }) - } - if (response.data.course_groups) { - this.setState({ - course_groups: response.data.course_groups - }) - } - - }) - .catch(function (error) { - console.log(error); - }); - } - setVisible = (visible) => { - if (visible) { - this.fetchOptions() - } - this.refs.modalWrapper.setVisible(visible) - if (visible == false) { - this.setState({ - checkBoxValues: [] - }) - } - } - - onSendOk = () => { - const courseId = this.props.match.params.coursesId - const url = `/courses/${courseId}/add_teacher.json` - if (this.state.checkBoxValues.length == 0) { - this.props.showNotification('请先在下面列表中选择要添加教师的成员') - return - } - const params = { - "user_list": this.state.checkBoxValues.map (item => { return { 'user_id': item }}) , - // "graduation_group_id": "2", - // "course_group_id": "820", - "role": this.props.isTeacher ? ROLE_TEACHER_NUM : ROLE_ASSISTANT_NUM - } - const { graduationGroup, courseGroup } = this.state - if (graduationGroup) { - params.graduation_group_id = graduationGroup - } - if (courseGroup) { - params.course_group_id = courseGroup - } - axios.post(url, params) - .then((response) => { - if (response.data.status == 0) { - this.setVisible(false) - this.props.showNotification('添加成功') - this.props.addTeacherSuccess && this.props.addTeacherSuccess(params) - } - }) - .catch(function (error) { - console.log(error); - }); - } - - onOk = () => { - this.onSendOk() - } - - onCheckBoxChange = (checkBoxValues) => { - this.setState({ - checkBoxValues: checkBoxValues - }) - } - - handleInfiniteOnLoad = () => { - this.fetchMemberList(this.state.page + 1) - } - - onSearch = () => { - this.fetchMemberList(1) - } - handleGradationGroupChange = (value) => { - this.setState({ - graduationGroup: value - }) - } - handleCourseGroupChange = (value) => { - this.setState({ - courseGroup: value - }) - } - onOrgNameChange = (value) => { - // console.log('school_name: ', value) - this.setState({ school_name: value }) - } - - hasGraduationModule = () => { - const { course_modules } = this.props; - const result = course_modules && course_modules.filter( item => { - return item.type == 'graduation' - }) - return result && result.length > 0 - } - - render(){ - const { candidates, checkBoxValues, loading, hasMore, name, school_name, school_names - , graduationGroup, graduation_groups, courseGroup, course_groups } = this.state - const { moduleName } = this.props - - return( - - - -
    - 姓名: - {this.setState({name: e.target.value})}} - style={{ width: '200px', marginRight: '18px' }}> - - 单位: - - {/* */} - this.fetchMemberList(1)} - style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} - >搜索 -
    - {/* graduation_groups && !!graduation_groups.length */} - - -

    - - - - - - -

    - { loading || candidates.length ?
    - {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} -
    - - - - { candidates && candidates.map( candidate => { - return ( -

    - - - {/* "color":"#4c4c4c" */} - 12 }> - - - - - 12 }> - - - - - - -

    - ) - }) } -
    - {loading && hasMore && ( -
    - -
    - )} - -
    -
    -
    : } -
    - { this.hasGraduationModule() &&
    - 添加至答辩组: - -
    } - - { course_groups && !!course_groups.length &&
    - 管理权限: - -
    } -
    -
    - ) - } -} -export default AddTeacherModal; +import React, { Component } from "react"; +import { Modal, Checkbox, Input, Spin, Select, Divider, Icon } from "antd"; +import axios from 'axios' +import ModalWrapper from "../../common/ModalWrapper" +import InfiniteScroll from 'react-infinite-scroller'; +import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common' +import { ConditionToolTip, ActionBtn } from 'educoder' +import NoneData from '../../coursesPublic/NoneData' +import AddGraduationGroupModal from './AddGraduationGroupModal' +import SchoolSelect from '../../coursesPublic/form/SchoolSelect' + +const Option = Select.Option; +const pageCount = 15; +let timeout, currentValue +class AddTeacherModal extends Component{ + constructor(props){ + super(props); + this.state={ + school_names: [], + checkBoxValues: [], + candidates: [], + hasMore: true, + loading: false, + page: 1 + } + } + fetchMemberList = (arg_page) => { + const courseId = this.props.match.params.coursesId + const page = arg_page || this.state.page; + const { name, school_name } = this.state + let url = `/courses/${courseId}/search_teacher_candidate.json` + this.setState({ loading: true }) + axios.post(url, { + page: page, + limit: pageCount, + school_name: school_name || '', + name: name || '' + }) + .then((response) => { + if (!response.data.candidates || response.data.candidates.length == 0) { + this.setState({ + candidates: page == 1 ? response.data.candidates : this.state.candidates, + page, + loading: false, + hasMore: false, + }) + } else { + this.setState({ + candidates: page == 1 ? response.data.candidates : this.state.candidates.concat(response.data.candidates), + page, + loading: false, + hasMore: response.data.candidates.length == pageCount + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } + componentDidMount() { + + + } + onAddGraduationGroupOk = () => { + this.fetchOptions() + } + fetchOptions = () => { + // add_teacher_popup + const courseId = this.props.match.params.coursesId + + let url = `/courses/${courseId}/add_teacher_popup.json` + + axios.get(url, { + }) + .then((response) => { + + if (response.data.school_name) { + this.setState({ + school_name: response.data.school_name + }, () => this.fetchMemberList()) + } else { + this.fetchMemberList() + + } + if (response.data.graduation_groups) { + this.setState({ + graduation_groups: response.data.graduation_groups + }) + } + if (response.data.course_groups) { + this.setState({ + course_groups: response.data.course_groups + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } + setVisible = (visible) => { + if (visible) { + this.fetchOptions() + } + this.refs.modalWrapper.setVisible(visible) + if (visible == false) { + this.setState({ + checkBoxValues: [] + }) + } + } + + onSendOk = () => { + const courseId = this.props.match.params.coursesId + const url = `/courses/${courseId}/add_teacher.json` + if (this.state.checkBoxValues.length == 0) { + this.props.showNotification('请先在下面列表中选择要添加教师的成员') + return + } + const params = { + "user_list": this.state.checkBoxValues.map (item => { return { 'user_id': item }}) , + // "graduation_group_id": "2", + // "course_group_id": "820", + "role": this.props.isTeacher ? ROLE_TEACHER_NUM : ROLE_ASSISTANT_NUM + } + const { graduationGroup, courseGroup } = this.state + if (graduationGroup) { + params.graduation_group_id = graduationGroup + } + if (courseGroup) { + params.course_group_id = courseGroup + } + axios.post(url, params) + .then((response) => { + if (response.data.status == 0) { + this.setVisible(false) + this.props.showNotification('添加成功') + this.props.addTeacherSuccess && this.props.addTeacherSuccess(params) + } + }) + .catch(function (error) { + console.log(error); + }); + } + + onOk = () => { + this.onSendOk() + } + + onCheckBoxChange = (checkBoxValues) => { + this.setState({ + checkBoxValues: checkBoxValues + }) + } + + handleInfiniteOnLoad = () => { + this.fetchMemberList(this.state.page + 1) + } + + onSearch = () => { + this.fetchMemberList(1) + } + handleGradationGroupChange = (value) => { + this.setState({ + graduationGroup: value + }) + } + handleCourseGroupChange = (value) => { + this.setState({ + courseGroup: value + }) + } + onOrgNameChange = (value) => { + // console.log('school_name: ', value) + this.setState({ school_name: value }) + } + + hasGraduationModule = () => { + const { course_modules } = this.props; + const result = course_modules && course_modules.filter( item => { + return item.type == 'graduation' + }) + return result && result.length > 0 + } + + render(){ + const { candidates, checkBoxValues, loading, hasMore, name, school_name, school_names + , graduationGroup, graduation_groups, courseGroup, course_groups } = this.state + const { moduleName } = this.props + + return( + + + +
    + 姓名: + {this.setState({name: e.target.value})}} + style={{ width: '200px', marginRight: '18px' }}> + + 单位: + + {/* */} + this.fetchMemberList(1)} + style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} + >搜索 +
    + {/* graduation_groups && !!graduation_groups.length */} + + +

    + + + + + + +

    + { loading || candidates.length ?
    + {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} +
    + + + + { candidates && candidates.map( candidate => { + return ( +

    + + + {/* "color":"#4c4c4c" */} + 12 }> + + + + + 12 }> + + + + + + +

    + ) + }) } +
    + {loading && hasMore && ( +
    + +
    + )} + +
    +
    +
    : } +
    + { this.hasGraduationModule() &&
    + 添加至答辩组: + +
    } + + { course_groups && !!course_groups.length &&
    + 管理权限: + +
    } +
    +
    + ) + } +} +export default AddTeacherModal; diff --git a/public/react/src/modules/courses/members/modal/CreateGroupByImportModal.js b/public/react/src/modules/courses/members/modal/CreateGroupByImportModal.js index 54c0df912..d5e77da9d 100644 --- a/public/react/src/modules/courses/members/modal/CreateGroupByImportModal.js +++ b/public/react/src/modules/courses/members/modal/CreateGroupByImportModal.js @@ -13,12 +13,15 @@ class CreateGroupByImportModal extends Component{ constructor(props){ super(props); this.state={ - errorTip:undefined } } - + fetchMemberList = (arg_page) => { + } + componentDidMount() { + + + } onSendOk = () => { - const courseId = this.props.match.params.coursesId let url = `/courses/${courseId}/create_group_by_importing_file.json` @@ -109,7 +112,7 @@ class CreateGroupByImportModal extends Component{ render(){ const { candidates, checkBoxValues, loading, hasMore, name, school_name, school_names - , graduationGroup, graduation_groups, courseGroup, course_groups , fileList , errorTip } = this.state + , graduationGroup, graduation_groups, courseGroup, course_groups , fileList } = this.state const { moduleName } = this.props const props = { @@ -129,18 +132,15 @@ class CreateGroupByImportModal extends Component{ onOk={this.onOk} className="createGroupByImport" > - -

    - -

    -

    点击或拖拽文件到这里上传

    -

    - 单个文件最大150MB -

    -
    -

    - {errorTip} -

    + +

    + +

    +

    点击或拖拽文件到这里上传

    +

    + 单个文件最大150MB +

    +
    ) } diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js index 07be2196c..a01c142a4 100644 --- a/public/react/src/modules/courses/poll/Poll.js +++ b/public/react/src/modules/courses/poll/Poll.js @@ -288,6 +288,7 @@ class Poll extends Component{ }) let{type,StudentList_value}=this.state this.InitList(type,StudentList_value,1); + this.props.updataleftNavfun(); } }).catch((error)=>{ console.log(error); @@ -595,7 +596,8 @@ class Poll extends Component{ {...this.state} courseType={course_types} item={item} - key={key} + index={key} + onItemClick={this.onItemClick} checkBox={ this.onItemClick(item)}>} > ) diff --git a/public/react/src/modules/courses/poll/PollListItem.js b/public/react/src/modules/courses/poll/PollListItem.js index 50c471e76..6f081b952 100644 --- a/public/react/src/modules/courses/poll/PollListItem.js +++ b/public/react/src/modules/courses/poll/PollListItem.js @@ -16,7 +16,7 @@ class PollListItem extends Component{ super(props); } render(){ - let{item,checkBox,courseType}=this.props; + let{item,checkBox,courseType,index}=this.props; let {coursesId}=this.props.match.params; const IsAdmin =this.props.isAdmin(); @@ -28,10 +28,10 @@ class PollListItem extends Component{ let canNotLink = !isAdminOrStudent && item.lock_status == 0 return( -
    +
    window.$(`.pollitem${index} input`).click() }> { IsAdmin && - + {checkBox} } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js index 38ab63a4f..942c06800 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js @@ -124,13 +124,19 @@ class ShixunhomeWorkItem extends Component{ }) } - editname = (name,id) => { + // 实训详情,阻止冒泡 + stopPro = (event) => { + event.stopPropagation() + } + + editname = (name,id,event) => { this.setState({ ModalsRenametype:true, NavmodalValue:name, Navmodalname:"重命名", url:`/homework_commons/${id}/alter_name.json` }) + event.stopPropagation() } cannerNavmoda=()=>{ this.setState({ @@ -157,88 +163,74 @@ class ShixunhomeWorkItem extends Component{ const { checkBox, discussMessage, - taskid, + taskid,index } = this.props; - // - - // allow_late: true //是否开启补交 - - // homework_id: 9250 - - // shixun_identifier: "25ykhpvl" - - // - // console.log("this.props.isAdmin"); - - return( -
    - {this.state.ModalsRenametype===true? - this.cannerNavmoda()} - /> - :""} - - - - {visible===true?:""} - - - -
    -

    实训已经更新了,正在为您重置!

    -
    - -
    - -
    -

    本实训的开启时间:{shixunsmessage}
    开启时间之前不能挑战 -

    -
    -
    - {/*取消*/} - 知道啦 -
    - {/*

    */} - {/*知道了*/} - {/*

    */} -
    - + + { + this.state.ModalsRenametype===true? + this.cannerNavmoda()} + /> + :""} + + {visible===true?:""} + +
    +

    实训已经更新了,正在为您重置!

    +
    + +
    + + +
    +

    本实训的开启时间:{shixunsmessage}
    开启时间之前不能挑战 +

    +
    +
    + {/*取消*/} + 知道啦 +
    + {/*

    */} + {/*知道了*/} + {/*

    */} +
    +
    window.$(`.shixunitem${index} input`).click() } > - {this.props.isAdmin?checkBox:""} + {this.props.isAdmin? + {checkBox} + : + "" + }
    - {this.props.isAdmin?
    - 实训详情 - {this.props.isAdminOrCreator()?this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名:""} + {this.props.isAdmin?
    this.stopPro(event)} className={this.props.isAdminOrCreator()?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}> + 实训详情 + {this.props.isAdminOrCreator()?this.editname(discussMessage.name,discussMessage.homework_id,event)} className={"btn colorblue ml20 font-16"}>重命名:""} {/* 设置*/} 设置
    :""} @@ -408,6 +404,7 @@ class ShixunhomeWorkItem extends Component{
    + ) } } diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index 74d142129..635c026b6 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -587,6 +587,8 @@ class ShixunHomework extends Component{ let {Coursename,page}=this.state; this.setState({ order: e.key, + checkBoxValues:[], + checkedtype:false, isSpin:true }); let newkey=e.key; @@ -655,6 +657,7 @@ class ShixunHomework extends Component{ } + savedelete=()=>{ let {Coursename,page,order,checkBoxValues,datas}=this.state; let category_id=this.props.match.params.category_id; @@ -1019,8 +1022,8 @@ class ShixunHomework extends Component{

    - {datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"} - {/* 实训作业*/} + {/*{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}*/} + 实训作业

  • {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? @@ -1035,7 +1038,7 @@ class ShixunHomework extends Component{

    -

    +

    共 {datas&&datas.all_count}个实训作业 已发布:{datas&&datas.published_count}个 @@ -1062,7 +1065,9 @@ class ShixunHomework extends Component{
    - {this.props.isAdmin()===true?
    + {this.props.isAdmin()===true? + datas===undefined?'' :datas.task_count===0?"": +
    已选 {checkBoxValues&&checkBoxValues.length} 个 @@ -1152,7 +1157,7 @@ class ShixunHomework extends Component{ // console.log("++++++++++++++++++++++++++++++++++++++++++") // console.log(JSON.stringify(this.props)) return ( -
    +
    :""} match={this.props.match} + index={index} coursedata={this.props.coursedata} coursupdata={()=>this.homeworkupdatalist(Coursename,page,order)} course_identity={datas.course_identity} @@ -1203,18 +1209,10 @@ class ShixunHomework extends Component{
    + { + datas===undefined?'' :datas.task_count===0? :"" + } -
    -
    -

    暂时还没有相关数据哦!

    -
    @@ -1223,3 +1221,14 @@ class ShixunHomework extends Component{ } } export default ShixunHomework; +// {/*
    */} +// {/*
    */} +// {/**/} +// {/*

    暂时还没有相关数据哦!

    */} +// {/*
    */} \ No newline at end of file diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 3214fe5d5..f50ec9d21 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -224,12 +224,15 @@ class MainContentContainer extends Component { } componentDidUpdate(prevProps, prevState, snapshot) { - const { game } = this.props + const { game, challenge } = this.props if (game && prevProps.game && prevProps.game.identifier !== game.identifier) { // 切换关卡时,停止轮训 this.oldGameIdentifier = prevProps.game.identifier; + this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) + } else if (challenge && (challenge.pathIndex || prevProps.challenge.pathIndex) && challenge.pathIndex != prevProps.challenge.pathIndex) { + this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) } } @@ -386,8 +389,8 @@ class MainContentContainer extends Component { } - doFileUpdateRequestOnCodeMirrorBlur = () => { - var fileUpdatePromise = this.doFileUpdateRequest(true) + doFileUpdateRequestOnCodeMirrorBlur = (props) => { + var fileUpdatePromise = this.doFileUpdateRequest(true, undefined, props) if (fileUpdatePromise) { fileUpdatePromise.then((resData) => { if (resData.status === -1) { // 保存文件出现异常 @@ -496,7 +499,8 @@ class MainContentContainer extends Component { } // forTest true 是评测时触发的file_update - doFileUpdateRequest(checkIfCodeChanged, forTest) { + doFileUpdateRequest(checkIfCodeChanged, forTest, props) { + const _props = props || this.props; const { codeStatus } = this.state; if (!forTest && codeStatus !== UPDATED) { // 已修改状态才能保存 return; @@ -521,7 +525,7 @@ class MainContentContainer extends Component { }) return null; } - const { challenge, output_sets, onRunCodeTestFinish, myshixun } = this.props + const { challenge, output_sets, onRunCodeTestFinish, myshixun } = _props // var url = `${locationPath}/file_update?path=${encodeURIComponent(challenge.path)}` var url = `/myshixuns/${myshixun.identifier}/update_file.json` diff --git a/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js b/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js index 50072c627..d19aa03ec 100644 --- a/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js +++ b/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js @@ -37,6 +37,8 @@ export function ImageLayerOfCommentHOC(options = {}) { } // jQuery._data( $('.newMain')[0], "events" ) componentDidMount() { + this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef']) + // commentsDelegateParent #game_left_contents #tab_con_4 setTimeout(() => { $(options.parentSelector || ".commentsDelegateParent") @@ -60,7 +62,7 @@ export function ImageLayerOfCommentHOC(options = {}) { - + ) diff --git a/public/react/src/modules/paths/PathDetail/addCollaborators.js b/public/react/src/modules/paths/PathDetail/addCollaborators.js index 0b99fd467..056e69b31 100644 --- a/public/react/src/modules/paths/PathDetail/addCollaborators.js +++ b/public/react/src/modules/paths/PathDetail/addCollaborators.js @@ -14,7 +14,8 @@ class addCollaborators extends Component{ search:'', partnerListid:[], checkAll: false, - optionss:[] + optionss:[], + useristrue:false } } addBox=()=>{ @@ -70,6 +71,13 @@ class addCollaborators extends Component{ let {partnerListid} =this.state; let id=this.props.match.params.pathId; let url="/paths/"+id+"/add_subject_members.json" + + if(partnerListid.length===0){ + this.setState({ + useristrue:true + }) + return + } axios.post(url,{ user_ids:partnerListid }).then((response) => { @@ -87,9 +95,17 @@ class addCollaborators extends Component{ } addCollaboratorsid=(id)=>{ - this.setState({ - partnerListid:id - }) + if(id.length===0){ + this.setState({ + partnerListid:id, + }) + }else{ + this.setState({ + partnerListid:id, + useristrue:false + }) + } + } onCheckAllChange = (e) => { @@ -145,7 +161,7 @@ class addCollaborators extends Component{ } render(){ - let {addPartner,search,partnerList,optionss,checkAll,partnerListid} = this.state; + let {addPartner,search,partnerList,optionss,checkAll,partnerListid,useristrue} = this.state; return( this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_add_member===true? @@ -199,6 +215,7 @@ class addCollaborators extends Component{ } + {useristrue===true?请先选择用户:""}
    取消 确定 diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js index 1662635ba..ea99b740d 100644 --- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js +++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js @@ -45,7 +45,8 @@ class Collaborators extends Component { collaboratorListsumtype:true, user_name:undefined, school_name:undefined, - spinnings:false + spinnings:false, + useristrue:false } } componentDidMount() { @@ -217,10 +218,20 @@ class Collaborators extends Component { } else { alltype = false } - this.setState({ - Searchadmin: newlist, - allChangechecked: alltype - }) + + if(newlist.length===0){ + this.setState({ + Searchadmin: newlist, + allChangechecked: alltype, + }) + }else{ + this.setState({ + Searchadmin: newlist, + allChangechecked: alltype, + useristrue:false + }) + } + } allChange = (e) => { @@ -260,6 +271,13 @@ class Collaborators extends Component { } } } + + if(user_ids.length===0){ + this.setState({ + useristrue:true + }) + return + } let url = "/shixuns/" + id + "/shixun_members_added.json"; axios.post(url, { user_ids: user_ids @@ -405,7 +423,8 @@ class Collaborators extends Component { collaboratorListsum, collaboratorListsumtype, user_name, - school_name + school_name, + useristrue } = this.state; let {loadingContent} = this.props; const radioStyle = { @@ -547,7 +566,7 @@ class Collaborators extends Component {
    - + {useristrue===true?请先选择用户:""}
    this.CollaboratorsshowModal("cooperation")}>取消 diff --git a/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css b/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css index f3c4a30da..4470aaec1 100644 --- a/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css +++ b/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css @@ -1,45 +1,45 @@ -.ml350 { - margin-left: 40%; -} - -.ml32 { - margin-left: 32%; -} - -.square-Item{ - /*min-height: 324px;*/ -} -.square-img{ - min-height: 210px; -} -.task-hide{ - margin-bottom: 0em; -} -.backFAFAFA{ - background:#FAFAFA; -} - -.demo { - width: 500px; - background-color: #0dcecb; - text-align: center; - padding:50px; -} -.next-loading { - margin-bottom: 5px; - width:100%; -} - -.next-rating-overlay .next-icon{ - color: #FFA800!important; -} - -.custom-pagination { - display: inline-block; - margin-left: 10px; -} - -.ml425{ - margin-left:42.5%; - margin-top:20px; +.ml350 { + margin-left: 40%; +} + +.ml32 { + margin-left: 32%; +} + +.square-Item{ + /*min-height: 324px;*/ +} +.square-img{ + min-height: 210px; +} +.task-hide{ + margin-bottom: 0em; +} +.backFAFAFA{ + background:#FAFAFA; +} + +.demo { + width: 500px; + background-color: #0dcecb; + text-align: center; + padding:50px; +} +.next-loading { + margin-bottom: 5px; + width:100%; +} + +.next-rating-overlay .next-icon{ + color: #FFA800!important; +} + +.custom-pagination { + display: inline-block; + margin-left: 10px; +} + +.ml425{ + margin-left:42.5%; + margin-top:20px; } \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/InfosBank.js b/public/react/src/modules/user/usersInfo/InfosBank.js index 8adc7ba50..2abc15220 100644 --- a/public/react/src/modules/user/usersInfo/InfosBank.js +++ b/public/react/src/modules/user/usersInfo/InfosBank.js @@ -1,249 +1,249 @@ -import React, { Component } from 'react'; -import {Pagination,Spin,Checkbox,Modal} from 'antd'; -import moment from 'moment'; -import axios from 'axios'; -import NoneData from '../../courses/coursesPublic/NoneData' -import {getImageUrl} from 'educoder'; -import "./usersInfo.css" -import Modals from '../../modals/Modals' - -const dateFormat ="YYYY-MM-DD HH:mm" -class InfosBank extends Component{ - constructor(props){ - super(props); - this.state={ - category:"common", - type:"publicly", - page:1, - per_page:16, - sort_by:"updated_at", - CoursesId:undefined, - - totalCount:undefined, - data:undefined, - isSpin:false, - - dialogOpen:false, - modalsTopval:undefined, - modalsBottomval:undefined, - modalSave:undefined - } - } - - componentDidMount=()=>{ - this.setState({ - isSpin:true - }) - let{category,type,page,sort_by,CoursesId}=this.state; - this.getCourses(category,type,page,sort_by,CoursesId); - } - - getCourses=(category,type,page,sort_by,CoursesId)=>{ - let url=`/users/${this.props.match.params.username}/question_banks.json`; - axios.get((url),{params:{ - category, - type, - page, - sort_by, - per_page:category && page ==1?17:16, - course_list_id:CoursesId - }}).then((result)=>{ - if(result){ - this.setState({ - totalCount:result.data.count, - data:result.data, - isSpin:false - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - //切换种类 - changeCategory=(cate)=>{ - this.setState({ - category:cate, - page:1, - isSpin:true - }) - let{type,sort_by,CoursesId}=this.state; - this.getCourses(cate,type,1,sort_by,CoursesId); - } - //切换状态 - changeType=(type)=>{ - this.setState({ - type:type, - page:1, - isSpin:true - }) - let{category,sort_by,CoursesId}=this.state; - this.getCourses(category,type,1,sort_by,CoursesId); - } - //切换页数 - changePage=(page)=>{ - this.setState({ - page, - isSpin:true - }) - let{category,type,sort_by,CoursesId}=this.state; - this.getCourses(category,type,page,sort_by,CoursesId); - } - - // 进入课堂 - turnToCourses=(url)=>{ - this.props.history.push(url); - } - - // 切换排序方式 - changeOrder= (sort)=>{ - this.setState({ - sort_by:sort, - isSpin:true - }) - let{category,type,page,CoursesId}=this.state; - this.getCourses(category,type,page,sort,CoursesId); - } - - changeCourseListId =(CoursesId)=>{ - this.setState({ - CoursesId, - isSpin:true - }) - let{category,type,sort,page}=this.state; - this.getCourses(category,type,page,sort,CoursesId); - } - - //设为公开/删除 - setPublic=(index)=>{ - this.setState({ - dialogOpen:true, - modalsTopval:index==1?"您确定要公开吗?":"确定要删除该题吗?", - modalsBottomval:index==1?"公开后不能重设为私有":"", - modalSave:()=>this.sureOperation(index) - }) - } - // 确定--设为公开/删除 - sureOperation=()=>{ - - } - - //弹框隐藏 - handleDialogClose=()=>{ - this.setState({ - dialogOpen:false - }) - } - - render(){ - let{ - category, - type, - page, - data, - totalCount, - sort_by, - isSpin, - CoursesId, - dialogOpen, - modalsTopval, - modalsBottomval,modalSave - } = this.state; - let isStudent = this.props.isStudent(); - let is_current=this.props.is_current; - return( -
    - - -
    -
  • this.changeType("publicly")}>{is_current ? "我":"TA"}的题库
  • -
  • this.changeType("personal")}>公共题库
  • -
    -
    - -
    -
      -
    • this.changeCourseListId()}> - 全部 -
    • - { - data && data.course_list && data.course_list.map((item,key)=>{ - return( -
    • this.changeCourseListId(`${item.id}`)}> - {item.name} -
    • - ) - }) - } -
    -
    -
    -

    - 共参与{totalCount}个题库 -

    -
  • - {sort_by=="updated_at"?"时间最新":sort_by=="name"?"作业名称":"贡献者"} -
      -
    • this.changeOrder("updated_at")}>时间最新
    • -
    • this.changeOrder("name")}>作业名称
    • -
    • this.changeOrder("contributor")}>贡献者
    • -
    -
  • -
    -

    -
    - { - !data || data.question_banks.length==0 && - } - { - data && data.question_banks && data.question_banks.map((item,key)=>{ - return( -
    -
    - -
    -
    -

    - {item.name} - 发送 - { - item.is_public ==false ? - this.setPublic(1)} className="bank_public color-blue_4C fr mr60">设为公开:"" - } -

    -

    - {item.quotes_count}次引用 - {item.solve_count}次答题 - {moment(item.updated_at).format('YYYY-MM-DD HH:mm')} - this.setPublic(2)}>删除 - {item.course_list_name} -

    -
    -
    - ) - }) - } -
    - { - totalCount > 15 && -
    - -
    - } - -
    - ) - } -} +import React, { Component } from 'react'; +import {Pagination,Spin,Checkbox,Modal} from 'antd'; +import moment from 'moment'; +import axios from 'axios'; +import NoneData from '../../courses/coursesPublic/NoneData' +import {getImageUrl} from 'educoder'; +import "./usersInfo.css" +import Modals from '../../modals/Modals' + +const dateFormat ="YYYY-MM-DD HH:mm" +class InfosBank extends Component{ + constructor(props){ + super(props); + this.state={ + category:"common", + type:"publicly", + page:1, + per_page:16, + sort_by:"updated_at", + CoursesId:undefined, + + totalCount:undefined, + data:undefined, + isSpin:false, + + dialogOpen:false, + modalsTopval:undefined, + modalsBottomval:undefined, + modalSave:undefined + } + } + + componentDidMount=()=>{ + this.setState({ + isSpin:true + }) + let{category,type,page,sort_by,CoursesId}=this.state; + this.getCourses(category,type,page,sort_by,CoursesId); + } + + getCourses=(category,type,page,sort_by,CoursesId)=>{ + let url=`/users/${this.props.match.params.username}/question_banks.json`; + axios.get((url),{params:{ + category, + type, + page, + sort_by, + per_page:category && page ==1?17:16, + course_list_id:CoursesId + }}).then((result)=>{ + if(result){ + this.setState({ + totalCount:result.data.count, + data:result.data, + isSpin:false + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + //切换种类 + changeCategory=(cate)=>{ + this.setState({ + category:cate, + page:1, + isSpin:true + }) + let{type,sort_by,CoursesId}=this.state; + this.getCourses(cate,type,1,sort_by,CoursesId); + } + //切换状态 + changeType=(type)=>{ + this.setState({ + type:type, + page:1, + isSpin:true + }) + let{category,sort_by,CoursesId}=this.state; + this.getCourses(category,type,1,sort_by,CoursesId); + } + //切换页数 + changePage=(page)=>{ + this.setState({ + page, + isSpin:true + }) + let{category,type,sort_by,CoursesId}=this.state; + this.getCourses(category,type,page,sort_by,CoursesId); + } + + // 进入课堂 + turnToCourses=(url)=>{ + this.props.history.push(url); + } + + // 切换排序方式 + changeOrder= (sort)=>{ + this.setState({ + sort_by:sort, + isSpin:true + }) + let{category,type,page,CoursesId}=this.state; + this.getCourses(category,type,page,sort,CoursesId); + } + + changeCourseListId =(CoursesId)=>{ + this.setState({ + CoursesId, + isSpin:true + }) + let{category,type,sort,page}=this.state; + this.getCourses(category,type,page,sort,CoursesId); + } + + //设为公开/删除 + setPublic=(index)=>{ + this.setState({ + dialogOpen:true, + modalsTopval:index==1?"您确定要公开吗?":"确定要删除该题吗?", + modalsBottomval:index==1?"公开后不能重设为私有":"", + modalSave:()=>this.sureOperation(index) + }) + } + // 确定--设为公开/删除 + sureOperation=()=>{ + + } + + //弹框隐藏 + handleDialogClose=()=>{ + this.setState({ + dialogOpen:false + }) + } + + render(){ + let{ + category, + type, + page, + data, + totalCount, + sort_by, + isSpin, + CoursesId, + dialogOpen, + modalsTopval, + modalsBottomval,modalSave + } = this.state; + let isStudent = this.props.isStudent(); + let is_current=this.props.is_current; + return( +
    + + + +
    + +
    +
      +
    • this.changeCourseListId()}> + 全部 +
    • + { + data && data.course_list && data.course_list.map((item,key)=>{ + return( +
    • this.changeCourseListId(`${item.id}`)}> + {item.name} +
    • + ) + }) + } +
    +
    +
    +

    + 共参与{totalCount}个题库 +

    +
  • + {sort_by=="updated_at"?"时间最新":sort_by=="name"?"作业名称":"贡献者"} +
      +
    • this.changeOrder("updated_at")}>时间最新
    • +
    • this.changeOrder("name")}>作业名称
    • +
    • this.changeOrder("contributor")}>贡献者
    • +
    +
  • +
    +

    +
    + { + !data || data.question_banks.length==0 && + } + { + data && data.question_banks && data.question_banks.map((item,key)=>{ + return( +
    +
    + +
    +
    +

    + {item.name} + 发送 + { + item.is_public ==false ? + this.setPublic(1)} className="bank_public color-blue_4C fr mr60">设为公开:"" + } +

    +

    + {item.quotes_count}次引用 + {item.solve_count}次答题 + {moment(item.updated_at).format('YYYY-MM-DD HH:mm')} + this.setPublic(2)}>删除 + {item.course_list_name} +

    +
    +
    + ) + }) + } +
    + { + totalCount > 15 && +
    + +
    + } +
    +
    + ) + } +} export default InfosBank; \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index 92dd4f1d2..08bea57ed 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -1,115 +1,122 @@ -import React, { Component } from 'react'; - -import {Link} from 'react-router-dom'; -import {Tooltip,Menu} from 'antd'; -import {getImageUrl} from 'educoder'; - -import "./usersInfo.css" -import "../../courses/css/members.css" -import "../../courses/css/Courses.css" - -import banner from '../../../images/account/infobanner.png' - -class InfosBanner extends Component{ - constructor(props){ - super(props); - } - render(){ - let { - data , - id, - login, - moduleName, - current_user, - }=this.props; - let is_current=this.props.is_current; - let {username}= this.props.match.params; - let {pathname}=this.props.location; - moduleName=pathname.split("/")[3]; - return( -
    -
    -
    -

    头像

    -
    -

    - {data && data.name} - { - data && is_current == false && data.identity =="学生" ? "" : - - } -

    -

    - - - - - - -

    -
    -
    -
    - {is_current ? "我":"TA"}的经验值 - {data && data.experience} -
    -
    - {is_current ? "我":"TA"}的金币 - {data && data.grade} -
    - { - is_current ? - - { - data && data.attendance_signed ? - 已签到 - : - 签到 - } - - : - - 私信 - - } -
    -
    -
    -
  • - this.setState({moduleName: 'courses'})} - to={`/users/${username}/courses`}>翻转课堂 -
  • -
  • - this.setState({moduleName: 'shixuns'})} - to={`/users/${username}/shixuns`}>实训项目 -
  • -
  • - this.setState({moduleName: 'paths'})} - to={`/users/${username}/paths`}>实践课程 -
  • -
  • - this.setState({moduleName: 'projects'})} - to={`/users/${username}/projects`}>开发项目 -
  • -
  • - this.setState({moduleName: 'package'})} - to={`/users/${username}/package`}>众包 -
  • - {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) - &&
  • - this.setState({moduleName: 'videos'})} - to={`/users/${username}/videos`}>视频 -
  • } -
    -
    -
    - ) - } -} +import React, { Component } from 'react'; + +import {Link} from 'react-router-dom'; +import {Tooltip,Menu} from 'antd'; +import {getImageUrl} from 'educoder'; + +import "./usersInfo.css" +import "../../courses/css/members.css" +import "../../courses/css/Courses.css" + +import { LinkAfterLogin } from 'educoder' + +class InfosBanner extends Component{ + constructor(props){ + super(props); + } + render(){ + let { + data , + id, + login, + moduleName, + current_user, + }=this.props; + let is_current=this.props.is_current; + let {username}= this.props.match.params; + let {pathname}=this.props.location; + moduleName=pathname.split("/")[3]; + return( +
    +
    +
    +

    头像

    +
    +

    + {data && data.name} + { + data && is_current == false && data.identity =="学生" ? "" : + + } +

    +

    + + + + + + +

    +
    +
    +
    + {is_current ? "我":"TA"}的经验值 + {data && data.experience} +
    +
    + {is_current ? "我":"TA"}的金币 + {data && data.grade} +
    + { + is_current ? + + { + data && data.attendance_signed ? + 已签到 + : + 签到 + } + + : + + + 私信 + + + } +
    +
    +
    +
  • + this.setState({moduleName: 'courses'})} + to={`/users/${username}/courses`}>翻转课堂 +
  • +
  • + this.setState({moduleName: 'shixuns'})} + to={`/users/${username}/shixuns`}>开发社区 +
  • +
  • + this.setState({moduleName: 'paths'})} + to={`/users/${username}/paths`}>实践课程 +
  • +
  • + this.setState({moduleName: 'projects'})} + to={`/users/${username}/projects`}>项目 +
  • +
  • + this.setState({moduleName: 'package'})} + to={`/users/${username}/package`}>众包 +
  • + {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) + &&
  • + this.setState({moduleName: 'videos'})} + to={`/users/${username}/videos`}>视频 +
  • } +
    +
    +
    + ) + } +} export default InfosBanner; \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index c4c1c77e0..bc401d4d7 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -130,7 +130,7 @@ class InfosCourse extends Component{ this.props.current_user && this.props.current_user.user_identity != "学生" ? : "" } { - (!data || data.courses.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.courses.length==0)) && category && } { data && data.courses && data.courses.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index cb02ed604..554d8380f 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -152,7 +152,7 @@ class InfosPath extends Component{ this.props.current_user && this.props.current_user.user_identity != "学生" ? :"" } { - (!data || data.subjects.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.subjects.length==0)) && category && } { data && data.subjects && data.subjects.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index 2018f7b73..5aea5117b 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -125,7 +125,7 @@ class InfosProject extends Component{ :"" } { - (!data || data.projects.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.projects.length==0)) && category && } { data && data.projects && data.projects.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index 94ef3c29b..4799626a9 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -1,14 +1,11 @@ import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip,Menu,Pagination,Spin} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; + +import { Pagination , Spin } from 'antd'; + import NoneData from '../../courses/coursesPublic/NoneData' import axios from 'axios'; -import {getImageUrl,setImagesUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import { setImagesUrl } from 'educoder'; + import "./usersInfo.css" import Create from './publicCreatNew' @@ -115,7 +112,7 @@ class InfosShixun extends Component{ totalCount, isSpin } = this.state; - let isStudent = this.props.isStudent(); + let is_current=this.props.is_current; return(
    @@ -157,20 +154,18 @@ class InfosShixun extends Component{
    { - page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? + page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? :"" } { - (!data || data.shixuns.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + (!data || (data && data.shixuns.length==0)) && category && } { data && data.shixuns && data.shixuns.map((item,key)=>{ return(
    this.turnToCourses(`/shixuns/${item.identifier}/challenges`)}> { - item.tag &&
    {item.tag} - {/**/} -
    + item.tag &&
    {item.tag}
    } diff --git a/public/react/src/modules/user/usersInfo/banner_out.js b/public/react/src/modules/user/usersInfo/banner_out.js index 7afcf50fb..986a66cd3 100644 --- a/public/react/src/modules/user/usersInfo/banner_out.js +++ b/public/react/src/modules/user/usersInfo/banner_out.js @@ -1,190 +1,190 @@ -import React, { Component } from 'react'; - -import {Link} from 'react-router-dom'; -import {Tooltip,Menu} from 'antd'; -import {getImageUrl} from 'educoder'; - -import "./usersInfo.css" -import "../../courses/css/members.css" -import "../../courses/css/Courses.css" -class banner_out extends Component{ - constructor(props){ - super(props); - } - render(){ - let { - data , - is_current, - is_edit, - sign, - type, - followed, - id, - login, - moduleName, - next_gold - }=this.props; - let {username}= this.props.match.params; - return( -
    -
    -
    -
    -
    -
    - - -
    - {is_current ? "我":"TA"}的金币 - {data && data.grade} -
    -
    - 头像 -
    -
    - {is_current ? "我":"TA"}的粉丝 - {data && data.fan_count} -
    - -
    - {is_current ? "我":"TA"}的关注 - {data && data.follow_count} -
    - - {data && data.name} -
    -
    -
    -
    - { - data && is_current == false && data.identity =="学生" ? "" : {data && data.identity} - } - - - - - - - - - - - - - - - - - - - - - {/* */} - { - data && data.college_identifier && - - - - - - } -
    -
    -
    -

    - { - is_edit && is_current ? - - : - is_current ? - {sign || "这家伙很懒,什么都没留下~"} - : - {sign || "这家伙很懒,什么都没留下~"} - } -

    - { - is_current ? -
    - { - data && data.attendance_signed ? - - 已签到 -

    明日签到 +{next_gold} 金币

    -
    - : - 签到 - // 试用申请 - } -
    - : - - } -
    -
    -
    -
  • - this.setState({moduleName: 'courses'})} - to={`/users/${username}/courses`}>课堂 -
  • -
  • - this.setState({moduleName: 'shixuns'})} - to={`/users/${username}/shixuns`}>实训 -
  • -
  • - this.setState({moduleName: 'paths'})} - to={`/users/${username}/paths`}>实践课程 -
  • -
  • - this.setState({moduleName: 'projects'})} - to={`/users/${username}/projects`}>开发项目 -
  • - -
  • - this.setState({moduleName: 'package'})} - to={`/users/${username}/package`}>众包 -
  • - - {/*{ data && data.identity!="学生" &&
  • 题库
  • }*/} - -
    -
    -
    -
    -
    - ) - } -} +import React, { Component } from 'react'; + +import {Link} from 'react-router-dom'; +import {Tooltip,Menu} from 'antd'; +import {getImageUrl} from 'educoder'; + +import "./usersInfo.css" +import "../../courses/css/members.css" +import "../../courses/css/Courses.css" +class banner_out extends Component{ + constructor(props){ + super(props); + } + render(){ + let { + data , + is_current, + is_edit, + sign, + type, + followed, + id, + login, + moduleName, + next_gold + }=this.props; + let {username}= this.props.match.params; + return( +
    +
    +
    +
    +
    +
    +
    + {is_current ? "我":"TA"}的经验值 + {data && data.experience} +
    + +
    + {is_current ? "我":"TA"}的金币 + {data && data.grade} +
    +
    + 头像 +
    +
    + {is_current ? "我":"TA"}的粉丝 + {data && data.fan_count} +
    + +
    + {is_current ? "我":"TA"}的关注 + {data && data.follow_count} +
    + + {data && data.name} +
    +
    +
    +
    + { + data && is_current == false && data.identity =="学生" ? "" : {data && data.identity} + } + + + + + + + + + + + + + + + + + + + + + {/* */} + { + data && data.college_identifier && + + + + + + } +
    +
    +
    +

    + { + is_edit && is_current ? + + : + is_current ? + {sign || "这家伙很懒,什么都没留下~"} + : + {sign || "这家伙很懒,什么都没留下~"} + } +

    + { + is_current ? +
    + { + data && data.attendance_signed ? + + 已签到 +

    明日签到 +{next_gold} 金币

    +
    + : + 签到 + // 试用申请 + } +
    + : + + } +
    +
    +
    +
  • + this.setState({moduleName: 'courses'})} + to={`/users/${username}/courses`}>课堂 +
  • +
  • + this.setState({moduleName: 'shixuns'})} + to={`/users/${username}/shixuns`}>实训 +
  • +
  • + this.setState({moduleName: 'paths'})} + to={`/users/${username}/paths`}>实践课程 +
  • +
  • + this.setState({moduleName: 'projects'})} + to={`/users/${username}/projects`}>开发项目 +
  • + +
  • + this.setState({moduleName: 'package'})} + to={`/users/${username}/package`}>众包 +
  • + + {/*{ data && data.identity!="学生" &&
  • 题库
  • }*/} + +
    +
    +
    +
    +
    + ) + } +} export default banner_out; \ No newline at end of file diff --git a/public/react/src/public-path.js b/public/react/src/public-path.js new file mode 100644 index 000000000..6cca11a1e --- /dev/null +++ b/public/react/src/public-path.js @@ -0,0 +1,6 @@ +/*global __webpack_public_path__ */ +if (window._enableCDN && window.location.host == 'pre-newweb.educoder.net') { + __webpack_public_path__ = 'http://testali-cdn.educoder.net/react/build/' +} else if (window._enableCDN && window.location.host == 'www.educoder.net') { + __webpack_public_path__ = 'https://ali-newweb.educoder.net/react/build/' +} \ No newline at end of file