import * as React from 'react' import log from '../utils/lofter-log' import { getCouponData4Show, getPreferentialText } from '../utils/couponFormat' import { imgResize, getParmvalByKey } from '../utils/imgResize' import LazyLoad from 'react-lazy-load' import * as Styled from './index.style' import {handlePathQuery} from "../utils/snailTargetHandler"; import {genSpmLink} from "../utils/statistics"; import { ProductItemType } from '../lofterProductLarge' import { trackingClickEvent } from '../lofterProduct' export default class LofterProductDefault extends React.Component<{product:ProductItemType,size?:string}> { private async toProductDetail(id:string,specialArea:string,event:React.MouseEvent) { event.stopPropagation(); await trackingClickEvent(id) if(specialArea && this.props.product.shopUrl){ location.href = this.props.product.shopUrl return } const spmLink = genSpmLink({url: `https://www.lofter.com/market/fe/html/product.html?productId=${id}&njb_navigator=false`, name: 'spmCmspageProduct'}) location.href = spmLink; } public render() { let {product, size} = this.props return { product.iconText &&
{product.iconText.split(',').map((iconText:string) => { return {iconText} })}
}
{product.name}
{ product.shop && product.shopUrl && <>
{product.shop || '进店选购'} 进店
} { ( !!product.coupon || !!product.bounties && product.bounties.length > 0 ) &&
{ !!product.coupon &&
{getPreferentialText(product.coupon)}
} { !!product.bounties && product.bounties.length > 0 &&
津贴
}
} { !!product.activity && [1,2].includes(product.activity.type) &&
{product.activity.type == 1 ? '秒杀' : '限时购'}
}
{ product.priceType == 0 ? : ¥ } {product.storePrice} { product.storePrice != product.marketPrice && product.priceType != 0 && product.marketPrice && ¥{product.marketPrice} }
} }