diff --git a/config/dev.js b/config/dev.js index 2f809db..acd0ca0 100644 --- a/config/dev.js +++ b/config/dev.js @@ -22,10 +22,10 @@ module.exports = { args: [ { terserOptions: { - compress: true, // 默认使用terser压缩 - // compress: { - // drop_console: true, // 去掉打印 - // }, // 默认使用terser压缩 + // compress: true, // 默认使用terser压缩 + compress: { + drop_console: false, // 去掉打印 + }, // 默认使用terser压缩 // mangle: false, keep_classnames: true, // 不改变class名称 keep_fnames: true, // 不改变函数名称 diff --git a/config/pre.js b/config/pre.js index 688d394..6df5a41 100644 --- a/config/pre.js +++ b/config/pre.js @@ -24,7 +24,7 @@ module.exports = { terserOptions: { // compress: true, // 默认使用terser压缩 compress: { - // drop_console: true, // 去掉打印 + drop_console: false, // 去掉打印 }, // 默认使用terser压缩 // mangle: false, keep_classnames: true, // 不改变class名称 diff --git a/src/components/checkbox/index.module.scss b/src/components/checkbox/index.module.scss index 3eda977..dcefcb0 100644 --- a/src/components/checkbox/index.module.scss +++ b/src/components/checkbox/index.module.scss @@ -37,7 +37,7 @@ } } .checkbox_main_no_selected { - border: 0 !important; + border-color: #c2c2c2; } .checkbox_item { display: flex; @@ -45,7 +45,7 @@ justify-content: center; } .no_checkbox_item { - border: 0 !important; + border-color: #c2c2c2; background-color: #dddddd !important; } .checkbox_item_select { diff --git a/src/components/checkbox/index.tsx b/src/components/checkbox/index.tsx index ee1eef9..fb4f95c 100644 --- a/src/components/checkbox/index.tsx +++ b/src/components/checkbox/index.tsx @@ -44,6 +44,7 @@ const Checkbox = (props: params, ref) => { }) const onSelectEven = () => { + console.log('disabled', disabled) if (disabled) { return false } const res = !selected if (res) { diff --git a/src/pages/colorCardClipping/components/productItem/index.tsx b/src/pages/colorCardClipping/components/productItem/index.tsx index 3548886..ad1669d 100644 --- a/src/pages/colorCardClipping/components/productItem/index.tsx +++ b/src/pages/colorCardClipping/components/productItem/index.tsx @@ -66,7 +66,7 @@ export default (props: Param) => { { - value.color_card_info?.[0].affiliation_product?.map((item) => { + value.color_card_info?.[0]?.affiliation_product?.map((item) => { return {formatRemoveHashTag(item.code)} }) } diff --git a/src/pages/colorCardList/components/productItem/index.tsx b/src/pages/colorCardList/components/productItem/index.tsx index 0e691b3..c0338bf 100644 --- a/src/pages/colorCardList/components/productItem/index.tsx +++ b/src/pages/colorCardList/components/productItem/index.tsx @@ -3,6 +3,7 @@ import { memo, useCallback, useMemo, useState } from 'react' import styles from './index.module.scss' import LabAndImg from '@/components/LabAndImg' import Checkbox from '@/components/checkbox' +import { alert } from '@/common/common' interface ProductItemParamType { code: string @@ -19,13 +20,22 @@ export interface ParamType { is_add: boolean onSelect?: (val: ParamType, status: boolean) => void count?: number + selectList?: any[] } +// 限制5个 +const limit = 5 + export default memo((props: ParamType) => { - const { affiliation_product, color_card_name = '', texture_url = '', lab, rgb } = props + const { affiliation_product, color_card_name = '', texture_url = '', lab, rgb, selectList } = props const [checkStatus, setCheckStatus] = useState(false) const changeSelect = () => { + console.log('isDisabled', isDisabled) if (props.is_add) { return false } + if (isDisabled) { + alert.none('每次最多申请5种面料') + return false + } setCheckStatus(!checkStatus) props.onSelect?.(props, !checkStatus) } @@ -38,6 +48,20 @@ export default memo((props: ParamType) => { props.onSelect?.(props, false) setCheckStatus(false) } + + const isDisabled = useMemo(() => { + const set = new Set(selectList?.map(item => item.id)) + if (selectList) { + if (set.has(props.id)) { + return false + } + return set.size >= limit + } + else { + return false + } + }, [selectList]) + const labAndImgObj = useMemo( () => { return { lab: props.lab, rgb: props.rgb, texture_url: props.texture_url } @@ -56,7 +80,7 @@ export default memo((props: ParamType) => { e.stopPropagation()}> - + }) diff --git a/src/pages/colorCardList/index.tsx b/src/pages/colorCardList/index.tsx index 76d60e1..1c66e61 100644 --- a/src/pages/colorCardList/index.tsx +++ b/src/pages/colorCardList/index.tsx @@ -104,6 +104,8 @@ export default () => { const multipleSelection = useRef([]) const onSelectData = (val, status) => { + console.log('onSelectData', val, status) + console.log('selectList', selectList) if (status) { multipleSelection.current.push(val) setSelectList(e => [val, ...e]) @@ -133,7 +135,7 @@ export default () => { {colorCardData.list?.map((item) => { return ( - + ) })} diff --git a/src/pages/cutSampleListOrder/index.config.ts b/src/pages/cutSampleListOrder/index.config.ts index 70da7a6..712b2bc 100644 --- a/src/pages/cutSampleListOrder/index.config.ts +++ b/src/pages/cutSampleListOrder/index.config.ts @@ -1,6 +1,5 @@ export default { navigationBarTitleText: '领取剪样', - enableShareAppMessage: true, disableSwipeBack: true, navigationStyle: 'custom', }