edu/admin/src/views/decoration/tabbar.vue

147 lines
3.8 KiB
Vue
Raw Normal View History

2022-09-06 10:42:24 +00:00
<template>
<div class="decoration-tabbar">
<div class="flex-1 min-h-0 w-full">
<div class="h-full">
<ElScrollbar>
<div class="flex min-w-[900px] scroll-view-content">
<el-card
shadow="never"
class="!border-none flex"
:body-style="{ 'padding-right': 0 }"
2022-09-06 10:42:24 +00:00
>
<Menu class="!h-full flex-none" v-model="activeMenu" :menus="menus" />
</el-card>
<div class="flex-1 pages-preview-box">
<div class="pages-preview mx-[30px]">
<el-scrollbar height="100%">
<component
:is="currentTab.component?.content"
v-bind="currentTab.data"
/>
</el-scrollbar>
</div>
2022-09-06 10:42:24 +00:00
</div>
<el-scrollbar class="attr-setting flex-none">
<div class="px-5 pb-5">
<component
:is="currentTab.component?.attr"
v-model="currentTab.data"
/>
</div>
</el-scrollbar>
2022-09-06 10:42:24 +00:00
</div>
</ElScrollbar>
2022-09-06 10:42:24 +00:00
</div>
</div>
2024-11-16 07:27:25 +00:00
<footer-btns :fixed="true" v-perms="['decorate.tabbar/save']">
2022-09-06 10:42:24 +00:00
<el-button type="primary" @click="setData">保存</el-button>
</footer-btns>
</div>
</template>
2022-09-20 02:58:38 +00:00
<script lang="ts" setup name="decorationTabbar">
2022-09-06 10:42:24 +00:00
import { getDecorateTabbar, setDecorateTabbar } from '@/api/decoration'
import Menu from './component/pages/menu.vue'
import mobileTab from './component/tabbar/mobile'
// import pcTab from './component/tabbar/pc'
2022-09-06 10:42:24 +00:00
enum ClientTypeEnum {
MOBILE = '1',
PC = '2'
2022-09-06 10:42:24 +00:00
}
const activeMenu = ref(ClientTypeEnum.MOBILE)
const menus: Record<
string,
{
id: number
name: string
type: number
data: any
component: any
}
> = reactive({
[ClientTypeEnum.MOBILE]: {
id: 1,
type: 1,
name: '移动端导航栏',
data: {
style: {
default_color: '',
selected_color: ''
},
list: []
},
component: mobileTab
}
})
const currentTab = computed(() => {
return menus[activeMenu.value]
})
2022-09-06 10:42:24 +00:00
const getData = async () => {
const data = await getDecorateTabbar({
type: activeMenu.value
})
menus['1'].data = data
2022-09-06 10:42:24 +00:00
}
const setData = async () => {
const { data } = currentTab.value
await setDecorateTabbar({
...data
})
2022-09-06 10:42:24 +00:00
getData()
}
watch(
activeMenu,
() => {
getData()
},
{
immediate: true
}
)
2022-09-06 10:42:24 +00:00
</script>
<style lang="scss" scoped>
$scroll-height: calc(100vh - var(--navbar-height) - 74px);
2022-09-06 10:42:24 +00:00
.decoration-tabbar {
height: $scroll-height;
width: 100%;
2022-09-06 10:42:24 +00:00
@apply flex flex-col;
.scroll-view-content {
height: calc($scroll-height - 60px);
}
.pages-preview-box {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
height: 100%;
.pages-preview {
background-color: #ffffff;
width: 360px;
height: 615px;
color: #333;
position: relative;
2022-09-06 10:42:24 +00:00
}
}
.nav-item {
&:hover {
.drag-move {
display: block;
}
}
}
.attr-setting {
width: 450px;
height: 100%;
}
2022-09-06 10:42:24 +00:00
}
</style>