Bladeren bron

左侧增加页面插入指定位置

曹冬冬 5 jaren geleden
bovenliggende
commit
b7f168e82e
6 gewijzigde bestanden met toevoegingen van 528 en 518 verwijderingen
  1. 9 0
      src/api/test.js
  2. 3 3
      src/main.js
  3. 3 2
      src/model/Page.js
  4. 508 507
      src/views/h5editor/overview.vue
  5. 3 3
      src/vuex/editor/actions.js
  6. 2 3
      src/vuex/editor/mutations.js

+ 9 - 0
src/api/test.js

@@ -0,0 +1,9 @@
+import * as http from '../util/http'
+
+const testList = (param) => {
+  return http.post('/testTheme/testList', param)
+}
+
+module.exports = {
+  testList
+}

+ 3 - 3
src/main.js

@@ -1,7 +1,7 @@
 // 全局插件
-window.hasSaveFlag=true;
-window.revocationFlag=false
-window.baseUrl='http://skyforest.static.elab-plus.com/h5maker/'
+window.hasSaveFlag = true;
+window.revocationFlag = false
+window.baseUrl = 'http://skyforest.static.elab-plus.com/h5maker/'
 import Vue from 'vue'
 import VueRouter from 'vue-router'
 import Vuex from 'vuex'

+ 3 - 2
src/model/Page.js

@@ -2,7 +2,8 @@
  * Created by zhengguorong on 2016/11/24.
  */
 export default class Page {
-  constructor (page = {}) {
-    this.elements = page.elements || []
+  constructor(page = {}) {
+    this.elements = page.elements || [];
+    this.position = 0;
   }
 }

File diff suppressed because it is too large
+ 508 - 507
src/views/h5editor/overview.vue


+ 3 - 3
src/vuex/editor/actions.js

@@ -69,10 +69,10 @@ export const addPage = ({ commit }) => {
   commit(types.ADD_PAGE, page)
   commit(types.SET_CUR_EDITOR_PAGE, page)
 }
-export const addPage1 = ({ commit }, position) => {
-  console.log("SSSSSSSSSSSSSSSS", position);
+export const addPagePosition = ({ commit }, position) => {
   var page = new Page()
-  commit(types.ADD_PAGE_POSITION, page, position)
+  page.position = position
+  commit(types.ADD_PAGE_POSITION, page)
   commit(types.SET_CUR_EDITOR_PAGE, page)
 }
 

+ 2 - 3
src/vuex/editor/mutations.js

@@ -57,9 +57,8 @@ const mutations = {
   [types.ADD_PAGE](state, page) {
     state.editorTheme.pages.push(page);
   },
-  [types.ADD_PAGE_POSITION](state, page, position) {
-    console.log("XXXXXXXXX", position);
-    state.editorTheme.pages.splice(2, 0, page);
+  [types.ADD_PAGE_POSITION](state, page) {
+    state.editorTheme.pages.splice(page.position, 0, page);
   },
   [types.DELETE_PAGE](state, data) {
     state.editorTheme.pages.findIndex((value, index, arr) => {