Authored by leo

Update: 增加PC端拖拽逻辑

@@ -188,11 +188,31 @@ var Bll = { @@ -188,11 +188,31 @@ var Bll = {
188 188
189 renderDecoratorPCTemplate: function() { 189 renderDecoratorPCTemplate: function() {
190 $('.decorator-right').html(common.util.__template2($('#pc-template').html(), {data: Bll.moduleDataList})); 190 $('.decorator-right').html(common.util.__template2($('#pc-template').html(), {data: Bll.moduleDataList}));
  191 + let _975EditorArr = $('#pc-dragable-975').find('.modular-editor');
191 new common.dragSort.create(document.getElementById('pc-dragable-975'), { 192 new common.dragSort.create(document.getElementById('pc-dragable-975'), {
192 animation: 150, 193 animation: 150,
  194 + onEnd: function(evt) {
  195 + let oldIndex = evt.oldIndex;
  196 + let newIndex = evt.newIndex;
  197 + let oldEditor = _975EditorArr[oldIndex];
  198 + let newEditor = _975EditorArr[newIndex];
  199 + oldIndex = $(oldEditor).data('index');
  200 + newIndex = $(newEditor).data('index');
  201 + Bll.adaptModuleData(Bll.moduleDataList, oldIndex, newIndex);
  202 + }
193 }); 203 });
  204 + let _160EditorArr = $('#pc-dragable-160').find('.modular-editor');
194 new common.dragSort.create(document.getElementById('pc-dragable-160'), { 205 new common.dragSort.create(document.getElementById('pc-dragable-160'), {
195 animation: 150, 206 animation: 150,
  207 + onEnd: function(evt) {
  208 + let oldIndex = evt.oldIndex;
  209 + let newIndex = evt.newIndex;
  210 + let oldEditor = _160EditorArr[oldIndex];
  211 + let newEditor = _160EditorArr[newIndex];
  212 + oldIndex = $(oldEditor).data('index');
  213 + newIndex = $(newEditor).data('index');
  214 + Bll.adaptModuleData(Bll.moduleDataList, oldIndex, newIndex);
  215 + }
196 }); 216 });
197 }, 217 },
198 218