调整移动端将bar放在下方

This commit is contained in:
ivan deng
2023-05-25 18:49:24 +08:00
parent 199025663a
commit 3b34c2e3f9
9 changed files with 129 additions and 35 deletions

View File

@@ -1,13 +0,0 @@
/** @odoo-module **/
import { WebClient } from "@web/webclient/webclient";
import { patch } from "@web/core/utils/patch";
import { session } from "@web/session";
patch(WebClient.prototype, "app_odoo_customize.WebClient", {
setup() {
this._super.apply(this, arguments);
const app_system_name = session.app_system_name || 'odooApp';
this.title.setParts({ zopenerp: app_system_name }); // zopenerp is easy to grep
}
});

View File

@@ -17,6 +17,46 @@
content: '/';
}
}
// navbar在下方的特殊处理
.o_web_client.navbar_pos_bottom {
.o_navbar {
display: block;
.o_main_navbar {
--o-navbar-height: 40px;
}
}
//message
.o_MessagingMenu_dropdownMenu:not(.o-isDeviceSmall) {
bottom: var(--o-navbar-height) ;
top: auto;
}
.o_MessagingMenu_dropdownMenu.o-isDeviceSmall {
bottom: var(--o-navbar-height)+6!important; ;
height: calc(100% - var(--o-navbar-height));
top: 0;
}
//Activity
.o_ActivityMenuView_dropdownMenu {
bottom: var(--o-navbar-height) ;
top: auto;
}
//userMenu
.o_burger_menu {
//height: 95%;
}
// toggle处理
.dropdown .dropdown-toggle::after {
display: inline-block;
margin-left: 3.4px;
vertical-align: 3.4px;
content: "";
border-top: 0;
border-right: 4px solid transparent;
border-bottom: 4px solid;
border-left: 4px solid transparent;
}
}
// Colors replace to ent
//$o-community-color: #875A7B;

View File

@@ -0,0 +1,27 @@
/** @odoo-module **/
import { WebClient } from "@web/webclient/webclient";
import { patch } from "@web/core/utils/patch";
import { session } from "@web/session";
patch(WebClient.prototype, "app_odoo_customize.WebClient", {
setup() {
// 处理 navbar 全局可配置位置
var self = this;
self._super.apply(this, arguments);
this.state.navbar_pos_pc = session.app_navbar_pos_pc || 'top';
this.state.navbar_pos_mobile = session.app_navbar_pos_mobile || 'top';
if (self.env.isSmall)
this.state.navbar_pos = this.state.navbar_pos_mobile;
else
this.state.navbar_pos = this.state.navbar_pos_pc;
if (this.state.navbar_pos === 'bottom') {
document.body.className += ' navbar_pos_bottom';
}
const app_system_name = session.app_system_name || 'odooAi';
// zopenerp is easy to grep
this.title.setParts({ zopenerp: app_system_name });
}
});

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- 移动端nav在下方可配置处理-->
<t t-name="app_web_enterprise.WebClient" t-inherit="web.WebClient" t-inherit-mode="extension">
<xpath expr="//t/t" position="attributes">
<attribute name="t-if">
!state.fullscreen and state.navbar_pos!='bottom'
</attribute>
</xpath>
<xpath expr="//MainComponentsContainer" position="after">
<t t-if="!state.fullscreen and state.navbar_pos=='bottom'">
<NavBar/>
</t>
<!-- <div class="row" style="height:200px">-->
<!-- 增加Debug pad-->
<!-- </div>-->
</xpath>
</t>
</templates>