|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import {Image, ScrollView, Swiper, SwiperItem, View} from "@tarojs/components"; |
|
|
|
|
import {ScrollView, Swiper, SwiperItem, View} from "@tarojs/components"; |
|
|
|
|
import {HomeApi} from "@/api"; |
|
|
|
|
import {useEffect, useState} from "react"; |
|
|
|
|
import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; |
|
|
|
@ -6,6 +6,7 @@ import Empty from "@/components/empty/empty"; |
|
|
|
|
import Taro from "@tarojs/taro"; |
|
|
|
|
import styles from './profession.module.scss' |
|
|
|
|
import Spin from "@/components/spinner"; |
|
|
|
|
import Img from "@/components/image/image"; |
|
|
|
|
|
|
|
|
|
interface KillData { |
|
|
|
|
data: Kill[] |
|
|
|
@ -18,7 +19,6 @@ const Profession = () => { |
|
|
|
|
const [categoryId, setCategoryId] = useState<number | null>(null) |
|
|
|
|
const [data, setData] = useState<Map<number, KillData>>(new Map) |
|
|
|
|
const [enable, setEnable] = useState(true) |
|
|
|
|
const [loading, setLoading] = useState(false) |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* more 开启加载更多 |
|
|
|
@ -35,7 +35,6 @@ const Profession = () => { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
setLoading(true) |
|
|
|
|
const res = await HomeApi.skillList(categoryId!, page, 10) |
|
|
|
|
const dataList = res.data.reduce((pre, cur) => { |
|
|
|
|
const index = pre.findIndex(d => d.id === cur.id) |
|
|
|
@ -55,7 +54,6 @@ const Profession = () => { |
|
|
|
|
setData(oldData) |
|
|
|
|
} catch (e) { |
|
|
|
|
} |
|
|
|
|
setLoading(false) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
@ -101,12 +99,11 @@ const Profession = () => { |
|
|
|
|
{ |
|
|
|
|
data.data.map(d => |
|
|
|
|
<View className={styles.killBox} onClick={() => jump(d)}> |
|
|
|
|
<Image src={d.url_path} mode='widthFix'/> |
|
|
|
|
<Img width={320} height={180} src={d.url_path} mode='widthFix' className={styles.image}/> |
|
|
|
|
<View className='text-ellipsis flex-1'>{d?.resource?.name}</View> |
|
|
|
|
</View> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
<Spin enable={loading}/> |
|
|
|
|
</ScrollView> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|