Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 28206b44
authored
Mar 06, 2026
by
cen
Committed by
chenwq1
Mar 17, 2026
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 竖屏布局
1 parent
00f5c1cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
447 additions
and
104 deletions
apps/uniappX/uniapp-x-tape/App.uvue
apps/uniappX/uniapp-x-tape/adapt/landscape/1080/boutique-index.scss
apps/uniappX/uniapp-x-tape/adapt/landscape/1080/home-frame.scss
apps/uniappX/uniapp-x-tape/adapt/landscape/1080/login.scss
apps/uniappX/uniapp-x-tape/adapt/landscape/1920/boutique-index.scss
apps/uniappX/uniapp-x-tape/adapt/landscape/1920/home-frame.scss
apps/uniappX/uniapp-x-tape/adapt/landscape/1920/login.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/account-items.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/boutique-index.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/home-frame.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/login.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/account-items.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/boutique-index.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/home-frame.scss
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/login.scss
apps/uniappX/uniapp-x-tape/components/HomeFrame/LeftSide.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/index.uvue
apps/uniappX/uniapp-x-tape/components/LayoutRoot/index.uvue
apps/uniappX/uniapp-x-tape/manifest.json
apps/uniappX/uniapp-x-tape/pages.json
apps/uniappX/uniapp-x-tape/pages/common/accountItems/index.uvue
apps/uniappX/uniapp-x-tape/pages/common/components/MerchantList.uvue
apps/uniappX/uniapp-x-tape/pages/common/components/Scene.uvue
apps/uniappX/uniapp-x-tape/pages/common/login/index.uvue
apps/uniappX/uniapp-x-tape/services/LayoutService.uts
apps/uniappX/uniapp-x-tape/App.uvue
View file @
28206b4
...
...
@@ -11,10 +11,8 @@ export default {
onLaunch () {
// #ifdef APP
layoutService.init();
// uni.onWindowResize((res) => {
// updateResolutionConfig();
// });
const sys = uni.getSystemInfoSync();
console.log(`[App] 当前分辨率:${ sys.screenWidth } x ${ sys.screenHeight}`);
// #endif
console.log("App Launch");
...
...
@@ -60,9 +58,24 @@ export default {
};
</script>
<style>
<style
lang="scss"
>
/* 引入自定义 CSS 工具类 */
@import url("./common.css");
/* I18n 布局适配:横竖屏 + 分辨率 */
@import "./adapt/landscape/1080/home-frame.scss";
@import "./adapt/landscape/1920/home-frame.scss";
@import "./adapt/portrait/1080/home-frame.scss";
@import "./adapt/portrait/1920/home-frame.scss";
@import "./adapt/landscape/1080/boutique-index.scss";
@import "./adapt/landscape/1920/boutique-index.scss";
@import "./adapt/portrait/1080/boutique-index.scss";
@import "./adapt/portrait/1920/boutique-index.scss";
@import "./adapt/landscape/1080/login.scss";
@import "./adapt/landscape/1920/login.scss";
@import "./adapt/portrait/1080/login.scss";
@import "./adapt/portrait/1920/login.scss";
@import "./adapt/portrait/1080/account-items.scss";
@import "./adapt/portrait/1920/account-items.scss";
/* 全局默认样式 */
uni-page-body {
...
...
apps/uniappX/uniapp-x-tape/adapt/landscape/1080/boutique-index.scss
0 → 100644
View file @
28206b4
/* 精品页 横屏 1080 档位适配
* 目前主要依赖全局 spacing/font/radius 变量,这里预留结构,后续可按需补充页面级变量
*/
.mode-landscape.res-1080
{
/* 示例:可在此处为精品页单独定义变量,例如:
* --boutique-card-height: 200px;
*/
}
apps/uniappX/uniapp-x-tape/adapt/landscape/1080/home-frame.scss
0 → 100644
View file @
28206b4
/* HomeFrame 横屏 1080 档位适配 */
.home-frame-container.mode-landscape.res-1080
{
/* 对应 layout-vars.uts 中 1024/1174 档的值 */
--l-content-left-width
:
605px
;
--l-module-box-height
:
332px
;
--l-tool-box-min-height
:
120px
;
--l-common-title-height
:
60px
;
}
apps/uniappX/uniapp-x-tape/adapt/landscape/1080/login.scss
0 → 100644
View file @
28206b4
/* 登录选择账号页 横屏 1080 档位适配
* 通过 LayoutRoot 上的 .mode-landscape.res-1080 类控制,仅在横屏 1080 档时生效。
*/
.mode-landscape.res-1080
{
/* 示例:可根据登录页设计调整根容器
* .page-container {
* padding: 0 var(--l-spacing-lg);
* }
*/
}
apps/uniappX/uniapp-x-tape/adapt/landscape/1920/boutique-index.scss
0 → 100644
View file @
28206b4
/* 精品页 横屏 1920 档位适配(预留) */
.mode-landscape.res-1920
{
/* 示例:后续可在此定义 1920 档变量 */
}
apps/uniappX/uniapp-x-tape/adapt/landscape/1920/home-frame.scss
0 → 100644
View file @
28206b4
/* HomeFrame 横屏 1920 档位适配 */
.home-frame-container.mode-landscape.res-1920
{
/* 对应 layout-vars.uts 中 1920 档的值 */
--l-content-left-width
:
1134px
;
--l-module-box-height
:
623px
;
--l-tool-box-min-height
:
225px
;
--l-common-title-height
:
113px
;
}
apps/uniappX/uniapp-x-tape/adapt/landscape/1920/login.scss
0 → 100644
View file @
28206b4
/* 登录选择账号页 横屏 1920 档位适配
* 大屏(如 1920 宽度)下,可在此增加更宽松的留白和布局。
*/
.mode-landscape.res-1920
{
/* 示例:后续按实际设计稿补充
* .page-container {
* max-width: 1600px;
* margin: 0 auto;
* }
*/
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/account-items.scss
0 → 100644
View file @
28206b4
/* 账号选择页 竖屏 1080 档位适配
* 典型手机竖屏场景(如 360 x 800 等宽度归为 1080 档)。
* 通过 .account-page 避免影响其他页面。
*/
.mode-portrait.res-1080
.account-page
{
.layout
{
padding-top
:
48px
;
padding-bottom
:
24px
;
}
.content-box
{
top
:
120px
;
bottom
:
48px
;
width
:
94%
;
border-radius
:
16px
;
}
.step-box
{
transform
:
scale
(
0
.9
);
}
/* 竖屏下账号/门店列表:一行一个,撑满宽度 */
.box
{
padding
:
0
16px
;
justify-content
:
flex-start
;
}
.box
.items
{
width
:
100%
;
margin-bottom
:
16px
;
}
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/boutique-index.scss
0 → 100644
View file @
28206b4
/* 精品页 竖屏 1080 档位适配
* 使用 LayoutRoot 提供的 mode/res class:
* - .mode-portrait.res-1080
* 可在此范围内定制精品页在竖屏手机上的布局与尺寸。
*/
.mode-portrait.res-1080
{
/* 精品首页竖屏下“开始接待”区域适配,降低高度避免图片拉伸感 */
.start
{
height
:
96px
;
padding-top
:
24px
;
}
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/home-frame.scss
0 → 100644
View file @
28206b4
/* HomeFrame 竖屏 1080 档位适配
* 注意:数值暂时复用横屏 1080 档,后续可根据你的竖屏设计稿单独调整
*/
.home-frame-container.mode-portrait.res-1080
{
--l-content-left-width
:
605px
;
--l-module-box-height
:
332px
;
--l-tool-box-min-height
:
120px
;
--l-common-title-height
:
60px
;
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1080/login.scss
0 → 100644
View file @
28206b4
/* 登录页 竖屏 1080 档位适配(如 360 x 800 等宽度归为 1080 档)
* 通过 .login-page 避免影响其他页面;仅在手机竖屏时生效。
*/
.mode-portrait.res-1080
.login-page
{
.layout
{
justify-content
:
flex-start
;
align-items
:
stretch
;
padding
:
32px
24px
;
}
.login
{
align-items
:
stretch
;
margin-top
:
16px
;
max-width
:
320px
;
margin-left
:
auto
;
margin-right
:
auto
;
}
.login
.title
{
font-size
:
28px
;
margin-bottom
:
12px
;
}
.login
.sub-title
{
font-size
:
14px
;
margin
:
12px
0
20px
;
}
.login
.input
{
width
:
100%
;
height
:
48px
;
border-radius
:
24px
;
margin-bottom
:
16px
;
}
.login
.btn
{
width
:
100%
;
height
:
48px
;
margin-top
:
8px
;
font-size
:
18px
;
}
.form-footer
{
padding-left
:
0
;
margin-top
:
16px
;
}
.app-code
{
bottom
:
12px
;
/* 手机端登录页 APP 编码:完全使用固定像素,不参与变量缩放 */
font-size
:
10px
!
important
;
line-height
:
14px
;
left
:
50%
;
transform
:
translateX
(
-50%
)
scale
(
0
.85
);
}
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/account-items.scss
0 → 100644
View file @
28206b4
/* 账号选择页 竖屏 1920 档位适配(预留)
* 如后续有竖屏大屏需求,可在此补充。
*/
.mode-portrait.res-1920
.account-page
{
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/boutique-index.scss
0 → 100644
View file @
28206b4
/* 精品页 竖屏 1920 档位适配(预留)
* 当前大屏场景通常为横屏,此处作为扩展占位。
*/
.mode-portrait.res-1920
{
/* 根据后续竖屏大屏设计补充 */
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/home-frame.scss
0 → 100644
View file @
28206b4
/* HomeFrame 竖屏 1920 档位适配
* 注意:数值暂时复用横屏 1920 档,后续可根据你的竖屏设计稿单独调整
*/
.home-frame-container.mode-portrait.res-1920
{
--l-content-left-width
:
1134px
;
--l-module-box-height
:
623px
;
--l-tool-box-min-height
:
225px
;
--l-common-title-height
:
113px
;
}
apps/uniappX/uniapp-x-tape/adapt/portrait/1920/login.scss
0 → 100644
View file @
28206b4
/* 登录选择账号页 竖屏 1920 档位适配(预留)
* 如后续有竖屏大屏设备需求,可在此补充。
*/
.mode-portrait.res-1920
{
/* 预留占位,不影响现有布局 */
}
apps/uniappX/uniapp-x-tape/components/HomeFrame/LeftSide.uvue
View file @
28206b4
<template>
<view class="left-side left-side-pad">
<!-- 横屏 / Pad:左侧竖向导航(头像 + 场景切换 + 设置) -->
<view v-if="!isPortraitMode"
class="left-side left-side-pad">
<image class="left-side-bg-img"
mode="aspectFill"
src="/static/images/home/left-bg.png" />
...
...
@@ -35,6 +37,20 @@
<SettingBox :visible="showSetting"
@update:visible="onSettingVisible" />
</view>
<!-- 竖屏手机:底部 TabBar,仅保留场景 Tab,不显示头像和底部两个按钮 -->
<view v-else
class="left-side left-side-portrait">
<view class="portrait-tabs-row">
<view v-for="(item, index) in tabs"
:key="index"
class="tab-item tab-item-inline"
:class="[tabIndex == index ? 'tabActive' : '']"
@click="onChangeTab(index)">
<text class="tab-label">{{ item.label }}</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
...
...
@@ -234,6 +250,7 @@ function jumpPersonCenter(): void {
padding: var(--l-spacing-sm) var(--l-spacing-md);
min-height: 56px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
justify-content: center;
}
.portrait-top-row {
...
...
@@ -255,6 +272,7 @@ function jumpPersonCenter(): void {
flex-direction: row;
align-items: center;
padding: 0 var(--l-spacing-sm);
justify-content: center;
}
.portrait-tabs-row .tab-item-inline {
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/index.uvue
View file @
28206b4
<template>
<view class="home-frame-container">
<view class="home-frame-container"
:class="[modeClass, resolutionClass]">
<!-- 首页内容区 -->
<view v-if="!showDetail"
class="home-content home-content-pad">
<HomeFrameLeftSide :tab-index="tabIndex"
:user-info="userInfo"
@change-tab="onChangeTab" />
<view class="right-side">
class="home-content"
:class="[isPortraitMode ? 'home-content-portrait' : 'home-content-pad']">
<!-- 右侧内容:竖屏和横屏共用一套结构,只是顺序不同 -->
<view v-if="isPortraitMode" class="right-side">
<!-- 横屏三卡片布局:轻改等使用 swiperCustom -->
<view v-if="useCardLayout && tabIndex == 0" class="app-content-box right-content show-content-box">
<view class="start" @click="onStartClick">
<image class="start-bg-img"
:mode="isPortraitMode ? 'aspectFill' : 'scaleToFill'"
src="/static/images/home/start-btn.png" />
<view class="start-inner">
<text class="start-text">开始接待</text>
</view>
</view>
<view class="right-content-box flex-row">
<view class="content-left">
<view class="module-box box-class">
<view class="common-title">
<text class="title-text">产品介绍</text>
</view>
<view class="content-box">
<slot v-if="swiperCustom" name="swiperCustom"></slot>
<view v-else class="swiper-placeholder">
<text class="placeholder-text">敬请期待</text>
</view>
</view>
</view>
<view class="tool-box box-class">
<view class="common-title">
<text class="title-text">展业工具</text>
</view>
<view class="content-box">
<Entrance :scene-type="sceneType" />
</view>
</view>
</view>
<view class="content-right box-class">
<view class="common-title">
<text class="title-text">服务中心</text>
</view>
<view class="content-box">
<HomeFrameMessageIndex class="message-box" />
</view>
</view>
</view>
</view>
<!-- 旧版居中布局:权益、二手车等使用 #home -->
<view v-else-if="tabIndex == 0" class="legacy-home-wrap">
<slot name="home"></slot>
</view>
</view>
<view v-else class="right-side">
<!-- 横屏三卡片布局:轻改等使用 swiperCustom -->
<view v-if="useCardLayout && tabIndex == 0" class="app-content-box right-content show-content-box">
<view class="start" @click="onStartClick">
...
...
@@ -54,6 +104,18 @@
<slot name="home"></slot>
</view>
</view>
<!-- 竖屏:底部 TabBar;横屏:左侧栏 -->
<HomeFrameLeftSide v-if="isPortraitMode"
:is-portrait="true"
:tab-index="tabIndex"
:user-info="userInfo"
@change-tab="onChangeTab" />
<HomeFrameLeftSide v-else
:is-portrait="false"
:tab-index="tabIndex"
:user-info="userInfo"
@change-tab="onChangeTab" />
<!-- 底部门店信息:与 right-side 同级,样式与旧项目 store-addr 一致 -->
<!-- <view v-if="showFooter" class="store-addr">
<view class="addr-line addr-line-left"></view>
...
...
@@ -74,6 +136,7 @@
import { computed, defineExpose, ref } from "vue";
import Entrance from "@/components/Entrance.uvue";
import { layoutService } from "@/services/LayoutService.uts";
import { storage } from "@/utils/storage.uts";
import HomeFrameLeftSide from "./LeftSide.uvue";
...
...
@@ -92,6 +155,22 @@ const useCardLayout = computed((): boolean => {
return props.swiperCustom === true;
});
const modeClass = computed((): string => {
const modeRef = layoutService.getCurrentMode();
const m = modeRef.value;
// pad / desktop 归为横屏,portrait 归为竖屏
return m == "portrait" ? "mode-portrait" : "mode-landscape";
});
const resolutionClass = computed((): string => {
const bucket = layoutService.getResolutionBucket();
return `res-${bucket}`;
});
const isPortraitMode = computed((): boolean => {
return layoutService.isMode("portrait");
});
const showDetail = ref(false);
const userInfo = ref<UTSJSONObject>({});
const sceneType = ref<number>(1);
...
...
@@ -130,6 +209,7 @@ defineExpose({
</script>
<style scoped lang="scss">
.home-frame-container {
width: 100%;
height: 100%;
...
...
@@ -152,6 +232,10 @@ defineExpose({
flex-direction: row;
}
.home-content-portrait {
flex-direction: column;
}
.detail-content {
flex: 1;
width: 100%;
...
...
@@ -166,7 +250,16 @@ defineExpose({
overflow: hidden;
}
.mode-portrait .right-side {
order: 1;
}
.mode-portrait .left-side-portrait {
order: 2;
}
.app-content-box {
margin-top: 50px;
flex: 1;
display: flex;
flex-direction: column;
...
...
@@ -179,7 +272,7 @@ defineExpose({
/* 与旧项目一致:背景图铺满,文字居中偏上,无渐变遮罩 */
.start {
height:
12
6px;
height:
8
6px;
box-sizing: border-box;
margin-right: 32px;
position: relative;
...
...
@@ -216,7 +309,7 @@ defineExpose({
}
.start-text {
font-size:
36
px;
font-size:
20
px;
font-weight: 600;
color: #ffffff;
text-align: center;
...
...
apps/uniappX/uniapp-x-tape/components/LayoutRoot/index.uvue
View file @
28206b4
<template>
<view class="layout-root" :style="styleObj">
<view class="layout-root" :
class="[modeClass, resolutionClass]" :
style="styleObj">
<slot></slot>
</view>
</template>
...
...
@@ -7,15 +7,28 @@
<script setup lang="uts">
import { computed, type Ref } from 'vue'
import { useLayout } from '@/composables/useLayout'
import { layoutService } from '@/services/LayoutService.uts'
const layout = useLayout()
const rawCssVars = (layout as UTSJSONObject)['cssVars'] as Ref<UTSJSONObject> | null
const styleObj = computed((): UTSJSONObject => {
const r = rawCssVars
if (r == null) return {}
const v = r.value
return v != null ? v : {}
})
const modeClass = computed((): string => {
const modeRef = layoutService.getCurrentMode()
const m = modeRef.value
return m == 'portrait' ? 'mode-portrait' : 'mode-landscape'
})
const resolutionClass = computed((): string => {
const bucket = layoutService.getResolutionBucket()
return `res-${bucket}`
})
</script>
<style scoped>
...
...
apps/uniappX/uniapp-x-tape/manifest.json
View file @
28206b4
...
...
@@ -41,6 +41,7 @@
}
},
"orientation"
:
[
"portrait-primary"
,
"landscape-primary"
]
}
...
...
@@ -66,6 +67,7 @@
"default"
:
{}
},
"orientation"
:
[
"portrait-primary"
,
"landscape-primary"
],
"permissions"
:
[
...
...
@@ -93,6 +95,7 @@
"icons"
:
{},
"splashScreens"
:
{},
"orientation"
:
[
"portrait-primary"
,
"landscape-primary"
]
}
...
...
apps/uniappX/uniapp-x-tape/pages.json
View file @
28206b4
...
...
@@ -82,8 +82,7 @@
"navigationBarTextStyle"
:
"black"
,
"navigationBarTitleText"
:
"uni-app x"
,
"navigationBarBackgroundColor"
:
"#F8F8F8"
,
"backgroundColor"
:
"#F8F8F8"
,
"pageOrientation"
:
"landscape"
"backgroundColor"
:
"#F8F8F8"
},
"uniIdRouter"
:
{}
}
apps/uniappX/uniapp-x-tape/pages/common/accountItems/index.uvue
View file @
28206b4
This diff is collapsed.
Click to expand it.
apps/uniappX/uniapp-x-tape/pages/common/components/MerchantList.uvue
View file @
28206b4
...
...
@@ -323,13 +323,13 @@ defineExpose({
.items .name {
font-weight: 500;
font-size:
var(--l-font-base)
;
font-size:
16px
;
color: #181a1f;
margin-bottom: 6px;
}
.items .text_no {
font-size:
var(--l-font-sm)
;
font-size:
14px
;
color: #999ea8;
}
...
...
apps/uniappX/uniapp-x-tape/pages/common/components/Scene.uvue
View file @
28206b4
This diff is collapsed.
Click to expand it.
apps/uniappX/uniapp-x-tape/pages/common/login/index.uvue
View file @
28206b4
<template>
<Layout class="layout">
<view class="bg"></view>
<view class="login flex-col">
<text class="title">登录</text>
<text class="sub-title">手机号码登录</text>
<layout-root>
<view class="layout login-page">
<view class="bg"></view>
<view class="login flex-col">
<text class="title">登录</text>
<text class="sub-title">手机号码登录</text>
<view class="input">
<input v-model="mobile"
auto-blur
maxlength="11"
placeholder="请输入手机号"
type="tel" />
<view v-if="mobile != ''"
class="icon"
@click="clearMobile">
<icon color="#000"
size="16"
type="clear">
</icon>
<view class="input">
<input v-model="mobile"
auto-blur
maxlength="11"
placeholder="请输入手机号"
type="tel" />
<view v-if="mobile != ''"
class="icon"
@click="clearMobile">
<icon color="#000"
size="16"
type="clear">
</icon>
</view>
</view>
</view>
<view class="input">
<input v-model="code"
auto-blur
maxlength="4"
placeholder="请输入验证码"
type="number" />
<view v-if="code != ''"
class="icon"
@click="clearCode">
<icon color="#000"
size="16"
type="clear">
</icon>
</view>
<view class="code-btn"
:class="[count > 0 ? 'code-disabled' : '']"
@click="getSmsCode">
{{ count > 0 ? `重新发送(${count}s)` : '获取验证码' }}
<view class="input">
<input v-model="code"
auto-blur
maxlength="4"
placeholder="请输入验证码"
type="number" />
<view v-if="code != ''"
class="icon"
@click="clearCode">
<icon color="#000"
size="16"
type="clear">
</icon>
</view>
<view class="code-btn"
:class="[count > 0 ? 'code-disabled' : '']"
@click="getSmsCode">
{{ count > 0 ? `重新发送(${count}s)` : '获取验证码' }}
</view>
</view>
</view>
<button class="btn"
@click="login">
登录
</button>
<view class="form-footer">
<view class="autoLogin">
<radio :checked="readingStatus"
color="#2C66F7"
@click="toggleReadingStatus">
</radio>
<text @click="toggleReadingStatus">我已阅读并同意</text>
<text @click.stop="openPrivacy">《隐私协议》</text>
</view>
<button class="btn"
@click="login">
登录
</button>
<view class="form-footer">
<view class="autoLogin">
<radio :checked="readingStatus"
color="#2C66F7"
@click="toggleReadingStatus">
</radio>
<text @click="toggleReadingStatus">我已阅读并同意</text>
<text @click.stop="openPrivacy">《隐私协议》</text>
</view>
<view class="autoLogin">
<radio :checked="noSignIn"
color="#2C66F7"
@click="toggleNoSignIn">
</radio>
<text @click="toggleNoSignIn">30天内免登录</text>
<view class="autoLogin">
<radio :checked="noSignIn"
color="#2C66F7"
@click="toggleNoSignIn">
</radio>
<text @click="toggleNoSignIn">30天内免登录</text>
</view>
</view>
</view>
</view>
<view class="app-code flex">
APP编码:{{ deviceId }}
<view class="sprite-icon icon-clone"
@click="copyDeviceId">
<view class="app-code flex">
APP编码:{{ deviceId }}
<view class="sprite-icon icon-clone"
@click="copyDeviceId">
</view>
</view>
</view>
</layout-root>
<!-- Test Entry Point -->
<!-- <view class="test-entry" @click="goToTest">
<text>测试入口</text>
</view>
<view class="demo-test" :style="{ paddingLeft: $resState.config.demo.paddingLeft }">
<text :style="{ fontSize: $resState.config.demo.titleFontSize }">Resolution Demo Text</text>
<image mode="widthFix"
:src="$getResImg($resState.config.demo.heroImageSrc)"
:style="{ width: $resState.config.demo.heroImageWidth }">
</image>
</view> -->
</Layout>
</template>
<script setup lang="uts">
...
...
@@ -94,8 +86,8 @@ import { ref, watch } from "vue";
import { apiAutoLogin, apiGetSmsCode, apiSmsLogin } from "@/api/user-api.uts";
import { storage } from "@/utils/storage.uts";
//
import { onLoad } from "@dcloudio/uni-app";
import { onLoad } from "@dcloudio/uni-app";
// 手机号正则
const phoneRex = /^1([3-9])\d{9}$/;
...
...
@@ -370,12 +362,6 @@ function toggleReadingStatus(): void {
function toggleNoSignIn(): void {
noSignIn.value = !noSignIn.value;
}
function goToTest(): void {
uni.navigateTo({
url: "/pages/test/index"
});
}
</script>
<style scoped lang="scss">
...
...
apps/uniappX/uniapp-x-tape/services/LayoutService.uts
View file @
28206b4
...
...
@@ -118,7 +118,12 @@ class LayoutService {
* 更新 CSS 变量缓存(遍历 LAYOUT_VARS)
*/
private updateCSSVariables(): void {
const w = this.screenWidth.value
// 对于 portrait 模式,使用物理短边参与缩放,避免横屏手机出现非常大的宽度(例如 800x360),
// 造成与 H5 模拟器(390x844)视觉比例差异过大
const sw = this.screenWidth.value
const sh = this.screenHeight.value
const isPortraitMode = this.currentMode.value == 'portrait'
const w = isPortraitMode ? (sw < sh ? sw : sh) : sw
const baseWidth = this.getBaseWidth()
const out: UTSJSONObject = {}
...
...
@@ -180,6 +185,22 @@ class LayoutService {
}
/**
* 获取当前分辨率档位(例如 1080 / 1920)
* - 仅用于选择 I18n 适配配置,不追求特别细的区分
*/
getResolutionBucket(): string {
if (!this.initialized.value) {
this.init()
}
const sw = this.screenWidth.value
const sh = this.screenHeight.value
const isPortraitMode = this.currentMode.value == 'portrait'
const w = isPortraitMode ? (sw < sh ? sw : sh) : sw
// 简单两档划分:大于等于 1440 归为 1920,否则归为 1080
return w >= 1440 ? '1920' : '1080'
}
/**
* 是否指定模式
*/
isMode(mode: LayoutMode): boolean {
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment