feat: 分包
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
export default defineAppConfig({
|
||||
pages: [
|
||||
"pages/home/index", //中转页
|
||||
"pages/login/index/index",
|
||||
"pages/login/verification/index",
|
||||
"pages/login/terms/index",
|
||||
"pages/publishBall/index",
|
||||
],
|
||||
subPackages: [
|
||||
{
|
||||
root: 'login_pages',
|
||||
pages: [
|
||||
"login/index/index",
|
||||
"login/verification/index",
|
||||
"login/terms/index",
|
||||
],
|
||||
},
|
||||
{
|
||||
root: 'publish_pages',
|
||||
pages: [
|
||||
"publishBall/index",
|
||||
],
|
||||
},
|
||||
{
|
||||
root: "mod_user",
|
||||
pages: [
|
||||
|
||||
@@ -12,7 +12,8 @@ interface AppProps {
|
||||
}
|
||||
|
||||
class App extends Component<AppProps> {
|
||||
onLaunch() {
|
||||
onLaunch(options) {
|
||||
console.log('launch options: ', options)
|
||||
console.log("小程序启动,初始化逻辑写这里");
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function withAuth<P extends object>(
|
||||
// if (!is_login) {
|
||||
// const currentPage = getCurrentFullPath();
|
||||
// Taro.redirectTo({
|
||||
// url: `/pages/login/index/index${
|
||||
// url: `/login_pages/login/index/index${
|
||||
// currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : ""
|
||||
// }`,
|
||||
// });
|
||||
|
||||
@@ -26,7 +26,7 @@ const GuideBar = (props) => {
|
||||
|
||||
const handlePublish = () => {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/publishBall/index",
|
||||
url: "/publish_pages/publishBall/index",
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
// 跳转到publishBall页面并传递type参数
|
||||
console.log(type, 'type');
|
||||
Taro.navigateTo({
|
||||
url: `/pages/publishBall/index?type=${type}`
|
||||
url: `/publish_pages/publishBall/index?type=${type}`
|
||||
})
|
||||
setIsVisible(false)
|
||||
}
|
||||
@@ -29,11 +29,11 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
|
||||
return (
|
||||
<View className={styles.publishMenu}>
|
||||
|
||||
|
||||
{/* 菜单选项 */}
|
||||
{isVisible && (
|
||||
<View className={styles.menuCard}>
|
||||
<View
|
||||
<View
|
||||
className={styles.menuItem}
|
||||
onClick={() => handleMenuItemClick('individual')}
|
||||
>
|
||||
@@ -48,8 +48,8 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
<Image src={images.ICON_ARROW_RIGHT} className={styles.img} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View
|
||||
|
||||
<View
|
||||
className={styles.menuItem}
|
||||
onClick={() => handleMenuItemClick('group')}
|
||||
>
|
||||
@@ -66,9 +66,9 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
|
||||
{/* 绿色圆形按钮 */}
|
||||
<View
|
||||
<View
|
||||
className={`${styles.greenButton} ${isVisible ? styles.rotated : ''}`}
|
||||
onClick={handleIconClick}
|
||||
>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { View, Text, Button, Image } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { wechat_auth_login, save_login_state, check_login_status } from '../../../services/loginService';
|
||||
import { wechat_auth_login, save_login_state, check_login_status } from '@/services/loginService';
|
||||
import './index.scss';
|
||||
|
||||
const LoginPage: React.FC = () => {
|
||||
@@ -82,7 +82,7 @@ const LoginPage: React.FC = () => {
|
||||
|
||||
// 跳转到验证码页面
|
||||
Taro.navigateTo({
|
||||
url: `/pages/login/verification/index?redirect=${redirect}`
|
||||
url: `/login_pages/login/verification/index?redirect=${redirect}`
|
||||
});
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const LoginPage: React.FC = () => {
|
||||
// 查看协议
|
||||
const handle_view_terms = (type: string = 'terms') => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/login/terms/index?type=${type}`
|
||||
url: `/login_pages/login/terms/index?type=${type}`
|
||||
});
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
send_sms_code,
|
||||
save_login_state,
|
||||
updateUserPhone,
|
||||
} from "../../../services/loginService";
|
||||
} from "@/services/loginService";
|
||||
import "./index.scss";
|
||||
|
||||
const VerificationPage: React.FC = () => {
|
||||
@@ -239,7 +239,7 @@ const EditProfilePage: React.FC = () => {
|
||||
clear_login_state();
|
||||
|
||||
Taro.reLaunch({
|
||||
url: '/pages/login/index/index'
|
||||
url: '/login_pages/login/index/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { View, } from '@tarojs/components';
|
||||
import { check_login_status } from '../../services/loginService';
|
||||
import { check_login_status } from '@/services/loginService';
|
||||
import { useUserActions } from '@/store/userStore';
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
@@ -20,10 +20,10 @@ const HomePage: React.FC = () => {
|
||||
} catch (error) {
|
||||
console.error('获取用户信息失败:', error);
|
||||
// 如果获取用户信息失败,跳转到登录页
|
||||
Taro.redirectTo({ url: '/pages/login/index/index' });
|
||||
Taro.redirectTo({ url: '/login_pages/login/index/index' });
|
||||
}
|
||||
} else {
|
||||
Taro.redirectTo({ url: '/pages/login/index/index' });
|
||||
Taro.redirectTo({ url: '/login_pages/login/index/index' });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { CommonPopup } from '../../../../components'
|
||||
import { CommonPopup } from '@/components'
|
||||
import styles from './PopupGameplay.module.scss'
|
||||
|
||||
interface PopupGameplayProps {
|
||||
@@ -13,28 +13,28 @@ interface PopupGameplayProps {
|
||||
|
||||
export default function PopupGameplay({ visible, onClose, onConfirm, value = '不限', options = [] }: PopupGameplayProps) {
|
||||
const [selectedOption, setSelectedOption] = useState(value)
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (visible && value) {
|
||||
setSelectedOption(value)
|
||||
}
|
||||
}, [visible, value])
|
||||
|
||||
|
||||
const handleOptionSelect = (option: string) => {
|
||||
setSelectedOption(option)
|
||||
}
|
||||
|
||||
|
||||
const handleClose = () => {
|
||||
onClose()
|
||||
}
|
||||
|
||||
|
||||
const handleConfirm = () => {
|
||||
onConfirm(selectedOption)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<CommonPopup
|
||||
<CommonPopup
|
||||
visible={visible}
|
||||
onClose={handleClose}
|
||||
showHeader={false}
|
||||
@@ -44,7 +44,7 @@ export default function PopupGameplay({ visible, onClose, onConfirm, value = '
|
||||
>
|
||||
<View className={styles.optionsList}>
|
||||
{options.map((option) => (
|
||||
<View
|
||||
<View
|
||||
key={option.value}
|
||||
className={`${styles.optionItem} ${selectedOption === option.value ? styles.selected : ''}`}
|
||||
onClick={() => handleOptionSelect(option.value)}
|
||||
@@ -3,7 +3,7 @@ import { View, Text, Input, ScrollView, Image } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { Loading } from '@nutui/nutui-react-taro'
|
||||
import StadiumDetail, { StadiumDetailRef } from './StadiumDetail'
|
||||
import { CommonPopup } from '../../../../components'
|
||||
import { CommonPopup } from '@/components'
|
||||
import { getLocation } from '@/utils/locationUtils'
|
||||
import PublishService from '@/services/publishService'
|
||||
import images from '@/config/images'
|
||||
@@ -57,7 +57,7 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
@@ -157,8 +157,8 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 如果显示详情页面
|
||||
if (showDetail && selectedStadium) {
|
||||
@@ -194,7 +194,7 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
||||
position="bottom"
|
||||
round
|
||||
>
|
||||
|
||||
|
||||
<View className='select-stadium'>
|
||||
{/* 搜索框 */}
|
||||
<View className='search-section'>
|
||||
@@ -255,20 +255,20 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
||||
<View className='stadium-item-right'>
|
||||
<View className='stadium-name' dangerouslySetInnerHTML={{ __html: markSearchText(stadium.name) }}></View>
|
||||
<View className='stadium-address'>
|
||||
<Text
|
||||
<Text
|
||||
className='stadium-distance'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleItemLocation(stadium)
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleItemLocation(stadium)
|
||||
}}
|
||||
>
|
||||
{calculateDistance(stadium)} ·
|
||||
{calculateDistance(stadium)} ·
|
||||
</Text>
|
||||
<Text
|
||||
<Text
|
||||
className='stadium-address-text'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleItemLocation(stadium)
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleItemLocation(stadium)
|
||||
}}
|
||||
>
|
||||
{stadium.address}
|
||||
@@ -276,7 +276,7 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
||||
<Image src={images.ICON_ARRORW_SMALL} className='stadium-map-icon' />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
</View>
|
||||
))}
|
||||
{searchValue && (
|
||||
@@ -297,10 +297,10 @@ const SelectStadium: React.FC<SelectStadiumProps> = ({
|
||||
)
|
||||
}
|
||||
{/* 场馆列表 */}
|
||||
|
||||
|
||||
</View>
|
||||
</CommonPopup>
|
||||
)
|
||||
}
|
||||
|
||||
export default SelectStadium
|
||||
export default SelectStadium
|
||||
@@ -2,14 +2,14 @@ import React, { useState, useEffect } from "react";
|
||||
import { View, Text, Button, Image } from "@tarojs/components";
|
||||
import { Checkbox } from "@nutui/nutui-react-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { type ActivityType } from "../../components/ActivityTypeSwitch";
|
||||
import CommonDialog from "../../components/CommonDialog";
|
||||
import { type ActivityType } from "@/components/ActivityTypeSwitch";
|
||||
import CommonDialog from "@/components/CommonDialog";
|
||||
import { withAuth } from "@/components";
|
||||
import PublishForm from "./publishForm";
|
||||
import {
|
||||
FormFieldConfig,
|
||||
publishBallFormSchema,
|
||||
} from "../../config/formSchema/publishBallFormSchema";
|
||||
} from "@/config/formSchema/publishBallFormSchema";
|
||||
import { PublishBallFormData } from "../../../types/publishBall";
|
||||
import PublishService from "@/services/publishService";
|
||||
import { getNextHourTime, getEndTime, delay } from "@/utils";
|
||||
@@ -1,13 +1,13 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { ImageUpload, Range, TimeSelector, TextareaTag, NumberInterval, TitleTextarea, FormSwitch, UploadCover } from '../../components'
|
||||
import { ImageUpload, Range, TimeSelector, TextareaTag, NumberInterval, TitleTextarea, FormSwitch, UploadCover } from '@/components'
|
||||
import FormBasicInfo from './components/FormBasicInfo'
|
||||
import { type CoverImage } from '../../components/index.types'
|
||||
import { FormFieldConfig, FieldType } from '../../config/formSchema/publishBallFormSchema'
|
||||
import { type CoverImage } from '@/components/index.types'
|
||||
import { FormFieldConfig, FieldType } from '@/config/formSchema/publishBallFormSchema'
|
||||
import { PublishBallFormData } from '../../../types/publishBall';
|
||||
import WechatSwitch from './components/WechatSwitch/WechatSwitch'
|
||||
import styles from './index.module.scss'
|
||||
import { useDictionaryActions } from '../../store/dictionaryStore'
|
||||
import { useDictionaryActions } from '@/store/dictionaryStore'
|
||||
|
||||
// 组件映射器
|
||||
const componentMap = {
|
||||
@@ -97,15 +97,15 @@ const PublishForm: React.FC<{
|
||||
console.warn('getNTRPText: ntrp 不是有效的数组格式:', ntrp);
|
||||
return '未设置';
|
||||
}
|
||||
|
||||
|
||||
const [min, max] = ntrp;
|
||||
|
||||
|
||||
// 检查 min 和 max 是否为有效数字
|
||||
if (typeof min !== 'number' || typeof max !== 'number') {
|
||||
console.warn('getNTRPText: min 或 max 不是有效数字:', { min, max });
|
||||
return '未设置';
|
||||
}
|
||||
|
||||
|
||||
if (min === 1.0 && max === 5.0) {
|
||||
return '不限'
|
||||
}
|
||||
@@ -124,7 +124,7 @@ const PublishForm: React.FC<{
|
||||
if (min > 1.0 && max < 5.0) {
|
||||
return `${min.toFixed(1)} - ${max.toFixed(1)}之间`
|
||||
}
|
||||
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -134,15 +134,15 @@ const PublishForm: React.FC<{
|
||||
console.warn('getPlayersText: players 不是有效的数组格式:', players);
|
||||
return '未设置';
|
||||
}
|
||||
|
||||
|
||||
const [min, max] = players;
|
||||
|
||||
|
||||
// 检查 min 和 max 是否为有效数字
|
||||
if (typeof min !== 'number' || typeof max !== 'number') {
|
||||
console.warn('getPlayersText: min 或 max 不是有效数字:', { min, max });
|
||||
return '未设置';
|
||||
}
|
||||
|
||||
|
||||
return `最少${min}人,最多${max}人`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user