Commit 31df9f88 by liimin

refactor(components): 重构车品牌选择组件使用新弹窗组件

- 替换 MessageBox 组件为 un-popup 组件
- 优化车品牌选择界面 UI 样式和交互体验
- 添加返回按钮和关闭按钮功能
- 重构员工选择组件数据加载逻辑
- 移除 HomeFrame 中已废弃的属性和方法
- 更新样式变量配置适配新的界面布局
- 优化账号列表组件骨架屏和触摸反馈效果
1 parent 26cb64d0
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
:show-scrollbar="false" :show-scrollbar="false"
:bounces="false" :bounces="false"
:scroll-with-animation="false" :scroll-with-animation="false"
:enable-back-to-top="false"
scroll-y> scroll-y>
<view v-if="employeeList.length === 0" style="padding: 40px 20px; text-align: center;"> <view v-show="employeeList.length === 0" style="padding: 40px 20px; text-align: center;">
<text style="color: #999; font-size: 14px;">暂无销售人员数据</text> <text style="color: #999; font-size: 14px;">暂无销售人员数据</text>
</view> </view>
<view class="view-content"> <view v-show="employeeList.length > 0" class="view-content">
<template v-for="(item, index) in employeeList" :key="index"> <template v-for="(item, index) in employeeList" :key="index">
<view class="select-item" <view class="select-item"
:class="[{ 'is-active': (salesUuid as string) == (item as UTSJSONObject).uuid }]" :class="[{ 'is-active': (salesUuid as string) == (item as UTSJSONObject).uuid }]"
...@@ -90,12 +91,9 @@ const windowHeight = computed<number>(() => { ...@@ -90,12 +91,9 @@ const windowHeight = computed<number>(() => {
const employeeList = ref<Array<any>>([]); const employeeList = ref<Array<any>>([]);
watch(updateView, () => { watch(updateView, () => {
console.log("updateView triggered, reading from storage");
const list = storage.get("employeeList") as UTSArray<Any>; const list = storage.get("employeeList") as UTSArray<Any>;
console.log("storage employeeList:", list, "length:", list != null ? (list as Array<any>).length : 0);
employeeList.value = list != null ? (list as Array<any>) : []; employeeList.value = list != null ? (list as Array<any>) : [];
console.log("employeeList.value updated, length:", employeeList.value.length); }, { immediate: true });
}, { immediate: true, deep: true });
function close(): void { function close(): void {
visible.value = false; visible.value = false;
...@@ -119,23 +117,25 @@ function handleHide(): void { ...@@ -119,23 +117,25 @@ function handleHide(): void {
} }
function open(): void { function open(): void {
// 先显示弹窗
visible.value = true; visible.value = true;
// 如果已有数据,直接返回
if (employeeList.value.length > 0) {
return;
}
const userInfo: null | UserInfo = storage.get("userInfo") as null | UTSJSONObject; const userInfo: null | UserInfo = storage.get("userInfo") as null | UTSJSONObject;
if (userInfo == null) return; if (userInfo == null) return;
const shopMerchantId = userInfo.shopMerchantId; const shopMerchantId = userInfo.shopMerchantId;
// 获取销售人员列表 // 异步获取销售人员列表,不阻塞弹窗显示
getEmployeeListApi({ merchantId: shopMerchantId }).then((res: any) => { getEmployeeListApi({ merchantId: shopMerchantId }).then((res: any) => {
console.log("getEmployeeListApi response:", res);
const list = res as Array<any>; const list = res as Array<any>;
console.log("list length:", list != null ? list.length : 0);
dispatch("setEmployeeList", list); dispatch("setEmployeeList", list);
const listToStore = list != null ? list : []; const listToStore = list != null ? list : [];
console.log("Saving to storage, length:", listToStore.length);
storage.set("employeeList", listToStore, 0); storage.set("employeeList", listToStore, 0);
console.log("Triggering updateView");
updateView.value = Date.now(); updateView.value = Date.now();
console.log("updateView triggered with:", updateView.value);
}); });
} }
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
:autoplay="modules.length > 1" :autoplay="modules.length > 1"
:circular="modules.length > 1" :circular="modules.length > 1"
:indicator="false" :indicator="false"
:height="swiperHeight"
@change="(e: any) => onSwiperChangeFromEvent(e)" @change="(e: any) => onSwiperChangeFromEvent(e)"
@click="(idx: any) => onSlideTapFromEvent(idx)" @click="(idx: any) => onSlideTapFromEvent(idx)"
></un-swiper> ></un-swiper>
......
<template> <template>
<view class="home-frame-container scene-shell-root hf-embed-in-tab-slot" <view class="home-frame-container scene-shell-root hf-embed-in-tab-slot"
:class="[adapterClass]"> >
<!-- 主导航 Tabbar 由 SceneShell 横/竖壳承担;此处仅内容区 --> <!-- 主导航 Tabbar 由 SceneShell 横/竖壳承担;此处仅内容区 -->
<view class="home-content hf-content-without-tabbar"> <view class="home-content hf-content-without-tabbar">
<view class="right-side"> <view class="right-side">
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
:eyebrow="resolvedIntroEyebrow" :eyebrow="resolvedIntroEyebrow"
:empty-title="resolvedIntroEmptyTitle" :empty-title="resolvedIntroEmptyTitle"
:empty-text="resolvedIntroEmptyText" :empty-text="resolvedIntroEmptyText"
:swiper-height="resolvedIntroSwiperHeight"
@swiper-change="onIntroSwiperChange" @swiper-change="onIntroSwiperChange"
@slide-tap="onIntroSlideTap" /> @slide-tap="onIntroSlideTap" />
<view v-else class="swiper-placeholder"> <view v-else class="swiper-placeholder">
...@@ -65,7 +64,7 @@ ...@@ -65,7 +64,7 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, defineExpose, onMounted, ref } from "vue"; import { computed, defineExpose, ref } from "vue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix"; import type { UnSwiperItem } from "@/uni_modules/uview-unix";
...@@ -159,29 +158,29 @@ const resolvedIntroEmptyText = computed((): string => { ...@@ -159,29 +158,29 @@ const resolvedIntroEmptyText = computed((): string => {
return t != null && t !== "" ? (t as string) : "敬请期待"; return t != null && t !== "" ? (t as string) : "敬请期待";
}); });
const resolvedIntroSwiperHeight = computed((): number => { // const resolvedIntroSwiperHeight = computed((): number => {
const h = props.introSwiperHeight; // const h = props.introSwiperHeight;
if (h != null) { // if (h != null) {
return h as number; // return h as number;
} // }
// 轮播图高度 = module-box 高度 - 标题栏高度(48px) - 头部高度(40px) // // 轮播图高度 = module-box 高度 - 标题栏高度(48px) - 头部高度(40px)
// 从 CSS 变量中获取 module-box-height // // 从 CSS 变量中获取 module-box-height
const isLandscape = !layoutService.isMode("portrait"); // const isLandscape = !layoutService.isMode("portrait");
const resolution = layoutService.getResolutionBucket(); // const resolution = layoutService.getResolutionBucket();
// 根据不同分辨率返回对应的高度 // // 根据不同分辨率返回对应的高度
if (isLandscape) { // if (isLandscape) {
if (resolution == "1174x768") return 266; // 360 - 54 - 40 // if (resolution == "1174x768") return 266; // 360 - 54 - 40
if (resolution == "1024x768") return 348; // 440 - 52 - 40 // if (resolution == "1024x768") return 348; // 440 - 52 - 40
if (resolution == "816x393") return 116; // 200 - 44 - 40 // if (resolution == "816x393") return 116; // 200 - 44 - 40
return 352; // 默认横屏 440 - 48 - 40 // return 352; // 默认横屏 440 - 48 - 40
} else { // } else {
if (resolution == "768x1174") return 556; // 650 - 54 - 40 // if (resolution == "768x1174") return 556; // 650 - 54 - 40
if (resolution == "414x896") return 366; // 450 - 44 - 40 // if (resolution == "414x896") return 366; // 450 - 44 - 40
if (resolution == "393x816") return 318; // 400 - 42 - 40 // if (resolution == "393x816") return 318; // 400 - 42 - 40
return 332; // 默认竖屏 420 - 48 - 40 // return 332; // 默认竖屏 420 - 48 - 40
} // }
}); // });
function onIntroSwiperChange(index: number): void { function onIntroSwiperChange(index: number): void {
emit("introSwiperChange", index); emit("introSwiperChange", index);
...@@ -191,33 +190,33 @@ function onIntroSlideTap(index: number): void { ...@@ -191,33 +190,33 @@ function onIntroSlideTap(index: number): void {
emit("introSlideTap", index); emit("introSlideTap", index);
} }
useResolutionConfig(); // useResolutionConfig();
const adapterClass = computed((): string => { // const adapterClass = computed((): string => {
const cls = cssClassRef.value; // const cls = cssClassRef.value;
console.log('[HomeFrame] adapterClass:', cls); // console.log('[HomeFrame] adapterClass:', cls);
return cls != null ? (cls as string) : ""; // return cls != null ? (cls as string) : "";
}); // });
const modeClass = computed((): string => { // const modeClass = computed((): string => {
const modeRef = layoutService.getCurrentMode(); // const modeRef = layoutService.getCurrentMode();
const m = modeRef.value; // const m = modeRef.value;
return m == "portrait" ? "mode-portrait" : "mode-landscape"; // return m == "portrait" ? "mode-portrait" : "mode-landscape";
}); // });
const resolutionClass = computed((): string => { // const resolutionClass = computed((): string => {
const bucket = layoutService.getResolutionBucket(); // const bucket = layoutService.getResolutionBucket();
return `res-${bucket}`; // return `res-${bucket}`;
}); // });
// 动态样式 - 根据分辨率返回不同的样式(使用 CSS 变量) // // 动态样式 - 根据分辨率返回不同的样式(使用 CSS 变量)
const dynamicModuleBoxStyle = computed((): any => { // const dynamicModuleBoxStyle = computed((): any => {
return {}; // return {};
}); // });
const dynamicToolBoxStyle = computed((): any => { // const dynamicToolBoxStyle = computed((): any => {
return {}; // return {};
}); // });
const userInfo = ref<UTSJSONObject>({}); const userInfo = ref<UTSJSONObject>({});
const sceneType = ref<number>(1); const sceneType = ref<number>(1);
...@@ -235,8 +234,7 @@ function onStartClick(): void { ...@@ -235,8 +234,7 @@ function onStartClick(): void {
emit("start"); emit("start");
} }
onLoad((options) => {
onMounted((): void => {
requestRecordPermission(); requestRecordPermission();
}); });
defineExpose({ defineExpose({
......
...@@ -433,33 +433,14 @@ ...@@ -433,33 +433,14 @@
background: linear-gradient(to right, #eeeeee, rgba(216, 216, 216, 0)); background: linear-gradient(to right, #eeeeee, rgba(216, 216, 216, 0));
} }
// ===== HomeFrame Tabbar(横屏左侧 / 竖屏底部)===== // ===== HomeFrame Tabbar( .hf-landscape-column,
.home-tabbar {
display: flex;
flex-direction: column;
position: relative;
// width: 120px;
flex-shrink: 0;
background-image: linear-gradient(to bottom, #e8f0fe, #e8ecf5);
.home-tabbar-bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.hf-landscape-column,
.user-box, .user-box,
.landscape-tabbar-wrap, .landscape-tabbar-wrap,
.home-tabbar-footer { .home-tabbar-footer {
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
}
.home-tabbar-landscape { .home-tabbar-landscape {
min-height: 0; min-height: 0;
...@@ -581,6 +562,28 @@ ...@@ -581,6 +562,28 @@
/* 横屏:footer 为侧栏第三段,由父级 flex 贴底;竖屏若复用此类名再按需加 margin */ /* 横屏:footer 为侧栏第三段,由父级 flex 贴底;竖屏若复用此类名再按需加 margin */
.home-tabbar-footer { .home-tabbar-footer {
flex-shrink: 0; flex-shrink: 0;
text-align: center;
}
// 横屏:中间区域放 un-tabbar(组件根节点通过 custom-style 纵向排列)
.landscape-tabbar-wrap {
flex: 1;
min-height: 0;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.landscape-un-tabbar {
width: 100%;
flex: 1;
min-height: 0;
}
.home-tabbar-footer {
margin-top: auto;
padding-bottom: 40px; padding-bottom: 40px;
} }
......
...@@ -77,9 +77,8 @@ export default { ...@@ -77,9 +77,8 @@ export default {
'--common-title-height': '54px', '--common-title-height': '54px',
'--entrance-icon-size': '64px', '--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)', '--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '640px', '--tabbar-height': '70px',
'--tabbar-icon-size': '34px', '--tabbar-icon-size': '46px',
'--tabbar-width': '140px',
}, },
// 小屏 Pad 横屏 (816x393) - 产品介绍占 65% // 小屏 Pad 横屏 (816x393) - 产品介绍占 65%
...@@ -96,7 +95,7 @@ export default { ...@@ -96,7 +95,7 @@ export default {
// iPhone 14 Pro 竖屏 (393x816) - 产品介绍占 60% // iPhone 14 Pro 竖屏 (393x816) - 产品介绍占 60%
// 可用高度 = 816 - 44(状态栏) - 42(标题) - 60(TabBar) ≈ 670px // 可用高度 = 816 - 44(状态栏) - 42(标题) - 60(TabBar) ≈ 670px
'portrait-393x816': { 'portrait-393x816': {
'--module-box-height': '300px', '--module-box-height': '288px',
'--tool-box-min-height': '200px', '--tool-box-min-height': '200px',
'--common-title-height': '42px', '--common-title-height': '42px',
'--tabbar-height': '70px', '--tabbar-height': '70px',
...@@ -106,13 +105,13 @@ export default { ...@@ -106,13 +105,13 @@ export default {
// 大屏平板竖屏 (768x1174) - 产品介绍占 65% // 大屏平板竖屏 (768x1174) - 产品介绍占 65%
// 可用高度 = 1174 - 44(状态栏) - 54(标题) - 70(TabBar) ≈ 1006px // 可用高度 = 1174 - 44(状态栏) - 54(标题) - 70(TabBar) ≈ 1006px
'portrait-768x1174': { 'portrait-768x1174': {
'--module-box-height': '550px', '--module-box-height': '500px',
'--tool-box-min-height': '380px', '--tool-box-min-height': '200px',
'--common-title-height': '54px', '--common-title-height': '54px',
'--entrance-icon-size': '64px', '--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)', '--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '70px', '--tabbar-height': '100px',
'--tabbar-icon-size': '34px', '--tabbar-icon-size': '36px',
}, },
} }
} }
<template> <template>
<!-- 保持单根节点,确保父组件 v-show 生效 --> <!-- 保持单根节点,确保父组件 v-show 生效 -->
<view> <view class="fade-in-up">
<view v-if="!flag" class="skeleton-wrap"> <SingleColumnSkeleton v-if="!flag" :count="4" />
<un-skeleton :animate="true" <view v-else class="list-container">
avatar
:loading="true"
rows="6"
title>
</un-skeleton>
</view>
<view v-else class="box">
<template v-if="loginUserInfoList.length > 0"> <template v-if="loginUserInfoList.length > 0">
<view v-for="(item, index) in loginUserInfoList" <view v-for="(item, index) in loginUserInfoList"
:key="index" :key="index"
class="items" class="items"
:class="[item.active ? 'active' : '']" :class="[item.active ? 'active' : '', pressedIndex === index ? 'pressed' : '']"
@touchstart="handleTouchStart(index)"
@touchend="handleTouchEnd"
@click="chooseAccount(item)"> @click="chooseAccount(item)">
<view class="right"> <view class="right">
<view class="midle" :class="[getMidleClass(item)]"> <view class="midle" :class="[getMidleClass(item)]">
...@@ -25,7 +20,6 @@ ...@@ -25,7 +20,6 @@
<text class="name">{{ item.merchantName }}</text> <text class="name">{{ item.merchantName }}</text>
<text class="shop_no">商户号:{{ item.merchantId }}</text> <text class="shop_no">商户号:{{ item.merchantId }}</text>
</view> </view>
</view> </view>
</template> </template>
<template v-else> <template v-else>
...@@ -39,6 +33,7 @@ ...@@ -39,6 +33,7 @@
import { defineExpose, onMounted, ref } from "vue"; import { defineExpose, onMounted, ref } from "vue";
import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts"; import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts";
import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
type AccountItem = { type AccountItem = {
...@@ -57,6 +52,7 @@ const loginUserInfoList = ref<AccountItem[]>([]); ...@@ -57,6 +52,7 @@ const loginUserInfoList = ref<AccountItem[]>([]);
const copyLoginUserInfoList = ref<AccountItem[]>([]); const copyLoginUserInfoList = ref<AccountItem[]>([]);
const selectedUuid = ref<string>(""); const selectedUuid = ref<string>("");
const flag = ref<boolean>(false); const flag = ref<boolean>(false);
const pressedIndex = ref<number>(-1);
function getRoleText(item: AccountItem): string { function getRoleText(item: AccountItem): string {
if (item.isSuper == true) return "超管"; if (item.isSuper == true) return "超管";
...@@ -74,6 +70,14 @@ function getMidleClass(item: AccountItem): string { ...@@ -74,6 +70,14 @@ function getMidleClass(item: AccountItem): string {
return "midle_5"; return "midle_5";
} }
function handleTouchStart(index: number): void {
pressedIndex.value = index;
}
function handleTouchEnd(): void {
pressedIndex.value = -1;
}
function get4SStoreList(loginUserObj: UTSJSONObject): void { function get4SStoreList(loginUserObj: UTSJSONObject): void {
console.log("get4SStoreList:", loginUserObj); console.log("get4SStoreList:", loginUserObj);
...@@ -150,18 +154,12 @@ function get4SStoreList(loginUserObj: UTSJSONObject): void { ...@@ -150,18 +154,12 @@ function get4SStoreList(loginUserObj: UTSJSONObject): void {
function selectAccountLogin(id: string, merchantName: string, userInfo: AccountItem | null): void { function selectAccountLogin(id: string, merchantName: string, userInfo: AccountItem | null): void {
console.log(`选择账号${merchantName}登录!`); console.log(`选择账号${merchantName}登录!`);
uni.showLoading({
title: "加载中",
mask: false
});
const params: UTSJSONObject = { const params: UTSJSONObject = {
id id
}; };
apiSelectAccountLogin(params).then((res: UTSJSONObject): void => { apiSelectAccountLogin(params).then((res: UTSJSONObject): void => {
uni.hideLoading();
console.log("selectAccountLogin 返回数据:", res); console.log("selectAccountLogin 返回数据:", res);
const code = res.code as null | string; const code = res.code as null | string;
...@@ -189,7 +187,6 @@ function selectAccountLogin(id: string, merchantName: string, userInfo: AccountI ...@@ -189,7 +187,6 @@ function selectAccountLogin(id: string, merchantName: string, userInfo: AccountI
}); });
} }
}).catch((error: any | null): void => { }).catch((error: any | null): void => {
uni.hideLoading();
console.error("selectAccountLogin 失败:", error); console.error("selectAccountLogin 失败:", error);
uni.showToast({ uni.showToast({
title: "网络异常,请稍后重试", title: "网络异常,请稍后重试",
...@@ -236,6 +233,7 @@ function chooseAccount(item: AccountItem): void { ...@@ -236,6 +233,7 @@ function chooseAccount(item: AccountItem): void {
} }
i++; i++;
} }
console.log("选择账号:", list);
loginUserInfoList.value = list; loginUserInfoList.value = list;
selectedUuid.value = item.uuid; selectedUuid.value = item.uuid;
choiceAccountLogin(); choiceAccountLogin();
...@@ -278,16 +276,9 @@ function getListSelectAccount(autoLogin: boolean): void { ...@@ -278,16 +276,9 @@ function getListSelectAccount(autoLogin: boolean): void {
console.log("进入选择账号页面!autoLogin:", autoLogin); console.log("进入选择账号页面!autoLogin:", autoLogin);
flag.value = false; flag.value = false;
uni.showLoading({
title: "加载中",
mask: false
});
const params: UTSJSONObject = {}; const params: UTSJSONObject = {};
apiGetListSelectAccount(params).then((res: UTSJSONObject): void => { apiGetListSelectAccount(params).then((res: UTSJSONObject): void => {
uni.hideLoading();
console.log("getListSelectAccount 返回数据:", res); console.log("getListSelectAccount 返回数据:", res);
const code = res.code as null | string; const code = res.code as null | string;
...@@ -336,7 +327,7 @@ function getListSelectAccount(autoLogin: boolean): void { ...@@ -336,7 +327,7 @@ function getListSelectAccount(autoLogin: boolean): void {
i++; i++;
} }
console.log("解析后的账号列表,数量:", accountList.length); console.log("解析后的账号列表,数量:", accountList.length,accountList);
loginUserInfoList.value = accountList; loginUserInfoList.value = accountList;
copyLoginUserInfoList.value = accountList; copyLoginUserInfoList.value = accountList;
flag.value = true; flag.value = true;
...@@ -360,7 +351,6 @@ function getListSelectAccount(autoLogin: boolean): void { ...@@ -360,7 +351,6 @@ function getListSelectAccount(autoLogin: boolean): void {
flag.value = true; flag.value = true;
} }
}).catch((error: any | null): void => { }).catch((error: any | null): void => {
uni.hideLoading();
flag.value = true; flag.value = true;
console.error("getListSelectAccount 失败:", error); console.error("getListSelectAccount 失败:", error);
uni.showToast({ uni.showToast({
...@@ -382,122 +372,156 @@ onMounted(() => { ...@@ -382,122 +372,156 @@ onMounted(() => {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.skeleton-wrap { .list-container {
padding: 24px; display: flex;
flex-direction: column;
width: 100%; width: 100%;
} }
.box { .items {
min-height: 92px;
background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
border-radius: 16px;
padding: 18px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
flex-wrap: wrap; box-sizing: border-box;
padding: 0 24px; border: 1px solid rgba(226, 232, 240, 0.6);
justify-content: space-between; box-shadow:
0 2px 8px rgba(15, 23, 42, 0.04),
0 8px 24px rgba(15, 23, 42, 0.06);
transition: all 0.1s ease-out;
width: 100%;
margin-bottom: 16px;
position: relative;
overflow: hidden;
// 微妙的光泽效果
&::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent 0%,
rgba(255, 255, 255, 0.3) 50%,
transparent 100%
);
transition: left 0.6s ease;
}
&:last-child {
margin-bottom: 0;
}
&:active,
&.pressed {
transform: scale(0.96);
box-shadow:
0 1px 2px rgba(15, 23, 42, 0.08),
0 2px 6px rgba(15, 23, 42, 0.1);
border-color: rgba(22, 119, 255, 0.4);
background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
}
.left {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
.name {
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
color: #1e293b;
letter-spacing: 0.3px;
line-height: 1.4;
}
.shop_no {
font-weight: 400;
font-size: 13px;
margin-top: 6px;
color: #94a3b8;
letter-spacing: 0.2px;
}
}
.items { .right {
width: 48%; flex-shrink: 0;
margin-bottom: 24px;
height: 80px;
background: #ffffff;
border-radius: 8px;
padding: 16px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; margin-right: 16px;
box-sizing: border-box;
border: 2px solid transparent;
.left { .midle {
flex: 1; width: 52px;
height: 52px;
border-radius: 26px;
display: flex; display: flex;
flex-direction: column; flex-direction: row;
align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
.name { transition: all 0.3s ease;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
color: #181a1f;
}
.shop_no {
font-weight: 400;
font-size: 14px;
margin-top: 6px;
color: #999ea8;
}
} }
.right { .midle-text {
flex-shrink: 0; font-size: 14px;
display: flex; font-weight: 700;
flex-direction: row; text-align: center;
align-items: center; letter-spacing: 0.5px;
margin-right: 14px; }
.midle { .midle_1 {
width: 48px; background: linear-gradient(135deg, rgba(242, 71, 36, 0.12) 0%, rgba(242, 71, 36, 0.06) 100%);
height: 48px; .midle-text { color: #f24724; }
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.midle-text {
font-size: 14px;
font-weight: 700;
text-align: center;
}
.midle_1 {
background-color: #f247241a;
.midle-text {
color: #f24724;
}
}
.midle_2 {
background-color: #ff9d0a1a;
.midle-text {
color: #ff9d0a;
}
}
.midle_3 {
background-color: #347bff1a;
.midle-text {
color: #347bff;
}
}
.midle_4 {
background-color: #35c3761a;
.midle-text {
color: #35c376;
}
}
.midle_5 {
background-color: #35c3761a;
.midle-text {
color: #35c376;
}
}
} }
.midle_2 {
background: linear-gradient(135deg, rgba(255, 157, 10, 0.12) 0%, rgba(255, 157, 10, 0.06) 100%);
.midle-text { color: #ff9d0a; }
}
.midle_3 {
background: linear-gradient(135deg, rgba(52, 123, 255, 0.12) 0%, rgba(52, 123, 255, 0.06) 100%);
.midle-text { color: #347bff; }
}
.midle_4 {
background: linear-gradient(135deg, rgba(53, 195, 118, 0.12) 0%, rgba(53, 195, 118, 0.06) 100%);
.midle-text { color: #35c376; }
}
.midle_5 {
background: linear-gradient(135deg, rgba(53, 195, 118, 0.12) 0%, rgba(53, 195, 118, 0.06) 100%);
.midle-text { color: #35c376; }
}
}
}
.active {
background: linear-gradient(135deg, rgba(22, 119, 255, 0.06) 0%, rgba(22, 119, 255, 0.02) 100%);
border-color: rgba(22, 119, 255, 0.3);
box-shadow:
0 4px 16px rgba(22, 119, 255, 0.12),
0 12px 32px rgba(22, 119, 255, 0.16);
.left .name {
color: #1677FF;
font-weight: 700;
} }
.active { .right .midle {
border: 2px solid #347bff; box-shadow: 0 4px 12px rgba(22, 119, 255, 0.2);
transform: scale(1.05);
} }
} }
</style> </style>
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
<view v-for="(item, index) in loginUserInfoList" <view v-for="(item, index) in loginUserInfoList"
:key="index" :key="index"
class="items" class="items"
:class="[item.active ? 'active' : '', (index + 1) % 2 === 0 ? 'item-even' : '']" :class="[item.active ? 'active' : '', (index + 1) % 2 === 0 ? 'item-even' : '', pressedIndex === index ? 'pressed' : '']"
@touchstart="handleTouchStart(index)"
@touchend="handleTouchEnd"
@click="chooseMerchantItem(item)"> @click="chooseMerchantItem(item)">
<view class="left"> <view class="left">
<view class="store-badge"> <view class="store-badge">
...@@ -43,8 +45,17 @@ const loginUserInfoList = ref<MerchantItem[]>([]); ...@@ -43,8 +45,17 @@ const loginUserInfoList = ref<MerchantItem[]>([]);
const copyLoginUserInfoList = ref<MerchantItem[]>([]); const copyLoginUserInfoList = ref<MerchantItem[]>([]);
const flag = ref<boolean>(false); const flag = ref<boolean>(false);
const selectMerchantId = ref<string>(""); const selectMerchantId = ref<string>("");
const pressedIndex = ref<number>(-1);
let userInfo: null | UTSJSONObject = null; let userInfo: null | UTSJSONObject = null;
function handleTouchStart(index: number): void {
pressedIndex.value = index;
}
function handleTouchEnd(): void {
pressedIndex.value = -1;
}
function jumpPage(item: MerchantItem, openSceneArr: number[]): void { function jumpPage(item: MerchantItem, openSceneArr: number[]): void {
const shopMerchantName = item.merchantName; const shopMerchantName = item.merchantName;
const shopMerchantId = item.merchantId; const shopMerchantId = item.merchantId;
...@@ -306,7 +317,7 @@ defineExpose({ ...@@ -306,7 +317,7 @@ defineExpose({
box-shadow: box-shadow:
0 2px 8px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04),
0 6px 18px rgba(15, 23, 42, 0.05); 0 6px 18px rgba(15, 23, 42, 0.05);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); transition: all 0.1s ease-out;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
...@@ -320,12 +331,14 @@ defineExpose({ ...@@ -320,12 +331,14 @@ defineExpose({
margin-right: 0; margin-right: 0;
} }
&:active { &:active,
transform: translateY(-1px) scale(0.99); &.pressed {
transform: scale(0.95);
box-shadow: box-shadow:
0 3px 10px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.08),
0 8px 24px rgba(15, 23, 42, 0.08); 0 2px 6px rgba(15, 23, 42, 0.1);
border-color: rgba(22, 119, 255, 0.2); border-color: rgba(22, 119, 255, 0.4);
background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
} }
} }
...@@ -389,7 +402,6 @@ defineExpose({ ...@@ -389,7 +402,6 @@ defineExpose({
box-shadow: box-shadow:
0 3px 12px rgba(22, 119, 255, 0.1), 0 3px 12px rgba(22, 119, 255, 0.1),
0 8px 24px rgba(22, 119, 255, 0.12); 0 8px 24px rgba(22, 119, 255, 0.12);
transform: translateY(-1px) scale(0.99);
} }
.items.active .name { .items.active .name {
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
<view v-for="(item, index) in sceneList" <view v-for="(item, index) in sceneList"
:key="index" :key="index"
class="items" class="items"
:class="[item.actived ? 'active' : '']" :class="[item.actived ? 'active' : '', pressedIndex === index ? 'pressed' : '']"
@touchstart="handleTouchStart(index)"
@touchend="handleTouchEnd"
@click="selectScene(item, index)"> @click="selectScene(item, index)">
<view class="left"> <view class="left">
<view class="scene-icon" :class="[`scene-type-${item.sceneType}`]"> <view class="scene-icon" :class="[`scene-type-${item.sceneType}`]">
...@@ -45,6 +47,7 @@ const sceneList = ref<SceneItem[]>([ ...@@ -45,6 +47,7 @@ const sceneList = ref<SceneItem[]>([
]); ]);
const loading = ref<boolean>(true); const loading = ref<boolean>(true);
const pressedIndex = ref<number>(-1);
let userInfo: null | UTSJSONObject = null; let userInfo: null | UTSJSONObject = null;
let jumpTimer: number = 0; let jumpTimer: number = 0;
...@@ -62,6 +65,14 @@ function getSceneIconText(sceneType: number): string { ...@@ -62,6 +65,14 @@ function getSceneIconText(sceneType: number): string {
} }
} }
function handleTouchStart(index: number): void {
pressedIndex.value = index;
}
function handleTouchEnd(): void {
pressedIndex.value = -1;
}
function jump(info: UTSJSONObject, data: any | null): void { function jump(info: UTSJSONObject, data: any | null): void {
const now = Date.now(); const now = Date.now();
if (now - jumpTimer < 3000) { if (now - jumpTimer < 3000) {
...@@ -223,7 +234,7 @@ defineExpose({ ...@@ -223,7 +234,7 @@ defineExpose({
box-shadow: box-shadow:
0 2px 8px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04),
0 8px 24px rgba(15, 23, 42, 0.06); 0 8px 24px rgba(15, 23, 42, 0.06);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); transition: all 0.1s ease-out;
width: 100%; width: 100%;
margin-bottom: 16px; margin-bottom: 16px;
position: relative; position: relative;
...@@ -233,12 +244,14 @@ defineExpose({ ...@@ -233,12 +244,14 @@ defineExpose({
margin-bottom: 0; margin-bottom: 0;
} }
&:active { &:active,
transform: translateY(-2px); &.pressed {
transform: scale(0.96);
box-shadow: box-shadow:
0 4px 12px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.08),
0 12px 32px rgba(15, 23, 42, 0.1); 0 2px 6px rgba(15, 23, 42, 0.1);
border-color: rgba(22, 119, 255, 0.2); border-color: rgba(22, 119, 255, 0.4);
background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
} }
.left { .left {
...@@ -316,7 +329,6 @@ defineExpose({ ...@@ -316,7 +329,6 @@ defineExpose({
box-shadow: box-shadow:
0 4px 16px rgba(22, 119, 255, 0.12), 0 4px 16px rgba(22, 119, 255, 0.12),
0 12px 32px rgba(22, 119, 255, 0.16); 0 12px 32px rgba(22, 119, 255, 0.16);
transform: translateY(-2px);
.right .name { .right .name {
color: #1677FF; color: #1677FF;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!