📃 docs:解决冲突问题
This commit is contained in:
@@ -21,9 +21,13 @@ const segmentedControl: FC<PropsType> = (props) => {
|
||||
})
|
||||
const { list, defaultId = -1, onSelect } = props
|
||||
|
||||
const isValidNumber = (value: any) => {
|
||||
return typeof value === 'number' && value >= 0
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log('defaultId', defaultId)
|
||||
if (typeof defaultId === 'number' && defaultId >= 0) {
|
||||
if (isValidNumber(defaultId)) {
|
||||
console.log('defaultId:::', defaultId)
|
||||
const index = list?.findIndex((item) => {
|
||||
return item.id == defaultId
|
||||
@@ -33,7 +37,7 @@ const segmentedControl: FC<PropsType> = (props) => {
|
||||
setSelectInfo((e) => ({ ...e, tabId: list[num].id.toString() }))
|
||||
}
|
||||
}
|
||||
setSelectInfo((e) => ({ ...e, selected: defaultId || -1 }))
|
||||
setSelectInfo((e) => ({ ...e, selected: isValidNumber(defaultId) ? defaultId : -1 }))
|
||||
console.log('selectInfo', selectInfo)
|
||||
}, [defaultId])
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
.cell {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 28px;
|
||||
padding: 12px 0;
|
||||
.title {
|
||||
min-width: 140px;
|
||||
flex: none;
|
||||
color: #a9a9a9;
|
||||
}
|
||||
.desc {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex: 1 1 auto;
|
||||
color: $color_font_one;
|
||||
}
|
||||
}
|
||||
.descText {
|
||||
@include common_ellipsis(2);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import classNames from "classnames"
|
||||
import { FC, useCallback, useMemo, useRef } from "react"
|
||||
import IconFont, { IconNames } from "../iconfont/iconfont"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
interface CellPropsType {
|
||||
title: string
|
||||
desc: string
|
||||
isLink?: boolean
|
||||
onClick?: () => void
|
||||
customStyle?: React.CSSProperties
|
||||
customClassName?: string
|
||||
iconName?: IconNames
|
||||
}
|
||||
const Cell:FC<CellPropsType> = (props) => {
|
||||
const {title, desc, isLink = false, customClassName, customStyle, onClick, iconName} = props
|
||||
|
||||
const onClickRef = useRef(onClick)
|
||||
onClickRef.current = onClick
|
||||
// 防止函数的引用改变
|
||||
const handleClick = useCallback(() => {
|
||||
return isLink && onClickRef.current?.()
|
||||
}, [isLink])
|
||||
|
||||
const CellElement = useMemo(() => {
|
||||
return (
|
||||
<View className={classNames(styles.cell, customClassName)} style={customStyle} onClick={handleClick}>
|
||||
<View className={styles.title}>
|
||||
{iconName && <IconFont name={iconName} size={46}></IconFont>}
|
||||
<Text>{title}</Text>
|
||||
</View>
|
||||
<View className={styles.desc}>
|
||||
<Text className={styles.descText}>{desc}</Text>
|
||||
{isLink && <IconFont name='icon-chakanquanbukehu' size={46} color='inherit'></IconFont>}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}, [title, desc, handleClick, customStyle])
|
||||
|
||||
return <>{CellElement}</>
|
||||
}
|
||||
export default Cell
|
||||
@@ -10,9 +10,9 @@ type params = {
|
||||
onSelect?: () => void //选择触发
|
||||
onClose?: () => void //取消触发
|
||||
status?: boolean //是否选中
|
||||
hidden?: boolean // 隐藏单选框
|
||||
hiddenCheckboxIcon?: boolean // 隐藏多选框
|
||||
disabled?: boolean //是否禁用
|
||||
triggerLabel?: boolean // 点击label是否触发选中
|
||||
triggerLabel?: boolean // 点击label是否触发选中
|
||||
circle?: boolean
|
||||
round?: boolean
|
||||
size?: CheckboxSize
|
||||
@@ -35,7 +35,7 @@ export default forwardRef((props: params, ref) => {
|
||||
customStyles = {},
|
||||
customClassName = '',
|
||||
customTextClass = '',
|
||||
hidden = false,
|
||||
hiddenCheckboxIcon = false,
|
||||
} = props
|
||||
const [selected, SetSelected] = useState(false)
|
||||
const onSelectEven = () => {
|
||||
@@ -81,11 +81,14 @@ export default forwardRef((props: params, ref) => {
|
||||
}, [status])
|
||||
return (
|
||||
<View className={classnames(customClassName, styles.checkbox)} style={customStyles} onClick={onSelectEven}>
|
||||
<View className={classnames(styles.checkbox_main, getMainClassName())} hidden={hidden}>
|
||||
<View className={classnames(styles.checkbox_item, getClassName())}>
|
||||
{selected && <IconFont name='icon-a-jizhumima' size={22} color='#fff'></IconFont>}
|
||||
{!hiddenCheckboxIcon && (
|
||||
<View className={classnames(styles.checkbox_main, getMainClassName())}>
|
||||
<View className={classnames(styles.checkbox_item, getClassName())}>
|
||||
{selected && <IconFont name='icon-a-jizhumima' size={22} color='#fff'></IconFont>}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{children && (
|
||||
<View className={classnames(styles['checkbox--text'], customTextClass)} onClick={handleClickChildren}>
|
||||
{children}
|
||||
|
||||
@@ -12,22 +12,24 @@ type params = {
|
||||
onBlue?:(val:number) => void, //失去焦点触发
|
||||
onClickBtn?:(val:number) => void,
|
||||
unit?: string,
|
||||
disable?: true|false, //是否禁用
|
||||
disable?: boolean, //是否禁用
|
||||
}
|
||||
export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0, onChange, onBlue, onClickBtn, unit = '', disable = false}: params) => {
|
||||
const [value, setValue] = useState<any>({count:defaultNum})
|
||||
|
||||
const onPlus = () => {
|
||||
if(disable) return false
|
||||
let {count} = value
|
||||
const onPlus = (event) => {
|
||||
event.stopPropagation()
|
||||
if (disable) return false
|
||||
let { count } = value
|
||||
let num_res = Big(count).add(step).toNumber()
|
||||
num_res = num_res >= maxNum?maxNum:num_res
|
||||
num_res = num_res >= maxNum ? maxNum : num_res
|
||||
num_res = formatDigits(num_res)
|
||||
setValue({...value, count:num_res})
|
||||
setValue({ ...value, count: num_res })
|
||||
onChange?.(parseFloat(num_res))
|
||||
onClickBtn?.(parseFloat(num_res))
|
||||
}
|
||||
const minus = () => {
|
||||
const minus = (event) => {
|
||||
event.stopPropagation()
|
||||
if(disable) return false
|
||||
let {count} = value
|
||||
let num_res = Big(count).minus(step).toNumber()
|
||||
@@ -98,7 +100,7 @@ export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0,
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.reduce} onClick={() => minus()}>-</View>
|
||||
<View className={styles.reduce} onClick={minus}>-</View>
|
||||
<View className={styles.input}>
|
||||
<Input
|
||||
value={String(value.count)}
|
||||
@@ -109,7 +111,7 @@ export default ({minNum = 0, maxNum = 10000, step=1, digits = 0, defaultNum = 0,
|
||||
/>
|
||||
<View className={styles.unit}>{unit}</View>
|
||||
</View>
|
||||
<View className={styles.plus} onClick={() => onPlus()}>+</View>
|
||||
<View className={styles.plus} onClick={onPlus}>+</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { View } from '@tarojs/components'
|
||||
import { FC, ReactNode } from 'react'
|
||||
import IconFont from '../iconfont/iconfont'
|
||||
import IconFont, { IconNames } from '../iconfont/iconfont'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
import classname from 'classnames'
|
||||
|
||||
type IconfontName = Parameters<typeof IconFont>['0']['name']
|
||||
|
||||
interface PropsType {
|
||||
iconName: IconfontName
|
||||
iconName: IconNames
|
||||
title: string
|
||||
children?: ReactNode
|
||||
onClick?: Function
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { FC } from "react"
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import IconFont from '../iconfont/iconfont'
|
||||
import IconFont, { IconNames } from '../iconfont/iconfont'
|
||||
import styles from './index.module.scss'
|
||||
import classnames from 'classnames'
|
||||
|
||||
type IconfontName = Parameters<typeof IconFont>['0']['name']
|
||||
|
||||
type PropsType = {
|
||||
iconName: IconfontName
|
||||
iconName: IconNames
|
||||
iconSize?: number
|
||||
svg?: boolean
|
||||
text?: string
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
background-color: #fff;
|
||||
padding: 32px;
|
||||
margin-bottom: 20px;
|
||||
margin-left: 24px;
|
||||
margin-right: 24px;
|
||||
&--row {
|
||||
flex-flow: row nowrap;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { EnumSaleMode } from "@/common/Enumerate"
|
||||
import { FC } from "react"
|
||||
import Tag, { TagSize } from "../tag"
|
||||
|
||||
interface SaleModeProps {
|
||||
saleMode: number
|
||||
size?: TagSize
|
||||
customClassName?: string
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
const SaleModeTag: FC<SaleModeProps> = (props) => {
|
||||
const { saleMode, size = 'small', customClassName } = props
|
||||
return (
|
||||
<>
|
||||
{saleMode === EnumSaleMode.Bulk && (
|
||||
<Tag circle type='primary' plain size={size} customClassName={customClassName}>
|
||||
大货
|
||||
</Tag>
|
||||
)}
|
||||
{saleMode === EnumSaleMode.Plate && (
|
||||
<Tag circle type='danger' plain size={size} customClassName={customClassName}>
|
||||
剪板
|
||||
</Tag>
|
||||
)}
|
||||
{saleMode === EnumSaleMode.BulkCut && (
|
||||
<Tag circle type='warning' plain size={size} customClassName={customClassName}>
|
||||
散剪
|
||||
</Tag>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default SaleModeTag
|
||||
@@ -3,7 +3,7 @@ import { FC, ReactNode } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type TagSize = 'small' | 'normal'
|
||||
export type TagSize = 'small' | 'normal'
|
||||
type TagType = 'primary' | 'danger' | 'warning' | 'info'
|
||||
|
||||
interface PropsType {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Taro, { FC } from '@tarojs/taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { memo, useEffect, useState } from 'react'
|
||||
import useUploadCDNImg from '@/use/useUploadImage'
|
||||
import { Image, Text, View } from '@tarojs/components'
|
||||
@@ -11,10 +11,11 @@ import Popup from '@/components/popup'
|
||||
type ImageParam = {
|
||||
onChange?: (val: string[]) => void
|
||||
defaultList?: string[]
|
||||
onlyRead?: false | true
|
||||
onlyRead?: boolean
|
||||
}
|
||||
const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = false }) => {
|
||||
const PictureItem = memo<ImageParam>(({ onChange, defaultList, onlyRead = false }) => {
|
||||
const { getWxPhoto, getChatPhoto } = useUploadCDNImg()
|
||||
|
||||
const [imageList, setImageLise] = useState<string[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user