|
@@ -387,71 +387,73 @@ const mutations = {
|
|
|
},
|
|
|
|
|
|
moveModule(state, data) {
|
|
|
- Message.error('移动板块功能暂时停用!');
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (state.pageStatus == 1) {
|
|
|
+ const moveType = data.moveType;
|
|
|
+ const moduleId = data.i;
|
|
|
+ const modules = state.pageData.index;
|
|
|
+
|
|
|
+ const thisIndex = modules.findIndex(module => module.i === moduleId);
|
|
|
+ if (thisIndex === -1) {
|
|
|
+ Message.error('模块未找到!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const thisY = modules[thisIndex].y;
|
|
|
+ let thatY;
|
|
|
+ if (moveType === 'up') {
|
|
|
+ thatY = Math.max(
|
|
|
+ ...modules.filter(item => item.y < thisY).map(item => item.y)
|
|
|
+ );
|
|
|
+ if (thatY === -Infinity) {
|
|
|
+ Message.error('已经是顶部了!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const thatIndex = modules.findIndex(item => item.y === thatY);
|
|
|
+ if (thatIndex === -1) {
|
|
|
+ Message.error('上方模块未找到!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ [modules[thisIndex].y, modules[thatIndex].y] = [modules[thatIndex].y, modules[thisIndex].y];
|
|
|
+
|
|
|
+ } else if (moveType === 'down') {
|
|
|
+ thatY = Math.min(
|
|
|
+ ...modules.filter(item => item.y > thisY).map(item => item.y)
|
|
|
+ );
|
|
|
+ if (thatY === Infinity) {
|
|
|
+ Message.error('已经是底部了!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const thatIndex = modules.findIndex(item => item.y === thatY);
|
|
|
+ if (thatIndex === -1) {
|
|
|
+ Message.error('下方模块未找到!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ [modules[thisIndex].y, modules[thatIndex].y] = [modules[thatIndex].y, modules[thisIndex].y];
|
|
|
+ } else {
|
|
|
+ Message.error('未知的移动类型!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ modules.sort((a, b) => a.y - b.y);
|
|
|
+
|
|
|
+ Vue.set(state.pageData, 'index', [...modules]);
|
|
|
+ console.log(state.pageData.index);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (state.pageStatus == 2) {}
|
|
|
+
|
|
|
+ if (state.pageStatus == 3) {}
|
|
|
+
|
|
|
+ if (state.pageStatus == 4) {}
|
|
|
+
|
|
|
+ if (state.pageStatus == 5) {}
|
|
|
+
|
|
|
+ if (state.pageStatus == 6) {}
|
|
|
+
|
|
|
+ if (state.pageStatus == 7) {}
|
|
|
},
|
|
|
|
|
|
setModuleHeight(state,data){
|