diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index 55cafca..1fa5feb 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -10,10 +10,12 @@ interface PropsType { onClose?: (show: boolean) => void onChange?: (isShow) => void children?: React.ReactNode + customClassName?: string + customStyles?: React.CSSProperties } // 弹出框 const Dialog = (props: PropsType) => { - const { showOverLay = true, show = false, onClose: _onClose, onChange: _onChange, children } = props + const { showOverLay = true, show = false, onClose: _onClose, onChange: _onChange, children, customClassName, customStyles } = props const [_show, setShow] = usePropsValue({ value: show, @@ -47,7 +49,7 @@ const Dialog = (props: PropsType) => { } }, [show]) return _show - ? + ? {/* 遮罩层 start */} = (props) => { const { + hoverClass = '', type = 'primary', size = 'normal', round = false, @@ -57,7 +59,7 @@ const NormalButton: FC = (props) => { } return ( - + {loading && } {children} diff --git a/src/components/organizationNameModal/index.module.scss b/src/components/organizationNameModal/index.module.scss index 8d003c1..d8e8fb8 100644 --- a/src/components/organizationNameModal/index.module.scss +++ b/src/components/organizationNameModal/index.module.scss @@ -10,6 +10,7 @@ border-radius: 20px; padding: 20px 42px; margin: 32px 40px; + margin-bottom: 0; font-size: 26px; color: #333; &_focus { @@ -37,6 +38,7 @@ align-items: center; justify-content: space-between; border-top: 1px solid #eee; + margin-top: 30px; .button { display: flex; align-items: center; @@ -44,9 +46,11 @@ text-align: center; box-sizing: border-box; width: 50%; - font-size: 30px; + height: 100%; + font-size: 32px; font-weight: 550; padding: 30px 0; + border: 0; background-color: #fff; } &_left { @@ -58,6 +62,7 @@ } } .tips { + display: flex; background-color: #fef9f4; font-size: 24px; color: #ff9b33; @@ -65,3 +70,8 @@ padding: 20px; } } +.error_tips { + color: #f64861; + padding: 10px 42px; + font-size: 20px; +} diff --git a/src/components/organizationNameModal/index.tsx b/src/components/organizationNameModal/index.tsx index d50d26e..fe0319d 100644 --- a/src/components/organizationNameModal/index.tsx +++ b/src/components/organizationNameModal/index.tsx @@ -1,11 +1,11 @@ import type { CommonEventFunction, InputProps } from '@tarojs/components' -import { Input, View } from '@tarojs/components' -import React, { useState } from 'react' +import { Input, Text, View } from '@tarojs/components' +import React, { useMemo, useState } from 'react' import classNames from 'classnames' import Dialog from '../Dialog' -import InputX from '../InputX' +import IconFont from '../iconfont/iconfont' +import NormalButton from '../normalButton' import styles from './index.module.scss' -import { usePropsValue } from '@/use/useCommon' interface PropsType { showModal: boolean @@ -37,37 +37,61 @@ const OrganizationNameModal = (props: PropsType) => { onConfirm?.(text) } const [inputStyles, setInputStyles] = useState([]) - const Reg = /^[a-zA-Z0-9\u4E00-\u9FA5]+$/ + const [tipsComp, setTipsComp] = useState(null) + + const isInvalidate = useMemo(() => { + let flag = false + const Reg = /^[a-zA-Z0-9\u4E00-\u9FA5]+$/ + console.log('text', text) + setTipsComp(null) + setInputStyles(() => [styles.inputBar_focus]) + if (!text) { + flag = true + } + if (text && !Reg.test(text)) { + flag = true + setInputStyles(() => [styles.inputBar_error]) + setTipsComp(() => { + return + 只允许输入数字、英文、中文;不允许输入任何其他符号 + + }) + } + return flag + }, [text]) const handleIntput: CommonEventFunction = (e) => { - if (!Reg.test(e.detail.value)) { - setInputStyles(() => [styles.inputBar_error]) - setText(e.detail.value) - return - } setText(e.detail.value) } const handleFocus = () => { - if (text && !Reg.test(text)) { + if (isInvalidate) { setInputStyles(() => [styles.inputBar_error]) return } setInputStyles(() => [styles.inputBar_focus]) } const handleBlur = () => { + if (isInvalidate) { + setInputStyles(() => [styles.inputBar_error]) + return + } setInputStyles(() => []) } - return + return 请设置您的组织昵称 - 公司名称是辨识您身份的重要依据,请谨慎修改。(仅支持修改一次) + + + 公司名称是辨识您身份的重要依据,请谨慎修改。(仅支持修改一次) + + {tipsComp} - 下次更改 - 确认 + 下次更改 + 确认 diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index f187256..0a7cd1d 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -7,6 +7,7 @@ import type { SalesManDialogRef } from '../bindSalesManDialog' import BindSalesManDialog from '../bindSalesManDialog' import LabAndImgShow from '../LabAndImgShow' import LabAndImg from '../LabAndImg' +import OrganizationNameModal from '../organizationNameModal' import styles from './index.module.scss' import ProductItem from './components/productItem' import Popup from '@/components/popup' @@ -258,6 +259,15 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod } }, [list]) + const [showModal, setShowModal] = useState(false) + + const handleClose = () => { + setShowModal(false) + } + const handleShowChange = (val: boolean) => { + setShowModal(val) + } + // 去结算 const { fetchData: FetchData } = GetAdminUserInfoApi() const { fetchData: applyOrderAccessFetchData } = ApplyOrderAccessApi() @@ -268,7 +278,12 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod bindSalesManDialogRef.current?.handleChange(true) // setShowBindSalesman(() => true) onClose?.() - return false + return + } + // TODO 检测是否修改过组织昵称 + if (false) { + setShowModal(true) + return } getSelectId() if (selectIds.current.length == 0) { @@ -308,6 +323,7 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod setSelectStatus(true) }) }, [selectIndex]) + return ( closePopup()}> @@ -378,6 +394,7 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod + ) } diff --git a/src/pages/userEdit/components/ModifyModal/index.tsx b/src/pages/userEdit/components/ModifyModal/index.tsx index 0ac1f2d..80f5312 100644 --- a/src/pages/userEdit/components/ModifyModal/index.tsx +++ b/src/pages/userEdit/components/ModifyModal/index.tsx @@ -7,6 +7,7 @@ import classNames from 'classnames' import styles from './index.module.scss' import Popup from '@/components/popup' import NormalButton from '@/components/normalButton' +import IconFont from '@/components/iconfont/iconfont' interface Params { title?: string @@ -31,7 +32,10 @@ const ModifyModal = (props: Params, ref: Ref) => { flag = true setTipsComp(() => { return - 仅允许驶入类型为数字、英文、中文,禁止输入其他任何字符 + + + 仅允许驶入类型为数字、英文、中文,禁止输入其他任何字符 + }) return flag @@ -43,8 +47,10 @@ const ModifyModal = (props: Params, ref: Ref) => { flag = false setTipsComp(() => { return - 公司名称是辨识您身份的重要依据, - 请谨慎修改。(仅支持修改一次) + + + 公司名称是辨识您身份的重要依据,请谨慎修改。(仅支持修改一次) + }) } @@ -52,8 +58,10 @@ const ModifyModal = (props: Params, ref: Ref) => { flag = true setTipsComp(() => { return - 您修改的次数已达到上限! - 如需修改,请联系业务经理修改。 + + + 您修改的次数已达到上限!如需修改,请联系业务经理修改。 + }) } diff --git a/src/pages/userEdit/index.tsx b/src/pages/userEdit/index.tsx index 6484819..6df2adb 100644 --- a/src/pages/userEdit/index.tsx +++ b/src/pages/userEdit/index.tsx @@ -198,17 +198,7 @@ export default () => { }) } - const [showModal, setShowModal] = useState(false) - - const handleClose = () => { - setShowModal(false) - } - const handleShowChange = (val: boolean) => { - setShowModal(val) - } - const handleClickNickname = () => { - // setShowModal(true) ModifyNicknameEl.current?.setModalShow(true) } const handleClickCompanyName = () => { @@ -278,7 +268,6 @@ export default () => { value={formData?.company_name} save={value => handleTextareaSave(value, 'companyName')} /> - ) } diff --git a/src/styles/common.scss b/src/styles/common.scss index 7859b92..dc03936 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -34,6 +34,8 @@ $opacity-disabled: 0.3; filter: brightness(70%); } +$opacity-active: 0.6 !default; + //省略号 @mixin common_ellipsis($params: 1) { overflow: hidden;