🐳 chore(eslint): 修正所有文件的eslint 错误❌

This commit is contained in:
xuan
2022-11-28 11:06:15 +08:00
parent 99a920975f
commit cc99111b4f
149 changed files with 3270 additions and 3252 deletions
+27 -28
View File
@@ -6,11 +6,10 @@ import styles from './index.module.scss'
import FromList from '@/components/FromList'
import Address from '@/components/address'
import { alert } from '@/common/common'
import { mppurchaseraddress, mppurchaseraddressdelect, mppurchaseraddressget, mppurchaseraddressput } from '@/api/addressList'
import { getFilterData } from '@/common/util'
import { MpPurchaserAddress, MpPurchaserAddressDelete, MpPurchaserAddressGet, MpPurchaserAddressPut } from '@/api/addressList'
import IconFont from '@/components/iconfont/iconfont'
export default () => {
const AddAddress = () => {
const [itemList, setItemList] = useState<any[]>(
[
{
@@ -54,22 +53,6 @@ export default () => {
)
const [ischecked, setIsChecked] = useState(false)
const onChange = (eq) => {
setIsChecked(eq.detail.value)
setFormData(e => ({ ...e, is_default: eq.detail.value, address_detail: itemList[4].value }))
}
const router = useRouter()
useDidShow(() => {
if (router.params.type === 'add') {
setNavigationBarTitle({ title: '新增收货地址' })
}
else {
setFormData(e => ({ ...e, id: router.params.id as any }))
getInfo()
setNavigationBarTitle({ title: '编辑收货地址' })
}
})
const [formData, setFormData] = useState({
name: '',
phone: '',
@@ -81,8 +64,15 @@ export default () => {
id: '',
factory: '',
})
const onChange = (eq) => {
setIsChecked(eq.detail.value)
setFormData(e => ({ ...e, is_default: eq.detail.value, address_detail: itemList[4].value }))
}
const router = useRouter()
// 获取相应id的信息
const { fetchData: infoFetch } = mppurchaseraddressget()
const { fetchData: infoFetch } = MpPurchaserAddressGet()
const [infoObj, setinfoObj] = useState<any>()
const getInfo = async() => {
const res = await infoFetch({
@@ -116,7 +106,7 @@ export default () => {
item.value = res.data.phone
}
if (item.title === '收货地址') {
item.value = res.data.province_name, res.data.city_name, res.data.district_name
item.value = `${res.data.province_name}${res.data.city_name}${res.data.district_name}`
}
if (item.title === '详细地址') {
item.value = res.data.address_detail
@@ -131,13 +121,20 @@ export default () => {
}
}
// `${res.data.province_name} + ${res.data.city_name} + ${res.data.district_name}`
useDidShow(() => {
if (router.params.type === 'add') {
setNavigationBarTitle({ title: '新增收货地址' })
}
else {
setFormData(e => ({ ...e, id: router.params.id as any }))
getInfo()
setNavigationBarTitle({ title: '编辑收货地址' })
}
})
const btnDisabled = useMemo(() => {
let canShow = false
const obj = itemList.filter((item) => {
if (item.require) {
return item.value !== ''
}
return item.require && (item.value !== '')
})
if (obj.length < 4) {
canShow = true
@@ -214,7 +211,7 @@ export default () => {
})
}
// 新增地址
const { fetchData: addAddressFetch } = mppurchaseraddress()
const { fetchData: addAddressFetch } = MpPurchaserAddress()
const handAdd = async() => {
// if (!btnDisabled) return false
const res = await addAddressFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id) })
@@ -233,7 +230,7 @@ export default () => {
}
// 编辑地址
const { fetchData: putFetch } = mppurchaseraddressput()
const { fetchData: putFetch } = MpPurchaserAddressPut()
const handEdit = async() => {
// if (!btnDisabled) return false
const res = await putFetch({ ...formData, purchaser_id: Number(router.params.purchaser_id), id: Number(infoObj?.id) })
@@ -251,7 +248,7 @@ export default () => {
}
}
// 删除地址
const { fetchData: deleteFetch } = mppurchaseraddressdelect()
const { fetchData: deleteFetch } = MpPurchaserAddressDelete()
const handleDelete = async() => {
Taro.showModal(({
title: '提示',
@@ -334,3 +331,5 @@ export default () => {
</>
)
}
export default AddAddress