修改登录页

This commit is contained in:
zm2000 2026-09-19 14:43:31 +08:00
parent 01599d1716
commit b2607a22e0
8 changed files with 63 additions and 152 deletions

View File

@ -4,7 +4,7 @@ const DESIGN_WIDTH = 1920
const DESIGN_HEIGHT = 1280
const BASE_FONT_SIZE = 100
// 整体缩放系数:<1 整体缩小,>1 整体放大(布局偏大就调小这个值)
const REM_SCALE = 0.45
const REM_SCALE = 0.675
function logScreenInfo () {
try {
@ -78,6 +78,12 @@ export default {
<style>
/*每个页面公共css */
/* rem 基准:设计稿 1920×1280,REM_SCALE=0.675
fontSize = min(w/1920, h/1280) × 67.5px = min(3.515625vw, 5.2734375vh)
纯 CSS 实现,首帧即正确,不依赖 renderjs 时序(修复真机退出登录后白屏) */
html {
font-size: min(3.515625vw, 5.2734375vh);
}
/* H5/Electron 下 picker 下拉弹窗宽度与触发下拉框一致(高特异性覆盖库默认 300px),阴影调淡 */
uni-picker .uni-picker-container .uni-picker-custom,

View File

@ -12,7 +12,7 @@
"compilerVersion" : 3,
"screenOrientation" : [ "landscape-primary", "landscape-secondary" ],
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"alwaysShowBeforeRender" : false,
"waiting" : true,
"autoclose" : true,
"delay" : 0

View File

@ -37,6 +37,10 @@ export default {
})
},
onShow() {
this.lockLandscape()
setTimeout(() => {
this.lockLandscape()
}, 300)
uni.hideKeyboard?.()
;[80, 180, 320, 520].forEach((delay) => {
setTimeout(() => {
@ -75,6 +79,29 @@ export default {
},
},
methods: {
// 强制锁定横屏 + 全屏重排:真机 reLaunch 后新 WebView 可能以竖屏尺寸创建,需 setStyle 强制全屏
lockLandscape() {
// #ifdef APP-PLUS
try {
const screen = plus && plus.screen
if (screen && typeof screen.lockOrientation === 'function') {
screen.lockOrientation('landscape')
console.log('[index] lockOrientation=landscape done')
}
if (typeof plus !== 'undefined' && plus.webview) {
const wv = plus.webview.currentWebview()
if (wv && typeof wv.setStyle === 'function') {
wv.setStyle({ top: '0px', bottom: '0px', left: '0px', right: '0px' })
console.log('[index] webview setStyle fullscreen done')
}
}
return true
} catch (e) {
console.error('[index] lockOrientation 异常:', e)
}
// #endif
return false
},
getMenuTitle(menu) {
return menu?.meta?.title || menu?.name || '未命名菜单'
},
@ -187,31 +214,6 @@ export default {
}
</script>
<script module="remInject" lang="renderjs">
export default {
mounted() {
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
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) {
window.removeEventListener('resize', this._remResizeHandler)
this._remResizeHandler = null
}
}
}
</script>
<style>
.layout-page {
min-height: 100vh;

View File

@ -1603,31 +1603,6 @@ export default {
}
</script>
<script module="remInject" lang="renderjs">
export default {
mounted() {
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
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) {
window.removeEventListener('resize', this._remResizeHandler)
this._remResizeHandler = null
}
}
}
</script>
<style>
.page {
min-height: 100vh;

View File

@ -3150,31 +3150,6 @@ export default {
}
</script>
<script module="remInject" lang="renderjs">
export default {
mounted() {
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
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) {
window.removeEventListener('resize', this._remResizeHandler)
this._remResizeHandler = null
}
}
}
</script>
<style>
.page {
height: 100%;

View File

@ -584,6 +584,7 @@ export default {
})
return
}
this.lockLandscape()
this.restoreWorkbenchMember()
this.loadTodayPackStat()
this.loadWorkbenchInfo()
@ -591,6 +592,10 @@ export default {
onShow() {
try {
this.pageActive = true
this.lockLandscape()
setTimeout(() => {
this.lockLandscape()
}, 300)
this.attachPlusKeyboardListener()
this.attachGlobalKeyboardListener()
this.startScanWatchdog()
@ -607,6 +612,29 @@ export default {
this.clearScanTimers()
},
methods: {
// 强制锁定横屏 + 全屏重排:真机 reLaunch 后新 WebView 可能以竖屏尺寸创建,需 setStyle 强制全屏
lockLandscape() {
// #ifdef APP-PLUS
try {
const screen = plus && plus.screen
if (screen && typeof screen.lockOrientation === 'function') {
screen.lockOrientation('landscape')
console.log('[packaging] lockOrientation=landscape done')
}
if (typeof plus !== 'undefined' && plus.webview) {
const wv = plus.webview.currentWebview()
if (wv && typeof wv.setStyle === 'function') {
wv.setStyle({ top: '0px', bottom: '0px', left: '0px', right: '0px' })
console.log('[packaging] webview setStyle fullscreen done')
}
}
return true
} catch (e) {
console.error('[packaging] lockOrientation 异常:', e)
}
// #endif
return false
},
handlePackSearch() {
const kw = this.dedupeRepeatedScan(String(this.keyword || '').trim())
if (!kw) {
@ -2689,31 +2717,6 @@ export default {
}
</script>
<script module="remInject" lang="renderjs">
export default {
mounted() {
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
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) {
window.removeEventListener('resize', this._remResizeHandler)
this._remResizeHandler = null
}
}
}
</script>
<style>
.page {
height: 100vh;

View File

@ -30,31 +30,6 @@ export default {
}
</script>
<script module="remInject" lang="renderjs">
export default {
mounted() {
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
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) {
window.removeEventListener('resize', this._remResizeHandler)
this._remResizeHandler = null
}
}
}
</script>
<style>
.page {
height: 100%;

View File

@ -30,31 +30,6 @@ export default {
}
</script>
<script module="remInject" lang="renderjs">
export default {
mounted() {
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
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) {
window.removeEventListener('resize', this._remResizeHandler)
this._remResizeHandler = null
}
}
}
</script>
<style>
.page {
height: 100%;