Authored by 陶雨

资源内容修改部分图片可拖拽排序

... ... @@ -13,6 +13,7 @@ var jQuery = require('jquery');
return;
}
var _self = $(this);
_self.css("height",_self.height());
var index, items = $(this).children(options.items), connectWith = options.connectWith || false;
var dataArray = options.array;
... ...
... ... @@ -81,6 +81,22 @@ var Bll = {
Bll.__editRender();
},
__editRender: function () {
$('.draggable').sortable().bind('sortupdate', function() {
var fn = new Function("Bll","return Bll.module.contentData." + $(this).data("array"));
var arr = fn(Bll);
var arr2 = [];//拖拽后顺序
var itemsUpdate = $(this).children();
if(itemsUpdate.length == arr.length) {
for (var i = 0; i < itemsUpdate.length; i++) {
arr2.push($(itemsUpdate[i]).attr("drag-index"));
}
for(var i = 0; i < arr.length; i++) {
arr2[i] = arr[arr2[i]];
}
arr = arr2;
}
//console.log(arr);
});
edit.init();
edit.on("file_onComplete", function (obj) {
var names = obj.field;
... ...
... ... @@ -373,7 +373,7 @@
<option value="6">一行六个</option>
</select> <font color="#999">注:只有图片列表是选择才会有效</font></p>
<div id="imageGroup-bottom">
<ul class="draggable">
<ul class="draggable" data-array="data.list">
[[each contentData.data.list as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -391,7 +391,7 @@
<input value="[[item.url.url]]" placeholder="url" class="form-control observe" required="required" data-field="list.[[index]].url.url"/>
</div>
<div class="col-sm-12">
<input placeholder="图片描述" value="[[item.url.title]]" data-field="list.[[index]].url.title" class="form-control observe" required="required" />
<input placeholder="图片描述" value="[[item.title]]" data-field="list.[[index]].title" class="form-control observe" required="required" />
</div>
</td>
</tr>
... ... @@ -425,7 +425,7 @@
</div>
</div>
<div id="paramsGroup-bottom">
<ul id="sortable" class="sortable" style="margin:10px;width:100%;">
<ul class="draggable sortable" data-array="data.list" style="margin:10px;width:100%;">
[[each contentData.data.list as item index]]
<li class="dragItem">
<table style="width:100%;z-index:-1;">
... ... @@ -460,7 +460,7 @@
<p><input type="button" class="btn btn-info btn-xs addBtn" value="添加banner" style="margin:10px;" data-event="newUserFloor.banner_image"></p>
</div>
<div id="newUserFloor-bottom">
<ul class="draggable">
<ul class="draggable" data-array="data.banner_image">
[[each contentData.data.banner_image as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -495,7 +495,7 @@
<div class="panel-body" id="debrisSlider-baseFrom">
<div class="debris_slider">
<p><input type="button" name="select-pic" class="btn btn-info btn-xs addBtn" value="添加左图" style="margin:10px;" data-event="debrisSlider.left"></p>
<ul class="draggable">
<ul class="draggable" data-array="data.left">
[[each contentData.data.left as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -523,7 +523,7 @@
[[/each]]
</ul>
<p><input type="button" name="select-pic" class="btn btn-info btn-xs addBtn" value="添加中间图" style="margin:10px;" data-event="debrisSlider.big_image"></p>
<ul class="draggable">
<ul class="draggable" data-array="data.big_image">
[[each contentData.data.big_image as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -551,7 +551,7 @@
[[/each]]
</ul>
<p><input type="button" name="select-pic" class="btn btn-info btn-xs addBtn" value="添加右图" style="margin:10px;" data-event="debrisSlider.right"></p>
<ul class="draggable">
<ul class="draggable" data-array="data.right">
[[each contentData.data.right as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -595,7 +595,7 @@
</div>
<p><input type="button" class="btn btn-info btn-xs addBtn" value="添加标签" style="margin:10px;" data-event="editorTalk.list"></p>
[[if contentData.data.list.length]]
<ul class="draggable">
<ul class="draggable" data-array="data.list">
[[each contentData.data.list as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -637,7 +637,7 @@
</p>
<p><input type="button" name="select-pic" class="btn btn-info btn-xs addBtn" value="添加左上图片" style="margin:10px;" data-event="hotCategory.blocks"></p>
[[if contentData.data.blocks.length]]
<ul class="draggable">
<ul class="draggable" data-array="data.blocks">
[[each contentData.data.blocks as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -726,7 +726,7 @@
</p>
<p><input type="button" name="select-pic" class="btn btn-info btn-xs addBtn" value="添加图片" style="margin:10px;" data-event="imageList.list"></p>
[[if contentData.data.list.length]]
<ul class="draggable">
<ul class="draggable" data-array="data.list">
[[each contentData.data.list as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -776,7 +776,7 @@
<script type="text/template" id="carouselBanner-template">
<input type="button" name="select-pic" value="添加图片" class="btn btn-info btn-xs addBtn" style="margin:10px;" data-event="carouselBanner.list">
  轮播速度:<input type="text" placeholder="轮播速度" class="observe" data-field="speed" value="[[contentData.data.speed]]"><br>
<ul class="draggable">
<ul class="draggable" data-array="data.list">
[[each contentData.data.list as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -837,7 +837,7 @@
<option value="2">左右滑动</option>
<option value="3">手风琴</option>
</select>
<ul class="draggable">
<ul class="draggable" data-array="data">
[[each contentData.data as item index]]
<li>
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ...