|
@@ -549,7 +549,7 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
$(document).on('click', '.author-delete-button', function () {
|
|
$(document).on('click', '.author-delete-button', function () {
|
|
let author_content_length = $('.add-author-content').children('.add-author-item').length;
|
|
let author_content_length = $('.add-author-content').children('.add-author-item').length;
|
|
if (author_content_length > 1) {
|
|
if (author_content_length > 1) {
|
|
- $(this).parent().parent().remove();
|
|
|
|
|
|
+ $(this).parent().parent().parent().remove();
|
|
|
|
|
|
// 删除后更新 input 的 name 值
|
|
// 删除后更新 input 的 name 值
|
|
updateInputNames();
|
|
updateInputNames();
|
|
@@ -1077,13 +1077,14 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
// let input_index = author_content_length - 1;
|
|
// let input_index = author_content_length - 1;
|
|
// 克隆作者信息
|
|
// 克隆作者信息
|
|
let str = `<div class="add-author-item div">
|
|
let str = `<div class="add-author-item div">
|
|
- <hr style="background: #B8B8B8;">
|
|
|
|
- <div class="form-group author-content-button-item">
|
|
|
|
- <div class="author-sort-button text-sort-button text-button">
|
|
|
|
- <i class="fa fa-sort"></i> Sort
|
|
|
|
|
|
+ <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>
|
|
- <div class="author-delete-button text-delete-button text-button">
|
|
|
|
- <i class="fa fa-trash"></i> Delete
|
|
|
|
|
|
+ <div class="author-operate-button">
|
|
|
|
+ <div class="author-delete-button text-delete-button text-button">
|
|
|
|
+ <i class="fa fa-trash"></i> Delete
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
@@ -1193,7 +1194,7 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
|
|
|
|
// 排序input 的 name 值
|
|
// 排序input 的 name 值
|
|
function updateInputNames() {
|
|
function updateInputNames() {
|
|
- drags('add-author-item', 'div-dash', 'dash');
|
|
|
|
|
|
+ // drags('add-author-item', 'div-dash', 'dash');
|
|
|
|
|
|
// 遍历所有的div元素
|
|
// 遍历所有的div元素
|
|
$(".add-author-item").each(function (index) {
|
|
$(".add-author-item").each(function (index) {
|
|
@@ -1219,150 +1220,152 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
correspondsing_author_yes_radio.attr('name', "row[author][" + index + "][correspondsing_author]");
|
|
correspondsing_author_yes_radio.attr('name', "row[author][" + index + "][correspondsing_author]");
|
|
correspondsing_author_no_radio.attr('name', "row[author][" + index + "][correspondsing_author]");
|
|
correspondsing_author_no_radio.attr('name', "row[author][" + index + "][correspondsing_author]");
|
|
|
|
|
|
|
|
+ $(this).find('.author-sort-number-text').html('Author' + (index + 1));
|
|
|
|
+
|
|
select.attr('name', "row[author][" + index + "][author_country]");
|
|
select.attr('name', "row[author][" + index + "][author_country]");
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
// 拖拽初始化
|
|
// 拖拽初始化
|
|
- drags('add-author-item', 'div-dash', 'dash');
|
|
|
|
|
|
+ // 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);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ // 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 () {
|
|
$.fn.serializeObject = function () {
|
|
var obj = {};
|
|
var obj = {};
|
|
@@ -1381,24 +1384,28 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
return obj;
|
|
return obj;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // 实时保存
|
|
$(document).on('mouseup', function () {
|
|
$(document).on('mouseup', function () {
|
|
let values = $('#submit-manuscript-form').serializeObject();
|
|
let values = $('#submit-manuscript-form').serializeObject();
|
|
- $.ajax({
|
|
|
|
- url: '/api/user/incomplete_submit',
|
|
|
|
- type: 'POST',
|
|
|
|
- dataType: 'json',
|
|
|
|
- data: values,
|
|
|
|
- success: function (res) {
|
|
|
|
- // 如果保存了就代表接下来都是修改,所以记录返回的id
|
|
|
|
- if (res.code == 1) {
|
|
|
|
- $('#c-manuscript_id').val(res.data);
|
|
|
|
|
|
+ if (index != 2) {
|
|
|
|
+ $.ajax({
|
|
|
|
+ url: '/api/user/incomplete_submit',
|
|
|
|
+ type: 'POST',
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ data: values,
|
|
|
|
+ success: function (res) {
|
|
|
|
+ // 如果保存了就代表接下来都是修改,所以记录返回的id
|
|
|
|
+ if (res.code == 1) {
|
|
|
|
+ $('#c-manuscript_id').val(res.data);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ error: function (xhr, status, error) {
|
|
|
|
+ top.window.Toastr.error('Save failed');
|
|
}
|
|
}
|
|
- },
|
|
|
|
- error: function (xhr, status, error) {
|
|
|
|
- top.window.Toastr.error('Save failed');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
+
|
|
// 单选框选择显示对应input
|
|
// 单选框选择显示对应input
|
|
$(document).on('click', '.radio-inline', function () {
|
|
$(document).on('click', '.radio-inline', function () {
|
|
let copyright_files_value = $("input[name='row[is_copyright]']:checked").val();
|
|
let copyright_files_value = $("input[name='row[is_copyright]']:checked").val();
|
|
@@ -1430,6 +1437,51 @@ define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, und
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // 折叠作者文本
|
|
|
|
+ $(document).on('click', '.author-content-button-item', function () {
|
|
|
|
+ var content = $(this).parent('.add-author-item')[0];
|
|
|
|
+ content.style.height = content.offsetHeight === 520 ? 42 + 'px' : 520 + 'px';
|
|
|
|
+
|
|
|
|
+ // 改为图片向上
|
|
|
|
+ if (content.style.height == '42px') {
|
|
|
|
+ $(this).children('.author-sort-number').children('.fa').attr('class', 'fa fa-angle-up');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 改为图片向下
|
|
|
|
+ if (content.style.height == '520px') {
|
|
|
|
+ $(this).children('.author-sort-number').children('.fa').attr('class', 'fa fa-angle-down');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var moveItem = document.getElementsByTagName('label');
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //右-〉左
|
|
|
|
+ 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));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
Form.api.bindevent($("#submit-manuscript-form"), function () {
|
|
Form.api.bindevent($("#submit-manuscript-form"), function () {
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
location.href = '/index/user/display_submitted';
|
|
location.href = '/index/user/display_submitted';
|