修改弹窗遮挡
This commit is contained in:
@@ -41,8 +41,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.common-popup__body {
|
.common-popup__body {
|
||||||
overflow: auto;
|
|
||||||
-webkit-overflow-scrolling: touch;
|
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export type CoverImageValue = {
|
|||||||
|
|
||||||
export interface UploadCoverProps {
|
export interface UploadCoverProps {
|
||||||
value: CoverImageValue[]
|
value: CoverImageValue[]
|
||||||
|
changePicker?: (value: boolean) => void
|
||||||
onChange: (value: CoverImageValue[] | ((prev: CoverImageValue[]) => CoverImageValue[])
|
onChange: (value: CoverImageValue[] | ((prev: CoverImageValue[]) => CoverImageValue[])
|
||||||
) => void
|
) => void
|
||||||
source?: source
|
source?: source
|
||||||
@@ -56,6 +57,7 @@ export default function UploadCover(props: UploadCoverProps) {
|
|||||||
maxCount = 9,
|
maxCount = 9,
|
||||||
align = 'center',
|
align = 'center',
|
||||||
tag = 'cover',
|
tag = 'cover',
|
||||||
|
changePicker
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const [visible, setVisible] = useState(false)
|
const [visible, setVisible] = useState(false)
|
||||||
@@ -82,11 +84,18 @@ export default function UploadCover(props: UploadCoverProps) {
|
|||||||
onChange(value.filter(item => item.id !== image.id))
|
onChange(value.filter(item => item.id !== image.id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const openPicker = (value: boolean) => {
|
||||||
|
setVisible(value)
|
||||||
|
if (changePicker) {
|
||||||
|
changePicker(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CommonPopup
|
<CommonPopup
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onClose={() => setVisible(false)}
|
onClose={() => openPicker(false)}
|
||||||
round
|
round
|
||||||
position="bottom"
|
position="bottom"
|
||||||
hideFooter
|
hideFooter
|
||||||
@@ -115,7 +124,7 @@ export default function UploadCover(props: UploadCoverProps) {
|
|||||||
<UploadSourcePopup tag={tag} ref={uploadSourcePopupRef} onAdd={onAdd} />
|
<UploadSourcePopup tag={tag} ref={uploadSourcePopupRef} onAdd={onAdd} />
|
||||||
<div className={`upload-cover-root ${value.length === 0 && align === 'center' ? 'upload-cover-act-center' : ''}`}>
|
<div className={`upload-cover-root ${value.length === 0 && align === 'center' ? 'upload-cover-act-center' : ''}`}>
|
||||||
{value.length < maxCount && (
|
{value.length < maxCount && (
|
||||||
<div className="upload-cover-act" onClick={() => setVisible(true)}>
|
<div className="upload-cover-act" onClick={() => openPicker(true)}>
|
||||||
<Image className='upload-cover-act-icon' src={img.ICON_ADD} />
|
<Image className='upload-cover-act-icon' src={img.ICON_ADD} />
|
||||||
<div className="upload-cover-text">添加活动封面</div>
|
<div className="upload-cover-text">添加活动封面</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
|||||||
const stadiumDetailRef = useRef<StadiumDetailRef>(null)
|
const stadiumDetailRef = useRef<StadiumDetailRef>(null)
|
||||||
const [stadiumList, setStadiumList] = useState<Stadium[]>([])
|
const [stadiumList, setStadiumList] = useState<Stadium[]>([])
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
// const [keyboardVisible, setKeyboardVisible] = useState(false);
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
try {
|
try {
|
||||||
@@ -162,6 +163,9 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
|||||||
`<span class="highlight-text">${searchValue}</span>`
|
`<span class="highlight-text">${searchValue}</span>`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// const handleAnyInput = (value) => {
|
||||||
|
// setKeyboardVisible(value)
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -178,11 +182,13 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
|||||||
onCancel={handleDetailCancel}
|
onCancel={handleDetailCancel}
|
||||||
onConfirm={handleConfirm}
|
onConfirm={handleConfirm}
|
||||||
position="bottom"
|
position="bottom"
|
||||||
|
//style={{ paddingBottom: keyboardVisible ? `20px` : undefined }}
|
||||||
round
|
round
|
||||||
>
|
>
|
||||||
<StadiumDetail
|
<StadiumDetail
|
||||||
ref={stadiumDetailRef}
|
ref={stadiumDetailRef}
|
||||||
stadium={selectedStadium}
|
stadium={selectedStadium}
|
||||||
|
//onAnyInput={handleAnyInput}
|
||||||
/>
|
/>
|
||||||
</CommonPopup>
|
</CommonPopup>
|
||||||
)
|
)
|
||||||
@@ -248,7 +254,11 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
|||||||
<Loading type="circular" className='loading-icon'>加载中</Loading>
|
<Loading type="circular" className='loading-icon'>加载中</Loading>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<ScrollView className='stadium-list' scrollY>
|
<ScrollView className='stadium-list'
|
||||||
|
scrollWithAnimation
|
||||||
|
enhanced
|
||||||
|
showScrollbar={false}
|
||||||
|
scrollY>
|
||||||
{filteredStadiums.map((stadium) => (
|
{filteredStadiums.map((stadium) => (
|
||||||
<View
|
<View
|
||||||
key={stadium.id}
|
key={stadium.id}
|
||||||
@@ -260,26 +270,26 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
|||||||
</View>
|
</View>
|
||||||
<View className='stadium-item-right'>
|
<View className='stadium-item-right'>
|
||||||
<View className='stadium-name' dangerouslySetInnerHTML={{ __html: markSearchText(stadium.name) }}></View>
|
<View className='stadium-name' dangerouslySetInnerHTML={{ __html: markSearchText(stadium.name) }}></View>
|
||||||
<View className='stadium-address'>
|
<View className='stadium-address'>
|
||||||
<Text
|
<Text
|
||||||
className='stadium-distance'
|
className='stadium-distance'
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
handleItemLocation(stadium)
|
handleItemLocation(stadium)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{calculateDistance(stadium)} ·
|
{calculateDistance(stadium)} ·
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
className='stadium-address-text'
|
className='stadium-address-text'
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
handleItemLocation(stadium)
|
handleItemLocation(stadium)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{stadium.address}
|
{stadium.address}
|
||||||
</Text>
|
</Text>
|
||||||
<Image src={images.ICON_ARRORW_SMALL} className='stadium-map-icon' />
|
<Image src={images.ICON_ARRORW_SMALL} className='stadium-map-icon' />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
background: white;
|
background: white;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-y: scroll;
|
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
.stadium-detail-scroll{
|
.stadium-detail-scroll{
|
||||||
height:72vh;
|
height:72vh;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useCallback, forwardRef, useImperativeHandle } from 'react'
|
import React, { useState, useCallback, forwardRef, useImperativeHandle, useEffect } from 'react'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import { View, Text, Image, ScrollView } from '@tarojs/components'
|
import { View, Text, Image, ScrollView } from '@tarojs/components'
|
||||||
import images from '@/config/images'
|
import images from '@/config/images'
|
||||||
@@ -6,6 +6,7 @@ import TextareaTag from '@/components/TextareaTag'
|
|||||||
// import CoverImageUpload, { type CoverImage } from '@/components/ImageUpload'
|
// import CoverImageUpload, { type CoverImage } from '@/components/ImageUpload'
|
||||||
import UploadCover, { type CoverImageValue } from '@/components/UploadCover'
|
import UploadCover, { type CoverImageValue } from '@/components/UploadCover'
|
||||||
import { useDictionaryActions } from '@/store/dictionaryStore'
|
import { useDictionaryActions } from '@/store/dictionaryStore'
|
||||||
|
|
||||||
import './StadiumDetail.scss'
|
import './StadiumDetail.scss'
|
||||||
|
|
||||||
export interface Stadium {
|
export interface Stadium {
|
||||||
@@ -25,6 +26,7 @@ export interface Stadium {
|
|||||||
|
|
||||||
interface StadiumDetailProps {
|
interface StadiumDetailProps {
|
||||||
stadium: Stadium
|
stadium: Stadium
|
||||||
|
onAnyInput?: (value: boolean) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义暴露给父组件的方法接口
|
// 定义暴露给父组件的方法接口
|
||||||
@@ -65,7 +67,9 @@ const SectionContainer: React.FC<{ title: string; children: React.ReactNode, pro
|
|||||||
|
|
||||||
const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||||
stadium,
|
stadium,
|
||||||
|
onAnyInput
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
|
const [openPicker, setOpenPicker] = useState(false);
|
||||||
const { getDictionaryValue } = useDictionaryActions()
|
const { getDictionaryValue } = useDictionaryActions()
|
||||||
const court_type = getDictionaryValue('court_type') || []
|
const court_type = getDictionaryValue('court_type') || []
|
||||||
const court_surface = getDictionaryValue('court_surface') || []
|
const court_surface = getDictionaryValue('court_surface') || []
|
||||||
@@ -162,11 +166,16 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
}, [formData.court_type, formData.court_surface])
|
}, [formData.court_type, formData.court_surface])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const changePicker = (value) => {
|
||||||
|
setOpenPicker(value)
|
||||||
|
}
|
||||||
|
|
||||||
console.log(stadium,'stadiumstadium');
|
console.log(stadium,'stadiumstadium');
|
||||||
return (
|
return (
|
||||||
<View className='stadium-detail'>
|
<View className='stadium-detail'>
|
||||||
<ScrollView className='stadium-detail-scroll' scrollY>
|
<ScrollView className='stadium-detail-scroll' scrollY={!openPicker}>
|
||||||
{/* 已选球场 */}
|
{/* 已选球场 */}
|
||||||
<View
|
<View
|
||||||
className={`stadium-item`}
|
className={`stadium-item`}
|
||||||
onClick={() => handleMapLocation()}
|
onClick={() => handleMapLocation()}
|
||||||
@@ -209,6 +218,8 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
<TextareaTag
|
<TextareaTag
|
||||||
value={formData[item.prop]}
|
value={formData[item.prop]}
|
||||||
onChange={(value) => updateFormData(item.prop, value)}
|
onChange={(value) => updateFormData(item.prop, value)}
|
||||||
|
// onBlur={() => onAnyInput(false)}
|
||||||
|
// onFocus={() => onAnyInput(true)}
|
||||||
placeholder='有其他场地信息可备注'
|
placeholder='有其他场地信息可备注'
|
||||||
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
||||||
/>
|
/>
|
||||||
@@ -222,11 +233,10 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
<SectionContainer key={item.label} title={item.label} prop={item.prop}>
|
<SectionContainer key={item.label} title={item.label} prop={item.prop}>
|
||||||
<UploadCover
|
<UploadCover
|
||||||
value={formData[item.prop]}
|
value={formData[item.prop]}
|
||||||
|
changePicker={changePicker}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
console.log(value, 'value')
|
|
||||||
if (value instanceof Function) {
|
if (value instanceof Function) {
|
||||||
const newValue = value(formData[item.prop])
|
const newValue = value(formData[item.prop])
|
||||||
console.log(newValue, 'newValue')
|
|
||||||
updateFormData(item.prop, newValue)
|
updateFormData(item.prop, newValue)
|
||||||
} else {
|
} else {
|
||||||
updateFormData(item.prop, value)
|
updateFormData(item.prop, value)
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 4px 16px 20px 16px;
|
padding: 4px 16px 20px 16px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__content {
|
&__content {
|
||||||
|
|||||||
Reference in New Issue
Block a user