|
@@ -12,9 +12,11 @@ import InifiniteList from "@/compents/InifiniteList";
|
12
|
12
|
import IsLogin from "../../layout/IsLogin";
|
13
|
13
|
|
14
|
14
|
const account = props => {
|
|
15
|
+ const tabRef = useRef()
|
15
|
16
|
const { id } = getQueryValue();
|
16
|
17
|
const [list, setList] = useState([]);
|
17
|
18
|
const [page, setPage] = useState({ total: 0, pageNum: 0 });
|
|
19
|
+ const [listHeight, setListHeight] = useState('600')
|
18
|
20
|
|
19
|
21
|
useDidShow(() => {
|
20
|
22
|
console.log("useDidShow");
|
|
@@ -28,7 +30,8 @@ const account = props => {
|
28
|
30
|
method: "get"
|
29
|
31
|
}).then(res => {
|
30
|
32
|
const { records, ...page } = res.data.data;
|
31
|
|
- setList(list.concat(records || []));
|
|
33
|
+ const newList = records || []
|
|
34
|
+ setList(page.current === 1 ? newList : list.concat(newList))
|
32
|
35
|
setPage({
|
33
|
36
|
...page,
|
34
|
37
|
pageNum: page.current
|
|
@@ -61,6 +64,13 @@ const account = props => {
|
61
|
64
|
getShopKepperList({ pageNum: page.pageNum + 1 });
|
62
|
65
|
};
|
63
|
66
|
|
|
67
|
+ useEffect(() => {
|
|
68
|
+ if (tabRef.current) {
|
|
69
|
+ const h = `calc(100vh - 10px - ${tabRef.current.offsetHeight}px)`
|
|
70
|
+ setListHeight(h)
|
|
71
|
+ }
|
|
72
|
+ }, [tabRef.current])
|
|
73
|
+
|
64
|
74
|
const renderItem = (index, key) => (
|
65
|
75
|
<View className="account-view" key={key}>
|
66
|
76
|
{/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
|
|
@@ -99,7 +109,7 @@ const account = props => {
|
99
|
109
|
<InifiniteList
|
100
|
110
|
length={list.length}
|
101
|
111
|
total={page.total}
|
102
|
|
- height={600}
|
|
112
|
+ height={listHeight}
|
103
|
113
|
itemRenderer={renderItem}
|
104
|
114
|
loadMore={loadMore}
|
105
|
115
|
/>
|
|
@@ -107,6 +117,7 @@ const account = props => {
|
107
|
117
|
</Layout>
|
108
|
118
|
{/* onClick={(e)=>(e) */}
|
109
|
119
|
<Tab
|
|
120
|
+ ref={tabRef}
|
110
|
121
|
value={["+新增民宿老板账号"]}
|
111
|
122
|
color="#ffffff"
|
112
|
123
|
onClick={() => {
|