fix(api): 替换所有接口请求的域名为 guilixu-api.websoft.top
- 将获取 STS Token 的接口地址由 paopao-api 改为 guilixu-api - 更新图片上传接口地址为新的 guilixu-api 域名 - 修改用户推广页面中邀请码链接和二维码接口的域名 - 更改注册页微信登录接口请求的域名为 guilixu-api
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React from 'react'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { isGuest } from '@/utils/auth'
|
||||
|
||||
interface PriceProps {
|
||||
price: string | number
|
||||
@@ -7,6 +8,17 @@ interface PriceProps {
|
||||
size?: 'small' | 'normal' | 'large'
|
||||
color?: string
|
||||
symbol?: string
|
||||
/**
|
||||
* 游客脱敏模式:
|
||||
* - 当用户未登录时,**不显示价格**,改成"登录后查看"占位文案
|
||||
* - 用于过微信审核:游客可浏览商品列表/详情,但价格需登录后可见
|
||||
* - 不传则维持原行为(游客也显示价格)
|
||||
*/
|
||||
loginMask?: boolean
|
||||
/**
|
||||
* 自定义脱敏文案(仅在 loginMask=true 且游客态下生效)
|
||||
*/
|
||||
maskText?: string
|
||||
}
|
||||
|
||||
const Price: React.FC<PriceProps> = ({
|
||||
@@ -15,6 +27,8 @@ const Price: React.FC<PriceProps> = ({
|
||||
size = 'normal',
|
||||
color = '#ee0a24',
|
||||
symbol = '¥',
|
||||
loginMask = false,
|
||||
maskText = '登录后查看价格',
|
||||
}) => {
|
||||
const fmt = (p: string | number) => {
|
||||
const num = typeof p === 'string' ? parseFloat(p) : p
|
||||
@@ -22,13 +36,22 @@ const Price: React.FC<PriceProps> = ({
|
||||
}
|
||||
|
||||
const sizeMap = {
|
||||
small: { symbol: 'text-xs', integer: 'text-sm font-medium', decimal: 'text-xs' },
|
||||
normal: { symbol: 'text-sm', integer: 'text-lg font-bold', decimal: 'text-sm' },
|
||||
large: { symbol: 'text-lg', integer: 'text-2xl font-bold', decimal: 'text-lg' },
|
||||
small: { mask: 'text-xs', symbol: 'text-xs', integer: 'text-sm font-medium', decimal: 'text-xs' },
|
||||
normal: { mask: 'text-sm', symbol: 'text-sm', integer: 'text-lg font-bold', decimal: 'text-sm' },
|
||||
large: { mask: 'text-base', symbol: 'text-lg', integer: 'text-2xl font-bold', decimal: 'text-lg' },
|
||||
}
|
||||
|
||||
const cls = sizeMap[size]
|
||||
|
||||
// 游客态 + 开启脱敏 -> 显示占位文案
|
||||
if (loginMask && isGuest()) {
|
||||
return (
|
||||
<View className='flex items-baseline'>
|
||||
<Text className={`${cls.mask} text-gray-400`}>{maskText}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<View className='flex items-baseline'>
|
||||
<Text className={`${cls.symbol} font-medium`} style={{ color }}>{symbol}</Text>
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from 'react'
|
||||
import { View, Text, Image } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import Price from '../Price'
|
||||
import { isGuest } from '@/utils/auth'
|
||||
import type { ShopGoods } from '@/api/shop/shopGoods/model'
|
||||
|
||||
interface ProductCardProps {
|
||||
@@ -35,11 +36,13 @@ const ProductCard: React.FC<ProductCardProps> = ({ product, onClick }) => {
|
||||
</Text>
|
||||
<View className='flex items-end justify-between mt-2'>
|
||||
<View className='flex-1'>
|
||||
<Price price={product.price || '0'} size='small' />
|
||||
<Price price={product.price || '0'} size='small' loginMask />
|
||||
{product.salePrice && product.salePrice !== product.price && (
|
||||
<Text className='text-xs text-gray-400 line-through ml-1'>
|
||||
¥{product.salePrice}
|
||||
</Text>
|
||||
isGuest() ? null : (
|
||||
<Text className='text-xs text-gray-400 line-through ml-1'>
|
||||
¥{product.salePrice}
|
||||
</Text>
|
||||
)
|
||||
)}
|
||||
</View>
|
||||
{product.sales !== undefined && product.sales > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user