Commit 561a5068 by liimin

feat(ui): 优化多个组件的视觉设计和交互反馈

- 重构首页"开始接待"按钮样式,增加渐变、阴影和按压动效
- 统一优化选择组件(车品牌、销售员、商户列表等)的视觉风格,采用浅灰背景和主题色描边
- 改进骨架屏布局,使用分块设计提升加载体验
- 移除冗余的全局loading调用,改为组件内状态管理
- 更新权益页轮播图组件,使用uview-unix的un-swiper并优化覆盖层样式
1 parent 06a3fa52
......@@ -7,24 +7,17 @@
:title="currentView == 'brand' ? '请选择车品牌' : '请选择车系'"
:z-index="10076"
@close="handleMessageBoxClose">
<!-- 自定义返回按钮 -->
<!-- <view v-if="showBackButton"
class="custom-back-btn"
@click="handleBackClick
<un-icon name="arrow-left" size="20"></un-icon>">
</vie -->
<scroll-view class="select-box"
:show-scrollbar="false"
:style="{ maxHeight: windowHeight * 0.6 + 'px' }">
<!-- <view class="select-box"> -->
<!-- 品牌列表 -->
<view v-show="currentView == 'brand'" class="view-content">
<template v-for="(item, index) in carBrandList"
:key="index">
<view class="select-item"
:class="[{ checked: selectedBrandIndex == index }]"
:class="[{ 'is-active': selectedBrandIndex == index }]"
@click="selectBrand(item, index)">
<text class="select-item-text">{{ (item as UTSJSONObject).name }}</text>
<text class="select-item-text" :class="[{ 'is-active-text': selectedBrandIndex == index }]">{{ (item as UTSJSONObject).name }}</text>
</view>
</template>
</view>
......@@ -34,17 +27,15 @@
<template v-for="(item, index) in currentCarList"
:key="index">
<view class="select-item"
:class="[{ checked: carModel == (item as UTSJSONObject).name }]"
:class="[{ 'is-active': carModel == (item as UTSJSONObject).name }]"
@click="handleSelect(item)">
<text class="select-item-text">{{ (item as UTSJSONObject).name }}</text>
<text class="select-item-text" :class="[{ 'is-active-text': carModel == (item as UTSJSONObject).name }]">{{ (item as UTSJSONObject).name }}</text>
</view>
</template>
</view>
<!-- </un-transition> -->
</scroll-view>
</MessageBox>
</view>
</template>
<script setup lang="uts">
......@@ -386,49 +377,57 @@ defineExpose({ open, close, autoSelect });
<style scoped lang='scss'>
.select-box {
margin: 20px 0;
margin: 16px 0;
position: relative;
display: flex;
flex-direction: column;
min-height: 0;
flex: 1;
.view-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
.select-item {
width: 49%;
margin-right: 0;
margin-bottom: 16px;
height: 34px;
opacity: 1;
border: 1px solid #dce0e6;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
&.checked {
border: 1px solid #292d33;
}
}
}
.fade-in-left {
}
.fade-in-right {
}
}
.view-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
}
.select-item {
width: 48%; /* 给元素间留一点呼吸空间,避免 49% 可能产生的换行问题 */
margin-bottom: 12px;
height: 44px; /* 加高触控面积,显得更大气 */
background-color: #f8f9fa; /* 低调的浅灰背景 */
border-radius: 8px; /* 圆角增加现代感 */
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border: 1px solid transparent;
transition: background-color 0.2s ease, border-color 0.2s ease;
}
/* 悬浮反馈 */
.select-item:active {
background-color: #f1f3f5;
}
/* 选中状态 */
.is-active {
background-color: rgba(22, 119, 255, 0.05); /* 淡淡的主题色背景 */
border: 1px solid rgba(22, 119, 255, 0.3); /* 主题色描边 */
}
.select-item-text {
text-align: center;
color: #333;
font-size: 16px;
line-height: 22px;
color: #495057; /* 稳重的深灰色 */
font-size: 15px;
line-height: 20px;
font-weight: 500;
}
.is-active-text {
color: #1677FF; /* 选中时的文字色与边框呼应 */
font-weight: 600;
}
</style>
<template>
<MessageBox ref="employeeBoxVisible"
:is-footer="false"
:max-height="1000"
position="bottom"
:title="`请选择${title}`"
:z-index="10076"
......@@ -9,33 +8,35 @@
<scroll-view class="select-box"
:show-scrollbar="false"
:style="{ maxHeight: windowHeight * 0.6 + 'px' }">
<template v-for="(item, index) in employeeList" :key="index">
<view class="select-item"
:class="[{ checked: (salesUuid as string) == (item as UTSJSONObject).uuid }]"
@click="handleSelect(item)">
<text class="select-item-text">{{ (item as UTSJSONObject).staffName }}</text>
</view>
</template>
<view class="view-content">
<template v-for="(item, index) in employeeList" :key="index">
<view class="select-item"
:class="[{ 'is-active': (salesUuid as string) == (item as UTSJSONObject).uuid }]"
@click="handleSelect(item)">
<text class="select-item-text" :class="[{ 'is-active-text': (salesUuid as string) == (item as UTSJSONObject).uuid }]">{{ (item as UTSJSONObject).staffName }}</text>
</view>
</template>
</view>
</scroll-view>
</MessageBox>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref, watch } from "vue";
import { ComponentPublicInstance, computed, ref, watch } from "vue";
import { getEmployeeListApi } from "@/api/common-api.uts";
import { getEmployeeListApi } from "@/api/common-api.uts";
import { resolutionState } from "@/services/adapter/index.uts";
import { dispatch, state } from "@/store/index.uts";
import { storage } from "@/utils/storage.uts";
import MessageBox from "./MessageBox.uvue";
import { resolutionState } from "@/services/adapter/index.uts";
import { computed } from "vue";
type Props = {
salesPropsUuid?: string
title?: string
}
type UserInfo = UTSJSONObject
type Props = {
salesPropsUuid?: string
title?: string
}
type UserInfo = UTSJSONObject
const props = withDefaults(defineProps<Props>(), {
title: "销售",
......@@ -44,9 +45,9 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits(["close", "select"]);
const employeeBoxVisible = ref(null);
const employeeBoxVisible = ref<ComponentPublicInstance | null>(null);
const watchStatus = computed(() => {
const watchStatus = computed<boolean>(() => {
const status = state.user?.historyStatus;
if (status == null) {
return false;
......@@ -56,30 +57,31 @@ const watchStatus = computed(() => {
return false;
}
});
const updateView = ref<number>(Date.now());
const salesUuid = computed(() => {
const salesUuid = computed<string>(() => {
const val1 = state.user.customerInfo.salesUuid;
const val2 = props.salesPropsUuid;
return val1 !== null && val1 !== "" ? val1 : val2;
return val1 !== null && val1 !== "" ? (val1 as string) : val2;
});
const windowHeight = computed(() => resolutionState.windowHeight);
// const employeeList = computed(() => {
// return state.user.employeeList
// })
const windowHeight = computed<number>(() => resolutionState.windowHeight);
const employeeList = ref<Array<any>>([]);
watch(updateView.value, ()=>{
const list = storage.get("employeeList") as UTSArray<Any>;
employeeList.value = list != null ? list : [];
watch(updateView, () => {
const list = storage.get("employeeList") as UTSArray<Any>;
employeeList.value = list != null ? (list as Array<any>) : [];
}, { immediate: true, deep: true });
function close(): void {
if (employeeBoxVisible.value != null) {
(employeeBoxVisible.value as ComponentPublicInstance).$callMethod("close");
}
}
watch(watchStatus.value, () => {
watch(watchStatus, () => {
close();
}, { immediate: true });
......@@ -97,12 +99,11 @@ function open(): void {
// 获取销售人员列表
getEmployeeListApi({ merchantId: shopMerchantId }).then((res: any) => {
const employeeList = res as Array<any>;
dispatch("setEmployeeList", employeeList);
const listToStore = employeeList != null ? employeeList : [];
const list = res as Array<any>;
dispatch("setEmployeeList", list);
const listToStore = list != null ? list : [];
storage.set("employeeList", listToStore, 0);
updateView.value = Date.now();
});
}
......@@ -111,43 +112,63 @@ function handleSelect(item: any): void {
emit("select", item);
}
defineExpose({ open, close });
</script>
<style scoped lang="scss">
.select-box {
margin: 20px 0;
margin: 16px 0;
position: relative;
display: flex;
flex-direction: column;
min-height: 0;
flex: 1;
padding-bottom: 30px;
}
.view-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
max-height: 400px;
padding-bottom: 30px;
.select-item {
width: 49%;
/* width: 23.5%; */
margin-right: 0;
margin-bottom: 16px;
height: 34px;
opacity: 1;
border: 1px solid #dce0e6;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
&.checked {
border: 1px solid #292d33;
}
}
width: 100%;
}
.select-item {
width: 48%; /* 预留间距,避免49%引起的意外换行 */
margin-bottom: 12px;
height: 44px; /* 加高触控面积,显得更大气 */
background-color: #f8f9fa; /* 低调的浅灰背景 */
border-radius: 8px; /* 圆角增加现代感 */
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border: 1px solid transparent;
transition: background-color 0.2s ease, border-color 0.2s ease;
}
/* 悬浮反馈 */
.select-item:active {
background-color: #f1f3f5;
}
/* 选中状态 */
.is-active {
background-color: rgba(22, 119, 255, 0.05); /* 淡淡的主题色背景 */
border: 1px solid rgba(22, 119, 255, 0.3); /* 主题色描边 */
}
.select-item-text {
text-align: center;
color: #333;
font-size: 16px;
line-height: 22px;
color: #495057; /* 稳重的深灰色 */
font-size: 15px;
line-height: 20px;
font-weight: 500;
}
.is-active-text {
color: #1677FF; /* 选中时的文字色与边框呼应 */
font-weight: 600;
}
</style>
......@@ -10,7 +10,7 @@
<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">
<view class="start" hover-class="start-hover" @click="onStartClick">
<view class="start-inner">
<text class="start-text">开始接待</text>
</view>
......@@ -67,7 +67,7 @@
<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">
<view class="start" hover-class="start-hover" @click="onStartClick">
<view class="start-inner">
<text class="start-text">开始接待</text>
</view>
......@@ -314,21 +314,30 @@ defineExpose({
padding: 0 var(--l-spacing-xl) 0 var(--l-spacing-md);
}
/* 与旧项目一致:背景图铺满,文字居中偏上,无渐变遮罩 */
/* 开始接待按钮:重新设计,更大气、更有视觉冲击力和核心操作感 */
.start {
height: 86px;
height: 96px; /* 增加高度 */
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: row;
justify-content: center;
align-items: flex-start;
padding-top: 36px;
align-items: center; /* 居中对齐 */
overflow: hidden;
flex-shrink: 0;
min-width: 140px;
border-radius: 18px;
background: #5b8cff;
border-radius: 24px; /* 更大的圆角 */
background-image: linear-gradient(to right bottom, #1677ff, #469cff); /* 渐变蓝,更显质感。UniApp X 中需使用完整的 background-image 语法 */
box-shadow: 0 8px 24px rgba(22, 119, 255, 0.25); /* 增加弥散阴影 */
transition-property: transform, box-shadow, opacity;
transition-duration: 0.15s; /* 缩短过渡时间,让按压感更直接和强烈 */
transition-timing-function: ease-out; /* 使用 ease-out 让反馈更利落 */
}
.start-hover {
transform: scale(0.92); /* 显著加大缩放比例,营造强烈的按压感 */
box-shadow: 0 2px 8px rgba(22, 119, 255, 0.1); /* 阴影大幅度减小,模拟完全按下贴合屏幕 */
opacity: 0.8; /* 颜色加深更明显 */
}
.start-inner {
......@@ -339,16 +348,16 @@ defineExpose({
align-items: center;
justify-content: center;
padding: 0;
background: transparent;
border-radius: 0;
box-shadow: none;
background-color: transparent;
}
.start-text {
font-size: 16px;
font-weight: 600;
font-size: 22px; /* 增大字号 */
font-weight: bold; /* 加粗 */
color: #ffffff;
text-align: center;
/* UniApp X 对于 letter-spacing 可能兼容性有限,但在大部分情况下正常 */
letter-spacing: 2px;
}
.right-content-box {
......
......@@ -2,7 +2,7 @@
<layout-root>
<view class="page-container account-page">
<view class="page-container account-page fade-in">
<view class="bg">
<image class="bg-image"
mode="aspectFill"
......
<template>
<!-- 保持单根节点,确保父组件 v-show 生效 -->
<view>
<view class="fade-in-up">
<view v-if="!flag" class="skeleton-wrap">
<un-skeleton :animate="true"
:loading="true"
rows="6">
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
<view style="height: 24px;"></view>
<un-skeleton :animate="true"
:loading="true"
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
<view style="height: 24px;"></view>
<un-skeleton :animate="true"
:loading="true"
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
</view>
<view v-else class="box">
......@@ -23,7 +45,6 @@
<text class="name">{{ item.merchantName }}</text>
<text class="shop_no">商户号:{{ item.merchantId }}</text>
</view>
</view>
</template>
<template v-else>
......@@ -148,18 +169,12 @@ function get4SStoreList(loginUserObj: UTSJSONObject): void {
function selectAccountLogin(id: string, merchantName: string, userInfo: AccountItem | null): void {
console.log(`选择账号${merchantName}登录!`);
uni.showLoading({
title: "加载中",
mask: false
});
const params: UTSJSONObject = {
id
};
apiSelectAccountLogin(params).then((res: UTSJSONObject): void => {
uni.hideLoading();
console.log("selectAccountLogin 返回数据:", res);
const code = res.code as null | string;
......@@ -187,7 +202,6 @@ function selectAccountLogin(id: string, merchantName: string, userInfo: AccountI
});
}
}).catch((error: any | null): void => {
uni.hideLoading();
console.error("selectAccountLogin 失败:", error);
uni.showToast({
title: "网络异常,请稍后重试",
......@@ -276,16 +290,9 @@ function getListSelectAccount(autoLogin: boolean): void {
console.log("进入选择账号页面!autoLogin:", autoLogin);
flag.value = false;
uni.showLoading({
title: "加载中",
mask: false
});
const params: UTSJSONObject = {};
apiGetListSelectAccount(params).then((res: UTSJSONObject): void => {
uni.hideLoading();
console.log("getListSelectAccount 返回数据:", res);
const code = res.code as null | string;
......@@ -358,7 +365,6 @@ function getListSelectAccount(autoLogin: boolean): void {
flag.value = true;
}
}).catch((error: any | null): void => {
uni.hideLoading();
flag.value = true;
console.error("getListSelectAccount 失败:", error);
uni.showToast({
......@@ -383,6 +389,7 @@ onMounted(() => {
.skeleton-wrap {
padding: 24px;
width: 100%;
box-sizing: border-box;
}
.box {
......@@ -391,20 +398,26 @@ onMounted(() => {
flex-wrap: wrap;
padding: 0 24px;
justify-content: space-between;
width: 100%;
box-sizing: border-box;
.items {
width: 48%;
margin-bottom: 24px;
height: 80px;
background: #ffffff;
border-radius: 8px;
width: 48%; /* 避免 49% 导致挤换行 */
margin-bottom: 16px;
height: 84px; /* 增加一点高度更饱满 */
background: #f8f9fa; /* 浅灰底色 */
border-radius: 12px; /* 更大圆角 */
padding: 16px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
border: 2px solid transparent;
border: 1px solid transparent;
transition: background-color 0.25s ease, border-color 0.25s ease;
&:active {
background: #f1f3f5;
}
.left {
flex: 1;
......@@ -413,19 +426,19 @@ onMounted(() => {
justify-content: center;
.name {
font-weight: 500;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
color: #181a1f;
color: #495057; /* 深灰文字 */
}
.shop_no {
font-weight: 400;
font-size: 14px;
font-size: 13px;
margin-top: 6px;
color: #999ea8;
color: #868e96;
}
}
......@@ -439,7 +452,7 @@ onMounted(() => {
.midle {
width: 48px;
height: 48px;
border-radius: 4px;
border-radius: 24px; /* 圆形角色标更柔和 */
display: flex;
flex-direction: row;
align-items: center;
......@@ -453,49 +466,39 @@ onMounted(() => {
}
.midle_1 {
background-color: #f247241a;
.midle-text {
color: #f24724;
}
background-color: rgba(242, 71, 36, 0.08);
.midle-text { color: #f24724; }
}
.midle_2 {
background-color: #ff9d0a1a;
.midle-text {
color: #ff9d0a;
}
background-color: rgba(255, 157, 10, 0.08);
.midle-text { color: #ff9d0a; }
}
.midle_3 {
background-color: #347bff1a;
.midle-text {
color: #347bff;
}
background-color: rgba(52, 123, 255, 0.08);
.midle-text { color: #347bff; }
}
.midle_4 {
background-color: #35c3761a;
.midle-text {
color: #35c376;
}
background-color: rgba(53, 195, 118, 0.08);
.midle-text { color: #35c376; }
}
.midle_5 {
background-color: #35c3761a;
.midle-text {
color: #35c376;
}
background-color: rgba(53, 195, 118, 0.08);
.midle-text { color: #35c376; }
}
}
}
.active {
border: 2px solid #347bff;
background-color: rgba(22, 119, 255, 0.05); /* 淡淡主题色背景 */
border: 1px solid rgba(22, 119, 255, 0.3); /* 主题色细边框 */
.left .name {
color: #1677FF; /* 选中文字变蓝 */
}
}
}
</style>
<template>
<view v-if="!flag" class="skeleton-wrap">
<view class="fade-in-up">
<view v-if="!flag" class="skeleton-wrap">
<un-skeleton :animate="true"
:loading="true"
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
<view style="height: 24px;"></view>
<un-skeleton :animate="true"
:loading="true"
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
<view style="height: 24px;"></view>
<un-skeleton :animate="true"
:loading="true"
rows="6">
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
</view>
<view v-if="flag" class="box">
......@@ -23,6 +46,7 @@
</template>
<no-data v-else />
</view>
</view>
</template>
<script setup lang="uts">
......@@ -52,14 +76,12 @@ function jumpPage(item: MerchantItem, openSceneArr: number[]): void {
const currentUserInfo = userInfo;
if (currentUserInfo == null) {
uni.hideLoading();
return;
}
if (openSceneArr.length === 0) {
const isSuper = currentUserInfo.isSuper as boolean | null;
if (isSuper != true) {
uni.hideLoading();
uni.showToast({ title: "暂无开通业务,请联系总部管理员", icon: "none" });
return;
}
......@@ -105,17 +127,14 @@ function jumpPage(item: MerchantItem, openSceneArr: number[]): void {
}
newUserInfo.sceneType = usedCarSceneType;
storage.set("userInfo", newUserInfo, 0);
uni.hideLoading();
uni.reLaunch({ url: "/pages/usedCar/index" });
}).catch((error): void => {
uni.hideLoading();
uni.showToast({ title: "网络异常", icon: "none" });
});
return;
}
emit("chooseMerchant", newUserInfo);
uni.hideLoading();
}
function getSceneArr(shopMerchantId: string): Promise<number[]> {
......@@ -168,7 +187,6 @@ function getSceneArr(shopMerchantId: string): Promise<number[]> {
function chooseMerchantItem(item: MerchantItem): void {
console.log(`选择4s店${ item.merchantName }!`);
uni.showLoading({ title: "加载中", mask: false });
const list = loginUserInfoList.value;
let i = 0;
......@@ -194,8 +212,6 @@ function getMerchantList(): void {
return;
}
uni.showLoading({ title: "加载中", mask: false });
const isSuper = currentUserInfo.isSuper as boolean | null;
const params: UTSJSONObject = {
merchantId: isSuper == true ? "" : `${currentUserInfo.merchantId ?? ""}`,
......@@ -203,8 +219,6 @@ function getMerchantList(): void {
};
apiGetSceneMerchantRefStoreList(params).then((res: any): void => {
uni.hideLoading();
const code = (res as UTSJSONObject).code as null | string;
if (code == "0") {
const data = (res as UTSJSONObject).data as any[] | null;
......@@ -240,7 +254,6 @@ function getMerchantList(): void {
uni.showToast({ title: msg ?? "获取4S店列表失败", icon: "none" });
}
}).catch((error) => {
uni.hideLoading();
flag.value = true;
console.error("getMerchantList 失败:", error);
uni.showToast({ title: "网络异常,请稍后重试", icon: "none" });
......@@ -295,6 +308,7 @@ defineExpose({
.skeleton-wrap {
padding: 24px;
width: 100%;
box-sizing: border-box;
}
.box {
......@@ -309,17 +323,22 @@ defineExpose({
}
.items {
width: 49%;
height: 80px;
width: 48%; /* 给间距留出缓冲 */
height: 84px; /* 加高一些更稳重 */
margin-bottom: var(--l-spacing-lg);
background: #ffffff;
border-radius: var(--l-radius-md);
background: #f8f9fa; /* 浅灰背景 */
border-radius: 12px; /* 增加圆角 */
padding: var(--l-spacing-md);
display: flex;
flex-direction: row;
align-items: center;
box-sizing: border-box;
border: 2px solid transparent;
border: 1px solid transparent;
transition: background-color 0.25s ease, border-color 0.25s ease;
&:active {
background-color: #f1f3f5;
}
}
.items .right {
......@@ -335,18 +354,26 @@ defineExpose({
}
.items .name {
font-weight: 500;
font-weight: 600;
font-size: 16px;
color: #181a1f;
color: #495057; /* 深灰文字 */
margin-bottom: 6px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.items .text_no {
font-size: 14px;
color: #999ea8;
font-size: 13px;
color: #868e96;
}
.items.active {
border: 2px solid #347bff;
background-color: rgba(22, 119, 255, 0.05); /* 主题色浅色背景 */
border: 1px solid rgba(22, 119, 255, 0.3); /* 细蓝色描边 */
}
.items.active .name {
color: #1677FF; /* 选中文字变蓝 */
}
</style>
<template>
<view class="list-not">
<view class="list-not fade-in">
<image src="/static/images/login/nothing.webp" class="list-not-img" />
<text>暂无内容</text>
</view>
......
<template>
<view v-if="loading" class="skeleton-wrap">
<view class="fade-in-up">
<view v-if="loading" class="skeleton-wrap">
<un-skeleton :animate="true"
:loading="true"
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
<view style="height: 24px;"></view>
<un-skeleton :animate="true"
:loading="true"
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
<view style="height: 24px;"></view>
<un-skeleton :animate="true"
:loading="true"
rows="3"
title>
rows="2"
:title="true"
avatar
avatar-shape="circle"
avatar-size="48">
</un-skeleton>
</view>
<view v-else class="box">
......@@ -22,6 +43,7 @@
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
......@@ -51,14 +73,11 @@ let jumpTimer: number = 0;
function jump(info: UTSJSONObject, data: any | null): void {
const now = Date.now();
if (now - jumpTimer < 3000) {
uni.hideLoading();
return;
}
jumpTimer = now;
console.log("跳转进入首页!");
uni.hideLoading();
if (data !== null) {
const loginRole = (data as UTSJSONObject).loginRoleOnSelectMerchant;
if (loginRole !== null) {
......@@ -72,13 +91,9 @@ function jump(info: UTSJSONObject, data: any | null): void {
return;
}
// 这里的全屏 loading 会挡住后续页面的骨架屏;改为不加 mask
uni.showLoading({ title: "加载中", mask: false });
console.log(`调用 getMerchantBrand, merchantId: ${ shopMerchantId}`);
apiGetMerchantBrand({ merchantId: shopMerchantId }).then((res: any): void => {
console.log("getMerchantBrand 成功");
uni.hideLoading();
const code = (res as UTSJSONObject).code as null | string;
if (code === "0") {
......@@ -112,13 +127,8 @@ function jump(info: UTSJSONObject, data: any | null): void {
}
console.log(`准备跳转: ${ url}`);
// 跳转到精品页时,用页面内骨架屏承接加载态,避免全屏 loading 挡住骨架
if (url == "/pages/boutique/index") {
uni.hideLoading();
}
uni.reLaunch({ url });
}).catch((error) => {
uni.hideLoading();
console.error(`getMerchantBrand 失败: ${ JSON.stringify(error)}`);
info.channelType = 1;
storage.set("userInfo", info, 0);
......@@ -141,9 +151,6 @@ function jump(info: UTSJSONObject, data: any | null): void {
}
}
console.log(`准备跳转(catch): ${ url}`);
if (url == "/pages/boutique/index") {
uni.hideLoading();
}
uni.reLaunch({ url });
});
}
......@@ -203,9 +210,6 @@ function selectScene(item: SceneItem, index: number): void {
userInfo.sceneType = sceneType;
// 用页面内骨架/内容承接加载态,避免全屏遮罩挡住后续页面骨架
uni.showLoading({ title: "加载中", mask: false });
if (isSuper == true) {
jump(userInfo, null);
} else {
......@@ -219,7 +223,6 @@ function selectScene(item: SceneItem, index: number): void {
}).then((data: any): void => {
jump(userInfo, data);
}).catch((error) => {
uni.hideLoading();
console.error("selectMerchantScene 失败:", error);
uni.showToast({ title: "网络异常,请稍后重试", icon: "none" });
});
......@@ -235,6 +238,7 @@ defineExpose({
.skeleton-wrap {
padding: 24px;
width: 100%;
box-sizing: border-box;
}
.box {
......@@ -243,19 +247,26 @@ defineExpose({
flex-wrap: wrap;
padding: 0 24px;
justify-content: space-between;
width: 100%;
box-sizing: border-box;
.items {
width: 48%;
width: 48%; /* 给间隙留出空间 */
margin-bottom: 24px;
height: 80px;
background: #ffffff;
border-radius: 8px;
height: 84px; /* 加高一些更稳重 */
background: #f8f9fa; /* 浅灰底色 */
border-radius: 12px; /* 更大圆角 */
padding: 16px;
display: flex;
flex-direction: row;
align-items: center;
box-sizing: border-box;
border: 2px solid transparent;
border: 1px solid transparent;
transition: background-color 0.25s ease, border-color 0.25s ease;
&:active {
background: #f1f3f5;
}
.left {
margin-right: 14px;
......@@ -269,21 +280,26 @@ defineExpose({
justify-content: center;
.name {
font-weight: 500;
font-weight: 600;
font-size: 16px;
color: #181a1f;
color: #495057; /* 深灰文字 */
margin-bottom: 6px;
}
.shop_no {
font-size: 14px;
color: #999ea8;
font-size: 13px;
color: #868e96;
}
}
}
.active {
border: 2px solid #347bff;
background-color: rgba(22, 119, 255, 0.05); /* 主题色浅色背景 */
border: 1px solid rgba(22, 119, 255, 0.3); /* 细蓝色描边 */
.right .name {
color: #1677FF; /* 选中文字变蓝 */
}
}
}
</style>
<template>
<layout-root>
<view class="page-container">
<view class="page-container fade-in">
<HomeFrame ref="homeRef"
:show-footer="true"
:swiper-custom="true"
@start="handleStart">
<template #swiperCustom>
<view v-if="loadComplete" class="swiper-custom-wrap">
<view v-if="moduleList.length > 0" class="swiper-custom-content">
<view v-if="!loadComplete" class="swiper-loading">
<!-- 大气优雅的骨架屏 -->
<view class="skeleton-banner">
<un-skeleton :loading="true" :animate="true" :rows="0" :title="false" avatar avatar-shape="square" avatar-size="300"></un-skeleton>
</view>
<view class="skeleton-text">
<un-skeleton :loading="true" :animate="true" :rows="3" :title="true"></un-skeleton>
</view>
</view>
<view v-else-if="moduleList.length > 0" class="swiper-custom-wrap fade-in">
<view class="swiper-custom-content">
<view class="equity-swiper-stack">
<!-- 原生 swiper:uview un-swiper 为加密 .vue,在 uni-app x 下易无法渲染图片 -->
<swiper
<un-swiper
class="equity-swiper"
:indicator-dots="false"
:list="equitySwiperList"
:autoplay="moduleList.length > 1"
:circular="moduleList.length > 1"
:interval="5000"
:duration="400"
:current="currentSwiperIndex"
@change="onSwiperChange"
>
<swiper-item
v-for="(url, i) in equitySwiperUrls"
:key="i"
>
<view
class="equity-swiper-slide"
@tap="onEquitySlideTap(i)"
>
<image
class="equity-swiper-img"
:src="url"
mode="aspectFill"
/>
</view>
</swiper-item>
</swiper>
:indicator="false"
@change="(e: number) => onSwiperChange(e)"
@click="(e: number) => onEquitySlideTap(e)"
></un-swiper>
<view v-if="hasEquityOverlay()" class="equity-swiper-overlay">
<text class="swiper-name">
{{ equityOverlayName() }}
</text>
<text class="swiper-desc">
{{ equityOverlayDesc() }}
</text>
<view class="overlay-text-content">
<text class="swiper-name">
{{ equityOverlayName() }}
</text>
<text class="swiper-desc">
{{ equityOverlayDesc() }}
</text>
</view>
<view class="swiper-dots">
<view v-for="(_, i) in moduleList"
:key="i"
class="dot"
:class="[{ active: i == currentSwiperIndex }]" />
</view>
</view>
</view>
<text class="module-title">
{{ getCurrentModuleTitle() }}
</text>
<view class="swiper-dots">
<view v-for="(_, i) in moduleList"
:key="i"
class="dot"
:class="[{ active: i == currentSwiperIndex }]" />
</view>
</view>
<view v-else class="swiper-empty">
<text class="empty-text">敬请期待</text>
</view>
</view>
<view v-else class="swiper-loading">
<un-skeleton :loading="true" :animate="true" rows="6"></un-skeleton>
<view v-else class="swiper-empty fade-in">
<text class="empty-text">敬请期待</text>
</view>
</template>
......@@ -75,6 +62,7 @@
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref } from "vue";
import { UnSwiperItem } from '@/uni_modules/uview-unix';
import { getCarBrandsListApi, getEmployeeListApi, getMerchantCarBrandList } from "@/api/common-api.uts";
import { getMockData, getSoureData } from "@/api/system-api.uts";
......@@ -313,9 +301,9 @@ function getToolCoverById(moduleId: any | null): string {
return "";
}
const equitySwiperUrls = computed((): string[] => {
const equitySwiperList = computed((): UnSwiperItem[] => {
const list = moduleList.value;
const out: string[] = [];
const out: UnSwiperItem[] = [];
for (let i = 0; i < list.length; i++) {
const obj = list[i] as UTSJSONObject;
let cover = pickModuleCover(obj);
......@@ -328,7 +316,10 @@ const equitySwiperUrls = computed((): string[] => {
cover = getToolCoverById(moduleId);
}
}
out.push(cover != "" ? cover : EQUITY_SWIPER_PLACEHOLDER);
out.push({
url: cover != "" ? cover : EQUITY_SWIPER_PLACEHOLDER
} as UnSwiperItem);
}
return out;
});
......@@ -403,7 +394,7 @@ function parseSwiperEventIndex(e: number | UniSwiperChangeEvent | null): number
return e.detail.current;
}
function onSwiperChange(e: UniSwiperChangeEvent): void {
function onSwiperChange(e: number | UniSwiperChangeEvent): void {
currentSwiperIndex.value = parseSwiperEventIndex(e);
}
......@@ -539,7 +530,6 @@ onLoad((options) => {
}
});
get_Vehicle_Sales_Data();
uni.hideLoading();
});
onShow(() => {
......@@ -595,81 +585,71 @@ onShow(() => {
width: 100%;
min-height: 0;
position: relative;
/* 移除原有的 16px 左右内边距,让图片撑满更多空间 */
}
.equity-swiper {
width: 100%;
height: 100%;
}
.equity-swiper-slide {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.equity-swiper-img {
width: 100%;
flex: 1;
min-height: 0;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.equity-swiper-overlay {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 1;
top: 0;
z-index: 10;
pointer-events: none;
display: flex;
flex-direction: column;
justify-content: flex-end;
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 40%);
border-radius: 8px;
}
.overlay-text-content {
padding: 0 24px 8px;
display: flex;
flex-direction: column;
}
.swiper-name {
position: relative;
z-index: 1;
padding-top: var(--l-spacing-lg);
text-indent: 40px;
color: #333;
font-size: var(--l-font-base);
color: #fff;
font-size: 20px;
font-weight: 500;
margin-bottom: 6px;
opacity: 0.95;
}
.swiper-desc {
position: relative;
z-index: 1;
margin: var(--l-spacing-md) var(--l-spacing-xl) 0;
color: #666;
font-size: 12px;
line-height: 20px;
color: rgba(255, 255, 255, 0.7);
font-size: 13px;
line-height: 1.5;
}
.swiper-dots {
display: flex;
flex-direction: row;
justify-content: center;
padding: var(--l-spacing-sm) 0;
}
.module-title {
color: #333;
font-size: 14px;
text-align: center;
padding-top: 8px;
padding: 4px 0 12px;
}
.dot {
width: 8px;
height: 8px;
border-radius: 4px;
background: #ccc;
width: 4px;
height: 4px;
border-radius: 2px;
background: rgba(255, 255, 255, 0.3);
margin: 0 4px;
transition: all 0.3s ease;
}
.dot.active {
background: #4673ff;
width: 12px;
background: rgba(255, 255, 255, 0.8);
}
.swiper-empty,
......@@ -677,14 +657,39 @@ onShow(() => {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex-direction: column;
box-sizing: border-box;
}
.skeleton-banner {
width: 100%;
flex: 1; /* 让图片占位符自动填满大部分空间 */
min-height: 250px; /* 保证有一个比较大的基础高度 */
box-sizing: border-box;
margin-bottom: 20px;
}
/* 调整骨架屏头像占位符,使其填满 banner 区域,显得大气 */
.skeleton-banner :deep(.u-skeleton__wrapper) {
width: 100%;
height: 100%;
display: flex;
}
.skeleton-banner :deep(.u-skeleton__avatar) {
width: 100% !important;
height: 100% !important;
border-radius: 8px !important;
}
.skeleton-text {
padding: 0 16px 20px;
}
.empty-text {
font-size: var(--l-font-sm);
color: #999;
margin: auto;
}
.detail-content {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!