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

View File

@ -231,26 +231,21 @@ export default {
</script>
<script module="remInject" lang="renderjs">
import { applyRemBase } from '../../render-common/rem-base.js'
export default {
mounted() {
// #ifdef APP-PLUS
// 真机 rem 由 App.vue 全局纯 CSS(html { font-size: min(5.2734375vw, 7.91015625vh) },1.0125 系数)承担,
// renderjs 不再覆盖,避免与 CSS 方案互相覆盖导致白屏/抖动
return
// #ifndef APP-PLUS
// rem 基准统一走 render-common/rem-base.js(满格 1rem = 100px,>1280 宽不再放大字体),
// 字号偏大靠改 CSS 的 font-size 值(已全局 ×0.85),不动基准
// 各页面不再各算一份,避免系数漂移(历史上 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
// 整体缩放系数:<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() {
if (this._remResizeHandler) {
@ -265,14 +260,14 @@ export default {
height: 100vh;
min-height: 100vh;
overflow: hidden;
min-width: 19.2rem;
min-width: 6.14rem;
box-sizing: border-box;
padding: 0;
display: flex;
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
background-color: #f8f8f8;
background-color: var(--wms-page-bg);
}
.layout-main {
@ -285,31 +280,21 @@ export default {
}
.module-placeholder {
background-color: #fff;
border-radius: 0.41rem;
padding: 0.717rem;
background-color: var(--wms-card-bg);
border-radius: 0.13rem;
padding: 0.25rem;
}
.module-placeholder-title {
display: block;
font-size: 0.768rem;
color: #333;
font-size: 0.21rem;
color: var(--wms-text);
}
.module-placeholder-desc {
display: block;
margin-top: 0.256rem;
font-size: 0.614rem;
color: #999;
}
@media screen and (max-width: 20.48rem) {
.layout-page {
min-width: 15.2rem;
}
.layout-main {
padding: 0 0.512rem 0.205rem;
}
margin-top: 0.1rem;
font-size: 0.17rem;
color: var(--wms-text-placeholder);
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -31,26 +31,21 @@ export default {
</script>
<script module="remInject" lang="renderjs">
import { applyRemBase } from '../../render-common/rem-base.js'
export default {
mounted() {
// #ifdef APP-PLUS
// 真机 rem 由 App.vue 全局纯 CSS(html { font-size: min(5.2734375vw, 7.91015625vh) },1.0125 系数)承担,
// renderjs 不再覆盖,避免与 CSS 方案互相覆盖导致白屏/抖动
return
// #ifndef APP-PLUS
// rem 基准统一走 render-common/rem-base.js(满格 1rem = 100px,>1280 宽不再放大字体),
// 字号偏大靠改 CSS 的 font-size 值(已全局 ×0.85),不动基准
// 各页面不再各算一份,避免系数漂移
// 真机(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
// 整体缩放系数:<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() {
if (this._remResizeHandler) {
@ -61,22 +56,15 @@ export default {
}
</script>
<style>
/* 基准(src/styles/base.css 的 .page、.page-main):整屏 flex 列布局 + 内容区吃满剩余高度
+ 四周内间距(上 0.05、左右下 0.25),本页只写差异项 */
.page {
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
box-sizing: border-box;
background-color: #f8f8f8;
}
.page-main {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 0.205rem 0.819rem 0.819rem;
box-sizing: border-box;
}
.dynamic-view--catch-weight {
@ -84,23 +72,23 @@ export default {
}
.module-card {
background-color: #fff;
border-radius: 0.41rem;
padding: 0.819rem;
background-color: var(--wms-card-bg);
border-radius: 0.13rem;
padding: 0.25rem;
box-sizing: border-box;
}
.module-card-title {
display: block;
font-size: 0.819rem;
color: #333;
font-size: 0.22rem;
color: var(--wms-text);
font-weight: 600;
margin-bottom: 0.307rem;
margin-bottom: 0.1rem;
}
.module-card-desc {
display: block;
font-size: 0.666rem;
font-size: 0.18rem;
color: #888;
line-height: 1.5;
}