提交 b732a5a1 authored 作者: 龙菲's avatar 龙菲

布展模板

上级 2ccbaeda
...@@ -239,14 +239,17 @@ export default { ...@@ -239,14 +239,17 @@ export default {
width: 100%; width: 100%;
height: 49px; height: 49px;
line-height: 49px; line-height: 49px;
background: #f6f6f6; background: #f5f5f9;
border-radius: 6px; border-radius: 6px;
display: flex; display: flex;
padding: 0 15px; padding: 0 15px;
.dialogAudioPlay { .dialogAudioPlay {
cursor: pointer; cursor: pointer;
color: #5c5e66; color: #5c5e66;
font-size: 20px; display: flex;
align-items: center;
color: #2069c4;
font-size: 38px;
} }
.progress-bar-bg { .progress-bar-bg {
background-color: #fff; background-color: #fff;
...@@ -260,7 +263,7 @@ export default { ...@@ -260,7 +263,7 @@ export default {
margin: 0 10px; margin: 0 10px;
} }
.progress-bar { .progress-bar {
background-color: #56bf8b; background-color: #2069c4;
width: 0%; width: 0%;
height: 10px; height: 10px;
border-radius: 5px; border-radius: 5px;
......
...@@ -58,6 +58,9 @@ export default { ...@@ -58,6 +58,9 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.el-menu{
border-right: none;
}
.el-menu-item { .el-menu-item {
background-color: #ecf5ff; background-color: #ecf5ff;
color: #2069c4; color: #2069c4;
......
<template> <template>
<!-- <el-button-group>
<el-button
v-for="(op, index) in operations"
:key="index"
size="mini"
:icon="icons[op.type]"
@click="clickOperation(op)"
:type="op.type == 'delete' ? 'danger' : 'primary'"
>
<span v-if="op.type == 'delete'">
<el-popconfirm title="确定删除当前文物吗?">
<span slot="reference"> {{ op.title }}</span>
</el-popconfirm>
</span>
<span v-else>{{ op.title }}</span>
</el-button>
</el-button-group> -->
<span> <span>
<span v-for="(op, index) in operations" :key="index"> <span v-for="(op, index) in operations" :key="index">
<span v-if="op.type == 'delete'"> <span v-if="op.type == 'delete'">
......
...@@ -33,66 +33,9 @@ export default { ...@@ -33,66 +33,9 @@ export default {
components: { SidebarItem, Logo }, components: { SidebarItem, Logo },
computed: { computed: {
...mapGetters(["sidebar", "menu"]), ...mapGetters(["sidebar", "menu"]),
routes() { // routes() {
console.log(this.menu); // return this.getRoute()
let obj = {}; // },
let that = this;
traverseMenuList(this.menu || []);
that.addParentKeyWrapper(that.$router.options.routes); //为路由树增加parentKey
let flattenRouterData = that.flattenTreeDataClosure(
that.$router.options.routes
);
// debugger
let newMenu = getNewMenu(that.$router.options.routes);
newMenu.map((item) => {
if (!item.hidden) {
let parent = that.findParent(item.name, flattenRouterData);
that.$router.options.routes.map((v) => {
if (v == parent) {
v.hidden = false;
}
});
}
});
function traverseMenuList(arr) {
if (arr.length > 0) {
arr.map((item) => {
if (item.menuName) {
obj[item.menuName] = true;
}
if (item.children) {
traverseMenuList(item.children);
}
});
}
}
// 设置需要隐藏的菜单
function getNewMenu(arr) {
// debugger
arr.map((item) => {
if (!item.name || item.hidden) {
return;
} else {
item.hidden = item.hidden ? item.hidden : !obj[item.name];
// 如果该节点要显示,则获取到该节点的父节点并显示该父节点
// if (!item.hidden) {
// // console.log(222, item);
// // debugger;
// let parent = that.findParent(item.name, flattenRouterData);
// console.log(111, parent);
// }
if (item.children) {
getNewMenu(item.children);
}
}
});
return arr;
}
// console.log(obj);
return newMenu;
},
activeMenu() { activeMenu() {
const route = this.$route; const route = this.$route;
const { meta, path } = route; const { meta, path } = route;
...@@ -112,45 +55,49 @@ export default { ...@@ -112,45 +55,49 @@ export default {
return !this.sidebar.opened; return !this.sidebar.opened;
}, },
}, },
data() {
return {
routes: [],
};
},
created() {
this.routes = this.$router.options.routes;
// this.routes = this.getRoute()
// let parentArr = []
// for (const key in this.menu) {
// parentArr.push(key+'Menu')
// }
// this.routes.map(item=>{
// parentArr.map(pr=>{
// if (condition) {
// }
// })
// })
// console.log('parentArr',parentArr);
},
methods: { methods: {
// 1. 为子节点添加父级的key getRoute() {
addParentKeyWrapper(tree) { let that = this;
// debugger let newMenu = getNewMenu(that.$router.options.routes);
const data = JSON.parse(JSON.stringify(tree)); // 深度克隆(deepClone) // 设置需要隐藏的菜单
function addParentKey(data, parentKey) { function getNewMenu(arr) {
data.forEach((ele) => { // debugger
ele.parent = parentKey; arr.map((item) => {
if (ele.children) { if (!item.name) {
addParentKey(ele.children, ele.name); return;
} } else {
}); item.hidden = item.hasOwnProperty("hidden")
} ? item.hidden
addParentKey(data, null); // 一开始的时候是null : !that.menu[item.name];
return data; if (item.children) {
}, getNewMenu(item.children);
}
// 将树拉平,节点之间通过parentKey联系
flattenTreeDataClosure(data) {
const treeData = JSON.parse(JSON.stringify(data));
const flattenData = [];
function flattenTree(data, parentKey) {
data.forEach((ele) => {
// const { name } = ele;
flattenData.push({ name: ele.name, parentKey });
if (ele.children) {
flattenTree(ele.children, ele.name);
} }
}); });
return arr;
} }
flattenTree(treeData, null); return newMenu;
return flattenData;
},
// 找到某个元素的父节点
findParent(item, flattenTree) {
return flattenTree.find((ele) => {
return ele.name === item;
});
}, },
}, },
}; };
......
...@@ -47,6 +47,7 @@ export const constantRoutes = [{ ...@@ -47,6 +47,7 @@ export const constantRoutes = [{
component: Layout, component: Layout,
redirect: '/home', redirect: '/home',
name:'HomeMenu', name:'HomeMenu',
hidden: false,
children: [{ children: [{
path: 'home', path: 'home',
name: 'Home', name: 'Home',
...@@ -61,6 +62,7 @@ export const constantRoutes = [{ ...@@ -61,6 +62,7 @@ export const constantRoutes = [{
path: '/display', path: '/display',
component: Layout, component: Layout,
name:'DisplayMenu', name:'DisplayMenu',
hidden: false,
children: [{ children: [{
path: 'display', path: 'display',
name: 'Display', name: 'Display',
...@@ -75,6 +77,7 @@ export const constantRoutes = [{ ...@@ -75,6 +77,7 @@ export const constantRoutes = [{
path: '/boutique', path: '/boutique',
component: Layout, component: Layout,
name:'BoutiqueMenu', name:'BoutiqueMenu',
hidden: false,
children: [{ children: [{
path: 'boutique', path: 'boutique',
name: 'Boutique', name: 'Boutique',
...@@ -89,6 +92,7 @@ export const constantRoutes = [{ ...@@ -89,6 +92,7 @@ export const constantRoutes = [{
path: '/culturalRelic', path: '/culturalRelic',
component: Layout, component: Layout,
name:'CulturalRelicMenu', name:'CulturalRelicMenu',
hidden: false,
children: [{ children: [{
path: 'culturalRelic', path: 'culturalRelic',
name: 'CulturalRelic', name: 'CulturalRelic',
...@@ -103,6 +107,7 @@ export const constantRoutes = [{ ...@@ -103,6 +107,7 @@ export const constantRoutes = [{
path: '/museum', path: '/museum',
component: Layout, component: Layout,
name:'MuseumRelicMenu', name:'MuseumRelicMenu',
hidden: false,
children: [{ children: [{
path: 'museum', path: 'museum',
name: 'Museum', name: 'Museum',
...@@ -117,6 +122,7 @@ export const constantRoutes = [{ ...@@ -117,6 +122,7 @@ export const constantRoutes = [{
path: '/virtual', path: '/virtual',
component: Layout, component: Layout,
name:'VirtualMenu', name:'VirtualMenu',
hidden: false,
children: [{ children: [{
path: 'virtual', path: 'virtual',
name: 'Virtual', name: 'Virtual',
...@@ -131,6 +137,7 @@ export const constantRoutes = [{ ...@@ -131,6 +137,7 @@ export const constantRoutes = [{
path: '/literature', path: '/literature',
component: Layout, component: Layout,
name:'LiteratureMenu', name:'LiteratureMenu',
hidden: false,
children: [{ children: [{
path: 'literature', path: 'literature',
name: 'Literature', name: 'Literature',
...@@ -145,6 +152,7 @@ export const constantRoutes = [{ ...@@ -145,6 +152,7 @@ export const constantRoutes = [{
path: '/log', path: '/log',
component: Layout, component: Layout,
name:'LogMenu', name:'LogMenu',
hidden: false,
children: [{ children: [{
path: 'log', path: 'log',
name: 'Log', name: 'Log',
...@@ -159,6 +167,7 @@ export const constantRoutes = [{ ...@@ -159,6 +167,7 @@ export const constantRoutes = [{
path: '/importExport', path: '/importExport',
component: Layout, component: Layout,
name:'ImportExportMenu', name:'ImportExportMenu',
hidden: false,
children: [{ children: [{
path: 'importExport', path: 'importExport',
name: 'ImportExport', name: 'ImportExport',
......
...@@ -22,7 +22,7 @@ const getDefaultState = () => { ...@@ -22,7 +22,7 @@ const getDefaultState = () => {
return { return {
token: getToken(), token: getToken(),
userInfo: getUserInfo(), userInfo: getUserInfo(),
menu:getLocalMenu(), menu: getLocalMenu(),
name: '', name: '',
avatar: '', avatar: '',
} }
...@@ -46,7 +46,7 @@ const mutations = { ...@@ -46,7 +46,7 @@ const mutations = {
SET_USERINFO: (state, userInfo) => { SET_USERINFO: (state, userInfo) => {
state.userInfo = userInfo state.userInfo = userInfo
}, },
SET_MENU:(state,menu)=>{ SET_MENU: (state, menu) => {
state.menu = menu state.menu = menu
} }
} }
...@@ -94,6 +94,7 @@ const actions = { ...@@ -94,6 +94,7 @@ const actions = {
removeLocalMenu() removeLocalMenu()
resetRouter() resetRouter()
commit('RESET_STATE') commit('RESET_STATE')
window.location.reload() //刷新路由表
resolve() resolve()
}).catch(error => { }).catch(error => {
console.log('err', error); console.log('err', error);
...@@ -119,18 +120,39 @@ const actions = { ...@@ -119,18 +120,39 @@ const actions = {
console.log('getMenuList'); console.log('getMenuList');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getMenu().then((res) => { getMenu().then((res) => {
console.log(res);
const { const {
menus menus
} = res.data } = res.data
commit('SET_MENU', menus) let menuObj = getMenuObj(menus)
setLocalMenu(menus)
function getMenuObj(menu) {
let obj = {}
traverseMenuList(menu || []);
function traverseMenuList(arr) {
if (arr.length > 0) {
arr.map((item) => {
if (item.menuName) {
obj[item.menuName] = true;
}
if (item.children) {
traverseMenuList(item.children);
}
});
}
}
return obj
}
commit('SET_MENU', menuObj)
setLocalMenu(menuObj)
resolve() resolve()
}).catch(error => { }).catch(error => {
reject(error) reject(error)
}) })
}) })
} },
} }
......
...@@ -10,16 +10,16 @@ ...@@ -10,16 +10,16 @@
> >
<div class="exhibition-units-tree-node" slot-scope="{ node, data }"> <div class="exhibition-units-tree-node" slot-scope="{ node, data }">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="10" class="mg-bt20"> <!-- <el-col :span="10" class="mg-bt20">
<el-input <el-input
placeholder="请输入层级(如:第一单元)" placeholder="请输入层级(如:第一单元)"
v-model="data.unit" v-model="data.unit"
> >
</el-input> </el-input>
<span style="display: inline-block; padding: 0 4px"></span> <span style="display: inline-block; padding: 0 4px"></span>
</el-col> </el-col> -->
<el-col :span="10" class="mg-bt20"> <el-col :span="20" class="mg-bt20">
<el-input placeholder="请输入标题" v-model="data.title"> </el-input> <el-input placeholder="请输入标题" v-model="data.title"> </el-input>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
...@@ -236,7 +236,7 @@ export default { ...@@ -236,7 +236,7 @@ export default {
euId: euId++, euId: euId++,
// unit: "", // unit: "",
title: "", title: "",
intro: "", // intro: "",
showMediaUploader: false, showMediaUploader: false,
// showImageUploader: false, // showImageUploader: false,
// showVideoUploader: false, // showVideoUploader: false,
...@@ -274,7 +274,12 @@ export default { ...@@ -274,7 +274,12 @@ export default {
}, },
remove(node, data) { remove(node, data) {
const parent = node.parent; const parent = node.parent;
const children = parent.data; let children = "";
if (parent.data instanceof Array) {
children = parent.data;
} else {
children = parent.data.children;
}
const index = children.findIndex((d) => d.euId === data.euId); const index = children.findIndex((d) => d.euId === data.euId);
children.splice(index, 1); children.splice(index, 1);
}, },
......
...@@ -77,6 +77,17 @@ ...@@ -77,6 +77,17 @@
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="展览介绍" :label-width="formLabelWidth">
<el-input
type="textarea"
placeholder="请输入展览介绍"
v-model="dialogForm.intro"
maxlength="1000"
show-word-limit
rows="6"
>
</el-input>
</el-form-item>
<el-form-item label="展览封面" :label-width="formLabelWidth"> <el-form-item label="展览封面" :label-width="formLabelWidth">
<ManualUploader <ManualUploader
:fileLimit="1" :fileLimit="1"
...@@ -105,16 +116,7 @@ ...@@ -105,16 +116,7 @@
placeholder="请输入关键词" placeholder="请输入关键词"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="展览介绍" :label-width="formLabelWidth">
<el-input
type="textarea"
placeholder="请输入展览介绍"
v-model="dialogForm.intro"
maxlength="300"
show-word-limit
>
</el-input>
</el-form-item>
<el-form-item label="展览文物" :label-width="formLabelWidth"> <el-form-item label="展览文物" :label-width="formLabelWidth">
<el-select <el-select
v-model="crIds" v-model="crIds"
...@@ -254,23 +256,9 @@ export default { ...@@ -254,23 +256,9 @@ export default {
if (value) { if (value) {
this.dialogForm = JSON.parse(JSON.stringify(value)); this.dialogForm = JSON.parse(JSON.stringify(value));
if ( if (
(this.dialogForm.exhibitionUnits && this.dialogForm.exhibitionUnits &&
this.dialogForm.exhibitionUnits.length == 0) || this.dialogForm.exhibitionUnits.length > 0
!this.dialogForm.exhibitionUnits
) { ) {
// this.dialogForm.exhibitionUnits = [
// {
// euId: 1, //后期去掉
// // unit: "", //单元名称,如前言、第一单元,暂时忽略
// title: "", //单元标题,类似主题名称
// intro: "", //单元介绍
// images: "", //图片id集合
// videos: "", //视频id集合
// crIds: [], //关联文物集合
// // showMediaUploader: false,
// },
// ];
} else {
loopUnit(this.dialogForm.exhibitionUnits); loopUnit(this.dialogForm.exhibitionUnits);
function loopUnit(arr) { function loopUnit(arr) {
arr.forEach((unit) => { arr.forEach((unit) => {
...@@ -432,6 +420,7 @@ export default { ...@@ -432,6 +420,7 @@ export default {
}, },
async handleSubmit() { async handleSubmit() {
this.loading = true;
var that = this; var that = this;
let formData = new FormData(); let formData = new FormData();
// 已存在的文件的对象 // 已存在的文件的对象
......
...@@ -735,6 +735,7 @@ export default { ...@@ -735,6 +735,7 @@ export default {
width: 100%; width: 100%;
height: 569px; height: 569px;
background-image: url('~@/assets/imgs/display/lts-bg.png'); background-image: url('~@/assets/imgs/display/lts-bg.png');
overflow-x: hidden;
} }
} }
} }
......
...@@ -237,17 +237,21 @@ export default { ...@@ -237,17 +237,21 @@ export default {
} }
}, },
async handleOperation(value, row) { async handleOperation(value, row) {
const { exhibitionId } = row; console.log(value, row);
switch (value.type) { switch (value.type) {
case "add": case "add":
this.editDialogVisible = true; this.editDialogVisible = true;
case "view": case "view":
this.previewDialogVisible = true; if (row) {
let res = await getDisplayById({ exhibitionId }); this.previewDialogVisible = true;
this.curPreviewObj = res.data; let res = await getDisplayById({ exhibitionId: row.exhibitionId });
this.curPreviewObj = res.data;
}
break; break;
case "edit": case "edit":
let editRes = await getDisplayById({ exhibitionId }); let editRes = await getDisplayById({
exhibitionId: row.exhibitionId,
});
this.form = editRes.data; this.form = editRes.data;
this.editDialogVisible = true; this.editDialogVisible = true;
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论