|
@@ -1076,12 +1076,15 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
let input_index = $('.add-author-content').children('.add-author-item').length;
|
|
|
// let input_index = author_content_length - 1;
|
|
|
// 克隆作者信息
|
|
|
- let str = `<div class="add-author-item div">
|
|
|
+ let str = `<div class="add-author-item div" style="margin-bottom: 10px;">
|
|
|
<div class="author-content-button-item">
|
|
|
<div class="author-sort-number">
|
|
|
<i class="fa fa-angle-down"></i> <span class="author-sort-number-text">Author ${input_index + 1}</span>
|
|
|
</div>
|
|
|
<div class="author-operate-button">
|
|
|
+ <div class="author-sort-button text-sort-button text-button">
|
|
|
+ <i class="fa fa-sort"></i> Sort
|
|
|
+ </div>
|
|
|
<div class="author-delete-button text-delete-button text-button">
|
|
|
<i class="fa fa-trash"></i> Delete
|
|
|
</div>
|
|
@@ -1138,8 +1141,8 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
<div class="col-xs-12 col-sm-8">
|
|
|
<div class="input-group mb-3">
|
|
|
<div class="radio radio-inline pl-0">
|
|
|
- <label for="c-display-e-mail-yes-${input_index}"><input data-rule="required" id="c-display-e-mail-yes-${input_index}" name="row[author][${input_index}][display_email]" type="radio" value="yes" data-tip="" checked/>Yes</label>
|
|
|
- <label for="c-display-e-mail-no-${input_index}"><input data-rule="required" id="c-display-e-mail-no-${input_index}" name="row[author][${input_index}][display_email]" type="radio" value="no" data-tip="" />No</label>
|
|
|
+ <label><input data-rule="required" id="c-display-e-mail-yes" name="row[author][${input_index}][display_email]" type="radio" value="yes" checked="checked" />Yes</label>
|
|
|
+ <label><input data-rule="required" id="c-display-e-mail-no" name="row[author][${input_index}][display_email]" type="radio" value="no" />No</label>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -1152,8 +1155,8 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
<div class="col-xs-12 col-sm-8">
|
|
|
<div class="input-group mb-3">
|
|
|
<div class="radio radio-inline pl-0">
|
|
|
- <label for="c-correspondsing-author-yes-${input_index}"><input data-rule="required" id="c-correspondsing-author-yes-${input_index}" name="row[author][${input_index}][correspondsing_author]" type="radio" value="yes" checked/>Yes</label>
|
|
|
- <label for="c-correspondsing-author-no-${input_index}"><input data-rule="required" id="c-correspondsing-author-no-${input_index}" name="row[author][${input_index}][correspondsing_author]" type="radio" value="no" />No</label>
|
|
|
+ <label><input data-rule="required" id="c-correspondsing-author-yes" name="row[author][${input_index}][correspondsing_author]" type="radio" value="yes" checked="checked" />Yes</label>
|
|
|
+ <label><input data-rule="required" id="c-correspondsing-author-no" name="row[author][${input_index}][correspondsing_author]" type="radio" value="no" />No</label>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -1194,8 +1197,6 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
|
|
|
// 排序input 的 name 值
|
|
|
function updateInputNames() {
|
|
|
- // drags('add-author-item', 'div-dash', 'dash');
|
|
|
-
|
|
|
// 遍历所有的div元素
|
|
|
$(".add-author-item").each(function (index) {
|
|
|
var email_input = $(this).find('input[id="c-email"]');
|
|
@@ -1203,10 +1204,10 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
var middle_name_input = $(this).find('input[id="c-middle-name"]');
|
|
|
var last_name_input = $(this).find('input[id="c-last-name"]');
|
|
|
var author_affiliation_input = $(this).find('input[id="c-author-affiliation"]');
|
|
|
- var display_email_yes_radio = $(this).find("input[type=radio][id=c-display-e-mail-yes]");
|
|
|
- var display_email_no_radio = $(this).find("input[type=radio][id=c-display-e-mail-no]");
|
|
|
- var correspondsing_author_yes_radio = $(this).find("input[type=radio][id=c-correspondsing-author-yes]");
|
|
|
- var correspondsing_author_no_radio = $(this).find("input[type=radio][id=c-correspondsing-author-no]");
|
|
|
+ var display_email_yes_radio = $(this).find('input[id="c-display-e-mail-yes"]');
|
|
|
+ var display_email_no_radio = $(this).find('input[id="c-display-e-mail-no"]');
|
|
|
+ var correspondsing_author_yes_radio = $(this).find('input[id="c-correspondsing-author-yes"]');
|
|
|
+ var correspondsing_author_no_radio = $(this).find('input[id="c-correspondsing-author-no"]');
|
|
|
var select = $(this).find("select");
|
|
|
|
|
|
email_input.attr('name', "row[author][" + index + "][email]");
|
|
@@ -1217,6 +1218,23 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
|
|
|
display_email_yes_radio.attr('name', "row[author][" + index + "][display_email]");
|
|
|
display_email_no_radio.attr('name', "row[author][" + index + "][display_email]");
|
|
|
+
|
|
|
+ if (display_email_yes_radio[0].checked) {
|
|
|
+ display_email_yes_radio.prop('checked', 'checked');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (display_email_no_radio[0].checked) {
|
|
|
+ display_email_no_radio.prop('checked', 'checked');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (correspondsing_author_yes_radio[0].checked) {
|
|
|
+ correspondsing_author_yes_radio.prop('checked', 'checked');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (correspondsing_author_no_radio[0].checked) {
|
|
|
+ correspondsing_author_no_radio.prop('checked', 'checked');
|
|
|
+ }
|
|
|
+
|
|
|
correspondsing_author_yes_radio.attr('name', "row[author][" + index + "][correspondsing_author]");
|
|
|
correspondsing_author_no_radio.attr('name', "row[author][" + index + "][correspondsing_author]");
|
|
|
|
|
@@ -1224,148 +1242,7 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
|
|
|
select.attr('name', "row[author][" + index + "][author_country]");
|
|
|
});
|
|
|
- };
|
|
|
-
|
|
|
- // 拖拽初始化
|
|
|
- // drags('add-author-item', 'div-dash', 'dash');
|
|
|
-
|
|
|
- // 拖拽方法
|
|
|
- // function drags(name, name2, name3) {
|
|
|
- // var range = {x: 0, y: 0}; // 鼠标元素偏移量
|
|
|
- // var lastPos = {x: 0, y: 0, x1: 0, y1: 0}; // 拖拽对象的四个坐标
|
|
|
- // var tarPos = {x: 0, y: 0, x1: 0, y1: 0}; // 目标元素对象的坐标初始化
|
|
|
- // var thidDiv = null, move = false, choose = false; // 拖拽对象 拖拽状态 选中状态
|
|
|
- // //拖拽对象的索引、高度、的初始化。
|
|
|
- // var thidDivWidth = 0, thidDivHeight = 0, thidDivHalfW = 0, thidDivHalfH = 0, tarFirstX = 0,
|
|
|
- // tarFirstY = 0;
|
|
|
- // var tarDiv = null, tarFirst, tempDiv; // 要插入的目标元素的对象, 临时的虚线对象
|
|
|
- // var initPos = {x: 0, y: 0}; // 记录拖拽元素初始鼠标元素偏移量
|
|
|
- //
|
|
|
- // // 当鼠标按下时
|
|
|
- // $('.' + name).on('mousedown', function (event) {
|
|
|
- // console.log(event.target.tagName);
|
|
|
- // // 判断是否点击了 input 元素
|
|
|
- // if (event.target.tagName === 'INPUT') {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- //
|
|
|
- // if (event.target.tagName === 'SELECT') {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- //
|
|
|
- // if (event.target.tagName === 'LABEL') {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- //
|
|
|
- // // 判断如果鼠标是删除按钮则终止拖拽
|
|
|
- // let class_name = event.target.className.split(" ");
|
|
|
- // if (class_name[0] == 'author-delete-button') {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- //
|
|
|
- // choose = true;
|
|
|
- // // 拖拽对象
|
|
|
- // thidDiv = $(this);
|
|
|
- // // 记录拖拽元素初始位置
|
|
|
- // initPos.x = thidDiv.offset().left;
|
|
|
- // initPos.y = thidDiv.offset().top;
|
|
|
- // // 鼠标元素相对偏移量
|
|
|
- // range.x = event.pageX - thidDiv.offset().left;
|
|
|
- // range.y = event.pageY - thidDiv.offset().top;
|
|
|
- //
|
|
|
- // thidDivWidth = thidDiv.width();
|
|
|
- // thidDivHeight = thidDiv.height();
|
|
|
- // thidDivHalfW = thidDivWidth / 2;
|
|
|
- // thidDivHalfH = thidDivHeight / 2;
|
|
|
- // thidDiv.attr("class", name2);
|
|
|
- // thidDiv.css({
|
|
|
- // left: (event.pageX + range.x) + 'px',
|
|
|
- // top: (event.pageY + range.y) + 'px',
|
|
|
- // });
|
|
|
- //
|
|
|
- // // 创建新元素 插入拖拽元素之前的位置(虚线框)
|
|
|
- // $("<div class='" + name3 + "' style='float: right;'></div>").insertBefore(thidDiv);
|
|
|
- // tempDiv = $("." + name3);
|
|
|
- // });
|
|
|
- //
|
|
|
- // // 当鼠标抬起时
|
|
|
- // $(document).on('mouseup', function (event) {
|
|
|
- // if (!choose) {
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- //
|
|
|
- // if (!move) {
|
|
|
- // thidDiv.attr("class", name);
|
|
|
- // tempDiv.remove(); // 删除新建的虚线div
|
|
|
- // choose = false;
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- //
|
|
|
- // thidDiv.insertBefore(tempDiv); // 拖拽元素插入到 虚线div的位置上
|
|
|
- // thidDiv.attr("class", name); //恢复对象的初始样式
|
|
|
- // tempDiv.remove(); // 删除新建的虚线div
|
|
|
- // move = false;
|
|
|
- // choose = false;
|
|
|
- //
|
|
|
- // // 当鼠标移动时
|
|
|
- // }).on('mousemove', function (event) {
|
|
|
- //
|
|
|
- // if (!choose) return false;
|
|
|
- //
|
|
|
- // move = true;
|
|
|
- // lastPos.x = event.pageX - range.x;
|
|
|
- // lastPos.y = event.pageY - range.y;
|
|
|
- // lastPos.x1 = lastPos.x + thidDivWidth;
|
|
|
- // lastPos.y1 = lastPos.y + thidDivHeight;
|
|
|
- // // 拖拽元素随鼠标移动
|
|
|
- // thidDiv.css({
|
|
|
- // left: lastPos.x - custom_mousemove_x + 'px',
|
|
|
- // top: lastPos.y - custom_mousemove_y + 'px'
|
|
|
- // });
|
|
|
- // // 拖拽元素随鼠标移动 查找插入目标元素
|
|
|
- // var $main = $('.' + name); // 局部变量:按照重新排列过的顺序 再次获取 各个元素的坐标,
|
|
|
- //
|
|
|
- // $main.each(function () {
|
|
|
- //
|
|
|
- // tarDiv = $(this);
|
|
|
- // tarPos.x = tarDiv.offset().left;
|
|
|
- // tarPos.y = tarDiv.offset().top;
|
|
|
- // tarPos.x1 = tarPos.x + tarDiv.width() / 2;
|
|
|
- // tarPos.y1 = tarPos.y + tarDiv.height() / 2;
|
|
|
- // tarFirst = $main.eq(0); // 获得第一个元素
|
|
|
- // tarFirstX = tarFirst.offset().left + thidDivHalfW; // 第一个元素对象的中心纵坐标
|
|
|
- // tarFirstY = tarFirst.offset().top + thidDivHalfH; // 第一个元素对象的中心横坐标
|
|
|
- //
|
|
|
- // // 根据 拖拽对象x坐标 与 目标元素对象x坐标 对比,来显示 虚线div 在节点前、后出现的位置
|
|
|
- // if (lastPos.x > tarPos.x) {
|
|
|
- //
|
|
|
- // // 判断要插入目标元素的 坐标后, 直接插入
|
|
|
- // if (lastPos.x >= tarPos.x - thidDivHalfW && lastPos.x1 >= tarPos.x1 && lastPos.y >= tarPos.y - thidDivHalfH && lastPos.y1 >= tarPos.y1) {
|
|
|
- // tempDiv.insertAfter(tarDiv);
|
|
|
- // }
|
|
|
- //
|
|
|
- // //拖拽对象 移动到第一个位置
|
|
|
- // if (lastPos.x <= tarFirstX && lastPos.y <= tarFirstY) {
|
|
|
- // tempDiv.insertBefore(tarFirst);
|
|
|
- // }
|
|
|
- //
|
|
|
- // } else {
|
|
|
- //
|
|
|
- // //拖拽对象 移动到第一个位置
|
|
|
- // if (lastPos.x <= tarFirstX && lastPos.y <= tarFirstY) {
|
|
|
- // tempDiv.insertBefore(tarFirst);
|
|
|
- // }
|
|
|
- //
|
|
|
- // // 判断要插入目标元素的 坐标后, 直接插入
|
|
|
- // if (lastPos.x >= tarPos.x - thidDivHalfW && lastPos.x1 >= tarPos.x1 && lastPos.y >= tarPos.y - thidDivHalfH && lastPos.y1 >= tarPos.y1) {
|
|
|
- // tempDiv.insertAfter(tarDiv);
|
|
|
- // }
|
|
|
- //
|
|
|
- // }
|
|
|
- //
|
|
|
- // });
|
|
|
- // });
|
|
|
- // }
|
|
|
+ }
|
|
|
|
|
|
$.fn.serializeObject = function () {
|
|
|
var obj = {};
|
|
@@ -1409,28 +1286,28 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
// 单选框选择显示对应input
|
|
|
$(document).on('click', '.radio-inline', function () {
|
|
|
let copyright_files_value = $("input[name='row[is_copyright]']:checked").val();
|
|
|
- if (copyright_files_value == 'normal') {
|
|
|
+ if (copyright_files_value === 'normal') {
|
|
|
$('.copyright_files').show();
|
|
|
} else {
|
|
|
$('.copyright_files').hide();
|
|
|
}
|
|
|
|
|
|
let is_funding_value = $("input[name='row[is_funding]']:checked").val();
|
|
|
- if (is_funding_value == 'normal') {
|
|
|
+ if (is_funding_value === 'normal') {
|
|
|
$('.funding_content').show();
|
|
|
} else {
|
|
|
$('.funding_content').hide();
|
|
|
}
|
|
|
|
|
|
let is_interest_value = $("input[name='row[is_interest]']:checked").val();
|
|
|
- if (is_interest_value == 'normal') {
|
|
|
+ if (is_interest_value === 'normal') {
|
|
|
$('.interest_content').show();
|
|
|
} else {
|
|
|
$('.interest_content').hide();
|
|
|
}
|
|
|
|
|
|
let is_become_review = $("input[name='row[is_become_review]']:checked").val();
|
|
|
- if (is_become_review == 'normal') {
|
|
|
+ if (is_become_review === 'normal') {
|
|
|
$('.field_content').show();
|
|
|
} else {
|
|
|
$('.field_content').hide();
|
|
@@ -1443,44 +1320,89 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
content.style.height = content.offsetHeight === 520 ? 42 + 'px' : 520 + 'px';
|
|
|
|
|
|
// 改为图片向上
|
|
|
- if (content.style.height == '42px') {
|
|
|
+ if (content.style.height === '42px') {
|
|
|
$(this).children('.author-sort-number').children('.fa').attr('class', 'fa fa-angle-up');
|
|
|
+
|
|
|
+ // 设置拖动class
|
|
|
+ $(this).parent('.add-author-item').addClass('sort-author-item');
|
|
|
}
|
|
|
|
|
|
// 改为图片向下
|
|
|
- if (content.style.height == '520px') {
|
|
|
+ if (content.style.height === '520px') {
|
|
|
$(this).children('.author-sort-number').children('.fa').attr('class', 'fa fa-angle-down');
|
|
|
+ $(this).parent('.add-author-item').removeClass('sort-author-item');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- var moveItem = document.getElementsByTagName('label');
|
|
|
+ //flag用于判断鼠标状态点击后是否松开
|
|
|
+ let flag = false;
|
|
|
+ //移动的对象代码
|
|
|
+ let str = ''
|
|
|
+ //移动对象本身宽度
|
|
|
+ let obj_width = 0;
|
|
|
+ //移动对象本身高度
|
|
|
+ let obj_height = 0;
|
|
|
+ //移动对象
|
|
|
+ let obj_target = ''
|
|
|
+ //移动对象同等级下标 判断比较对象是在当前移动对象上面还是下面
|
|
|
+ let obj_index = 0;
|
|
|
+
|
|
|
+ //监听拖拽对象鼠标点击事件
|
|
|
+ $(document).on('mousedown', '.author-sort-button', function () {
|
|
|
+ // 存值
|
|
|
+ obj_target = $(this).parent().parent().parent()[0];
|
|
|
+ str = obj_target.outerHTML;
|
|
|
+ obj_width = $(obj_target).width()
|
|
|
+ obj_height = $(obj_target).height()
|
|
|
+ obj_index = $(obj_target).index()
|
|
|
+ //复制拖拽对象进入隐藏的box2并设置透明度(视觉效果好一些),移动到当前位置
|
|
|
+ $('#box2').html(str)
|
|
|
+ $('#box2').fadeTo(1, 0.5);
|
|
|
+ //obj_height除以二和obj_width除以二是为了让鼠标在复制对象的中间,视觉效果好一些
|
|
|
+ $('#box2').offset({top: event.pageY - (obj_height / 2), left: event.pageX - (obj_width / 2)});
|
|
|
|
|
|
- for (let i = 0; i < moveItem.length; i++) {
|
|
|
- //动态设置label元素id
|
|
|
- moveItem[i].setAttribute('id', 'label' + i);
|
|
|
- moveItem[i].ondragstart = function (ev) {
|
|
|
- //dataTransfer.setData() 方法设置被拖数据的数据类型和值
|
|
|
- ev.dataTransfer.setData("Text", this.id);
|
|
|
- };
|
|
|
- }
|
|
|
+ setTimeout(function () {
|
|
|
+ $('#box2').show();
|
|
|
+ }, 100)
|
|
|
+ //点击标识修改为true
|
|
|
+ flag = true;
|
|
|
+ });
|
|
|
|
|
|
- //右-〉左
|
|
|
- document.getElementById('box').ondragover = function (ev) {
|
|
|
- ev.preventDefault(); //阻止向上冒泡
|
|
|
- }
|
|
|
- document.getElementById('box').ondrop = function (ev) {
|
|
|
- ev.preventDefault();
|
|
|
- var id = ev.dataTransfer.getData('Text');
|
|
|
- var elem = document.getElementById(id);
|
|
|
- var toElem = ev.toElement.id;
|
|
|
- if (toElem == 'box') {
|
|
|
- //如果为container,元素放置在末尾
|
|
|
- this.appendChild(elem);
|
|
|
- } else {
|
|
|
- //如果为container里的元素,则插入该元素之前
|
|
|
- this.insertBefore(elem, document.getElementById(toElem));
|
|
|
+ //监听页面鼠标释放事件
|
|
|
+ $(document).mouseup(function (event) {
|
|
|
+ //清空box2
|
|
|
+ $("#box2").html('');
|
|
|
+ //点击标识修改为false
|
|
|
+ flag = false;
|
|
|
+
|
|
|
+ updateInputNames();
|
|
|
+ });
|
|
|
+
|
|
|
+ //监听页面鼠标移动事件
|
|
|
+ $(document).mousemove(function (event) {
|
|
|
+ if (flag) {
|
|
|
+ //复制对象跟随鼠标移动
|
|
|
+ $("#box2").offset({top: event.pageY - (obj_height / 2), left: event.pageX - (obj_width / 2)});
|
|
|
+ //循环要排序的对象
|
|
|
+ $("#box .add-author-item").each(function (k, v) {
|
|
|
+ //判断在移动对象上面的数据,判断鼠标所在距离顶部位置小于上面对象距顶部位置的位置+上面对象的高度时则移动
|
|
|
+ if (k < obj_index && event.pageY <= $(this).offset().top + $(this).height()) {
|
|
|
+ $(this).before(obj_target)
|
|
|
+ obj_index = $(obj_target).index()
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //判断在移动对象下面的数据,判断鼠标所在距离顶部位置大于下面对象的距顶部位置则移动
|
|
|
+ if (k > obj_index && event.pageY >= $(this).offset().top) {
|
|
|
+ $(this).after(obj_target)
|
|
|
+ obj_index = $(obj_target).index();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 阻止鼠标选中文本
|
|
|
+ $(document).bind("selectstart",function(){return false;});
|
|
|
|
|
|
Form.api.bindevent($("#submit-manuscript-form"), function () {
|
|
|
setTimeout(function () {
|