|
|
|
@ -134049,6 +134049,17 @@ $(document).on('turbolinks:load', function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$(document).on('turbolinks:load', function() {
|
|
|
|
|
if ($('body.admins-competitions-index-page').length > 0) {
|
|
|
|
|
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
|
|
|
|
|
var $imageElement = $('.competition-image-' + data.source_id);
|
|
|
|
|
$imageElement.attr('src', data.url);
|
|
|
|
|
$imageElement.show();
|
|
|
|
|
$imageElement.next().html('重新上传');
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).on('turbolinks:load', function() {
|
|
|
|
|
if ($('body.admins-cooperatives-index-page').length > 0) {
|
|
|
|
|
// ------------ 保存链接 -----------
|
|
|
|
@ -135645,6 +135656,66 @@ $(document).on('turbolinks:load', function() {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
;
|
|
|
|
|
$(document).on('turbolinks:load', function() {
|
|
|
|
|
if ($('body.admins-user-statistics-index-page').length > 0) {
|
|
|
|
|
var $form = $('.user-statistic-list-form');
|
|
|
|
|
|
|
|
|
|
// ************** 学校选择 *************
|
|
|
|
|
var matcherFunc = function(params, data){
|
|
|
|
|
if ($.trim(params.term) === '') {
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
if (typeof data.text === 'undefined') {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.name && data.name.indexOf(params.term) > -1) {
|
|
|
|
|
var modifiedData = $.extend({}, data, true);
|
|
|
|
|
return modifiedData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return `null` if the term should not be displayed
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var defineSchoolSelect = function (schools) {
|
|
|
|
|
$form.find('.school-select').select2({
|
|
|
|
|
theme: 'bootstrap4',
|
|
|
|
|
placeholder: '选择学校/单位',
|
|
|
|
|
minimumInputLength: 1,
|
|
|
|
|
data: schools,
|
|
|
|
|
templateResult: function (item) {
|
|
|
|
|
if(!item.id || item.id === '') return item.text;
|
|
|
|
|
return item.name;
|
|
|
|
|
},
|
|
|
|
|
templateSelection: function(item){
|
|
|
|
|
if (item.id) {
|
|
|
|
|
$form.find('#school_id').val(item.id);
|
|
|
|
|
}
|
|
|
|
|
return item.name || item.text;
|
|
|
|
|
},
|
|
|
|
|
matcher: matcherFunc
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化学校选择器
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '/api/schools/for_option.json',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
type: 'GET',
|
|
|
|
|
success: function(data) {
|
|
|
|
|
defineSchoolSelect(data.schools);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$form.on('click', '.clear-btn', function(){
|
|
|
|
|
$form.find('select[name="date"]').val('');
|
|
|
|
|
$form.find('.school-select').val('').trigger('change');
|
|
|
|
|
$form.find('input[type="submit"]').trigger('click');
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$(document).on('turbolinks:load', function() {
|
|
|
|
|
if ($('body.admins-users-edit-page, body.admins-users-update-page').length > 0) {
|
|
|
|
|
var initDepartmentSelect = true;
|