refactor(ui): 首页/退货/称重/顶部导航统一到全局排版规范

- 字号、行高、圆角、间距改用 :root token 与 5px 网格,删除页面内重复的通用样式
- 顶部导航高度统一 --wms-nav-height;页面 padding/背景统一 --wms-page-pad / --wms-page-bg
- 4 个页面 renderjs 统一为 #ifndef APP-PLUS 包裹 rem 初始化(H5 专用),消除 semicolon-after-return 编译告警
This commit is contained in:
liufumingren 2026-09-27 03:15:12 +08:00
parent 686d4442f5
commit 20f0454c79
4 changed files with 417 additions and 461 deletions

View File

@ -434,18 +434,22 @@ export default {
<style scoped> <style scoped>
.top-nav { .top-nav {
width: 100%; width: 100%;
margin-bottom: 0.614rem; /* 高度 0.7rem = 70px:内行 50px(由行内最高的 logo 决定)+ 上下内边距各 0.1rem */
padding: 0.461rem 0.717rem; height: 0.7rem;
margin-bottom: 0.2rem;
/* 水平内边距 = --wms-page-pad(25px):与所有页面的主体内容左右对齐 */
padding: 0.1rem var(--wms-page-pad);
box-sizing: border-box; box-sizing: border-box;
background-color: #2f7dff; background-color: var(--wms-primary);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.top-nav-logo { .top-nav-logo {
width: 6.144rem; /* 内行高基准:0.5rem = 50px(用户指定,行内最高元素就是它);宽度按原宽高比折半 */
height: 2.304rem; width: 1.33rem;
height: 0.5rem;
flex-shrink: 0; flex-shrink: 0;
} }
@ -457,14 +461,14 @@ export default {
.top-nav-menu-wrap { .top-nav-menu-wrap {
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 0.922rem; margin-left: 0.3rem;
gap: 0.358rem; gap: 0.1rem;
min-width: 0; min-width: 0;
} }
.top-nav-menu-item { .top-nav-menu-item {
padding: 0.256rem 0.461rem; padding: 0.1rem 0.15rem;
border-radius: 0.205rem; border-radius: 0.07rem;
} }
.top-nav-menu-item--active { .top-nav-menu-item--active {
@ -472,75 +476,75 @@ export default {
} }
.top-nav-menu-text { .top-nav-menu-text {
font-size: 0.819rem; font-size: 0.22rem;
color: #fff; color: var(--wms-white);
font-weight: 500; font-weight: 500;
} }
.top-nav-user { .top-nav-user {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.256rem; gap: 0.1rem;
cursor: pointer; cursor: pointer;
} }
.top-nav-user-name { .top-nav-user-name {
color: #fff; color: var(--wms-white);
font-size: 0.819rem; font-size: 0.22rem;
line-height: 1; line-height: 1;
} }
.top-nav-mine-icon { .top-nav-mine-icon {
width: 1.126rem; width: 0.36rem;
height: 1.126rem; height: 0.36rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 25.574rem; border-radius: 50%;
background-color: rgba(255, 255, 255, 0.2); background-color: rgba(255, 255, 255, 0.2);
box-sizing: border-box; box-sizing: border-box;
} }
.top-nav-mine-icon-head { .top-nav-mine-icon-head {
width: 0.307rem; width: 0.1rem;
height: 0.307rem; height: 0.1rem;
border: 0.051rem solid #fff; border: 0.02rem solid var(--wms-white);
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
} }
.top-nav-mine-icon-body { .top-nav-mine-icon-body {
width: 0.512rem; width: 0.16rem;
height: 0.256rem; height: 0.08rem;
margin-top: 0.102rem; margin-top: 0.04rem;
border: 0.051rem solid #fff; border: 0.02rem solid var(--wms-white);
border-top: none; border-top: none;
border-radius: 0 0 0.307rem 0.307rem; border-radius: 0 0 0.13rem 0.13rem;
box-sizing: border-box; box-sizing: border-box;
} }
.popup-card { .popup-card {
position: absolute; position: absolute;
right: 0; right: 0;
top: 1.792rem; top: 0.57rem;
min-width: 8.448rem; min-width: 2.7rem;
background: #fff; background: var(--wms-card-bg);
border-radius: 0.307rem; border-radius: 0.13rem;
box-shadow: 0 0.307rem 0.819rem rgba(0, 0, 0, 0.16); box-shadow: 0 0.1rem 0.26rem rgba(0, 0, 0, 0.16);
padding: 0.41rem; padding: 0.15rem;
box-sizing: border-box; box-sizing: border-box;
z-index: 30; z-index: 30;
} }
.popup-user-info { .popup-user-info {
max-height: 8.192rem; max-height: 2.62rem;
overflow-y: auto; overflow-y: auto;
} }
.popup-user-item { .popup-user-item {
padding: 0.307rem; padding: 0.1rem;
border-radius: 0.205rem; border-radius: 0.07rem;
} }
.popup-user-item--current { .popup-user-item--current {
@ -548,28 +552,28 @@ export default {
} }
.popup-user-text { .popup-user-text {
font-size: 0.717rem; font-size: 0.2rem;
color: #333; color: var(--wms-text);
} }
.popup-user-item--current .popup-user-text { .popup-user-item--current .popup-user-text {
color: #2f7dff; color: var(--wms-primary);
} }
.logout-btn { .logout-btn {
margin-top: 0.41rem; margin-top: 0.15rem;
height: 1.536rem; height: 0.36rem; /* 控件 36px */
line-height: 1.536rem; line-height: 0.36rem;
font-size: 0.717rem; font-size: 0.2rem;
} }
.close-btn { .close-btn {
margin-top: 0.256rem; margin-top: 0.1rem;
height: 1.536rem; height: 0.36rem; /* 控件 36px */
line-height: 1.536rem; line-height: 0.36rem;
font-size: 0.717rem; font-size: 0.2rem;
background-color: #f5f7fb; background-color: #f5f7fb;
color: #333; color: var(--wms-text);
} }
.switch-mask { .switch-mask {
@ -578,7 +582,7 @@ export default {
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: #f8f8f8; background-color: var(--wms-page-bg);
z-index: 9999; z-index: 9999;
pointer-events: none; pointer-events: none;
opacity: 0; opacity: 0;

View File

@ -231,26 +231,21 @@ export default {
</script> </script>
<script module="remInject" lang="renderjs"> <script module="remInject" lang="renderjs">
import { applyRemBase } from '../../render-common/rem-base.js'
export default { export default {
mounted() { mounted() {
// #ifdef APP-PLUS // #ifndef APP-PLUS
// 真机 rem 由 App.vue 全局纯 CSS(html { font-size: min(5.2734375vw, 7.91015625vh) },1.0125 系数)承担, // rem 基准统一走 render-common/rem-base.js(满格 1rem = 100px,>1280 宽不再放大字体),
// renderjs 不再覆盖,避免与 CSS 方案互相覆盖导致白屏/抖动 // 字号偏大靠改 CSS 的 font-size 值(已全局 ×0.85),不动基准
return // 各页面不再各算一份,避免系数漂移(历史上 returns 页曾写成 0.20,与其他页相差 2.1 倍)
// 真机(APP-PLUS)rem 由 App.vue 全局纯 CSS(html { font-size: 7.8125vw !important }=100/1280)承担。
// ⚠️ 这里用 #ifndef,不要写成 `#ifdef APP-PLUS + return`:后者会让 esbuild 报
// “semicolon-after-return”,且以后往 mounted 里补的视图层代码会变成真机永不执行。
this._remResizeHandler = applyRemBase
applyRemBase()
window.addEventListener('resize', this._remResizeHandler)
// #endif // #endif
// 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小);0.45 平板基准偏大,H5/Electron 桌面统一 0.42(0.28 基础上整体放大 50%)
const REM_SCALE = 0.42
const setFontSize = () => {
const docEl = document.documentElement
const width = docEl.clientWidth || window.innerWidth || 1920
const height = docEl.clientHeight || window.innerHeight || 1280
const scale = Math.min(width / 1920, height / 1280)
docEl.style.fontSize = (scale * 100 * REM_SCALE) + 'px'
console.log('[rem-renderjs] fontSize =', docEl.style.fontSize, 'width =', width, 'height =', height, 'scale =', scale, 'REM_SCALE =', REM_SCALE, 'dpr =', window.devicePixelRatio)
}
this._remResizeHandler = setFontSize
setFontSize()
window.addEventListener('resize', setFontSize)
}, },
beforeDestroy() { beforeDestroy() {
if (this._remResizeHandler) { if (this._remResizeHandler) {
@ -265,14 +260,14 @@ export default {
height: 100vh; height: 100vh;
min-height: 100vh; min-height: 100vh;
overflow: hidden; overflow: hidden;
min-width: 19.2rem; min-width: 6.14rem;
box-sizing: border-box; box-sizing: border-box;
padding: 0; padding: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: stretch; align-items: stretch;
justify-content: flex-start; justify-content: flex-start;
background-color: #f8f8f8; background-color: var(--wms-page-bg);
} }
.layout-main { .layout-main {
@ -285,31 +280,21 @@ export default {
} }
.module-placeholder { .module-placeholder {
background-color: #fff; background-color: var(--wms-card-bg);
border-radius: 0.41rem; border-radius: 0.13rem;
padding: 0.717rem; padding: 0.25rem;
} }
.module-placeholder-title { .module-placeholder-title {
display: block; display: block;
font-size: 0.768rem; font-size: 0.21rem;
color: #333; color: var(--wms-text);
} }
.module-placeholder-desc { .module-placeholder-desc {
display: block; display: block;
margin-top: 0.256rem; margin-top: 0.1rem;
font-size: 0.614rem; font-size: 0.17rem;
color: #999; color: var(--wms-text-placeholder);
}
@media screen and (max-width: 20.48rem) {
.layout-page {
min-width: 15.2rem;
}
.layout-main {
padding: 0 0.512rem 0.205rem;
}
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@ -31,26 +31,21 @@ export default {
</script> </script>
<script module="remInject" lang="renderjs"> <script module="remInject" lang="renderjs">
import { applyRemBase } from '../../render-common/rem-base.js'
export default { export default {
mounted() { mounted() {
// #ifdef APP-PLUS // #ifndef APP-PLUS
// 真机 rem 由 App.vue 全局纯 CSS(html { font-size: min(5.2734375vw, 7.91015625vh) },1.0125 系数)承担, // rem 基准统一走 render-common/rem-base.js(满格 1rem = 100px,>1280 宽不再放大字体),
// renderjs 不再覆盖,避免与 CSS 方案互相覆盖导致白屏/抖动 // 字号偏大靠改 CSS 的 font-size 值(已全局 ×0.85),不动基准
return // 各页面不再各算一份,避免系数漂移
// 真机(APP-PLUS)rem 由 App.vue 全局纯 CSS(html { font-size: 7.8125vw !important }=100/1280)承担。
// ⚠️ 这里用 #ifndef,不要写成 `#ifdef APP-PLUS + return`:后者会让 esbuild 报
// “semicolon-after-return”,且以后往 mounted 里补的视图层代码会变成真机永不执行。
this._remResizeHandler = applyRemBase
applyRemBase()
window.addEventListener('resize', this._remResizeHandler)
// #endif // #endif
// 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小);0.45 平板基准偏大,H5/Electron 桌面统一 0.42(0.28 基础上整体放大 50%)
const REM_SCALE = 0.42
const setFontSize = () => {
const docEl = document.documentElement
const width = docEl.clientWidth || window.innerWidth || 1920
const height = docEl.clientHeight || window.innerHeight || 1280
const scale = Math.min(width / 1920, height / 1280)
docEl.style.fontSize = (scale * 100 * REM_SCALE) + 'px'
console.log('[rem-renderjs] fontSize =', docEl.style.fontSize, 'width =', width, 'height =', height, 'scale =', scale, 'REM_SCALE =', REM_SCALE, 'dpr =', window.devicePixelRatio)
}
this._remResizeHandler = setFontSize
setFontSize()
window.addEventListener('resize', setFontSize)
}, },
beforeDestroy() { beforeDestroy() {
if (this._remResizeHandler) { if (this._remResizeHandler) {
@ -61,22 +56,15 @@ export default {
} }
</script> </script>
<style> <style>
/* 基准(src/styles/base.css 的 .page、.page-main):整屏 flex 列布局 + 内容区吃满剩余高度
+ 四周内间距(上 0.05、左右下 0.25),本页只写差异项 */
.page { .page {
height: 100%; height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden; overflow: hidden;
box-sizing: border-box;
background-color: #f8f8f8;
} }
.page-main { .page-main {
flex: 1;
min-height: 0;
overflow-y: auto; overflow-y: auto;
padding: 0.205rem 0.819rem 0.819rem;
box-sizing: border-box;
} }
.dynamic-view--catch-weight { .dynamic-view--catch-weight {
@ -84,23 +72,23 @@ export default {
} }
.module-card { .module-card {
background-color: #fff; background-color: var(--wms-card-bg);
border-radius: 0.41rem; border-radius: 0.13rem;
padding: 0.819rem; padding: 0.25rem;
box-sizing: border-box; box-sizing: border-box;
} }
.module-card-title { .module-card-title {
display: block; display: block;
font-size: 0.819rem; font-size: 0.22rem;
color: #333; color: var(--wms-text);
font-weight: 600; font-weight: 600;
margin-bottom: 0.307rem; margin-bottom: 0.1rem;
} }
.module-card-desc { .module-card-desc {
display: block; display: block;
font-size: 0.666rem; font-size: 0.18rem;
color: #888; color: #888;
line-height: 1.5; line-height: 1.5;
} }