feat: first commit
This commit is contained in:
3
src/pages/group-list/index.config.ts
Normal file
3
src/pages/group-list/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '合作群列表',
|
||||
});
|
||||
24
src/pages/group-list/index.less
Normal file
24
src/pages/group-list/index.less
Normal file
@ -0,0 +1,24 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.page-group-list {
|
||||
padding: 24px;
|
||||
|
||||
&__group-card {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
font-size: 32px;
|
||||
line-height: 150px;
|
||||
font-weight: 500;
|
||||
color: @blColor;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 40px;
|
||||
margin-top: 24px;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
src/pages/group-list/index.tsx
Normal file
49
src/pages/group-list/index.tsx
Normal file
@ -0,0 +1,49 @@
|
||||
import { useLoad } from '@tarojs/taro';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import PageLoading from '@/components/page-loading';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { SimpleGroupInfo } from '@/types/group';
|
||||
import { requestSimpleGroupList } from '@/utils/group';
|
||||
import { getPageQuery } from '@/utils/route';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'page-group-list';
|
||||
|
||||
export default function GroupList() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [groupList, setGroupList] = useState<SimpleGroupInfo[]>([]);
|
||||
|
||||
useLoad(async () => {
|
||||
try {
|
||||
const query = getPageQuery<{ city: string }>();
|
||||
const { city: cityCode } = query;
|
||||
if (!cityCode) {
|
||||
return;
|
||||
}
|
||||
const groups = await requestSimpleGroupList(cityCode);
|
||||
setLoading(false);
|
||||
setGroupList(groups);
|
||||
} catch (e) {
|
||||
Toast.error('加载失败请重试');
|
||||
}
|
||||
});
|
||||
|
||||
if (loading) {
|
||||
return <PageLoading />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
{groupList.map(group => (
|
||||
<div className={`${PREFIX}__group-card`} key={group.blGroupId}>
|
||||
{group.imGroupNick}
|
||||
</div>
|
||||
))}
|
||||
<SafeBottomPadding />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user