Commit da92007d by chenwq1

style: 更新组件样式以提升适应性和可读性

- 在多个组件中添加条件编译以支持 H5 端的 cursor 样式
- 调整 App 端的 font-size 处理方式,确保在不同设备上的一致性
- 重构工具箱和其他组件的布局,优化文本和图标的显示
- 更新滑动组件的实现,提升用户交互体验
1 parent 1075b6ee
...@@ -81,13 +81,18 @@ export default { ...@@ -81,13 +81,18 @@ export default {
@import "./adapt/portrait/1080/account-items.scss"; @import "./adapt/portrait/1080/account-items.scss";
@import "./adapt/portrait/1920/account-items.scss"; @import "./adapt/portrait/1920/account-items.scss";
/* 全局默认样式 */ /* 全局默认样式:App 端 view 不支持 font-size,基准字号用 var(--l-font-*) 落在 <text> 上 */
.layout-root { .layout-root {
font-size: 14px;
height: 100%; height: 100%;
min-height: 0; min-height: 0;
} }
/* #ifdef H5 */
.layout-root {
font-size: 14px;
}
/* #endif */
/* #ifdef H5 */ /* #ifdef H5 */
svg { svg {
display: initial; display: initial;
......
...@@ -332,9 +332,12 @@ function jumpPersonCenter(): void { ...@@ -332,9 +332,12 @@ function jumpPersonCenter(): void {
padding-top: 46px; /* toRpx(92) / 2 */ padding-top: 46px; /* toRpx(92) / 2 */
} }
/* App 端不支持 cursor,H5 可保留手型 */
/* #ifdef H5 */
.user-box-clickable { .user-box-clickable {
cursor: pointer; cursor: pointer;
} }
/* #endif */
.user-info-row { .user-info-row {
flex-direction: row; flex-direction: row;
......
...@@ -1490,13 +1490,13 @@ onUnmounted(() => { ...@@ -1490,13 +1490,13 @@ onUnmounted(() => {
.font-bold { font-weight: bold; } .font-bold { font-weight: bold; }
.font-extrabold { font-weight: bold; } .font-extrabold { font-weight: bold; }
/* Filter Section:单行展示,窄屏可横向滚动 */ /* Filter Section:单行展示(不用 overflow-x,App ucss 非标准);窄屏依赖子项 min-width + 外层裁剪 */
.filter-section { .filter-section {
flex-direction: row; flex-direction: row;
flex-wrap: nowrap; flex-wrap: nowrap;
margin-bottom: 16px; margin-bottom: 16px;
align-items: center; align-items: center;
overflow-x: auto; overflow: hidden;
} }
.filter-group { .filter-group {
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
@touchstart.stop @touchstart.stop
@touchmove.stop @touchmove.stop
@touchend.stop> @touchend.stop>
<view class="section-title">快捷操作</view> <view class="section-title-row">
<text class="section-title">快捷操作</text>
</view>
<view class="fixed-group"> <view class="fixed-group">
<view class="action-grid"> <view class="action-grid">
<view class="action-item" v-for="(action, idx) in fixedActionSlots" :key="'fixed-' + idx"> <view class="action-item" v-for="(action, idx) in fixedActionSlots" :key="'fixed-' + idx">
...@@ -44,7 +46,9 @@ ...@@ -44,7 +46,9 @@
</view> </view>
</view> </view>
</view> </view>
<view class="section-title" style="margin-top: 10px;">功能工具</view> <view class="section-title-row section-title-row--mt">
<text class="section-title">功能工具</text>
</view>
<view class="dynamic-group"> <view class="dynamic-group">
<view class="action-grid"> <view class="action-grid">
<view class="action-item" v-for="(action, idx) in dynamicActions" :key="'dynamic-' + idx"> <view class="action-item" v-for="(action, idx) in dynamicActions" :key="'dynamic-' + idx">
...@@ -687,15 +691,22 @@ defineExpose({ ...@@ -687,15 +691,22 @@ defineExpose({
display: flex; display: flex;
} }
.section-title { .section-title-row {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;
padding: 0 4px;
}
.section-title-row--mt {
margin-top: 10px;
}
.section-title {
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: bold;
letter-spacing: 0.5px; letter-spacing: 0.5px;
color: rgba(255, 255, 255, 0.45); color: rgba(255, 255, 255, 0.45);
padding: 0 4px;
} }
.dynamic-group { .dynamic-group {
...@@ -741,7 +752,6 @@ defineExpose({ ...@@ -741,7 +752,6 @@ defineExpose({
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer;
transition: transform 0.2s ease, opacity 0.2s ease; transition: transform 0.2s ease, opacity 0.2s ease;
width: 100%; width: 100%;
} }
...@@ -764,7 +774,17 @@ defineExpose({ ...@@ -764,7 +774,17 @@ defineExpose({
overflow: hidden; overflow: hidden;
flex-shrink: 0; flex-shrink: 0;
.btn-icon, /* image 上禁止 flex 对齐属性,由外层 .icon-box 居中 */
.btn-icon {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
z-index: 1;
}
.sprite-icon { .sprite-icon {
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -773,6 +793,7 @@ defineExpose({ ...@@ -773,6 +793,7 @@ defineExpose({
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 1; z-index: 1;
......
...@@ -9,44 +9,52 @@ ...@@ -9,44 +9,52 @@
<template #swiperCustom> <template #swiperCustom>
<view v-if="logic.loadComplete.value" class="swiper-custom-wrap"> <view v-if="logic.loadComplete.value" class="swiper-custom-wrap">
<view v-if="logic.packageList.value.length > 0" class="swiper-custom-content"> <view v-if="logic.packageList.value.length > 0" class="swiper-custom-content">
<swiper class="package-swiper" :current="logic.currentSwiperIndex.value" @change="logic.onSwiperChange"> <view class="package-swiper-stack">
<swiper-item v-for="(item, idx) in logic.packageList.value" :key="idx" @tap="toDetail(idx)"> <un-swiper
<image class="package-swiper"
v-if="logic.getPkg(item, 'bannerImg')" :list="packageSwiperUrls"
class="swiper-bg" :indicator="false"
mode="aspectFill" :autoplay="false"
:src="logic.getPkg(item, 'bannerImg')" :circular="logic.packageList.value.length > 1"
/> :current="logic.currentSwiperIndex.value"
imgMode="aspectFill"
height="100%"
radius="0"
bgColor="transparent"
@change="onPackageSwiperChange"
@click="onPackageSwiperClick"
/>
<view v-if="currentPackageItem != null" class="package-swiper-overlay">
<view class="swiper-name"> <view class="swiper-name">
{{ logic.getPkg(item, "name") }} {{ logic.getPkg(currentPackageItem, "name") }}
</view> </view>
<view class="swiper-content-box"> <view class="swiper-content-box">
<view class="price price-1"> <view class="price price-1">
<text class="price-label">市场价</text> <text class="price-label">市场价</text>
<view class="num"> <view class="num">
<text class="unit">¥</text> <text class="unit">¥</text>
<text>{{ logic.getPkg(item, "marketPrice") }}</text> <text>{{ logic.getPkg(currentPackageItem, "marketPrice") }}</text>
</view> </view>
</view> </view>
<view class="price price-2"> <view class="price price-2">
{{ logic.getPkg(item, "discountPrice") }} {{ logic.getPkg(currentPackageItem, "discountPrice") }}
</view> </view>
<view class="price price-3"> <view class="price price-3">
<text class="price-label">套餐价</text> <text class="price-label">套餐价</text>
<view class="num"> <view class="num">
<text class="unit">¥</text> <text class="unit">¥</text>
<text>{{ logic.getPkg(item, "packagePrice") }}</text> <text>{{ logic.getPkg(currentPackageItem, "packagePrice") }}</text>
</view> </view>
</view> </view>
<view class="briefIntroduction"> <view class="briefIntroduction">
{{ logic.getPkg(item, "briefIntroduction") }} {{ logic.getPkg(currentPackageItem, "briefIntroduction") }}
</view> </view>
</view> </view>
<view class="swiper-btn"> <view class="swiper-btn" @click="toDetailCurrent">
查看详情 查看详情
</view> </view>
</swiper-item> </view>
</swiper> </view>
<view class="swiper-dots"> <view class="swiper-dots">
<view <view
v-for="(_, i) in logic.packageList.value" v-for="(_, i) in logic.packageList.value"
...@@ -103,7 +111,7 @@ ...@@ -103,7 +111,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from "vue"; import { computed, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue"; import CenterPopup from "@/components/CenterPopup.uvue";
import HomeFrame from "@/components/HomeFrame/index.uvue"; import HomeFrame from "@/components/HomeFrame/index.uvue";
...@@ -116,6 +124,80 @@ const props = defineProps<{ ...@@ -116,6 +124,80 @@ const props = defineProps<{
const logic = props.logic; const logic = props.logic;
const PKG_BANNER_FALLBACK: UTSJSONObject = {
"1": "/static/images/boutique/package-1.webp",
"2": "/static/images/boutique/package-2.webp"
} as UTSJSONObject;
function bannerUrlForItem(item: any): string {
const u = logic.getPkg(item, "bannerImg") as string;
if (u != null && u !== "") {
return u;
}
const tKey = `${logic.getPkg(item, "type")}`;
const fb = PKG_BANNER_FALLBACK[tKey];
if (fb != null && typeof fb === "string" && fb !== "") {
return fb as string;
}
return "/static/images/boutique/package-1.webp";
}
const packageSwiperUrls = computed((): string[] => {
const list = logic.packageList.value;
const out: string[] = [];
for (let i = 0; i < list.length; i++) {
out.push(bannerUrlForItem(list[i]));
}
return out;
});
const currentPackageItem = computed((): any | null => {
const list = logic.packageList.value;
const idx = logic.currentSwiperIndex.value;
if (idx >= 0 && idx < list.length) {
return list[idx];
}
return null;
});
function parsePackageSwiperIndex(e: any): number {
if (e == null) {
return 0;
}
if (typeof e === "number") {
return e as number;
}
const o = e as UTSJSONObject;
const top = o["current"];
if (typeof top === "number") {
return top as number;
}
const idx = o["index"];
if (typeof idx === "number") {
return idx as number;
}
const detail = o["detail"] as UTSJSONObject | null;
if (detail != null) {
const dc = detail["current"];
if (typeof dc === "number") {
return dc as number;
}
}
return 0;
}
function onPackageSwiperChange(e: any): void {
logic.currentSwiperIndex.value = parsePackageSwiperIndex(e);
}
function onPackageSwiperClick(e: any): void {
toDetail(parsePackageSwiperIndex(e));
}
function toDetailCurrent(): void {
toDetail(logic.currentSwiperIndex.value);
}
const homeRef = ref(null); const homeRef = ref(null);
const customerTypeRef = ref(null); const customerTypeRef = ref(null);
const packageRef = ref(null); const packageRef = ref(null);
...@@ -182,18 +264,32 @@ defineExpose({ ...@@ -182,18 +264,32 @@ defineExpose({
flex-direction: column; flex-direction: column;
} }
.package-swiper { .package-swiper-stack {
flex: 1; flex: 1;
width: 100%; width: 100%;
min-height: 0;
position: relative;
} }
.swiper-bg { .package-swiper {
position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
top: 0; }
.package-swiper-overlay {
position: absolute;
left: 0; left: 0;
z-index: -1; top: 0;
right: 0;
bottom: 0;
z-index: 1;
pointer-events: none;
display: flex;
flex-direction: column;
}
.package-swiper-overlay .swiper-btn {
pointer-events: auto;
} }
.swiper-name { .swiper-name {
...@@ -373,196 +469,3 @@ defineExpose({ ...@@ -373,196 +469,3 @@ defineExpose({
color: #4673ff; color: #4673ff;
} }
</style> </style>
.swiper-custom-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.package-swiper {
flex: 1;
width: 100%;
}
.swiper-bg {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
}
.swiper-name {
padding-top: var(--l-spacing-lg);
text-indent: 67px;
color: #333;
font-size: var(--l-font-base);
font-weight: 500;
}
.swiper-content-box {
margin: var(--l-spacing-md) var(--l-spacing-xl) 0;
height: 132px;
position: relative;
}
.swiper-content-box .price,
.swiper-content-box .briefIntroduction {
position: absolute;
}
.price-1 {
color: #999;
font-size: 10px;
left: var(--l-spacing-xl);
top: 32px;
width: 97px;
text-align: center;
}
.price-1 .num {
color: #333;
font-size: var(--l-font-base);
font-weight: 700;
display: flex;
flex-direction: row;
justify-content: center;
}
.price-1 .unit {
margin-right: 4px;
}
.price-2 {
left: 129px;
top: 48px;
width: 94px;
color: #ff4747;
font-size: var(--l-font-lg);
font-weight: 700;
display: flex;
flex-direction: row;
justify-content: center;
}
.price-3 {
top: 27px;
left: 228px;
color: #999;
font-size: 14px;
width: 148px;
text-align: center;
}
.price-3 .num {
color: #ff4747;
font-size: 22px;
font-weight: 700;
display: flex;
flex-direction: row;
justify-content: center;
}
.price-3 .unit {
margin-right: 8px;
}
.briefIntroduction {
left: 0;
top: 106px;
color: #666;
font-size: 12px;
width: 100%;
text-align: center;
}
.swiper-btn {
color: #4673ff;
font-size: 13px;
text-align: center;
margin-top: var(--l-spacing-md);
}
.swiper-dots {
display: flex;
flex-direction: row;
justify-content: center;
padding: var(--l-spacing-sm) 0;
}
.dot {
width: 8px;
height: 8px;
border-radius: 4px;
background: #ccc;
margin: 0 4px;
}
.dot.active {
background: #4673ff;
}
.swiper-empty,
.swiper-loading {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.empty-text {
font-size: var(--l-font-sm);
color: #999;
}
.detail-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.detail-title {
font-size: var(--l-font-2xl);
color: #333;
}
.package-detail-box {
padding-bottom: 50px;
margin: 0 var(--l-spacing-xl);
}
.package-box {
border-radius: var(--l-radius-xl);
background: #ffffff;
box-shadow: 0 6px 24px rgba(44, 102, 247, 0.15);
margin-bottom: var(--l-spacing-xl);
box-sizing: border-box;
padding: var(--l-spacing-xl);
}
.package-name {
color: #333;
font-size: var(--l-font-xl);
font-weight: 500;
line-height: 28px;
margin-bottom: var(--l-spacing-md);
}
.package-content {
line-height: 22px;
color: #333;
font-size: 14px;
}
.package-detail {
border: 2px solid rgba(70, 115, 255, 0.5);
background: rgba(70, 115, 255, 0.1);
box-shadow: 0 6px 24px rgba(44, 102, 247, 0.15);
}
.package-detail .package-name {
color: #4673ff;
}
...@@ -8,28 +8,32 @@ ...@@ -8,28 +8,32 @@
<template #swiperCustom> <template #swiperCustom>
<view v-if="loadComplete" class="swiper-custom-wrap"> <view v-if="loadComplete" class="swiper-custom-wrap">
<view v-if="moduleList.length > 0" class="swiper-custom-content"> <view v-if="moduleList.length > 0" class="swiper-custom-content">
<swiper class="equity-swiper" <view class="equity-swiper-stack">
:current="currentSwiperIndex" <un-swiper
:circular="moduleList.length > 1" class="equity-swiper"
:list="equitySwiperUrls"
:indicator="false"
:autoplay="moduleList.length > 1" :autoplay="moduleList.length > 1"
:circular="moduleList.length > 1"
:interval="5000" :interval="5000"
:duration="400" :duration="400"
@change="onSwiperChange"> :current="currentSwiperIndex"
<swiper-item v-for="(item, idx) in moduleList" :key="idx" @tap="toPreview(item)"> imgMode="aspectFill"
<view class="swiper-card"> height="100%"
<image v-if="getModuleCover(item) != ''" radius="0"
class="swiper-bg" bgColor="transparent"
mode="aspectFill" @change="onSwiperChange"
:src="getModuleCover(item)" /> @click="onEquitySwiperClick"
<text class="swiper-name"> />
{{ getModuleName(item) }} <view v-if="equityCurrentModule != null" class="equity-swiper-overlay">
</text> <text class="swiper-name">
<text class="swiper-desc"> {{ getModuleName(equityCurrentModule) }}
{{ getModuleDesc(item) }} </text>
</text> <text class="swiper-desc">
</view> {{ getModuleDesc(equityCurrentModule) }}
</swiper-item> </text>
</swiper> </view>
</view>
<text class="module-title"> <text class="module-title">
{{ getCurrentModuleTitle() }} {{ getCurrentModuleTitle() }}
</text> </text>
...@@ -59,7 +63,7 @@ ...@@ -59,7 +63,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ComponentPublicInstance, ref } from "vue"; import { ComponentPublicInstance, computed, ref } from "vue";
import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList } from "@/api/common-api.uts"; import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList } from "@/api/common-api.uts";
import { getMockData, getSoureData } from "@/api/system-api.uts"; import { getMockData, getSoureData } from "@/api/system-api.uts";
...@@ -76,6 +80,27 @@ const toolList = ref<Array<any>>([]); ...@@ -76,6 +80,27 @@ const toolList = ref<Array<any>>([]);
const mediaId = ref<number | string>(""); const mediaId = ref<number | string>("");
const currentSwiperIndex = ref<number>(0); const currentSwiperIndex = ref<number>(0);
const EQUITY_SWIPER_PLACEHOLDER = "/static/images/login/nothing.webp";
const equitySwiperUrls = computed((): string[] => {
const list = moduleList.value;
const out: string[] = [];
for (let i = 0; i < list.length; i++) {
const cover = getModuleCover(list[i]);
out.push(cover != "" ? cover : EQUITY_SWIPER_PLACEHOLDER);
}
return out;
});
const equityCurrentModule = computed((): any | null => {
const list = moduleList.value;
const idx = currentSwiperIndex.value;
if (idx >= 0 && idx < list.length) {
return list[idx];
}
return null;
});
function normalizeModuleItem(item: any): UTSJSONObject { function normalizeModuleItem(item: any): UTSJSONObject {
const obj = item as UTSJSONObject; const obj = item as UTSJSONObject;
const detailTitle = const detailTitle =
...@@ -338,9 +363,42 @@ function toPreview(item: any): void { ...@@ -338,9 +363,42 @@ function toPreview(item: any): void {
uni.navigateTo({ url: `/pages/equity/detail/index?id=${id}&type=preview` }); uni.navigateTo({ url: `/pages/equity/detail/index?id=${id}&type=preview` });
} }
function onSwiperChange(e: UniSwiperChangeEvent): void { function parseSwiperEventIndex(e: any): number {
const currentValue = e.detail.current; if (e == null) {
currentSwiperIndex.value = currentValue; return 0;
}
if (typeof e === "number") {
return e as number;
}
const o = e as UTSJSONObject;
const top = o["current"];
if (typeof top === "number") {
return top as number;
}
const idx = o["index"];
if (typeof idx === "number") {
return idx as number;
}
const detail = o["detail"] as UTSJSONObject | null;
if (detail != null) {
const dc = detail["current"];
if (typeof dc === "number") {
return dc as number;
}
}
return 0;
}
function onSwiperChange(e: any): void {
currentSwiperIndex.value = parseSwiperEventIndex(e);
}
function onEquitySwiperClick(e: any): void {
const i = parseSwiperEventIndex(e);
const list = moduleList.value;
if (i >= 0 && i < list.length) {
toPreview(list[i]);
}
} }
async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promise<void> { async function getSoure(brandIdList: number[], subBrandIdList: number[]): Promise<void> {
const userInfo = storage.get("userInfo") as UTSJSONObject; const userInfo = storage.get("userInfo") as UTSJSONObject;
...@@ -515,24 +573,28 @@ onShow(() => { ...@@ -515,24 +573,28 @@ onShow(() => {
flex-direction: column; flex-direction: column;
} }
.equity-swiper { .equity-swiper-stack {
flex: 1; flex: 1;
width: 100%; width: 100%;
min-height: 0;
position: relative;
} }
.swiper-card { .equity-swiper {
position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.swiper-bg { .equity-swiper-overlay {
position: absolute; position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0; left: 0;
z-index: 0; top: 0;
right: 0;
bottom: 0;
z-index: 1;
pointer-events: none;
display: flex;
flex-direction: column;
} }
.swiper-name { .swiper-name {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!