Compare commits
2 Commits
df5e9e92a1
...
f272a57aa3
| Author | SHA1 | Date | |
|---|---|---|---|
| f272a57aa3 | |||
| 6eadcb46cd |
@@ -22,10 +22,6 @@
|
|||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
|
|
||||||
<view class="custom-indicator">
|
|
||||||
图片{{ active + 1 }}/{{ thumbnails.length }}
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 缩略图部分 -->
|
<!-- 缩略图部分 -->
|
||||||
<view
|
<view
|
||||||
v-if="showThumbnails"
|
v-if="showThumbnails"
|
||||||
@@ -52,16 +48,26 @@
|
|||||||
:src="thumb.photoUrl"
|
:src="thumb.photoUrl"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
></image>
|
></image>
|
||||||
<text>{{ thumb.photoName }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
|
<view class="custom-indicator">
|
||||||
|
<uni-icons fontFamily="znicons" size="10" color="#fff">{{
|
||||||
|
zniconsMap["zn-camera"]
|
||||||
|
}}</uni-icons>
|
||||||
|
<text class="custom-indicator-text">{{ thumbnails.length }}</text>
|
||||||
|
<uni-icons fontFamily="znicons" size="10" color="#fff">{{
|
||||||
|
zniconsMap["zn-nav-arrow-right"]
|
||||||
|
}}</uni-icons>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, nextTick } from "vue";
|
import { ref, computed, nextTick } from "vue";
|
||||||
|
import { zniconsMap } from "@/static/fonts/znicons.js";
|
||||||
|
|
||||||
// Props定义
|
// Props定义
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: znicons;
|
||||||
|
src: url("@/static/fonts/znicons.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
.image-swiper {
|
.image-swiper {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -13,27 +18,32 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-indicator {
|
|
||||||
position: absolute;
|
|
||||||
top: 8px;
|
|
||||||
right: 8px;
|
|
||||||
z-index: 10;
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
border-radius: $uni-border-radius-50px;
|
|
||||||
padding: 3px 8px;
|
|
||||||
font-size: 8px;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.thumbnail-box {
|
.thumbnail-box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 12px;
|
left: 12px;
|
||||||
right: 12px;
|
right: 12px;
|
||||||
height: 60px;
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-indicator {
|
||||||
|
margin-left: 12px;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
border-radius: $uni-border-radius-50px;
|
||||||
|
padding: 0 6px 4px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-indicator-text {
|
||||||
|
margin: 0 4px;
|
||||||
|
font-size: 10px;
|
||||||
|
text-align: center;
|
||||||
|
align-items: center;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail-scroll {
|
.thumbnail-scroll {
|
||||||
width: 100%;
|
flex: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -42,7 +52,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 0 5px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail-item {
|
.thumbnail-item {
|
||||||
@@ -52,29 +61,17 @@
|
|||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
.thumbnail-image {
|
.thumbnail-image {
|
||||||
border: 1px solid #fff;
|
border: 2px solid #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail-item .thumbnail-image {
|
.thumbnail-item .thumbnail-image {
|
||||||
width: 48px;
|
width: 36px;
|
||||||
height: 38px;
|
height: 36px;
|
||||||
border-radius: 4px;
|
border-radius: 8px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid transparent;
|
border: 2px solid transparent;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail-item text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 8px;
|
|
||||||
display: block;
|
|
||||||
margin-top: 4px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
max-width: 48px;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="goods-container bg-gray">
|
<view class="goods-container bg-gray">
|
||||||
<TopNavBar title="商品详情" />
|
<TopNavBar
|
||||||
|
title="商品详情"
|
||||||
|
:backgroundColor="`rgba(217, 238, 255, ${navOpacity})`"
|
||||||
|
:titleColor="navOpacity < 0.5 ? '#ffffff' : '#000000'"
|
||||||
|
:backIconColor="navOpacity < 0.5 ? '#ffffff' : '#000000'"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 滚动区域 -->
|
<!-- 滚动区域 -->
|
||||||
<scroll-view class="content-wrapper" scroll-y>
|
<scroll-view class="content-wrapper" scroll-y @scroll="handleScroll">
|
||||||
<ImageSwiper
|
<ImageSwiper
|
||||||
:border-radius="0"
|
:border-radius="0"
|
||||||
:height="300"
|
:height="300"
|
||||||
:images="goodsData.commodityPhotoList"
|
:images="goodsData.commodityPhotoList"
|
||||||
thumbnailBottom="36px"
|
thumbnailBottom="42px"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<view class="goods-content">
|
<view class="goods-content">
|
||||||
@@ -76,6 +81,9 @@ import {
|
|||||||
import { ThrottleUtils } from "@/utils";
|
import { ThrottleUtils } from "@/utils";
|
||||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||||
import ImageSwiper from "@/components/ImageSwiper/index.vue";
|
import ImageSwiper from "@/components/ImageSwiper/index.vue";
|
||||||
|
|
||||||
|
// 导航栏透明度 - 默认透明,随滚动变为不透明
|
||||||
|
const navOpacity = ref(0);
|
||||||
import GoodInfo from "./components/GoodInfo/index.vue";
|
import GoodInfo from "./components/GoodInfo/index.vue";
|
||||||
import GoodConfirm from "./components/GoodConfirm/index.vue";
|
import GoodConfirm from "./components/GoodConfirm/index.vue";
|
||||||
import Calender from "@/components/Calender/index.vue";
|
import Calender from "@/components/Calender/index.vue";
|
||||||
@@ -88,6 +96,15 @@ const calendarVisible = ref(false);
|
|||||||
const goodsData = ref({});
|
const goodsData = ref({});
|
||||||
const goodConfirmRef = ref(null);
|
const goodConfirmRef = ref(null);
|
||||||
|
|
||||||
|
// 处理滚动事件
|
||||||
|
const handleScroll = (e) => {
|
||||||
|
const scrollTop = e.detail.scrollTop;
|
||||||
|
// 设置一个阈值,当滚动超过200px时,导航栏完全不透明
|
||||||
|
const threshold = 200;
|
||||||
|
// 计算透明度,范围从0到1
|
||||||
|
navOpacity.value = Math.min(scrollTop / threshold, 1);
|
||||||
|
};
|
||||||
|
|
||||||
// 格式化日期为 yyyy-mm-dd 格式
|
// 格式化日期为 yyyy-mm-dd 格式
|
||||||
const formatDate = (date) => {
|
const formatDate = (date) => {
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
|
|||||||
@@ -8,10 +8,13 @@ $button-color: #00a6ff;
|
|||||||
|
|
||||||
// 顶部导航栏固定样式
|
// 顶部导航栏固定样式
|
||||||
:deep(.top-nav-bar) {
|
:deep(.top-nav-bar) {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用须知样式
|
// 使用须知样式
|
||||||
@@ -63,7 +66,7 @@ $button-color: #00a6ff;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.goods-content {
|
.goods-content {
|
||||||
border-radius: 12px 12px 0 0;
|
border-radius: 28px 28px 0 0;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
Reference in New Issue
Block a user