🔧 build(svg): 升级taro-iconfont-svg依赖

This commit is contained in:
xuan 2022-12-27 15:15:32 +08:00
parent 0a794a17e2
commit 979373a2f4
5 changed files with 86 additions and 50 deletions

View File

@ -82,16 +82,16 @@ export const retrieval = (data: any, rules?: Object, message = '请填写完信
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (rules) { if (rules) {
const keys = Reflect.ownKeys(rules) const keys = Reflect.ownKeys(rules)
const result = keys.some((key: any) => { const result = keys.some((key: string) => {
for (const item of (rules as any)[key]) { return (rules as any)[key].some((rule) => {
let _res = false let _res = false
if (item.validator) { if (rule.validator) {
if (item.validator(data[key], item)) { if (rule.validator(data[key], rule)) {
_res = true _res = true
} }
} }
else if (item.regex) { else if (rule.regex) {
if (!item.regex.test(data[key])) { if (!rule.regex.test(data[key])) {
_res = true _res = true
} }
} }
@ -100,9 +100,9 @@ export const retrieval = (data: any, rules?: Object, message = '请填写完信
_res = true _res = true
} }
} }
message = item.message message = rule.message
return _res return _res
} })
}) })
if (result) { if (result) {
reject(message) reject(message)

View File

@ -9,8 +9,8 @@ import { alert } from '@/common/common'
interface Param { interface Param {
onClose?: () => void onClose?: () => void
show: boolean, show: boolean
messageTitle?: string, messageTitle?: string
messagePath?: string messagePath?: string
showCard?: true|false showCard?: true|false
} }
@ -46,7 +46,7 @@ export default (props: Param) => {
className={styles.customer} className={styles.customer}
openType="contact" openType="contact"
sendMessageTitle={props.messageTitle} sendMessageTitle={props.messageTitle}
showMessageCard = {props.showCard} showMessageCard={props.showCard}
sendMessagePath={props.messagePath} sendMessagePath={props.messagePath}
></Button> ></Button>
</View> </View>

View File

@ -14,7 +14,7 @@ import Popup from '@/components/popup'
import MCheckbox from '@/components/checkbox' import MCheckbox from '@/components/checkbox'
import LoadingCard from '@/components/loadingCard' import LoadingCard from '@/components/loadingCard'
import InfiniteScroll from '@/components/infiniteScroll' import InfiniteScroll from '@/components/infiniteScroll'
import { alert, goLink } from '@/common/common' import { alert, goLink, retrieval } from '@/common/common'
import { DelShoppingCartApi, GetShoppingCartApi, UpdateShoppingCartApi } from '@/api/shopCart' import { DelShoppingCartApi, GetShoppingCartApi, UpdateShoppingCartApi } from '@/api/shopCart'
import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/fotmat' import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/fotmat'
import { setParam } from '@/common/system' import { setParam } from '@/common/system'
@ -22,6 +22,9 @@ import { debounce, throttle } from '@/common/util'
import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from '@/api/user' import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from '@/api/user'
import useCommonData from '@/use/useCommonData' import useCommonData from '@/use/useCommonData'
import type { saleModeType } from '@/common/enum' import type { saleModeType } from '@/common/enum'
import { useSelector } from '@/reducers/hooks'
import { companyDetailApi, companyUpdateApi } from '@/api/company'
import useLogin from '@/use/useLogin'
interface param { interface param {
show?: true | false show?: true | false
@ -46,6 +49,8 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod
{ value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.3, maxNum: 100000, defaultNum: 0.3 }, { value: 1, title: '剪板', unit: '米', eunit: 'm', step: 1, digits: 2, minNum: 0.3, maxNum: 100000, defaultNum: 0.3 },
{ value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 3, maxNum: 100000, defaultNum: 3 }, { value: 2, title: '散剪', unit: '米', eunit: 'kg', step: 1, digits: 2, minNum: 3, maxNum: 100000, defaultNum: 3 },
] ]
const userInfo = useSelector(state => state.userInfo)
const bindSalesManDialogRef = useRef<SalesManDialogRef | null>(null) const bindSalesManDialogRef = useRef<SalesManDialogRef | null>(null)
const [isPending, startTransition] = useTransition() const [isPending, startTransition] = useTransition()
@ -276,12 +281,11 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod
if (res.data.order_access_status !== 3) { if (res.data.order_access_status !== 3) {
if (res.data.order_access_status == 1) { applyOrderAccessFetchData() } if (res.data.order_access_status == 1) { applyOrderAccessFetchData() }
bindSalesManDialogRef.current?.handleChange(true) bindSalesManDialogRef.current?.handleChange(true)
// setShowBindSalesman(() => true)
onClose?.() onClose?.()
return return
} }
// TODO 检测是否修改过组织昵称 // 检测是否修改过组织昵称
if (false) { if (userInfo.adminUserInfo.first_change_name) {
setShowModal(true) setShowModal(true)
return return
} }
@ -323,7 +327,31 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod
setSelectStatus(true) setSelectStatus(true)
}) })
}, [selectIndex]) }, [selectIndex])
// 弹出修改组织昵称弹窗
const handleBindSalesManSuccess = () => {
// 检测是否修改过组织昵称
if (userInfo.adminUserInfo.first_change_name) {
setShowModal(true)
}
}
const { getAdminUserInfo } = useLogin()
const { fetchData: saveFetch } = companyUpdateApi()
const { fetchData: getCompanyFetch } = companyDetailApi()
const handleOrganizationNameModalConfirm = async(text: string) => {
const params = await getCompanyFetch()
const result = await saveFetch({
...params.data,
company_name: text,
})
if (result.success) {
getAdminUserInfo()
handleClose()
alert.success('保存成功')
}
else {
alert.none(result.msg)
}
}
return ( return (
<View className={styles.shop_cart_main}> <View className={styles.shop_cart_main}>
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()}> <Popup showTitle={false} show={showPopup} onClose={() => closePopup()}>
@ -389,12 +417,12 @@ const ShopCart = ({ show = false, onClose, intoStatus = 'shop', default_sale_mod
</View> </View>
</Popup> </Popup>
<View> <View>
<BindSalesManDialog ref={bindSalesManDialogRef} /> <BindSalesManDialog ref={bindSalesManDialogRef} onSuccess={handleBindSalesManSuccess} />
</View> </View>
<View> <View>
<LabAndImgShow value={labImageValue} show={showLabImage} onClose={closeLabImgShow} /> <LabAndImgShow value={labImageValue} show={showLabImage} onClose={closeLabImgShow} />
</View> </View>
<OrganizationNameModal showModal={showModal} onClose={handleClose} onShowModalChange={handleShowChange} /> <OrganizationNameModal showModal={showModal} onClose={handleClose} onShowModalChange={handleShowChange} onConfirm={handleOrganizationNameModalConfirm} />
</View> </View>
) )
} }

View File

@ -8,6 +8,7 @@ import styles from './index.module.scss'
import Popup from '@/components/popup' import Popup from '@/components/popup'
import NormalButton from '@/components/normalButton' import NormalButton from '@/components/normalButton'
import IconFont from '@/components/iconfont/iconfont' import IconFont from '@/components/iconfont/iconfont'
import { useSelector } from '@/reducers/hooks'
interface Params { interface Params {
title?: string title?: string
@ -21,6 +22,7 @@ export interface ModifyModalRef {
const ModifyModal = (props: Params, ref: Ref<ModifyModalRef>) => { const ModifyModal = (props: Params, ref: Ref<ModifyModalRef>) => {
const { title = '修改昵称', value: _value = '', isCompanyName = false } = props const { title = '修改昵称', value: _value = '', isCompanyName = false } = props
const [value, setValue] = useState('') const [value, setValue] = useState('')
const userInfo = useSelector(state => state.userInfo)
const [tipsComp, setTipsComp] = useState<React.ReactNode | null>(null) const [tipsComp, setTipsComp] = useState<React.ReactNode | null>(null)
// 不合法状态 // 不合法状态
@ -42,8 +44,8 @@ const ModifyModal = (props: Params, ref: Ref<ModifyModalRef>) => {
} }
// 修改组织名称 // 修改组织名称
if (isCompanyName) { if (isCompanyName) {
// TODO 检测是否没机会修改 // 检测是否没机会修改
if (true) { if (userInfo.adminUserInfo.first_change_name) {
flag = false flag = false
setTipsComp(() => { setTipsComp(() => {
return <View className={styles['warn-tips']}> return <View className={styles['warn-tips']}>
@ -67,7 +69,7 @@ const ModifyModal = (props: Params, ref: Ref<ModifyModalRef>) => {
} }
} }
return flag return flag
}, [value, isCompanyName]) }, [value, isCompanyName, userInfo])
useEffect(() => { useEffect(() => {
setValue(_value) setValue(_value)
@ -101,14 +103,19 @@ const ModifyModal = (props: Params, ref: Ref<ModifyModalRef>) => {
<View className={styles['modify-ickname-tips']}>2-20</View> <View className={styles['modify-ickname-tips']}>2-20</View>
<View className={styles['modify-ickname-operation']}> <View className={styles['modify-ickname-operation']}>
{ {
// TODO 检测是否没机会修改 // 检测是否没机会修改
true isCompanyName
? <> ? userInfo.adminUserInfo.first_change_name
? <>
<NormalButton round type="primary" plain onClick={handleTextareaReset} customClassName={classNames(styles.button, styles['modify-ickname-operation-reset'])}></NormalButton>
<NormalButton round disabled={isInvalidate} onClick={() => props.save(value)} type="primary" customClassName={classNames(styles.button, styles['modify-ickname-operation-save'])}></NormalButton>
</>
: <NormalButton round onClick={() => setModalShow(false)} type="primary" customClassName={classNames(styles.button, styles['modify-ickname-operation-IKnown'])}></NormalButton>
: <>
<NormalButton round type="primary" plain onClick={handleTextareaReset} customClassName={classNames(styles.button, styles['modify-ickname-operation-reset'])}></NormalButton> <NormalButton round type="primary" plain onClick={handleTextareaReset} customClassName={classNames(styles.button, styles['modify-ickname-operation-reset'])}></NormalButton>
<NormalButton round disabled={isInvalidate} onClick={() => props.save(value)} type="primary" customClassName={classNames(styles.button, styles['modify-ickname-operation-save'])}></NormalButton> <NormalButton round disabled={isInvalidate} onClick={() => props.save(value)} type="primary" customClassName={classNames(styles.button, styles['modify-ickname-operation-save'])}></NormalButton>
</> </>
: <NormalButton round onClick={() => setModalShow(false)} type="primary" customClassName={classNames(styles.button, styles['modify-ickname-operation-IKnown'])}></NormalButton>
} }
</View> </View>
</View> </View>

View File

@ -29,32 +29,33 @@ export interface UserParam {
} }
export interface UserAdminParam { export interface UserAdminParam {
avatar_url?: string avatar_url: string
open_id?: string open_id: string
physical_warehouse?: number physical_warehouse: number
physical_warehouse_name?: string physical_warehouse_name: string
union_id?: string union_id: string
user_code?: string user_code: string
user_id?: number user_id: number
user_name?: string user_name: string
wechat_user_open_id?: number wechat_user_open_id: number
is_authorize_name?: false|true is_authorize_name: boolean
is_authorize_phone?: false|true is_authorize_phone: boolean
phone?: string phone: string
authentication_status?: number authentication_status: number
authentication_status_name: string authentication_status_name: string
company_id?: number company_id: number
company_name?: string company_name: string
founder_user_id?: string first_change_name: boolean
founder_user_name?: string founder_user_id: string
order_access_status?: number founder_user_name: string
order_access_status_name?: string order_access_status: number
purchaser_type?: number order_access_status_name: string
purchaser_type_name?: string purchaser_type: number
collection_quantity?: number purchaser_type_name: string
sale_user_phone?: string collection_quantity: number
sale_user_name?: string sale_user_phone: string
sale_user_id?: number|string sale_user_name: string
sale_user_id: number|string
} }
export interface SortCodeParam { export interface SortCodeParam {