|
|
|
@ -1,17 +1,21 @@ |
|
|
|
|
import {View} from "@tarojs/components"; |
|
|
|
|
import {Image, View} from "@tarojs/components"; |
|
|
|
|
import {HomeApi} from "@/api"; |
|
|
|
|
import {useEffect, useState} from "react"; |
|
|
|
|
import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; |
|
|
|
|
import Empty from "@/components/empty/empty"; |
|
|
|
|
import Taro from "@tarojs/taro"; |
|
|
|
|
|
|
|
|
|
const Profession = () => { |
|
|
|
|
const [tabs, setTabs] = useState<TabList[]>([]) |
|
|
|
|
const [page, setPage] = useState(1) |
|
|
|
|
const [categoryId, setCategoryId] = useState<number | null>(null) |
|
|
|
|
const [data, setData] = useState([]) |
|
|
|
|
const [data, setData] = useState<Kill[]>([]) |
|
|
|
|
const [total, setTotal] = useState(0) |
|
|
|
|
|
|
|
|
|
async function getData(categoryId: number) { |
|
|
|
|
const res = await HomeApi.skillList(categoryId, page, 10) |
|
|
|
|
setTotal(res.total) |
|
|
|
|
setData(res.data) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
@ -30,6 +34,10 @@ const Profession = () => { |
|
|
|
|
setCategoryId(tab.tab?.value as number) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function jump(url: string) { |
|
|
|
|
Taro.navigateTo({url: '/pages/preview/videoFull/videoFull?url=' + url}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
getCategory().then() |
|
|
|
|
}, []) |
|
|
|
@ -42,7 +50,10 @@ const Profession = () => { |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
data.length > 0 |
|
|
|
|
? data.map(d => <View>{JSON.stringify(d)}</View>) |
|
|
|
|
? data.map(d => <View className='flex bg-white mt-2' onClick={() => jump(d.resource.url)}> |
|
|
|
|
<Image src={d.url_path} style={{width: '200px', height: '100px', marginRight: '10px'}}/> |
|
|
|
|
<View className='text-ellipsis'>{d.resource.name}</View> |
|
|
|
|
</View>) |
|
|
|
|
: <Empty name='暂无数据'/> |
|
|
|
|
} |
|
|
|
|
</> |
|
|
|
|