Commit b320052e by cen

feat: 轻改首页

1 parent 5a91d0e7
<template> <template>
<view class="home-frame-container"> <view class="home-frame-container">
<!-- 首页内容区 --> <!-- 首页内容区 -->
<view :class="['home-content', isPortraitMode ? 'home-content-portrait' : 'home-content-pad']" v-if="!showDetail"> <view v-if="!showDetail"
<HomeFrameLeftSide class="home-content"
:userInfo="userInfo" :class="[isPortraitMode ? 'home-content-portrait' : 'home-content-pad']">
:tabIndex="tabIndex" <HomeFrameLeftSide :is-portrait="isPortraitMode"
:isPortrait="isPortraitMode" :tab-index="tabIndex"
@changeTab="onChangeTab" :user-info="userInfo"
> @change-tab="onChangeTab">
<template v-if="isPortraitMode && useCardLayout" #portraitAction> <template v-if="isPortraitMode && useCardLayout" #portraitAction>
<view class="portrait-start-btn" @click="onStartClick"> <view class="portrait-start-btn" @click="onStartClick">
<text class="start-text">开始接待</text> <text class="start-text">开始接待</text>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</HomeFrameLeftSide> </HomeFrameLeftSide>
<view class="right-side"> <view class="right-side">
<!-- 竖屏布局:顶栏(含开始接待) + 纵向三卡片 --> <!-- 竖屏布局:顶栏(含开始接待) + 纵向三卡片 -->
<view class="portrait-layout" v-if="isPortraitMode && useCardLayout && tabIndex == 0"> <view v-if="isPortraitMode && useCardLayout && tabIndex == 0" class="portrait-layout">
<scroll-view class="portrait-scroll" scroll-y="true"> <scroll-view class="portrait-scroll" scroll-y="true">
<view class="portrait-cards"> <view class="portrait-cards">
<view class="module-box box-class portrait-card"> <view class="module-box box-class portrait-card">
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<text class="title-text">展业工具</text> <text class="title-text">展业工具</text>
</view> </view>
<view class="content-box"> <view class="content-box">
<Entrance :sceneType="sceneType" /> <Entrance :scene-type="sceneType" />
</view> </view>
</view> </view>
<view class="content-right box-class portrait-card"> <view class="content-right box-class portrait-card">
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- 横屏三卡片布局:轻改等使用 swiperCustom --> <!-- 横屏三卡片布局:轻改等使用 swiperCustom -->
<view class="app-content-box right-content show-content-box" v-else-if="isPortraitMode == false && useCardLayout && tabIndex == 0"> <view v-else-if="isPortraitMode == false && useCardLayout && tabIndex == 0" class="app-content-box right-content show-content-box">
<view class="start" @click="onStartClick"> <view class="start" @click="onStartClick">
<view class="start-inner"> <view class="start-inner">
<text class="start-text">开始接待</text> <text class="start-text">开始接待</text>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<text class="title-text">展业工具</text> <text class="title-text">展业工具</text>
</view> </view>
<view class="content-box"> <view class="content-box">
<Entrance :sceneType="sceneType" /> <Entrance :scene-type="sceneType" />
</view> </view>
</view> </view>
</view> </view>
...@@ -89,83 +89,86 @@ ...@@ -89,83 +89,86 @@
</view> </view>
</view> </view>
<!-- 旧版居中布局:权益、二手车等使用 #home --> <!-- 旧版居中布局:权益、二手车等使用 #home -->
<view class="legacy-home-wrap" v-else-if="tabIndex == 0"> <view v-else-if="tabIndex == 0" class="legacy-home-wrap">
<slot name="home"></slot> <slot name="home"></slot>
</view> </view>
</view> </view>
<!-- 底部门店信息:与 right-side 同级,样式与旧项目 store-addr 一致 -->
<view v-if="showFooter" class="store-addr">
<view class="addr-line addr-line-left"></view>
<view class="icon-addr"></view>
<text class="addr-text">{{ userInfo.shopMerchantName ?? '' }}</text>
<view class="addr-line addr-line-right"></view>
</view>
</view> </view>
<!-- 详情页内容区 --> <!-- 详情页内容区 -->
<view class="detail-content" v-if="showDetail"> <view v-if="showDetail" class="detail-content">
<slot name="detail"></slot> <slot name="detail"></slot>
</view> </view>
<!-- 底部门店信息 -->
<view class="store-footer" v-if="showFooter">
<view class="store-icon"></view>
<text class="store-name">{{ userInfo['shopMerchantName'] ?? '' }}</text>
</view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref, computed, defineExpose } from 'vue' import { computed, defineExpose, ref } from "vue";
import { storage } from '@/utils/storage.uts'
import { layoutService } from '@/services/LayoutService'
import HomeFrameLeftSide from './LeftSide.uvue'
import Entrance from '@/components/Entrance.uvue'
import HomeFrameMessageIndex from './MessageIndex.uvue'
const isPortraitMode = computed((): boolean => layoutService.isMode('portrait')) import Entrance from "@/components/Entrance.uvue";
import { layoutService } from "@/services/LayoutService";
import { storage } from "@/utils/storage.uts";
import HomeFrameLeftSide from "./LeftSide.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue";
const props = defineProps<{ const props = defineProps<{
showFooter?: boolean showFooter?: boolean
swiperCustom?: boolean swiperCustom?: boolean
}>() }>();
const useCardLayout = computed((): boolean => {
return props.swiperCustom === true
})
const emit = defineEmits<{ const emit = defineEmits<{
start: [] start: []
}>() }>();
const showDetail = ref(false) const isPortraitMode = computed((): boolean => layoutService.isMode("portrait"));
const userInfo = ref<UTSJSONObject>({})
const sceneType = ref<number>(1) const useCardLayout = computed((): boolean => {
const tabIndex = ref(0) return props.swiperCustom === true;
});
const showDetail = ref(false);
const userInfo = ref<UTSJSONObject>({});
const sceneType = ref<number>(1);
const tabIndex = ref(0);
function updateApp(): void { function updateApp(): void {
const info = storage.get('userInfo') const info = storage.get("userInfo");
if (info != null) { if (info != null) {
userInfo.value = info as UTSJSONObject userInfo.value = info as UTSJSONObject;
const st = userInfo.value['sceneType'] as number | null const st = userInfo.value.sceneType as null | number;
sceneType.value = st != null ? st : 1 sceneType.value = st != null ? st : 1;
} }
} }
function showDetailPage(): void { function showDetailPage(): void {
showDetail.value = true showDetail.value = true;
} }
function hideDetailPage(): void { function hideDetailPage(): void {
showDetail.value = false showDetail.value = false;
} }
function onChangeTab(index: number): void { function onChangeTab(index: number): void {
tabIndex.value = index tabIndex.value = index;
} }
function onStartClick(): void { function onStartClick(): void {
emit('start') emit("start");
} }
defineExpose({ defineExpose({
updateApp, updateApp,
showDetailPage, showDetailPage,
hideDetailPage hideDetailPage
}) });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -179,6 +182,7 @@ defineExpose({ ...@@ -179,6 +182,7 @@ defineExpose({
} }
.home-content { .home-content {
position: relative;
flex: 1; flex: 1;
display: flex; display: flex;
width: 100%; width: 100%;
...@@ -275,18 +279,25 @@ defineExpose({ ...@@ -275,18 +279,25 @@ defineExpose({
} }
.start { .start {
height: 116px; // 参考旧项目:使用 start-btn.png 作为背景
height: 232rpx;
box-sizing: border-box;
margin-right: 64rpx;
position: relative;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: flex-start; align-items: flex-start;
padding-top: var(--l-spacing-xl); padding-top: 60rpx;
background: url('@/assets/images/home/start-btn.png') no-repeat;
background-size: 100% 100%;
} }
.start-inner { .start-inner {
padding: var(--l-spacing-md) var(--l-spacing-2xl); // 背景由 .start 提供,这里只负责文字布局
background: linear-gradient(90deg, #4673ff 0%, #6b9bff 100%); padding: 0;
border-radius: var(--l-spacing-2xl); background: transparent;
box-shadow: 0 4px 16px rgba(70, 115, 255, 0.3); border-radius: 0;
box-shadow: none;
} }
.start-text { .start-text {
...@@ -380,30 +391,47 @@ defineExpose({ ...@@ -380,30 +391,47 @@ defineExpose({
overflow: hidden; overflow: hidden;
} }
.store-footer { /* 底部门店信息,与旧项目 store-addr 一致:居中、无通栏背景、两侧渐变线 */
.store-addr {
position: absolute; position: absolute;
bottom: 0; left: 50%;
left: 0; bottom: 24rpx;
right: 0; transform: translateX(-50%);
height: var(--l-store-footer-height);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center;
border-top: 1px solid #eeeeee;
background: rgba(255, 255, 255, 0.95);
} }
.store-icon { .icon-addr {
width: var(--l-font-xl); width: 32rpx;
height: var(--l-font-xl); height: 32rpx;
margin-right: var(--l-spacing-xs); flex-shrink: 0;
background-color: #4673ff; background-color: #4673ff;
border-radius: 10px; border-radius: 4rpx;
} }
.store-name { .addr-text {
font-size: var(--l-font-sm); font-size: 24rpx;
color: #999; color: #999999;
word-wrap: break-word;
white-space: normal;
line-height: 32rpx;
margin-left: 4rpx;
flex-shrink: 0;
}
.addr-line {
width: 600rpx;
height: 2rpx;
margin: 0 40rpx;
flex-shrink: 0;
}
.addr-line-left {
background: linear-gradient(270deg, #eeeeee 0%, rgba(216, 216, 216, 0) 100%);
}
.addr-line-right {
background: linear-gradient(90deg, #eeeeee 0%, rgba(216, 216, 216, 0) 100%);
} }
</style> </style>
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
<layout-root> <layout-root>
<!-- #endif --> <!-- #endif -->
<view class="page-container container"> <view class="page-container container">
<!-- 与旧项目一致:页面背景图 home-bg-1.webp -->
<view class="page-bg"></view>
<HomeFrame ref="homeRef" <HomeFrame ref="homeRef"
:show-footer="true" :show-footer="true"
:swiper-custom="true" :swiper-custom="true"
...@@ -146,7 +148,9 @@ function getPkg(item: any, key: string): any { ...@@ -146,7 +148,9 @@ function getPkg(item: any, key: string): any {
} }
function callExposedMethod(comp: any, methodName: string): void { function callExposedMethod(comp: any, methodName: string): void {
if (comp == null) return; if (comp == null) {
return;
}
const obj = comp as UTSJSONObject; const obj = comp as UTSJSONObject;
const fn = obj[methodName]; const fn = obj[methodName];
if (fn != null) { if (fn != null) {
...@@ -188,11 +192,7 @@ function jumpPage(pid: string): void { ...@@ -188,11 +192,7 @@ function jumpPage(pid: string): void {
function handleStart(): void { function handleStart(): void {
const comp = customerTypeRef.value; const comp = customerTypeRef.value;
if (comp != null) { if (comp != null) {
const compObj = comp as UTSJSONObject; callExposedMethod(comp, "open");
const openFn = compObj.open;
if (openFn != null && typeof openFn === "function") {
;(openFn as () => void)();
}
} }
} }
...@@ -343,8 +343,8 @@ async function getBoutiquePackageList(): Promise<void> { ...@@ -343,8 +343,8 @@ async function getBoutiquePackageList(): Promise<void> {
for (const element of arr) { for (const element of arr) {
const e = element as UTSJSONObject; const e = element as UTSJSONObject;
if (e != null) { if (e != null) {
e.scriptIntroduction = ((e.scriptIntroduction ?? "") as string).replace(/<\/?br\s*\/?>|\\n|\n/g, "<br>"); e.scriptIntroduction = ((e.scriptIntroduction ?? "") as string).replaceAll(/<\/?br\s*\/?>|\\n|\n/g, "<br>");
e.content = ((e.content ?? "") as string).replace(/<\/?br\s*\/?>|\\n|\n/g, "<br>"); e.content = ((e.content ?? "") as string).replaceAll(/<\/?br\s*\/?>|\\n|\n/g, "<br>");
if (e.marketPrice != null) e.marketPrice = Number.parseFloat((e.marketPrice as any).toString()).toString(); if (e.marketPrice != null) e.marketPrice = Number.parseFloat((e.marketPrice as any).toString()).toString();
if (e.packagePrice != null) e.packagePrice = Number.parseFloat((e.packagePrice as any).toString()).toString(); if (e.packagePrice != null) e.packagePrice = Number.parseFloat((e.packagePrice as any).toString()).toString();
list.push(e); list.push(e);
...@@ -401,12 +401,25 @@ onShow(async () => { ...@@ -401,12 +401,25 @@ onShow(async () => {
.page-container { .page-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative;
} }
.container { .container {
position: relative; position: relative;
} }
.page-bg {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: -1;
background-image: url('@/assets/images/common/home-bg-1.webp');
background-size: cover;
background-repeat: no-repeat;
}
.swiper-custom-wrap { .swiper-custom-wrap {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
// uni_modules/permission-handler-plus 根入口
export * from "./utssdk/index.uts";
// permission-handler-plus 统一入口,按平台导出实现
export type { SuccessCallBack, FailCallBack, PermissionObject } from "./interface.uts";
export { permissionStatusName, permissionIdByName, permissionNameById } from "./interface.uts";
// #ifdef APP-ANDROID
export { checkPermission, requestPermissions } from "./app-android/index.uts";
// #endif
// #ifdef APP-IOS
export { checkPermission, requestPermissions } from "./app-ios/index.uts";
// #endif
// #ifdef APP-HARMONY
export { checkPermission, requestPermissions } from "./app-harmony/index.uts";
// #endif
// #ifndef APP-ANDROID || APP-IOS || APP-HARMONY
// Web 等非 App 平台:导出 stub,避免运行时 "does not provide an export named 'checkPermission'" 报错
import type { PermissionObject } from "./interface.uts";
export function checkPermission(permission: string, complete: (result: string) => void): void {
complete("granted")
}
export function requestPermissions(permission: PermissionObject): void {
const nameMap = new Map<string, string>()
if (permission.names != null && permission.names.length > 0) {
permission.names.forEach((name: string) => {
nameMap.set(name, "granted")
})
}
permission.success(nameMap)
}
// #endif
...@@ -18,7 +18,7 @@ export default defineConfig({ ...@@ -18,7 +18,7 @@ export default defineConfig({
], ],
resolve: { resolve: {
alias: { alias: {
"@": resolve("src") "@": resolve(".")
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!