功能:更新 YumiNail 用户端流程

This commit is contained in:
xiaowang
2026-05-31 18:36:52 +08:00
parent 22347ff076
commit 73483e7b0c
49 changed files with 6053 additions and 1306 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<!-- gitnexus:start -->
# GitNexus — Code Intelligence
This project is indexed by GitNexus as **xiaowang** (14285 symbols, 29539 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
This project is indexed by GitNexus as **xiaowang** (15795 symbols, 31793 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
+1 -1
View File
@@ -1,7 +1,7 @@
<!-- gitnexus:start -->
# GitNexus — Code Intelligence
This project is indexed by GitNexus as **xiaowang** (14285 symbols, 29539 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
This project is indexed by GitNexus as **xiaowang** (15795 symbols, 31793 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
@@ -1,11 +1,19 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.CommentDTO;
import com.xiaowang.yuminailcore.vo.CommentVO;
import com.xiaowang.yuminailcore.dto.ObjectStorageFileDTO;
import com.xiaowang.yuminailcore.service.CommentService;
import com.xiaowang.yuminailcore.service.MinioService;
import com.xiaowang.yuminailcore.service.ObjectStorageFileService;
import com.xiaowang.yuminailcore.support.id.TimeOrderedSnowflakeIdGenerator;
import com.xiaowang.yuminailcore.support.security.UploadSecurityValidator;
import com.xiaowang.yuminailcore.vo.CommentVO;
import com.xiaowang.yuminailcore.vo.ObjectStorageFileVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@@ -25,6 +33,10 @@ public class CommentController {
* Variable `commentService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final CommentService commentService;
private final ObjectStorageFileService objectStorageFileService;
private final MinioService minioService;
private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator;
private final UploadSecurityValidator uploadSecurityValidator;
/**
* 创建评论
@@ -39,6 +51,38 @@ public class CommentController {
return Result.success(id);
}
@PostMapping("/upload-image")
@OperationGuard(action = "comment-image-upload", ttlSeconds = 15, message = "图片正在上传中,请勿重复操作")
public Result<ObjectStorageFileVO> uploadCommentImage(HttpServletRequest request, @RequestParam("file") MultipartFile file) {
Long userId = (Long) request.getAttribute("userId");
if (userId == null) {
return Result.error("请先登录后再上传评价图片");
}
try {
uploadSecurityValidator.validate(file);
String originalFilename = file.getOriginalFilename();
if (originalFilename == null || originalFilename.isEmpty()) {
originalFilename = "comment-image";
}
String fileExtension = originalFilename == null || !originalFilename.contains(".")
? ""
: originalFilename.substring(originalFilename.lastIndexOf("."));
String objectName = snowflakeIdGenerator.nextIdString() + fileExtension;
String fileUrl = minioService.uploadFile(file, objectName);
ObjectStorageFileDTO dto = new ObjectStorageFileDTO();
dto.setFileName(originalFilename);
dto.setFileUrl(fileUrl);
dto.setStatus(1);
Long fileId = objectStorageFileService.createObjectStorageFile(dto);
return Result.success(objectStorageFileService.getObjectStorageFileById(fileId));
} catch (Exception e) {
e.printStackTrace();
return Result.error("评价图片上传失败: " + e.getMessage());
}
}
/**
* 更新评论
*
@@ -36,6 +36,11 @@ public class NailArtistController {
List<NailArtistInfoDTO> nailArtistInfoDTOList = nailArtistInfoService.getAllAvailableNailArtists();
return Result.success(nailArtistInfoDTOList);
}
@GetMapping("/list/shop/{shopId}")
public Result<List<NailArtistInfoDTO>> listByShopId(@PathVariable Long shopId) {
return Result.success(nailArtistInfoService.getByShopId(shopId));
}
/**
* 根据用户ID获取美甲师信息(前台使用)
@@ -2,6 +2,8 @@ package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import java.util.List;
/**
* 用户评论信息表 DTO
* 用于评论信息的传输
@@ -36,4 +38,14 @@ public class CommentDTO {
* 父级评论ID(0表示为根评论)
*/
private Long parentCommentId;
/**
* 评论评分:1-5星,根评论使用
*/
private Integer ratingScore;
/**
* 评论图片文件ID集合,根评论使用
*/
private List<Long> imageFileIds;
}
@@ -47,6 +47,18 @@ public class CommentDO extends BaseEntity {
@TableField("parent_comment_id")
private Long parentCommentId;
/**
* 评论评分:1-5星
*/
@TableField("rating_score")
private Integer ratingScore;
/**
* 评论图片文件ID集合,多个ID以逗号分隔
*/
@TableField("image_file_ids")
private String imageFileIds;
/**
* 评论点赞数
*/
@@ -12,7 +12,11 @@ import com.xiaowang.yuminailcore.mapper.ProductMapper;
import com.xiaowang.yuminailcore.mapper.ShopMapper;
import com.xiaowang.yuminailcore.mapper.UserMapper;
import com.xiaowang.yuminailcore.service.CommentService;
import com.xiaowang.yuminailcore.service.MinioService;
import com.xiaowang.yuminailcore.service.ObjectStorageFileService;
import com.xiaowang.yuminailcore.support.ObjectStorageUrlSupport;
import com.xiaowang.yuminailcore.vo.CommentVO;
import com.xiaowang.yuminailcore.vo.ObjectStorageFileVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@@ -21,6 +25,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -51,6 +56,9 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, CommentDO> im
* Variable `productMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ProductMapper productMapper;
private final ObjectStorageFileService objectStorageFileService;
private final MinioService minioService;
private final ObjectStorageUrlSupport objectStorageUrlSupport;
@Override
/**
@@ -137,11 +145,16 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, CommentDO> im
}
}
CommentDO commentDO = new CommentDO();
boolean rootComment = parentCommentId == null;
commentDO.setUserId(currentUserId);
commentDO.setShopId(shopId);
commentDO.setProductId(productId);
commentDO.setCommentContent(content);
commentDO.setParentCommentId(parentCommentId);
if (rootComment) {
commentDO.setRatingScore(normalizeRatingScore(commentDTO.getRatingScore()));
commentDO.setImageFileIds(joinImageFileIds(commentDTO.getImageFileIds()));
}
commentDO.setLikeCount(0);
commentDO.setIsDelete(0);
commentMapper.insert(commentDO);
@@ -410,6 +423,10 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, CommentDO> im
commentVO.setCommentContent(commentDO.getCommentContent());
commentVO.setParentCommentId(commentDO.getParentCommentId());
commentVO.setLikeCount(commentDO.getLikeCount());
commentVO.setRatingScore(commentDO.getRatingScore());
List<Long> imageFileIds = parseImageFileIds(commentDO.getImageFileIds());
commentVO.setImageFileIds(imageFileIds);
commentVO.setImageUrls(resolveImageUrls(imageFileIds));
commentVO.setCreateTime(commentDO.getCreateTime());
commentVO.setUpdateTime(commentDO.getUpdateTime());
/**
@@ -492,6 +509,71 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, CommentDO> im
}
}
private Integer normalizeRatingScore(Integer ratingScore) {
if (ratingScore == null) {
return 5;
}
return Math.max(1, Math.min(5, ratingScore));
}
private String joinImageFileIds(List<Long> imageFileIds) {
if (imageFileIds == null || imageFileIds.isEmpty()) {
return null;
}
return imageFileIds.stream()
.filter(id -> id != null && id > 0)
.distinct()
.limit(6)
.map(String::valueOf)
.collect(Collectors.joining(","));
}
private List<Long> parseImageFileIds(String imageFileIds) {
List<Long> result = new ArrayList<>();
if (!StringUtils.hasText(imageFileIds)) {
return result;
}
for (String token : imageFileIds.split(",")) {
if (!StringUtils.hasText(token)) {
continue;
}
try {
Long id = Long.valueOf(token.trim());
if (id > 0) {
result.add(id);
}
} catch (NumberFormatException ignored) {
// Ignore malformed legacy tokens.
}
}
return new ArrayList<>(new LinkedHashSet<>(result));
}
private List<String> resolveImageUrls(List<Long> imageFileIds) {
if (imageFileIds == null || imageFileIds.isEmpty()) {
return new ArrayList<>();
}
Map<Long, ObjectStorageFileVO> fileMap = objectStorageFileService.getObjectStorageFileMapByIds(new LinkedHashSet<>(imageFileIds));
List<String> urls = new ArrayList<>();
for (Long imageFileId : imageFileIds) {
ObjectStorageFileVO fileVO = fileMap.get(imageFileId);
if (fileVO == null || !StringUtils.hasText(fileVO.getFileUrl())) {
continue;
}
String objectName = objectStorageUrlSupport.extractObjectName(fileVO.getFileUrl());
if (!StringUtils.hasText(objectName)) {
urls.add(fileVO.getFileUrl());
continue;
}
try {
urls.add(minioService.getPresignedUrl(objectName, 60));
} catch (Exception ignored) {
urls.add(fileVO.getFileUrl());
}
}
return urls;
}
/**
* Run business method `activeQuery`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
@@ -156,17 +156,21 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
List<UserDO> users = userMapper.selectList(new LambdaQueryWrapper<UserDO>()
.in(UserDO::getId, serviceUserIds)
.in(UserDO::getType, List.of(2, 3))
.eq(UserDO::getIsDelete, 0));
.eq(UserDO::getType, 3)
.eq(UserDO::getStatus, 1)
.eq(UserDO::getIsDelete, 0)
.orderByAsc(UserDO::getCreateTime)
.orderByAsc(UserDO::getId));
List<NailArtistInfoDTO> result = new ArrayList<>();
ShopDO shop = shopMapper.selectById(shopId);
for (UserDO user : users) {
NailArtistInfoDTO dto = getByUserId(user.getId());
if (dto != null && isVisibleServiceUser(dto)) {
dto.setShopId(shopId);
dto.setShopName(shop == null ? null : shop.getShopName());
result.add(dto);
if (dto == null) {
dto = buildFallbackArtistInfo(user);
}
dto.setShopId(shopId);
dto.setShopName(shop == null ? null : shop.getShopName());
result.add(dto);
}
return result;
}
@@ -418,6 +422,32 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
return dto;
}
private NailArtistInfoDTO buildFallbackArtistInfo(UserDO user) {
NailArtistInfoDTO dto = new NailArtistInfoDTO();
dto.setUserId(user.getId());
dto.setNickname(user.getNickname());
dto.setSignature(user.getSignature());
dto.setUserType(user.getType());
dto.setUserTypeName(resolveUserTypeName(user.getType()));
dto.setIdentity("美甲师");
dto.setStatus(1);
dto.setParticipateProduction(1);
dto.setShopId(user.getShopId());
List<ShopSimpleVO> shopOptions = userShopBindingSupport.listShopOptionsByUserId(user.getId(), true, true);
if (!shopOptions.isEmpty()) {
ShopSimpleVO primaryShop = shopOptions.get(0);
dto.setShopId(primaryShop.getId());
dto.setShopName(primaryShop.getShopName());
} else if (user.getShopId() != null && user.getShopId() > 0) {
ShopDO shop = shopMapper.selectById(user.getShopId());
if (shop != null) {
dto.setShopId(shop.getId());
dto.setShopName(shop.getShopName());
}
}
return dto;
}
/**
* Run business method `isVisibleServiceUser`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
@@ -463,10 +493,17 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
throw new RuntimeException("美甲师信息不存在");
}
NailArtistInfoDTO artistInfo = getByUserId(artistId);
if (artistInfo == null || !isVisibleServiceUser(artistInfo)) {
if (artistInfo != null && isVisibleServiceUser(artistInfo)) {
return artistInfo;
}
UserDO artist = userMapper.selectById(artistId);
if (artist == null
|| isDeleted(artist.getIsDelete())
|| !Integer.valueOf(3).equals(artist.getType())
|| !Integer.valueOf(1).equals(artist.getStatus())) {
throw new RuntimeException("美甲师信息不存在");
}
return artistInfo;
return buildFallbackArtistInfo(artist);
}
private BigDecimal resolvePublicRating(Long artistId, NailArtistInfoDTO artistInfo) {
@@ -39,6 +39,8 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Service
@@ -73,6 +75,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im
* Usage: reference this field from the owning layer and pass validated inputs before reading or updating related state.
*/
private static final int MAX_PUBLIC_PAGE_SIZE = 30;
private static final Pattern DURATION_PATTERN = Pattern.compile("(\\d+)");
private static final long DEFAULT_SERVICE_DURATION_MINUTES = 60L;
/**
* Variable `productMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
@@ -451,6 +455,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im
productVO.setLikeCount(productDO.getLikeCount());
productVO.setCollectCount(productDO.getCollectCount());
productVO.setApproximateDuration(productDO.getApproximateDuration());
productVO.setServiceDurationMinutes(resolveServiceDurationMinutes(productDO.getApproximateDuration()));
String validBookableArtists = bookableArtistSupport.filterValidBookableArtists(productDO.getShopId(), productDO.getBookableArtists());
productVO.setBookableArtists(productDO.getBookableArtists());
productVO.setAvailableBookableArtistCount(countBookableArtists(validBookableArtists));
@@ -489,6 +494,20 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im
return productVO;
}
private long resolveServiceDurationMinutes(String approximateDuration) {
if (!StringUtils.hasText(approximateDuration)) {
return DEFAULT_SERVICE_DURATION_MINUTES;
}
Matcher matcher = DURATION_PATTERN.matcher(approximateDuration);
if (matcher.find()) {
try {
return Math.max(1L, Long.parseLong(matcher.group(1)));
} catch (NumberFormatException ignored) {
}
}
return DEFAULT_SERVICE_DURATION_MINUTES;
}
/**
* Run business method `buildEnrichmentContext`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
@@ -23,8 +23,10 @@ import com.xiaowang.yuminailcore.mapper.TagMapper;
import com.xiaowang.yuminailcore.mapper.UserCouponMapper;
import com.xiaowang.yuminailcore.service.CouponService;
import com.xiaowang.yuminailcore.service.MapService;
import com.xiaowang.yuminailcore.service.NailArtistInfoService;
import com.xiaowang.yuminailcore.service.ObjectStorageFileService;
import com.xiaowang.yuminailcore.service.ShopService;
import com.xiaowang.yuminailcore.support.ObjectStorageUrlSupport;
import com.xiaowang.yuminailcore.support.ShopThemeSupport;
import com.xiaowang.yuminailcore.support.UserShopBindingSupport;
import com.xiaowang.yuminailcore.support.cache.MultiLevelCacheService;
@@ -81,6 +83,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
* Usage: reference this field from the owning layer and pass validated inputs before reading or updating related state.
*/
private static final String DISABLED_SHOP_ARCHIVED_MESSAGE = "停用店铺已封存,仅允许重新启用";
private static final Set<String> FEATURED_PRODUCT_TAG_NAMES = Set.of("特色作品", "热门");
/**
* Variable `shopMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
@@ -117,10 +120,15 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
* Variable `objectStorageFileService`: Spring-injected collaborator used by this class to resolve public image URLs for trust cards.
*/
private final ObjectStorageFileService objectStorageFileService;
/**
* Variable `objectStorageUrlSupport`: converts stored object URLs into frontend-accessible signed URLs.
*/
private final ObjectStorageUrlSupport objectStorageUrlSupport;
/**
* Variable `userShopBindingSupport`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserShopBindingSupport userShopBindingSupport;
private final NailArtistInfoService nailArtistInfoService;
/**
* Variable `multiLevelCacheService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
@@ -292,6 +300,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
}
long productCount = countActiveProducts(id);
long artistCount = countShopArtists(id);
List<ProductDO> featuredProducts = listFeaturedProducts(id);
List<OrderArtistReviewDO> recentReviews = listSubmittedReviews(id, 3);
BigDecimal averageRating = calculateAverageRating(id);
@@ -317,6 +326,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
ShopTrustProfileVO.Stats stats = new ShopTrustProfileVO.Stats();
stats.setProductCount(productCount);
stats.setArtistCount(artistCount);
stats.setReviewCount(reviewCount);
stats.setAverageRating(averageRating);
stats.setRecentReviewCount(recentReviews.size());
@@ -453,14 +463,23 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
return count == null ? 0L : count;
}
private long countShopArtists(Long shopId) {
return nailArtistInfoService.getByShopId(shopId).size();
}
/**
* Purpose: listFeaturedProducts returns representative active products for shop detail trust cards.
* Usage: render at most three products and navigate to product detail when tapped.
*/
private List<ProductDO> listFeaturedProducts(Long shopId) {
Set<String> featuredTagTokens = findFeaturedProductTagTokens(shopId);
if (featuredTagTokens.isEmpty()) {
return Collections.emptyList();
}
return productMapper.selectList(Wrappers.lambdaQuery(ProductDO.class)
.eq(ProductDO::getShopId, shopId)
.eq(ProductDO::getIsDelete, 0)
.and(wrapper -> applyProductTagTokenConditions(wrapper, featuredTagTokens))
.orderByDesc(ProductDO::getCollectCount)
.orderByDesc(ProductDO::getLikeCount)
.orderByDesc(ProductDO::getCreateTime)
@@ -470,6 +489,45 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
.collect(Collectors.toList());
}
private Set<String> findFeaturedProductTagTokens(Long shopId) {
Set<String> tokens = new LinkedHashSet<>(FEATURED_PRODUCT_TAG_NAMES);
List<TagDO> tags = tagMapper.selectList(Wrappers.lambdaQuery(TagDO.class)
.eq(TagDO::getIsDelete, 0)
.and(wrapper -> wrapper.eq(TagDO::getShopId, shopId)
.or()
.isNull(TagDO::getShopId)
.or()
.eq(TagDO::getShopId, 0L))
.and(wrapper -> wrapper.in(TagDO::getTagName, FEATURED_PRODUCT_TAG_NAMES)
.or()
.in(TagDO::getDisplayName, FEATURED_PRODUCT_TAG_NAMES)));
tags.stream()
.map(TagDO::getId)
.filter(Objects::nonNull)
.map(String::valueOf)
.forEach(tokens::add);
return tokens.stream()
.filter(StringUtils::hasText)
.collect(Collectors.toCollection(LinkedHashSet::new));
}
private void applyProductTagTokenConditions(LambdaQueryWrapper<ProductDO> wrapper, Set<String> tagTokens) {
boolean appended = false;
for (String tagToken : tagTokens) {
if (!StringUtils.hasText(tagToken)) {
continue;
}
if (appended) {
wrapper.or();
}
wrapper.apply("FIND_IN_SET({0}, REPLACE(tags, ';', ','))", tagToken);
appended = true;
}
if (!appended) {
wrapper.apply("1 = 0");
}
}
/**
* Purpose: listSubmittedReviews loads privacy-safe submitted review rows for the shop.
* Usage: only status=1 reviews should feed public trust display.
@@ -538,6 +596,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
featured.setAvailableBookableArtistCount(artistCount);
featured.setBookingHint(artistCount > 0 ? artistCount + " 位美甲师可预约" : "到店后由门店安排美甲师");
featured.setImageUrl(resolveFirstImageUrl(product.getImageFileIds(), fileMap));
featured.setImageFileIds(product.getImageFileIds());
return featured;
}
@@ -634,7 +693,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
for (Long fileId : fileIds) {
ObjectStorageFileVO file = fileMap.get(fileId);
if (file != null && StringUtils.hasText(file.getFileUrl())) {
urls.add(file.getFileUrl());
urls.add(objectStorageUrlSupport.toAccessibleUrl(file.getFileUrl()));
}
}
return urls;
@@ -70,6 +70,21 @@ public class CommentVO {
*/
private Integer likeCount;
/**
* 评论评分:1-5星
*/
private Integer ratingScore;
/**
* 评论图片文件ID集合
*/
private List<Long> imageFileIds;
/**
* 评论图片展示链接
*/
private List<String> imageUrls;
/**
* 评论创建时间
*/
@@ -97,6 +97,11 @@ public class ProductVO {
*/
private String approximateDuration;
/**
* 实际用于预约排期计算的服务时长(分钟)
*/
private Long serviceDurationMinutes;
/**
* 可预约的美甲师ID集合,多个ID以逗号分隔
*/
@@ -115,6 +115,12 @@ public class ShopTrustProfileVO {
*/
private Long productCount = 0L;
/**
* Purpose: artistCount is the number of active nail artist users bound to this shop.
* Usage: render as the staff confidence signal on shop detail pages.
*/
private Long artistCount = 0L;
/**
* Purpose: recentReviewCount is the number of review cards included in this response.
* Usage: clients use it for section labels and empty states.
@@ -146,6 +152,12 @@ public class ShopTrustProfileVO {
*/
private String imageUrl;
/**
* Purpose: imageFileIds provides product image file ids for clients that need signed image URLs.
* Usage: clients may resolve the first id into a stable thumbnail URL.
*/
private String imageFileIds;
/**
* Purpose: price carries the current product price.
* Usage: show it as a current quote, not as historical order price.
@@ -85,6 +85,8 @@ create table t_comment
product_id bigint unsigned default 0 null comment '关联商品表主键(0表示非商品评论)',
comment_content text not null comment '评论内容',
parent_comment_id bigint unsigned default 0 null comment '父级评论ID(0表示为根评论)',
rating_score tinyint unsigned default 5 null comment '评论评分:1-5星',
image_file_ids text null comment '评论图片文件ID集合,多个ID以逗号分隔',
like_count int unsigned default 0 null comment '评论点赞数',
create_time datetime default CURRENT_TIMESTAMP not null comment '评论创建时间',
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '评论更新时间',
+3 -2
View File
@@ -78,6 +78,7 @@ const adminThemeRefreshOptions = { mode: 'admin' as const }
const customerThemeRefreshOptions = { mode: 'customer' as const }
const isAdminShell = computed(() => route.path.startsWith('/admin') || route.matched.some(r => r.meta.isAdmin))
const bottomNavRouteNames = new Set(['home', 'products', 'cart', 'profile'])
/** isHiddenNav is a reactive state variable used by the template and event handlers. */
const isHiddenNav = computed(() => {
@@ -85,11 +86,11 @@ const isHiddenNav = computed(() => {
return true
}
if (route.path === '/' || isAdminShell.value) {
if (isAdminShell.value) {
return true
}
return route.matched.some(r => r.meta.hideNav) || route.matched.some(r => r.meta.isAdmin)
return !bottomNavRouteNames.has(String(route.name || ''))
})
/**
+29 -1
View File
@@ -21,11 +21,30 @@ export interface CommentVO {
parentCommentId?: IdType
parentCommentContent?: string
likeCount?: number
ratingScore?: number
imageFileIds?: IdType[]
imageUrls?: string[]
createTime?: string
updateTime?: string
replies?: CommentVO[]
}
export interface CommentCreateRequest {
productId: IdType
shopId?: IdType | null
parentCommentId?: IdType | null
commentContent: string
ratingScore?: number
imageFileIds?: IdType[]
}
export interface CommentImageFileVO {
id: IdType
fileName?: string
fileUrl?: string
createTime?: string
}
/**
* commentApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
@@ -44,9 +63,18 @@ export const commentApi = {
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string } caller-supplied value for `data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }`
*/
create: (data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }) => {
create: (data: CommentCreateRequest) => {
return api.post<IdType>('/comment/create', data) as unknown as Promise<IdType>
},
uploadImage: (file: File) => {
const formData = new FormData()
formData.append('file', file)
return api.post<CommentImageFileVO>('/comment/upload-image', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}) as unknown as Promise<CommentImageFileVO>
},
/**
* `delete` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
+23
View File
@@ -36,6 +36,26 @@ export interface NailArtistReviewVO {
submittedAt?: string
}
export interface NailArtistListItemVO {
id?: IdType
userId?: IdType
identity?: string
experience?: number
skills?: string
rating?: number | string
status?: number
participateProduction?: number
workStartTime?: string
workEndTime?: string
userType?: number
userTypeName?: string
portfolio?: string
nickname?: string
shopId?: IdType
shopName?: string
signature?: string
}
export interface NailArtistProfileVO {
artistId: IdType
artistName?: string
@@ -65,5 +85,8 @@ export const nailArtistApi = {
},
listReviews: async (artistId: IdType): Promise<NailArtistReviewVO[]> => {
return await api.get<NailArtistReviewVO[]>(`/nail-artist/${artistId}/reviews`) as unknown as NailArtistReviewVO[]
},
listByShopId: async (shopId: IdType): Promise<NailArtistListItemVO[]> => {
return await api.get<NailArtistListItemVO[]>(`/nail-artist/list/shop/${shopId}`) as unknown as NailArtistListItemVO[]
}
}
+1
View File
@@ -24,6 +24,7 @@ export interface ProductVO {
price: number
estimatedTime: number
approximateDuration?: string
serviceDurationMinutes?: number
bookableArtists?: string
availableBookableArtistCount?: number
bookableArtistRestricted?: boolean
+2
View File
@@ -65,6 +65,7 @@ export interface ShopTrustProfileVO {
averageRating?: number
reviewCount?: number
productCount?: number
artistCount?: number
recentReviewCount?: number
}
environmentImages?: string[]
@@ -72,6 +73,7 @@ export interface ShopTrustProfileVO {
id: IdType
title?: string
imageUrl?: string
imageFileIds?: string
price?: number
likeCount?: number
collectCount?: number
@@ -4,7 +4,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'home' }" type="button" @click="handleNavClick('home')">
<a-badge :count="0" :offset="[0, 0]">
<div class="nav-icon">
<HomeOutlined :style="{ fontSize: '22px' }" />
<HomeOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">首页</span>
@@ -13,7 +13,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'products' }" type="button" @click="handleNavClick('products')">
<a-badge :count="0" :offset="[0, 0]">
<div class="nav-icon">
<ShoppingOutlined :style="{ fontSize: '22px' }" />
<ShoppingOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">作品集</span>
@@ -22,7 +22,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'cart' }" type="button" @click="handleNavClick('cart')">
<a-badge :count="cartCount" :offset="[0, 0]">
<div class="nav-icon">
<ShoppingCartOutlined :style="{ fontSize: '22px' }" />
<ShoppingCartOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">购物车</span>
@@ -31,7 +31,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'profile' }" type="button" @click="handleNavClick('profile')">
<a-badge :dot="hasNotification" :offset="[0, 0]">
<div class="nav-icon">
<UserOutlined :style="{ fontSize: '22px' }" />
<UserOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">我的</span>
@@ -189,8 +189,8 @@ const handleNavClick = (tab: string) => {
display: flex;
align-items: center;
justify-content: center;
width: 34px;
height: 30px;
width: 40px;
height: 34px;
margin-bottom: 0;
border-radius: 18px 18px 16px 16px;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
@@ -247,7 +247,7 @@ const handleNavClick = (tab: string) => {
}
.nav-icon :deep(.anticon) {
font-size: 20px !important;
font-size: 22px !important;
}
.nav-label {
@@ -169,7 +169,7 @@ const displayContentHtml = computed(() => renderRichContent(displayContent.value
.system-message-card__title {
margin: 0;
color: var(--text-primary);
font-size: 22px;
font-size: 19px;
font-weight: 800;
line-height: 1.35;
overflow-wrap: break-word;
@@ -269,7 +269,7 @@ const displayContentHtml = computed(() => renderRichContent(displayContent.value
}
.system-message-card__title {
font-size: 20px;
font-size: 18px;
}
.system-message-card__footer {
+6
View File
@@ -56,6 +56,12 @@ const router = createRouter({
component: () => import('../views/ShopDetailView.vue'),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: '/shop/:shopId/artists',
name: 'shop-artists',
component: () => import('../views/ArtistListView.vue'),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: '/artist/:id',
name: 'artist-profile',
+30 -1
View File
@@ -113,7 +113,7 @@ body {
.yumi-title {
display: block;
color: var(--text-primary);
font-size: 24px;
font-size: 21px;
font-weight: 760;
line-height: 1.18;
}
@@ -154,6 +154,35 @@ body {
transform: scale(0.96);
}
.app-container--phone-shell :where(.nav-button, .icon-btn, .back-btn, .yumi-icon-button) :where(.anticon),
.app-container--phone-shell :where(.header, .shop-topbar, .detail-header, .artist-topbar, .artist-list-topbar, .auth-topbar, .not-found-topbar, .cart-topbar, .vip-header) :where(.ant-btn .anticon, button .anticon),
.app-container--admin :where(.mobile-icon-btn, .mobile-avatar-btn) :where(.anticon) {
font-size: 21px !important;
line-height: 1;
}
.app-container--phone-shell :where(.bottom-nav .nav-icon) {
width: 40px;
height: 34px;
}
.app-container--phone-shell :where(.bottom-nav .nav-icon .anticon) {
font-size: 25px !important;
line-height: 1;
}
.app-container--admin :where(.mobile-tabbar__item .anticon) {
font-size: 21px !important;
line-height: 1;
}
.app-container--phone-shell :where(.nav-button, .icon-btn, .back-btn, .yumi-icon-button, .bottom-nav .nav-icon) :where(.anticon svg),
.app-container--admin :where(.mobile-icon-btn, .mobile-avatar-btn, .mobile-tabbar__item) :where(.anticon svg) {
display: block;
width: 1em;
height: 1em;
}
.yumi-page-titlebar {
display: flex;
align-items: center;
@@ -45,7 +45,7 @@
.admin-page-intro__title {
margin: 0;
font-size: clamp(24px, 5vw, 32px);
font-size: clamp(20px, 4vw, 26px);
line-height: 1.08;
font-weight: 700;
}
@@ -234,7 +234,7 @@
.admin-mobile-stat__value {
margin-top: 10px;
font-size: 28px;
font-size: 24px;
font-weight: 700;
color: var(--admin-mobile-ink);
}
@@ -0,0 +1,16 @@
import { describe, expect, it } from 'vitest'
import { buildRatingStars, normalizeCommentRating } from './comment-review'
describe('comment review helpers', () => {
it('normalizes comment ratings for display and submit', () => {
expect(normalizeCommentRating(undefined)).toBe(5)
expect(normalizeCommentRating(0)).toBe(1)
expect(normalizeCommentRating(6)).toBe(5)
expect(normalizeCommentRating('3')).toBe(3)
})
it('builds filled and empty star states from a rating', () => {
expect(buildRatingStars(3)).toEqual([true, true, true, false, false])
expect(buildRatingStars(5)).toEqual([true, true, true, true, true])
})
})
@@ -0,0 +1,12 @@
export const normalizeCommentRating = (value: unknown, fallback = 5) => {
const numeric = Number(value ?? fallback)
if (!Number.isFinite(numeric)) {
return fallback
}
return Math.min(5, Math.max(1, Math.round(numeric)))
}
export const buildRatingStars = (rating: unknown) => {
const normalized = normalizeCommentRating(rating)
return Array.from({ length: 5 }, (_, index) => index < normalized)
}
@@ -132,7 +132,7 @@ onMounted(loadOrder)
.hero-card, .form-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.form-card { padding: 16px; }
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
@@ -107,7 +107,7 @@ onMounted(loadRecords)
.hero-card, .record-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span, .record-label { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p, .record-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.record-card { padding: 16px; margin-top: 14px; }
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
@@ -0,0 +1,340 @@
<script setup lang="ts">
import { computed, ref, shallowRef, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
CalendarOutlined,
LeftOutlined,
RightOutlined,
StarFilled,
UserOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { nailArtistApi, type NailArtistListItemVO } from '@/api/nail-artist'
const route = useRoute()
const router = useRouter()
const artists = ref<NailArtistListItemVO[]>([])
const loading = shallowRef(false)
const loadError = shallowRef('')
const shopId = computed(() => String(route.params.shopId || ''))
const pageTitle = computed(() => String(route.query.shopName || '美甲师'))
const formatRating = (value?: number | string) => {
const rating = Number(value || 0)
return rating > 0 ? rating.toFixed(1) : '暂无'
}
const parseSkillTags = (skills?: string) => {
return String(skills || '')
.split(/[,;,;、\s]+/)
.map(tag => tag.trim())
.filter(Boolean)
.slice(0, 4)
}
const formatWorkTime = (artist: NailArtistListItemVO) => {
const start = String(artist.workStartTime || '').slice(0, 5)
const end = String(artist.workEndTime || '').slice(0, 5)
return start && end ? `${start}-${end}` : '到店确认'
}
const displayName = (artist: NailArtistListItemVO) => artist.nickname || artist.identity || '美甲师'
const openArtist = (artist: NailArtistListItemVO) => {
const artistId = artist.userId
if (!artistId) {
message.info('美甲师信息暂未完善')
return
}
router.push(`/artist/${artistId}`)
}
const loadArtists = async () => {
if (!shopId.value) {
loadError.value = '缺少店铺信息'
return
}
loading.value = true
loadError.value = ''
try {
artists.value = await nailArtistApi.listByShopId(shopId.value)
} catch (error) {
loadError.value = error instanceof Error ? error.message : '美甲师列表加载失败'
message.error(loadError.value)
} finally {
loading.value = false
}
}
watch(shopId, loadArtists, { immediate: true })
</script>
<template>
<div class="artist-list-page">
<header class="artist-list-topbar">
<a-button class="nav-button" type="text" aria-label="返回" @click="router.back()">
<LeftOutlined />
</a-button>
<h1>{{ pageTitle }}</h1>
<span class="topbar-count">{{ artists.length }} 位</span>
</header>
<main class="artist-list-body">
<a-spin :spinning="loading">
<a-result v-if="loadError" status="warning" title="暂时无法查看美甲师" :sub-title="loadError">
<template #extra>
<a-button type="primary" @click="loadArtists">重试</a-button>
</template>
</a-result>
<template v-else>
<section class="list-summary">
<span>Artists</span>
<h2>本店美甲师</h2>
<p>选择熟悉的美甲师进入主页,查看作品、评价和近期可预约时间。</p>
</section>
<div v-if="artists.length" class="artist-cards">
<button
v-for="artist in artists"
:key="artist.userId || artist.id"
class="artist-card"
type="button"
@click="openArtist(artist)"
>
<a-avatar :size="56" class="artist-avatar">
<UserOutlined />
</a-avatar>
<div class="artist-copy">
<div class="artist-heading">
<strong>{{ displayName(artist) }}</strong>
<span :class="['status-chip', artist.status === 1 ? 'status-chip--active' : '']">
{{ artist.status === 1 ? '可预约' : '休息中' }}
</span>
</div>
<p>{{ artist.signature || artist.identity || '专注细节与稳定出品' }}</p>
<div class="artist-meta">
<span><StarFilled /> {{ formatRating(artist.rating) }}</span>
<span><CalendarOutlined /> {{ formatWorkTime(artist) }}</span>
</div>
<div v-if="parseSkillTags(artist.skills).length" class="tag-row">
<span v-for="tag in parseSkillTags(artist.skills)" :key="tag">{{ tag }}</span>
</div>
</div>
<RightOutlined class="card-arrow" />
</button>
</div>
<a-empty v-else class="empty-state" description="本店暂未配置可展示的美甲师" />
</template>
</a-spin>
</main>
</div>
</template>
<style scoped>
.artist-list-page {
min-height: 100vh;
background:
radial-gradient(circle at 18% 0%, rgba(232, 180, 184, 0.28), transparent 34%),
var(--theme-page-bg);
color: var(--text-primary);
}
.artist-list-topbar {
position: sticky;
top: 0;
z-index: 20;
display: grid;
grid-template-columns: 44px minmax(0, 1fr) 52px;
align-items: center;
height: 58px;
max-width: 960px;
margin: 0 auto;
padding: 0 14px;
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
border-bottom: 1px solid var(--theme-border);
backdrop-filter: blur(14px);
}
.nav-button {
width: 40px;
height: 40px;
}
.artist-list-topbar h1 {
margin: 0;
overflow: hidden;
font-size: 17px;
font-weight: 700;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.topbar-count {
color: var(--text-secondary);
font-size: 13px;
text-align: right;
}
.artist-list-body {
max-width: 960px;
margin: 0 auto;
padding: 18px 14px 36px;
}
.list-summary {
padding: 20px;
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
border: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
border-radius: 16px;
box-shadow: 0 16px 40px rgba(124, 83, 87, 0.08);
backdrop-filter: blur(18px);
}
.list-summary span {
color: var(--theme-primary);
font-size: 12px;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
}
.list-summary h2 {
margin: 8px 0;
font-size: 22px;
line-height: 1.2;
}
.list-summary p {
margin: 0;
color: var(--text-secondary);
line-height: 1.7;
}
.artist-cards {
display: grid;
gap: 12px;
margin-top: 16px;
}
.artist-card {
display: grid;
grid-template-columns: 56px minmax(0, 1fr) 18px;
gap: 14px;
align-items: center;
width: 100%;
padding: 16px;
color: inherit;
text-align: left;
cursor: pointer;
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
border: 1px solid color-mix(in srgb, var(--theme-border) 82%, transparent);
border-radius: 16px;
box-shadow: 0 12px 28px rgba(124, 83, 87, 0.06);
}
.artist-avatar {
color: var(--theme-primary);
background: var(--theme-primary-soft);
border: 2px solid #fff;
}
.artist-copy {
min-width: 0;
}
.artist-heading {
display: flex;
gap: 8px;
align-items: center;
justify-content: space-between;
}
.artist-heading strong {
overflow: hidden;
font-size: 17px;
text-overflow: ellipsis;
white-space: nowrap;
}
.status-chip {
flex: 0 0 auto;
padding: 4px 8px;
color: var(--text-secondary);
font-size: 12px;
background: color-mix(in srgb, var(--theme-card-bg) 70%, var(--theme-primary-soft));
border-radius: 999px;
}
.status-chip--active {
color: var(--theme-primary);
background: var(--theme-primary-soft);
}
.artist-copy p {
display: -webkit-box;
margin: 6px 0 10px;
overflow: hidden;
color: var(--text-secondary);
font-size: 13px;
line-height: 1.5;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.artist-meta,
.tag-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.artist-meta span {
display: inline-flex;
gap: 4px;
align-items: center;
color: var(--text-secondary);
font-size: 12px;
}
.artist-meta svg {
color: var(--theme-primary);
}
.tag-row {
margin-top: 10px;
}
.tag-row span {
padding: 4px 8px;
color: var(--theme-primary);
font-size: 12px;
background: var(--theme-primary-soft);
border-radius: 999px;
}
.card-arrow {
color: var(--text-secondary);
font-size: 12px;
}
.empty-state {
margin-top: 48px;
}
@media (max-width: 640px) {
.artist-list-body {
padding: 14px 12px 30px;
}
.artist-card {
grid-template-columns: 52px minmax(0, 1fr) 16px;
gap: 12px;
padding: 14px;
}
}
</style>
File diff suppressed because it is too large Load Diff
+67 -11
View File
@@ -1,5 +1,13 @@
<template>
<div class="mobile-container">
<header class="auth-topbar">
<button class="auth-back-button" type="button" aria-label="返回" @click="handleBackClick">
<LeftOutlined />
</button>
<strong>指尖设计师</strong>
<span class="auth-topbar-spacer" aria-hidden="true"></span>
</header>
<main class="auth-page">
<section class="brand-stage" aria-label="指尖设计师">
<div class="brand-mark" aria-hidden="true">
@@ -440,7 +448,7 @@
*/
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import { InfoCircleOutlined, LockOutlined, UserOutlined } from '@ant-design/icons-vue'
import { InfoCircleOutlined, LeftOutlined, LockOutlined, UserOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import type { Rule } from 'ant-design-vue/es/form'
/**
@@ -467,6 +475,14 @@ import type { IdType } from '@/utils/id'
*/
const router = useRouter()
const handleBackClick = () => {
if (window.history.length > 1) {
router.back()
return
}
router.push('/home')
}
/**
* Purpose: activeTab supports AuthView.vue by holding or executing the active tab page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -1326,10 +1342,50 @@ onBeforeUnmount(() => {
padding: 24px 20px 28px;
}
.auth-topbar {
position: sticky;
top: 0;
z-index: 20;
display: grid;
grid-template-columns: 40px minmax(0, 1fr) 40px;
align-items: center;
width: min(100%, 430px);
height: 44px;
margin: -10px auto 8px;
}
.auth-back-button {
display: inline-grid;
width: 36px;
height: 36px;
place-items: center;
border: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 86%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
cursor: pointer;
}
.auth-topbar strong {
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.auth-topbar-spacer {
width: 36px;
height: 36px;
}
.auth-page {
width: 100%;
max-width: 430px;
min-height: calc(100svh - 52px);
min-height: calc(100svh - 104px);
display: flex;
flex-direction: column;
justify-content: center;
@@ -1369,7 +1425,7 @@ onBeforeUnmount(() => {
background: var(--theme-gradient);
color: var(--theme-card-bg);
font-family: "Playfair Display", serif;
font-size: 30px;
font-size: 24px;
font-weight: 700;
line-height: 1;
letter-spacing: 0;
@@ -1379,7 +1435,7 @@ onBeforeUnmount(() => {
margin: 0;
color: var(--theme-primary-action);
font-family: "Playfair Display", serif;
font-size: 42px;
font-size: 28px;
font-weight: 700;
line-height: 1.05;
letter-spacing: 0;
@@ -1389,7 +1445,7 @@ onBeforeUnmount(() => {
margin: 8px 0 0;
color: var(--text-primary);
font-family: "Playfair Display", serif;
font-size: 28px;
font-size: 22px;
font-weight: 600;
line-height: 1.2;
letter-spacing: 0;
@@ -1436,7 +1492,7 @@ onBeforeUnmount(() => {
margin: 10px 0 0;
color: var(--text-primary);
font-family: "Playfair Display", serif;
font-size: 26px;
font-size: 22px;
font-weight: 600;
line-height: 1.25;
letter-spacing: 0;
@@ -1896,7 +1952,7 @@ onBeforeUnmount(() => {
}
.auth-page {
min-height: calc(100svh - 42px);
min-height: calc(100svh - 92px);
gap: 18px;
}
@@ -1909,15 +1965,15 @@ onBeforeUnmount(() => {
.brand-mark span {
width: 48px;
height: 48px;
font-size: 28px;
font-size: 22px;
}
.brand-name {
font-size: 38px;
font-size: 28px;
}
.brand-title {
font-size: 26px;
font-size: 21px;
}
.brand-copy {
@@ -1930,7 +1986,7 @@ onBeforeUnmount(() => {
}
.auth-card-header h2 {
font-size: 24px;
font-size: 21px;
}
}
</style>
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -82,7 +82,7 @@ onMounted(loadContact)
.hero-card, .section-card, .quick-grid button { border: 1px solid var(--theme-border); border-radius: 24px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px color-mix(in srgb, var(--theme-neutral) 8%, transparent); }
.hero-card { padding: 24px; margin-bottom: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--theme-primary) 24%, var(--theme-card-bg)), color-mix(in srgb, var(--theme-secondary) 18%, var(--theme-card-bg))); }
.hero-card span { color: var(--theme-primary-action); font-family: Georgia, 'Times New Roman', serif; font-size: 12px; font-weight: 800; }
.hero-card h2 { margin: 10px 0 6px; font-size: 25px; font-weight: 850; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; font-weight: 850; }
.hero-card p, .section-card p, .quick-grid span { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.section-card { padding: 16px; }
.section-card h3 { margin: 0 0 12px; font-size: 17px; }
+92 -30
View File
@@ -1,19 +1,17 @@
<template>
<div class="mobile-container home-page">
<header class="home-topbar">
<button class="yumi-icon-button" type="button" aria-label="打开菜单" @click="router.push('/profile')">
<MenuOutlined />
</button>
<strong class="home-brand">首页</strong>
<button class="yumi-icon-button" type="button" aria-label="查看购物车" @click="router.push('/cart')">
<ShoppingOutlined />
</button>
<span class="home-topbar-spacer" aria-hidden="true"></span>
<strong class="home-brand">{{ currentShopName }}</strong>
<span class="home-topbar-spacer" aria-hidden="true"></span>
</header>
<section class="hero">
<div class="hero-copy" @click="handleUserClick">
<p class="hero-kicker">{{ greeting }}</p>
<h1>{{ displayName }}</h1>
<h1 class="hero-greeting">
<span>{{ greeting }}</span>
<span class="hero-greeting__name">{{ displayName }}</span>
</h1>
<div class="member-line" aria-label="会员等级">
<span></span>
<p>{{ memberLevelText }}</p>
@@ -230,10 +228,8 @@ import {
AppstoreOutlined,
CalendarOutlined,
CreditCardOutlined,
MenuOutlined,
RightOutlined,
SearchOutlined,
ShoppingOutlined,
TagsOutlined,
} from '@ant-design/icons-vue'
/**
@@ -348,11 +344,45 @@ const page = ref(1)
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pageSize = 8
const now = ref(new Date())
let greetingTimer: ReturnType<typeof window.setInterval> | undefined
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
/** currentShopName renders the active shop name in the page navigation bar. */
const currentShopName = computed(() => {
const userShopName = userInfo.value?.shopName || userInfo.value?.shopNames?.find(Boolean)
if (userShopName) {
return userShopName
}
if (typeof window !== 'undefined') {
try {
const raw = localStorage.getItem('userInfo')
const storedUser = raw ? JSON.parse(raw) as { shopName?: string; shopNames?: string[] } : null
const cachedShopName = storedUser?.shopName || storedUser?.shopNames?.find(Boolean)
if (cachedShopName) {
return cachedShopName
}
} catch {
// Ignore malformed cached user data and keep resolving from public shops.
}
}
return publicShops.value.find(shop => shop.shopName)?.shopName || '当前门店'
})
/** greeting is a reactive state variable used by the template and event handlers. */
const greeting = computed(() => '早上好,')
const greeting = computed(() => {
const hour = now.value.getHours()
if (hour >= 5 && hour < 9) return '早上好,'
if (hour >= 9 && hour < 11) return '上午好,'
if (hour >= 11 && hour < 13) return '中午好,'
if (hour >= 13 && hour < 17) return '下午好,'
if (hour >= 17 && hour < 19) return '傍晚好,'
if (hour >= 19 && hour < 23) return '晚上好,'
if (hour >= 23 || hour < 1) return '深夜好,'
return '凌晨好,'
})
/** displayName is a reactive state variable used by the template and event handlers. */
const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value ? '用户' : '朋友'))
const memberLevelText = computed(() => `会员等级:${userInfo.value?.level || (isLoggedIn.value ? '普通会员' : '游客')}`)
@@ -587,6 +617,11 @@ const openShopById = (shopId: IdType) => {
}
onMounted(async () => {
now.value = new Date()
greetingTimer = window.setInterval(() => {
now.value = new Date()
}, 60 * 1000)
const homeTasks = [
loadUserInfo(),
loadAnnouncements(),
@@ -601,6 +636,9 @@ onMounted(async () => {
})
onUnmounted(() => {
if (greetingTimer) {
window.clearInterval(greetingTimer)
}
window.removeEventListener('scroll', handleScroll)
})
</script>
@@ -795,7 +833,7 @@ onUnmounted(() => {
.banner-copy h3 {
margin: 10px 0 4px;
font-size: 22px;
font-size: 19px;
color: var(--text-primary);
}
@@ -816,7 +854,7 @@ onUnmounted(() => {
.banner-empty h3 {
margin: 0;
font-size: 26px;
font-size: 21px;
color: var(--text-primary);
}
@@ -872,7 +910,7 @@ onUnmounted(() => {
}
.product-card :deep(.ant-card-body) {
padding: 12px;
padding: 12px 12px 16px;
}
.product-img {
@@ -915,9 +953,10 @@ onUnmounted(() => {
}
.price {
margin: 0;
margin: 0 0 2px;
font-size: 16px;
font-weight: 700;
line-height: 1.25;
color: var(--theme-primary-action);
}
@@ -994,7 +1033,7 @@ onUnmounted(() => {
}
.banner-empty h3 {
font-size: 22px;
font-size: 20px;
line-height: 1.35;
}
@@ -1073,20 +1112,30 @@ onUnmounted(() => {
position: sticky;
top: 0;
z-index: 40;
display: flex;
display: grid;
grid-template-columns: 42px minmax(0, 1fr) 42px;
align-items: center;
justify-content: space-between;
padding: 12px 18px 9px;
border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
backdrop-filter: blur(18px);
}
.home-topbar-spacer {
width: 42px;
height: 32px;
}
.home-brand {
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
letter-spacing: 0;
line-height: 1.25;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.hero {
@@ -1101,21 +1150,29 @@ onUnmounted(() => {
min-width: 0;
}
.hero-kicker {
margin: 0 0 4px;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.2;
}
.hero h1 {
.hero-greeting {
display: flex;
min-width: 0;
align-items: baseline;
margin: 0;
color: var(--text-primary);
font-size: 23px;
font-size: 18px;
font-weight: 800;
line-height: 1.12;
}
.hero-greeting span {
flex: 0 0 auto;
}
.hero-greeting__name {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.member-line {
display: flex;
align-items: center;
@@ -1403,13 +1460,16 @@ onUnmounted(() => {
}
.home-page .product-card {
overflow: hidden;
border-radius: 20px;
background: transparent;
box-shadow: none;
cursor: pointer;
}
.home-page .product-info {
padding: 0 2px 8px;
}
.home-page .product-img {
aspect-ratio: 1 / 1.08;
margin: 0 0 9px;
@@ -1435,6 +1495,8 @@ onUnmounted(() => {
align-items: center;
justify-content: space-between;
gap: 8px;
min-height: 22px;
padding-bottom: 3px;
}
.home-page .price {
@@ -1506,7 +1568,7 @@ onUnmounted(() => {
}
@media (max-width: 360px) {
.hero h1 {
.hero-greeting {
font-size: 20px;
}
+68 -5
View File
@@ -1,5 +1,13 @@
<template>
<div class="not-found-container">
<header class="not-found-topbar">
<button class="not-found-back" type="button" aria-label="返回" @click="handleBackClick">
<LeftOutlined />
</button>
<strong>指尖设计师</strong>
<span class="not-found-topbar-spacer" aria-hidden="true"></span>
</header>
<div class="not-found-content">
<span class="not-found-kicker">指尖设计师</span>
<div class="error-code">404</div>
@@ -20,6 +28,7 @@
*/
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
/**
* Purpose: router supports NotFoundView.vue by holding or executing the router page or API role.
@@ -30,11 +39,25 @@ const router = useRouter()
const countdown = ref(5)
let timer: number | null = null
/** redirectToHome is a local helper used by this page script. */
const redirectToHome = () => {
const clearRedirectTimer = () => {
if (timer) {
clearInterval(timer)
timer = null
}
}
const handleBackClick = () => {
clearRedirectTimer()
if (window.history.length > 1) {
router.back()
return
}
router.push('/home')
}
/** redirectToHome is a local helper used by this page script. */
const redirectToHome = () => {
clearRedirectTimer()
router.push('/home')
}
@@ -52,14 +75,13 @@ onMounted(() => {
})
onUnmounted(() => {
if (timer) {
clearInterval(timer)
}
clearRedirectTimer()
})
</script>
<style scoped>
.not-found-container {
position: relative;
min-height: 100vh;
display: flex;
justify-content: center;
@@ -70,6 +92,47 @@ onUnmounted(() => {
padding: 20px;
}
.not-found-topbar {
position: fixed;
top: 12px;
left: 50%;
z-index: 20;
display: grid;
grid-template-columns: 40px minmax(0, 1fr) 40px;
align-items: center;
width: min(calc(100% - 32px), var(--app-mobile-max-width, 480px));
height: 44px;
transform: translateX(-50%);
}
.not-found-back {
display: inline-grid;
width: 36px;
height: 36px;
place-items: center;
border: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
cursor: pointer;
}
.not-found-topbar strong {
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.not-found-topbar-spacer {
width: 36px;
height: 36px;
}
.not-found-content {
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
border: 1px solid var(--theme-border);
@@ -143,7 +143,7 @@ onMounted(loadMessages)
.page-header h1 {
margin: 0;
font-size: 24px;
font-size: 20px;
}
.page-header p {
@@ -280,7 +280,7 @@ onMounted(loadMessages)
}
.page-header h1 {
font-size: 27px;
font-size: 21px;
font-weight: 860;
}
@@ -212,10 +212,10 @@ onMounted(loadOrder)
.hero-card, .section-card, .timeline-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; background: var(--theme-gradient-soft); }
.eyebrow { display: block; color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p { margin: 0; color: var(--text-secondary); }
.hero-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.hero-meta strong { font-size: 22px; }
.hero-meta strong { font-size: 20px; }
.status-pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--theme-primary-soft); color: var(--theme-primary); }
.status-pill.cancelled { color: var(--theme-accent); }
.timeline-card { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-top: 14px; background: var(--theme-border); }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+150 -75
View File
@@ -1,16 +1,11 @@
<template>
<div class="mobile-container product-list-page">
<header class="gallery-header">
<a-button class="icon-btn" type="text" aria-label="返回首页" @click="handleBackClick">
<MenuOutlined />
</a-button>
<div class="brand-lockup" aria-label="指尖设计师">
<h1>指尖设计师</h1>
<span class="header-spacer" aria-hidden="true"></span>
<div class="brand-lockup" :aria-label="currentShopName">
<h1>{{ currentShopName }}</h1>
</div>
<a-button class="icon-btn icon-btn--bag" type="text" aria-label="前往购物车" @click="router.push('/cart')">
<ShoppingOutlined />
<span class="bag-dot" aria-hidden="true"></span>
</a-button>
<span class="header-spacer" aria-hidden="true"></span>
</header>
<main class="gallery-content">
@@ -105,7 +100,7 @@
@click.stop="handleAddToCart(item)"
>
<CheckOutlined v-if="item.inCart" />
<PlusOutlined v-else />
<ShoppingCartOutlined v-else />
</button>
</div>
@@ -151,6 +146,16 @@
</div>
</section>
</main>
<button
v-show="showBackTop"
class="back-to-top-button"
type="button"
aria-label="返回顶部"
@click="scrollToTop"
>
<UpOutlined />
</button>
</div>
</template>
@@ -159,17 +164,16 @@
* ProductListView page script.
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
*/
import { onMounted, ref, watch, inject, computed } from 'vue'
import { computed, inject, onMounted, onUnmounted, ref, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import {
CheckOutlined,
ClockCircleOutlined,
HeartOutlined,
MenuOutlined,
PlusOutlined,
SearchOutlined,
ShoppingOutlined,
StarOutlined
ShoppingCartOutlined,
StarOutlined,
UpOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
/**
@@ -219,6 +223,8 @@ const allTags = computed(() => filterGroups.value.flatMap(group => group.tags ||
const selectedCategory = ref('全部')
/** selectedTagId tracks the grouped filter id sent to the backend. */
const selectedTagId = ref('')
const selectedShopId = ref('')
const bookableOnly = ref(false)
/**
* Purpose: products supports ProductListView.vue by holding or executing the products page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -226,6 +232,8 @@ const selectedTagId = ref('')
const products = ref<ProductListItem[]>([])
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** showBackTop toggles the floating shortcut after the gallery scrolls down. */
const showBackTop = ref(false)
/** showSearch is a reactive state variable used by the template and event handlers. */
const showSearch = ref(false)
/** searchKeyword is a reactive state variable used by the template and event handlers. */
@@ -245,17 +253,57 @@ let useGlobalLoadingForNextRouteSync = false
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
/** currentShopName renders the active shop name in the page navigation bar. */
const currentShopName = computed(() => {
const routeShopName = typeof route.query.shopName === 'string' ? route.query.shopName.trim() : ''
if (routeShopName) {
return routeShopName
}
if (typeof window !== 'undefined') {
try {
const raw = localStorage.getItem('userInfo')
const storedUser = raw ? JSON.parse(raw) as { shopName?: string; shopNames?: string[] } : null
return storedUser?.shopName || storedUser?.shopNames?.find(Boolean) || '当前门店'
} catch {
return '当前门店'
}
}
return '当前门店'
})
/** activeBannerText is a reactive state variable used by the template and event handlers. */
const activeBannerText = computed(() => {
if (searchKeyword.value.trim()) {
return `当前显示“${searchKeyword.value.trim()}”的匹配结果`
}
if (selectedShopId.value && bookableOnly.value) {
return `当前显示“${currentShopName.value}”的可预约作品`
}
if (selectedShopId.value) {
return `当前显示“${currentShopName.value}”的作品`
}
if (selectedCategory.value !== '全部') {
return `当前按场景“${selectedCategory.value}”筛选`
}
return ''
})
const getScopedRouteQuery = (includeBookable = true) => {
const query: Record<string, string> = {}
const routeShopName = typeof route.query.shopName === 'string' ? route.query.shopName.trim() : ''
if (selectedShopId.value) {
query.shopId = selectedShopId.value
}
if (routeShopName) {
query.shopName = routeShopName
}
if (includeBookable && bookableOnly.value) {
query.bookable = '1'
}
return query
}
/**
* Purpose: DEFAULT_PRODUCT_IMAGE supports ProductListView.vue by holding or executing the default product image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -341,7 +389,15 @@ const fetchProducts = async () => {
response = pageResult.list || []
}
products.value = markProductsInCart(Array.isArray(response) ? response : [])
let filteredProducts = Array.isArray(response) ? response : []
if (selectedShopId.value) {
filteredProducts = filteredProducts.filter(item => String(item.shopId || '') === selectedShopId.value)
}
if (bookableOnly.value) {
filteredProducts = filteredProducts.filter(item => item.availableBookableArtistCount === undefined || Number(item.availableBookableArtistCount) > 0)
}
products.value = markProductsInCart(filteredProducts)
await loadImageUrls(products.value)
} catch (error: any) {
console.error('获取作品列表失败:', error)
@@ -358,12 +414,16 @@ const syncRouteFilters = async () => {
const keyword = typeof route.query.keyword === 'string' ? route.query.keyword.trim() : ''
const tag = typeof route.query.tag === 'string' ? route.query.tag.trim() : ''
const tagId = typeof route.query.tagId === 'string' ? route.query.tagId.trim() : ''
const shopId = typeof route.query.shopId === 'string' ? route.query.shopId.trim() : ''
const bookable = route.query.bookable === '1'
const matchedTag = tagId
? allTags.value.find(item => String(item.id) === tagId)
: allTags.value.find(item => item.tagName === tag || item.displayName === tag)
searchKeyword.value = keyword
showSearch.value = Boolean(keyword)
selectedShopId.value = shopId
bookableOnly.value = bookable
selectedTagId.value = matchedTag ? String(matchedTag.id) : ''
selectedCategory.value = matchedTag ? (matchedTag.displayName || matchedTag.tagName) : '全部'
if (useGlobalLoadingForNextRouteSync) {
@@ -374,11 +434,6 @@ const syncRouteFilters = async () => {
await fetchProducts()
}
/** handleBackClick is a local helper used by this page script. */
const handleBackClick = () => {
router.push('/home')
}
/** handleCategoryClick is a local helper used by this page script. */
const handleCategoryClick = (category: string) => {
selectedCategory.value = category
@@ -386,7 +441,7 @@ const handleCategoryClick = (category: string) => {
searchKeyword.value = ''
showSearch.value = false
useGlobalLoadingForNextRouteSync = true
router.replace({ path: '/products', query: {} })
router.replace({ path: '/products', query: getScopedRouteQuery() })
}
/** handleTagClick is a local helper used by grouped scene-filter chips. */
@@ -398,7 +453,7 @@ const handleTagClick = (tag: TagVO) => {
useGlobalLoadingForNextRouteSync = true
router.replace({
path: '/products',
query: { tag: tag.displayName || tag.tagName, tagId: String(tag.id) }
query: { ...getScopedRouteQuery(), tag: tag.displayName || tag.tagName, tagId: String(tag.id) }
})
}
@@ -434,7 +489,7 @@ const handleSearch = () => {
useGlobalLoadingForNextRouteSync = true
router.replace({
path: '/products',
query: keyword ? { keyword } : {}
query: keyword ? { ...getScopedRouteQuery(), keyword } : getScopedRouteQuery()
})
}
@@ -444,8 +499,19 @@ const resetFilters = () => {
selectedTagId.value = ''
searchKeyword.value = ''
showSearch.value = false
bookableOnly.value = false
useGlobalLoadingForNextRouteSync = true
router.replace('/products')
router.replace({ path: '/products', query: getScopedRouteQuery(false) })
}
/** handleWindowScroll keeps the return-to-top shortcut in sync with page position. */
const handleWindowScroll = () => {
showBackTop.value = (document.documentElement.scrollTop || document.body.scrollTop) > 360
}
/** scrollToTop returns the product gallery to the top of the page. */
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: 'smooth' })
}
watch(
@@ -459,6 +525,12 @@ watch(
onMounted(async () => {
await fetchTags()
await syncRouteFilters()
handleWindowScroll()
window.addEventListener('scroll', handleWindowScroll, { passive: true })
})
onUnmounted(() => {
window.removeEventListener('scroll', handleWindowScroll)
})
</script>
@@ -484,19 +556,25 @@ onMounted(async () => {
.gallery-header {
position: fixed;
top: 0;
left: 0;
right: 0;
left: 50%;
z-index: 100;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
width: min(100%, var(--app-mobile-max-width, 480px));
height: var(--gallery-header-height);
padding: 0 var(--gallery-gutter);
border-bottom: 1px solid var(--gallery-border);
background: color-mix(in srgb, var(--theme-tertiary) 86%, transparent);
box-shadow: 0 12px 36px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
backdrop-filter: blur(20px);
transform: translateX(-50%);
}
.header-spacer {
flex: 0 0 36px;
width: 36px;
height: 36px;
}
.brand-lockup {
@@ -508,45 +586,14 @@ onMounted(async () => {
.brand-lockup h1 {
margin: 0;
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
line-height: 1;
letter-spacing: 0;
}
.icon-btn {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 72%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-primary) 12%, transparent);
}
.icon-btn:hover,
.icon-btn:focus {
color: var(--theme-accent);
background: var(--theme-primary-soft);
}
.icon-btn :deep(.anticon) {
font-size: 18px;
}
.bag-dot {
position: absolute;
top: 10px;
right: 9px;
width: 7px;
height: 7px;
border: 1px solid var(--theme-card-bg);
border-radius: 999px;
background: var(--theme-secondary);
text-overflow: ellipsis;
white-space: nowrap;
}
.gallery-content {
@@ -555,17 +602,17 @@ onMounted(async () => {
.search-panel {
display: grid;
gap: 16px;
margin-bottom: 16px;
gap: 10px;
margin-bottom: 12px;
}
.search-field {
display: grid;
grid-template-columns: 22px minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
min-height: 56px;
padding: 8px 8px 8px 17px;
gap: 8px;
min-height: 46px;
padding: 6px 7px 6px 15px;
border: 1px solid var(--gallery-border);
border-radius: 999px;
background: var(--gallery-surface-strong);
@@ -582,7 +629,7 @@ onMounted(async () => {
.search-field__icon {
color: var(--theme-primary-action);
font-size: 19px;
font-size: 18px;
}
.search-field__input {
@@ -600,9 +647,9 @@ onMounted(async () => {
}
.search-field__action {
min-width: 58px;
height: 38px;
padding: 0 14px;
min-width: 52px;
height: 32px;
padding: 0 12px;
border: 1px solid color-mix(in srgb, var(--theme-primary) 54%, var(--theme-card-bg));
border-radius: 999px;
color: var(--theme-primary-action);
@@ -625,10 +672,10 @@ onMounted(async () => {
.category-rail {
display: flex;
gap: 10px;
gap: 8px;
overflow-x: auto;
overflow-y: hidden;
padding: 1px 0 7px;
padding: 0 0 5px;
scroll-snap-type: x proximity;
scrollbar-width: none;
}
@@ -639,8 +686,8 @@ onMounted(async () => {
.category-item {
flex: 0 0 auto;
min-height: 36px;
padding: 0 18px;
min-height: 30px;
padding: 0 14px;
border: 1px solid var(--gallery-border);
border-radius: 999px;
color: var(--text-secondary);
@@ -922,6 +969,34 @@ onMounted(async () => {
box-shadow: var(--theme-button-shadow);
}
.back-to-top-button {
position: fixed;
right: max(18px, calc((100vw - var(--app-mobile-max-width, 480px)) / 2 + 18px));
bottom: calc(92px + env(safe-area-inset-bottom, 0px));
z-index: 120;
display: inline-grid;
width: 42px;
height: 42px;
place-items: center;
border: 1px solid color-mix(in srgb, var(--theme-primary) 36%, var(--theme-border));
border-radius: 999px;
color: var(--theme-card-bg);
background: var(--theme-primary-action);
box-shadow: 0 14px 34px color-mix(in srgb, var(--theme-primary) 26%, transparent);
cursor: pointer;
transition: transform 0.18s ease, opacity 0.18s ease;
}
.back-to-top-button:hover,
.back-to-top-button:focus {
transform: translateY(-2px);
outline: 0;
}
.back-to-top-button:active {
transform: scale(0.94);
}
@media (max-width: 360px) {
.product-list-page {
--gallery-gutter: 14px;
+37 -10
View File
@@ -287,12 +287,9 @@ import { notifyShopThemeChanged } from '@/utils/shop-theme'
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const USER_INFO_CACHE_KEY = 'userInfo'
/**
* Purpose: userInfo supports ProfileView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO>({
const createEmptyUserInfo = (): UserVO => ({
id: 0,
nickname: '',
account: '',
@@ -303,6 +300,34 @@ const userInfo = ref<UserVO>({
updateTime: ''
})
const readCachedUserInfo = (): UserVO => {
if (typeof window === 'undefined') {
return createEmptyUserInfo()
}
try {
const raw = localStorage.getItem(USER_INFO_CACHE_KEY)
const cached = raw ? JSON.parse(raw) as Partial<UserVO> : null
return cached && typeof cached === 'object'
? { ...createEmptyUserInfo(), ...cached }
: createEmptyUserInfo()
} catch {
return createEmptyUserInfo()
}
}
const persistCachedUserInfo = (info: UserVO) => {
if (typeof window === 'undefined') {
return
}
localStorage.setItem(USER_INFO_CACHE_KEY, JSON.stringify(info))
}
/**
* Purpose: userInfo supports ProfileView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO>(readCachedUserInfo())
/** editModalVisible is a reactive state variable used by the template and event handlers. */
const editModalVisible = ref(false)
/** saving is a reactive state variable used by the template and event handlers. */
@@ -416,7 +441,7 @@ const shopOptions = computed(() => {
})
/** currentShopName is a reactive state variable used by the template and event handlers. */
const currentShopName = computed(() => userInfo.value.shopName || '当前门店')
const currentShopName = computed(() => userInfo.value.shopName || userInfo.value.shopNames?.find(Boolean) || '当前门店')
/** shopSwitchTip is a reactive state variable used by the template and event handlers. */
const shopSwitchTip = computed(() => {
if (shopOptions.value.length > 1) {
@@ -516,7 +541,7 @@ const isServiceUser = computed(() => {
const persistUserSession = (payload: any) => {
localStorage.setItem('accessToken', payload.accessToken)
localStorage.setItem('refreshToken', payload.refreshToken)
localStorage.setItem('userInfo', JSON.stringify(payload.userInfo))
localStorage.setItem(USER_INFO_CACHE_KEY, JSON.stringify(payload.userInfo))
sessionStorage.setItem('accessToken', payload.accessToken)
notifyShopThemeChanged()
if (payload.needSetPassword) {
@@ -532,6 +557,7 @@ const fetchUserInfo = async () => {
artistCalendarAccessible.value = false
const response = await userApi.getUserInfo()
userInfo.value = response
persistCachedUserInfo(response)
needSetPassword.value = localStorage.getItem('needSetPassword') === 'true'
selectedShopId.value = response.shopId ? String(response.shopId) : undefined
artistCalendarAccessible.value = response.type === 3
@@ -666,6 +692,7 @@ const handleDeleteAvatar = () => {
try {
await runWithGlobalLoading(() => userApi.updateUserInfo({ avatar: '' }))
userInfo.value.avatar = ''
persistCachedUserInfo(userInfo.value)
message.success('头像删除成功')
} catch (error) {
console.error('删除头像失败:', error)
@@ -829,7 +856,7 @@ const handleLogout = () => {
} finally {
localStorage.removeItem('accessToken')
localStorage.removeItem('refreshToken')
localStorage.removeItem('userInfo')
localStorage.removeItem(USER_INFO_CACHE_KEY)
localStorage.removeItem('needSetPassword')
sessionStorage.removeItem('accessToken')
notifyShopThemeChanged()
@@ -913,7 +940,7 @@ onMounted(async () => {
.profile-topbar h1 {
margin: 2px 0 0;
color: var(--text-primary);
font-size: 24px;
font-size: 18px;
font-weight: 780;
line-height: 1.18;
}
@@ -998,7 +1025,7 @@ onMounted(async () => {
margin: 4px 0 4px;
overflow: hidden;
color: var(--text-primary);
font-size: 22px;
font-size: 20px;
font-weight: 800;
line-height: 1.18;
text-overflow: ellipsis;
@@ -129,7 +129,7 @@ onMounted(loadProgress)
.hero-card, .section-card, .progress-list { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.progress-list { display: grid; gap: 0; overflow: hidden; }
.progress-list article { display: flex; gap: 12px; padding: 16px; border-top: 1px solid var(--theme-border); }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -797,6 +797,12 @@ onMounted(async () => {
color: var(--theme-card-bg);
}
.mobile-icon-btn :deep(.anticon),
.mobile-avatar-btn :deep(.anticon) {
font-size: 21px;
line-height: 1;
}
.mobile-topbar__actions {
display: inline-flex;
align-items: center;
@@ -1016,7 +1022,8 @@ onMounted(async () => {
}
.mobile-tabbar__item :deep(.anticon) {
font-size: 16px;
font-size: 21px;
line-height: 1;
}
.drawer-account {
@@ -398,7 +398,7 @@ const goToFrontend = () => {
}
.login-header h1 {
font-size: clamp(28px, 4vw, 38px);
font-size: clamp(23px, 3.2vw, 28px);
font-weight: 700;
margin: 0 0 8px 0;
}
Binary file not shown.
+2
View File
@@ -85,6 +85,8 @@ create table t_comment
product_id bigint unsigned default 0 null comment '关联商品表主键(0表示非商品评论)',
comment_content text not null comment '评论内容',
parent_comment_id bigint unsigned default 0 null comment '父级评论ID(0表示为根评论)',
rating_score tinyint unsigned default 5 null comment '评论评分:1-5星',
image_file_ids text null comment '评论图片文件ID集合,多个ID以逗号分隔',
like_count int unsigned default 0 null comment '评论点赞数',
create_time datetime default CURRENT_TIMESTAMP not null comment '评论创建时间',
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '评论更新时间',
@@ -0,0 +1,28 @@
DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists;
DELIMITER $$
CREATE PROCEDURE sp_add_column_if_not_exists(
IN p_table_name VARCHAR(64),
IN p_column_name VARCHAR(64),
IN p_definition TEXT
)
BEGIN
IF NOT EXISTS (
SELECT 1
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = p_table_name
AND COLUMN_NAME = p_column_name
) THEN
SET @sql = CONCAT('ALTER TABLE `', p_table_name, '` ADD COLUMN `', p_column_name, '` ', p_definition);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
END$$
DELIMITER ;
CALL sp_add_column_if_not_exists('t_comment', 'rating_score', 'tinyint unsigned DEFAULT 5 NULL COMMENT ''评论评分:1-5星'' AFTER `parent_comment_id`');
CALL sp_add_column_if_not_exists('t_comment', 'image_file_ids', 'text NULL COMMENT ''评论图片文件ID集合,多个ID以逗号分隔'' AFTER `rating_score`');
DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists;