🌈 style(typos): 修复eslint的报错

This commit is contained in:
xuan 2022-12-05 11:56:40 +08:00
parent d49314aa5b
commit 9dd7e9db18
10 changed files with 87 additions and 83 deletions

View File

@ -1,6 +1,7 @@
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import { Image, Text, View } from '@tarojs/components' import { Image, Text, View } from '@tarojs/components'
import { FC, memo, useEffect, useState } from 'react' import type { FC } from 'react'
import { memo, useEffect, useState } from 'react'
import classnames from 'classnames' import classnames from 'classnames'
import styles from './index.module.scss' import styles from './index.module.scss'
import useUploadCDNImg from '@/use/useUploadImage' import useUploadCDNImg from '@/use/useUploadImage'
@ -12,7 +13,7 @@ interface ImageParam {
defaultList?: string[] defaultList?: string[]
onlyRead?: false | true onlyRead?: false | true
} }
const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = false }) => { const PictureItem = ({ onChange, defaultList, onlyRead = false }: ImageParam) => {
const { getWxPhoto } = useUploadCDNImg() const { getWxPhoto } = useUploadCDNImg()
const [imageList, setImageLise] = useState<string[]>([]) const [imageList, setImageLise] = useState<string[]>([])
@ -24,7 +25,7 @@ const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
const uploadImage = async() => { const uploadImage = async() => {
const list: any = await getWxPhoto('after-sale', 5) const list: any = await getWxPhoto('after-sale', 5)
const images: any[] = [] const images: any[] = []
list?.map((item) => { list?.forEach((item) => {
images.push(item.url) images.push(item.url)
}) })
setImageLise([...imageList, ...images]) setImageLise([...imageList, ...images])
@ -53,7 +54,7 @@ const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
return ( return (
<View className={styles.image_main}> <View className={styles.image_main}>
{imageList?.map((item, index) => ( {imageList?.map((item, index) => (
<View className={styles.ImgItem}> <View className={styles.ImgItem} key={index}>
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image> <Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
{!onlyRead && <View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>} {!onlyRead && <View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>}
</View> </View>
@ -66,6 +67,6 @@ const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
)} )}
</View> </View>
) )
}) }
export default PictureItem export default memo(PictureItem)

View File

@ -8,19 +8,21 @@ import './index.scss'
import { addressAddApi, addressDetailApi, addressEditApi } from '@/api/addressManager' import { addressAddApi, addressDetailApi, addressEditApi } from '@/api/addressManager'
import useLogin from '@/use/useLogin' import useLogin from '@/use/useLogin'
export default () => { const AddressAdd = () => {
useLogin() useLogin()
const [showSiteModal, setShowSiteModal] = useState(false) const [showSiteModal, setShowSiteModal] = useState(false)
const { type, id } = useRouter().params const { type, id } = useRouter().params
useEffect(() => { // 保存
if (type == 'add') { const [formData, setFormData] = useState({
setNavigationBarTitle({ title: '新增收货地址' }) name: '',
} phone: '',
else { site: '',
initalFormData() siteArray: [],
setNavigationBarTitle({ title: '编辑收货地址' }) district_id: '',
} address_detail: '',
}, []) is_default: false,
id: 0,
})
// 获取编辑地址信息 // 获取编辑地址信息
const { fetchData: getFromData } = addressDetailApi() const { fetchData: getFromData } = addressDetailApi()
const initalFormData = async() => { const initalFormData = async() => {
@ -43,17 +45,7 @@ export default () => {
const { fetchData } = addressAddApi() const { fetchData } = addressAddApi()
const { fetchData: editFetch } = addressEditApi() const { fetchData: editFetch } = addressEditApi()
// 保存
const [formData, setFormData] = useState({
name: '',
phone: '',
site: '',
siteArray: [],
district_id: '',
address_detail: '',
is_default: false,
id: 0,
})
const rules = { const rules = {
name: [ name: [
{ {
@ -113,6 +105,15 @@ export default () => {
alert.none(message) alert.none(message)
}) })
} }
useEffect(() => {
if (type == 'add') {
setNavigationBarTitle({ title: '新增收货地址' })
}
else {
initalFormData()
setNavigationBarTitle({ title: '编辑收货地址' })
}
}, [])
// 监听表单完善 // 监听表单完善
const [hozon, setHozon] = useState(false) const [hozon, setHozon] = useState(false)
useEffect(() => { useEffect(() => {
@ -182,3 +183,5 @@ export default () => {
</View> </View>
) )
} }
export default AddressAdd

View File

@ -8,7 +8,7 @@ import type { Params as PopuParams } from '@/components/popup'
type params = { type params = {
onFiltr?: (val: object) => void onFiltr?: (val: object) => void
} & PopuParams } & PopuParams
export default ({ onClose, onFiltr, show = false }: params) => { const Filter = ({ onClose, onFiltr, show = false }: params) => {
const [filterObj, setFilterObj] = useState({ const [filterObj, setFilterObj] = useState({
series: '', series: '',
minWidth: '', minWidth: '',
@ -43,7 +43,7 @@ export default ({ onClose, onFiltr, show = false }: params) => {
const setNumber = (e, field) => { const setNumber = (e, field) => {
console.log(e) console.log(e)
const num = parseFloat(e.detail.value) const num = parseFloat(e.detail.value)
if (isNaN(num)) { if (Number.isNaN(num)) {
filterObj[field] = null filterObj[field] = null
} }
else { else {
@ -156,3 +156,4 @@ export default ({ onClose, onFiltr, show = false }: params) => {
</Popup> </Popup>
) )
} }
export default Filter

View File

@ -15,7 +15,7 @@ import { dataLoadingStatus, getFilterData } from '@/common/util'
import LoadingCard from '@/components/loadingCard' import LoadingCard from '@/components/loadingCard'
import useLogin from '@/use/useLogin' import useLogin from '@/use/useLogin'
export default () => { const ClassList = () => {
useLogin() useLogin()
const [showPopup, setShowPopup] = useState(false) const [showPopup, setShowPopup] = useState(false)
@ -70,6 +70,17 @@ export default () => {
return dataLoadingStatus({ list: categoryList.list, total: categoryList.total, status: state.loading }) return dataLoadingStatus({ list: categoryList.list, total: categoryList.total, status: state.loading })
}, [categoryList, state]) }, [categoryList, state])
// 筛选条件格式化
const [selectList, setSelectList] = useState<ListProps[]>()
const formatSelectList = (val = { data: {}, field: {} }) => {
const data: ListProps[] = []
for (const key in val.data) {
if (key !== 'seriesId' && val.data[key] != '') {
data.push({ title: val.field[key], value: val.data[key] })
}
}
setSelectList([...data])
}
// 获取筛选条件 // 获取筛选条件
const getFiltr = (e) => { const getFiltr = (e) => {
pageNum.current.page = 1 pageNum.current.page = 1
@ -85,19 +96,6 @@ export default () => {
}) })
formatSelectList(e) formatSelectList(e)
} }
// 筛选条件格式化
const [selectList, setSelectList] = useState<ListProps[]>()
const formatSelectList = (val = { data: {}, field: {} }) => {
const data: ListProps[] = []
for (const key in val.data) {
if (key !== 'seriesId' && val.data[key] != '') {
data.push({ title: val.field[key], value: val.data[key] })
}
}
setSelectList([...data])
}
// 输入了搜索关键字 // 输入了搜索关键字
const getSearchData = useCallback((e) => { const getSearchData = useCallback((e) => {
pageNum.current.page = 1 pageNum.current.page = 1
@ -148,3 +146,4 @@ export default () => {
</View> </View>
) )
} }
export default ClassList

View File

@ -1,4 +1,3 @@
import { Text, View } from '@tarojs/components'
import Taro, { useDidHide, useDidShow } from '@tarojs/taro' import Taro, { useDidHide, useDidShow } from '@tarojs/taro'
import classnames from 'classnames' import classnames from 'classnames'
import { useCallback, useEffect, useRef, useState } from 'react' import { useCallback, useEffect, useRef, useState } from 'react'
@ -11,6 +10,7 @@ import { getFilterData } from '@/common/util'
import { alert, goLink } from '@/common/common' import { alert, goLink } from '@/common/common'
import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from '@/api/favorite' import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from '@/api/favorite'
import useLogin from '@/use/useLogin' import useLogin from '@/use/useLogin'
import { View, Text } from '@tarojs/components'
export default () => { export default () => {
useLogin() useLogin()

View File

@ -113,10 +113,10 @@ export default () => {
}) })
} }
// product 产品相关,图片、纹理图等 全平台 // product 产品相关,图片、纹理图等 全平台
// after-sale 售后(申请退货、退款)相关的、图片、视频 全平台 // after-sale 售后(申请退货、退款)相关的、图片、视频 全平台
// mall 电子商城相关的 全平台 // mall 电子商城相关的 全平台
// logistics 物流(发货、提货)相关的、图片、视频 全平台 // logistics 物流(发货、提货)相关的、图片、视频 全平台
type cdn_upload_type_Param = 'product' | 'after-sale' | 'mall' | 'logistics' type cdn_upload_type_Param = 'product' | 'after-sale' | 'mall' | 'logistics'
/** /**
* *