From 1e28d067cf62814165e304e1c6ec342edee91049 Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Fri, 17 May 2019 23:15:38 -0700 Subject: [PATCH] add ModelInfoDialog --- cateditor/src/components/CatalogContents.vue | 17 ++-- cateditor/src/components/ModelInfoDialog.vue | 82 +++++++++++++++++++ .../src/components/SectionInfoDialog.vue | 4 +- cateditor/src/pages/editor/store/index.js | 8 ++ 4 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 cateditor/src/components/ModelInfoDialog.vue diff --git a/cateditor/src/components/CatalogContents.vue b/cateditor/src/components/CatalogContents.vue index b00c386..9a205dd 100644 --- a/cateditor/src/components/CatalogContents.vue +++ b/cateditor/src/components/CatalogContents.vue @@ -77,7 +77,7 @@ - + info @@ -133,6 +133,7 @@ + @@ -148,6 +149,7 @@ import AddProductDialog from './AddProductDialog' import AddSectionDialog from './AddSectionDialog' import SectionInfoDialog from './SectionInfoDialog' import SectionDeleteDialog from './SectionDeleteDialog' +import ModelInfoDialog from './ModelInfoDialog' export default { components: { @@ -156,6 +158,7 @@ export default { AddSectionDialog, SectionInfoDialog, SectionDeleteDialog, + ModelInfoDialog, //RawDisplayer, }, @@ -164,6 +167,7 @@ export default { showAddSectionDialog: false, showSectionInfoDialog: false, showSectionDeleteDialog: false, + showModelInfoDialog: false, }), computed: { ...mapState([ @@ -192,11 +196,6 @@ export default { }, methods: { - selectModel(id) { - console.log('select model', id) - this.$store.dispatch('selectModel', id) - }, - sectionModelCount(sectionID) { let section = this.section(sectionID) if (section) { @@ -258,8 +257,14 @@ export default { this.showSectionDeleteDialog = true }, + popModelInfo(id) { + this.selectModel(id) + this.showModelInfoDialog = true + }, + ...mapActions([ 'selectSection', + 'selectModel', 'reorderSection', 'setSectionPages', 'setModelMaterials', diff --git a/cateditor/src/components/ModelInfoDialog.vue b/cateditor/src/components/ModelInfoDialog.vue new file mode 100644 index 0000000..91176ec --- /dev/null +++ b/cateditor/src/components/ModelInfoDialog.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/cateditor/src/components/SectionInfoDialog.vue b/cateditor/src/components/SectionInfoDialog.vue index 38d3211..59fa8e4 100644 --- a/cateditor/src/components/SectionInfoDialog.vue +++ b/cateditor/src/components/SectionInfoDialog.vue @@ -86,9 +86,7 @@ export default { } return count }, - - } - }, + }, methods: { ...mapGetters([ diff --git a/cateditor/src/pages/editor/store/index.js b/cateditor/src/pages/editor/store/index.js index 16a33a4..054c047 100644 --- a/cateditor/src/pages/editor/store/index.js +++ b/cateditor/src/pages/editor/store/index.js @@ -210,6 +210,10 @@ export const store = new Vuex.Store({ } }, + setModelName(state, { model, name }) { + model.name = name + }, + setModelMaterials(state, { model, materials }) { if (model) { model.ids = materials.map(m => (typeof m === 'object') ? m.id : m) @@ -318,6 +322,10 @@ export const store = new Vuex.Store({ commit('setSectionPages', payload) }, + setModelName({ commit }, payload) { + commit('setModelName', payload) + }, + setModelMaterials({ commit }, payload) { commit('setModelMaterials', payload) },