mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-10 05:46:05 +08:00
fix: privacy modal theme in RootPortal; image placeholders; coupon btn styles
- SpPrivacyModal: render via RootPortal on weapp; inject themeColor() on root so var(--color-primary) works outside SpPage; clean unused imports - SpImage container and goods card image areas: white background for loading/empty - WgtCouponCard: use camelCase inline style keys for receive button - goods widget: list thumb background #fff instead of gray Made-with: Cursor
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
.sp-image-container {
|
||||
position: relative;
|
||||
overflow: hidden; /* 防止圆角溢出 */
|
||||
background-color: transparent;
|
||||
background-color: #fff;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
*/
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { View, Image, Button, Text } from '@tarojs/components'
|
||||
import { View, Text, RootPortal } from '@tarojs/components'
|
||||
import { AtButton } from 'taro-ui'
|
||||
import { useImmer } from 'use-immer'
|
||||
import { SpImage } from '@/components'
|
||||
import api from '@/api'
|
||||
import { classNames, styleNames } from '@/utils'
|
||||
import { useLogin } from '@/hooks'
|
||||
import { useLogin, useThemsColor } from '@/hooks'
|
||||
|
||||
import './index.scss'
|
||||
|
||||
@@ -21,6 +20,7 @@ const initState = {
|
||||
}
|
||||
|
||||
function SpPrivacyModal(props) {
|
||||
const { themeColor } = useThemsColor()
|
||||
const { login, updatePolicyTime, getUserInfoAuth } = useLogin()
|
||||
const { open = false, onCancel = () => {}, onConfirm = () => {} } = props
|
||||
const [info, setInfo] = useImmer(initState)
|
||||
@@ -56,11 +56,13 @@ function SpPrivacyModal(props) {
|
||||
onCancel()
|
||||
}
|
||||
|
||||
return (
|
||||
// RootPortal 脱离 SpPage,根节点需注入 themeColor(),子树内 var(--color-primary) 才能生效
|
||||
const modal = (
|
||||
<View
|
||||
className={classNames('sp-privacy-modal', {
|
||||
'open': open
|
||||
})}
|
||||
style={styleNames(themeColor())}
|
||||
>
|
||||
<View className='sp-privacy-modal__overlay'></View>
|
||||
<View className='modal-container'>
|
||||
@@ -95,6 +97,13 @@ function SpPrivacyModal(props) {
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
|
||||
// 微信小程序:scroll-view 内图片等同层渲染节点可能盖住普通 fixed 层;挂到页面根节点保证最顶层
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
return <RootPortal>{modal}</RootPortal>
|
||||
}
|
||||
|
||||
return modal
|
||||
}
|
||||
|
||||
SpPrivacyModal.options = {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
&__image {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
|
||||
.soldout-mask {
|
||||
position: absolute;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
width: 100%;
|
||||
aspect-ratio: 1/1;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
|
||||
.soldout-mask {
|
||||
position: absolute;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
aspect-ratio: 1/1;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
|
||||
.soldout-mask {
|
||||
position: absolute;
|
||||
|
||||
@@ -67,7 +67,7 @@ function WgtCouponCard(props) {
|
||||
const receiveBtnStyle = useMemo(() => {
|
||||
const { color, textColor } = receiveBtn
|
||||
return {
|
||||
'background-color': color,
|
||||
backgroundColor: color,
|
||||
color: textColor
|
||||
}
|
||||
}, [receiveBtn])
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
&-img {
|
||||
width: 157px;
|
||||
height: 157px;
|
||||
background: #d6d6d6;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user