feat: first commit
This commit is contained in:
134
src/hooks/use-config.tsx
Normal file
134
src/hooks/use-config.tsx
Normal file
@ -0,0 +1,134 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
import { omit } from 'lodash-es';
|
||||
|
||||
import { PageType, PageUrl } from '@/constants/app';
|
||||
|
||||
export type TabItemType = Taro.TabBarItem & { type: PageType };
|
||||
|
||||
export type AppConfigType = Taro.AppConfig & { tabBar: Taro.AppConfig['tabBar'] & { list: TabItemType[] } };
|
||||
|
||||
const CommonTabs: TabItemType[] = [
|
||||
{
|
||||
type: PageType.Message,
|
||||
pagePath: PageUrl.Message,
|
||||
text: ' 消息',
|
||||
},
|
||||
{
|
||||
type: PageType.User,
|
||||
pagePath: PageUrl.User,
|
||||
text: ' 我的',
|
||||
},
|
||||
// {
|
||||
// type: PageType.DEV,
|
||||
// pagePath: PageUrl.DevDebug,
|
||||
// text: ' 调试页面',
|
||||
// },
|
||||
];
|
||||
|
||||
const AnchorTabs: TabItemType[] = [
|
||||
{
|
||||
type: PageType.JOB,
|
||||
pagePath: PageUrl.Job,
|
||||
text: '通告',
|
||||
},
|
||||
{
|
||||
type: PageType.GroupV2,
|
||||
pagePath: PageUrl.GroupV2,
|
||||
text: '通告群',
|
||||
},
|
||||
];
|
||||
|
||||
const CompanyTabs: TabItemType[] = [
|
||||
{
|
||||
type: PageType.Anchor,
|
||||
pagePath: PageUrl.Anchor,
|
||||
text: '主播',
|
||||
},
|
||||
{
|
||||
type: PageType.BatchPublish,
|
||||
pagePath: PageUrl.UserBatchPublish,
|
||||
text: '群代发',
|
||||
},
|
||||
];
|
||||
|
||||
export const ANCHOR_TAB_LIST: TabItemType[] = AnchorTabs.concat(CommonTabs);
|
||||
|
||||
export const COMPANY_TAB_LIST: TabItemType[] = CompanyTabs.concat(CommonTabs);
|
||||
|
||||
const ALL_TABS = AnchorTabs.concat(CompanyTabs.concat(CommonTabs));
|
||||
|
||||
export const APP_CONFIG: AppConfigType = {
|
||||
entryPagePath: PageUrl.Start,
|
||||
pages: [
|
||||
PageUrl.Start,
|
||||
PageUrl.Job,
|
||||
PageUrl.JobDetail,
|
||||
PageUrl.JobSearch,
|
||||
PageUrl.JobPublish,
|
||||
// PageUrl.JobPublishAddress,
|
||||
PageUrl.JobPublishDescribe,
|
||||
PageUrl.JobSelectMyPublish,
|
||||
// PageUrl.Group,
|
||||
PageUrl.GroupV2,
|
||||
PageUrl.GroupList,
|
||||
// PageUrl.GroupJob,
|
||||
PageUrl.Anchor,
|
||||
PageUrl.Message,
|
||||
PageUrl.MessageChat,
|
||||
PageUrl.User,
|
||||
PageUrl.UserInfo,
|
||||
PageUrl.UserBatchPublish,
|
||||
PageUrl.CitySearch,
|
||||
PageUrl.MyDeclaration,
|
||||
PageUrl.MyPublish,
|
||||
// PageUrl.FollowGroup,
|
||||
PageUrl.MaterialProfile,
|
||||
PageUrl.MaterialUploadVideo,
|
||||
PageUrl.MaterialCreateProfile,
|
||||
PageUrl.MaterialEditProfile,
|
||||
PageUrl.MaterialView,
|
||||
PageUrl.MaterialWebview,
|
||||
PageUrl.Certification,
|
||||
PageUrl.CertificationStart,
|
||||
PageUrl.CertificationManage,
|
||||
PageUrl.ProtocolWebview,
|
||||
PageUrl.PrivacyWebview,
|
||||
// PageUrl.DevDebug,
|
||||
],
|
||||
window: {
|
||||
backgroundColor: '#F5F6FA',
|
||||
backgroundTextStyle: 'light',
|
||||
navigationBarBackgroundColor: '#F5F6FA',
|
||||
backgroundColorTop: '#F5F6FA',
|
||||
backgroundColorBottom: '#F5F6FA',
|
||||
navigationBarTextStyle: 'black',
|
||||
},
|
||||
permission: {
|
||||
'scope.userLocation': {
|
||||
desc: '获取经纬度',
|
||||
},
|
||||
},
|
||||
requiredPrivateInfos: ['getLocation'],
|
||||
tabBar: {
|
||||
custom: true,
|
||||
color: '#999999',
|
||||
selectedColor: '#333333',
|
||||
backgroundColor: '#fff',
|
||||
position: 'bottom',
|
||||
list: ALL_TABS.map(tab => omit(tab, 'type')),
|
||||
},
|
||||
lazyCodeLoading: 'requiredComponents',
|
||||
plugins: {
|
||||
chooseLocation: {
|
||||
version: '1.1.1',
|
||||
provider: 'wx76a9a06e5b4e693e',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
function useConfig() {
|
||||
return APP_CONFIG;
|
||||
}
|
||||
|
||||
export default useConfig;
|
Reference in New Issue
Block a user