mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
[frontend-next] Optimized styles
This commit is contained in:
parent
4512fc0309
commit
2a13103186
6 changed files with 85 additions and 72 deletions
|
@ -176,7 +176,9 @@ const reset_search = async () => {
|
|||
layout="inline"
|
||||
>
|
||||
<template #action>
|
||||
<div class="reset-btn">
|
||||
<a-button @click="reset_search">重置</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</std-data-entry>
|
||||
<a-table
|
||||
|
@ -238,4 +240,11 @@ const reset_search = async () => {
|
|||
// overflow-x: scroll;
|
||||
}
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
// min-height: 50px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {defineComponent} from 'vue'
|
||||
import {Form, FormItem} from 'ant-design-vue'
|
||||
import './style.less'
|
||||
|
||||
export default defineComponent({
|
||||
props: ['dataList', 'dataSource', 'error', 'layout'],
|
||||
|
@ -18,7 +19,7 @@ export default defineComponent({
|
|||
})
|
||||
|
||||
if (slots.action) {
|
||||
template.push(<div>{slots.action()}</div>)
|
||||
template.push(<div class={'std-data-entry-action'}>{slots.action()}</div>)
|
||||
}
|
||||
|
||||
return <Form layout={props.layout || 'vertical'}>{template}</Form>
|
||||
|
|
7
frontend/src/components/StdDataEntry/style.less
Normal file
7
frontend/src/components/StdDataEntry/style.less
Normal file
|
@ -0,0 +1,7 @@
|
|||
.std-data-entry-action {
|
||||
@media (max-width: 350px) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
|
@ -1,19 +1,60 @@
|
|||
<script setup lang="ts">
|
||||
import HeaderLayout from './HeaderLayout.vue'
|
||||
import SideBar from './SideBar.vue'
|
||||
import FooterLayout from './FooterLayout.vue'
|
||||
import PageHeader from '@/components/PageHeader/PageHeader.vue'
|
||||
import zh_CN from 'ant-design-vue/es/locale/zh_CN'
|
||||
import zh_TW from 'ant-design-vue/es/locale/zh_TW'
|
||||
import en_US from 'ant-design-vue/es/locale/en_US'
|
||||
import {computed, ref} from 'vue'
|
||||
import _ from 'lodash'
|
||||
|
||||
import gettext from '@/gettext'
|
||||
|
||||
const drawer_visible = ref(false)
|
||||
const collapsed = ref(collapse())
|
||||
const clientWidth = ref(getClientWidth())
|
||||
|
||||
addEventListener('resize', _.throttle(() => {
|
||||
collapsed.value = collapse()
|
||||
}, 50))
|
||||
|
||||
function getClientWidth() {
|
||||
return document.body.clientWidth
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
return getClientWidth() < 768
|
||||
}
|
||||
|
||||
const lang = computed(() => {
|
||||
switch (gettext.current) {
|
||||
case 'zh_CN':
|
||||
return zh_CN
|
||||
case 'zh_TW':
|
||||
return zh_TW
|
||||
default:
|
||||
return en_US
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<a-config-provider :locale="lang">
|
||||
<a-layout style="min-height: 100%;">
|
||||
<template v-show="clientWidth.value<512">
|
||||
<a-drawer
|
||||
v-show="clientWidth<512"
|
||||
:closable="false"
|
||||
:visible="collapsed"
|
||||
v-model:visible="drawer_visible"
|
||||
placement="left"
|
||||
@close="collapsed=false"
|
||||
@close="drawer_visible=false"
|
||||
>
|
||||
<side-bar/>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<a-layout-sider
|
||||
v-show="clientWidth>=512"
|
||||
v-model="collapsed"
|
||||
v-model:collapsed="collapsed"
|
||||
:collapsible="true"
|
||||
:style="{zIndex: 11}"
|
||||
theme="light"
|
||||
|
@ -24,7 +65,7 @@
|
|||
|
||||
<a-layout>
|
||||
<a-layout-header :style="{position: 'fixed', zIndex: 10, width:'100%'}">
|
||||
<header-layout @clickUnFold="collapsed=true"/>
|
||||
<header-layout @clickUnFold="drawer_visible=true"/>
|
||||
</a-layout-header>
|
||||
|
||||
<a-layout-content>
|
||||
|
@ -43,59 +84,14 @@
|
|||
</a-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HeaderLayout from './HeaderLayout.vue'
|
||||
import SideBar from './SideBar.vue'
|
||||
import FooterLayout from './FooterLayout.vue'
|
||||
import PageHeader from '@/components/PageHeader/PageHeader.vue'
|
||||
import zh_CN from 'ant-design-vue/es/locale/zh_CN'
|
||||
import zh_TW from 'ant-design-vue/es/locale/zh_TW'
|
||||
import en_US from 'ant-design-vue/es/locale/en_US'
|
||||
|
||||
export default {
|
||||
name: 'BaseLayout',
|
||||
data() {
|
||||
return {
|
||||
collapsed: this.collapse(),
|
||||
clientWidth: document.body.clientWidth,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.onresize = () => {
|
||||
this.collapsed = this.collapse()
|
||||
this.clientWidth = this.getClientWidth()
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SideBar,
|
||||
PageHeader,
|
||||
HeaderLayout,
|
||||
FooterLayout
|
||||
},
|
||||
methods: {
|
||||
getClientWidth() {
|
||||
return document.body.clientWidth
|
||||
},
|
||||
collapse() {
|
||||
return !(this.getClientWidth() > 768 || this.getClientWidth() < 512)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
lang: {
|
||||
get() {
|
||||
switch (this.$language.current) {
|
||||
case 'zh_CN':
|
||||
return zh_CN
|
||||
case 'zh_TW':
|
||||
return zh_TW
|
||||
default:
|
||||
return en_US
|
||||
}
|
||||
}
|
||||
}
|
||||
<style lang="less" scoped>
|
||||
.layout-sider {
|
||||
@media (max-width: 600px) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.layout-sider .sidebar {
|
||||
//position: fixed;
|
||||
|
|
|
@ -68,7 +68,7 @@ function logout() {
|
|||
.tool {
|
||||
position: fixed;
|
||||
left: 20px;
|
||||
@media (min-width: 512px) {
|
||||
@media (min-width: 600px) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ function wsOnMessage(m: { data: any }) {
|
|||
<template>
|
||||
<div>
|
||||
<a-row :gutter="[16,16]" class="first-row">
|
||||
<a-col :xl="7" :lg="24" :md="24">
|
||||
<a-col :xl="7" :lg="24" :md="24" :xs="24">
|
||||
<a-card :title="$gettext('Server Info')" :bordered="false">
|
||||
<p>
|
||||
<translate>Uptime:</translate>
|
||||
|
@ -155,7 +155,7 @@ function wsOnMessage(m: { data: any }) {
|
|||
</p>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xl="10" :lg="16" :md="24" class="chart_dashboard">
|
||||
<a-col :xl="10" :lg="16" :md="24" :xs="24" class="chart_dashboard">
|
||||
<a-card :title="$gettext('Memory and Storage')" :bordered="false">
|
||||
<a-row :gutter="[0,16]">
|
||||
<a-col :xs="24" :sm="24" :md="8">
|
||||
|
@ -174,7 +174,7 @@ function wsOnMessage(m: { data: any }) {
|
|||
</a-row>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xl="7" :lg="8" :sm="24" class="chart_dashboard">
|
||||
<a-col :xl="7" :lg="8" :sm="24" :xs="24" class="chart_dashboard">
|
||||
<a-card :title="$gettext('Network Statistics')" :bordered="false">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
|
@ -190,7 +190,7 @@ function wsOnMessage(m: { data: any }) {
|
|||
</a-col>
|
||||
</a-row>
|
||||
<a-row class="row-two" :gutter="[16,32]">
|
||||
<a-col :xl="8" :lg="24" :md="24" :sm="24">
|
||||
<a-col :xl="8" :lg="24" :md="24" :sm="24" :xs="24">
|
||||
<a-card :title="$gettext('CPU Status')" :bordered="false">
|
||||
<a-statistic :value="cpu" title="CPU">
|
||||
<template v-slot:suffix>
|
||||
|
@ -200,7 +200,7 @@ function wsOnMessage(m: { data: any }) {
|
|||
<area-chart :series="cpu_analytic_series" :max="100"/>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xl="8" :lg="12" :md="24" :sm="24">
|
||||
<a-col :xl="8" :lg="12" :md="24" :sm="24" :xs="24">
|
||||
<a-card :title="$gettext('Network')">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
|
@ -222,7 +222,7 @@ function wsOnMessage(m: { data: any }) {
|
|||
<area-chart :series="net_analytic" :y_formatter="net_formatter"/>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xl="8" :lg="12" :md="24" :sm="24">
|
||||
<a-col :xl="8" :lg="12" :md="24" :sm="24" :xs="24">
|
||||
<a-card :title="$gettext('Disk IO')">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue