diff --git a/.gitignore b/.gitignore index b7dd2d1..fdc3298 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ deploy_versions/ node_modules/ .DS_Store .swc +src/config/env.ts diff --git a/src/app.config.ts b/src/app.config.ts index b58ead8..8f41f6d 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -1,6 +1,8 @@ export default defineAppConfig({ pages: [ + 'pages/home/index', //中转页 + 'pages/login/index/index', 'pages/login/verification/index', 'pages/login/terms/index', @@ -12,15 +14,25 @@ export default defineAppConfig({ 'pages/detail/index', 'pages/message/index', 'pages/orderCheck/index', - - 'pages/userInfo/myself/index', // 个人中心 - 'pages/userInfo/edit/index', // 个人中心 - 'pages/userInfo/favorites/index', // 个人中心 - 'pages/userInfo/orders/index', // 个人中心 + + // 'pages/mapDisplay/index', ], - + subPackages: [ + { + root: "mod_user", + pages: [ + 'pages/myself/index', // 个人中心 + 'pages/edit/index', // 个人中心 + 'pages/favorites/index', // 个人中心 + 'pages/orders/index', // 个人中心 + + ] + + } + ], + window: { backgroundTextStyle: 'light', navigationBarBackgroundColor: '#fff', diff --git a/src/components/Auth/index.tsx b/src/components/Auth/index.tsx index 137e358..2ec4f42 100644 --- a/src/components/Auth/index.tsx +++ b/src/components/Auth/index.tsx @@ -32,17 +32,17 @@ export default function withAuth

(WrappedComponent: React.Compo if (!is_login) { const currentPage = getCurrentFullPath() - Taro.redirectTo({ - url: `/pages/login/index/index${ - currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : '' - }`, - }) + // Taro.redirectTo({ + // url: `/pages/login/index/index${ + // currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : '' + // }`, + // }) } }, []) - if (!authed) { - return // 空壳,避免 children 渲染出错 - } + // if (!authed) { + // return // 空壳,避免 children 渲染出错 + // } return } diff --git a/src/components/CalendarCard/CalendarCard.tsx b/src/components/CalendarCard/CalendarCard.tsx deleted file mode 100644 index eb1e23c..0000000 --- a/src/components/CalendarCard/CalendarCard.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import React, { useMemo, useState } from 'react' -import { View, Text, Image } from '@tarojs/components' -import styles from './index.module.scss' -import images from '@/config/images' -interface CalendarCardProps { - value?: Date - minDate?: Date - maxDate?: Date - onChange?: (date: Date) => void - onNext?: (date: Date) => void - onHeaderClick?: (date: Date) => void -} - -const startOfMonth = (date: Date) => new Date(date.getFullYear(), date.getMonth(), 1) -const endOfMonth = (date: Date) => new Date(date.getFullYear(), date.getMonth() + 1, 0) -const addMonths = (date: Date, delta: number) => new Date(date.getFullYear(), date.getMonth() + delta, 1) - -const formatHeader = (date: Date) => `${date.getMonth() + 1}月 ${date.getFullYear()}` - -const CalendarCard: React.FC = ({ - value, - minDate, - maxDate, - onChange, - onHeaderClick -}) => { - const today = new Date() - const [current, setCurrent] = useState(value || startOfMonth(today)) - const [selected, setSelected] = useState(value || today) - - - const firstDay = useMemo(() => startOfMonth(current), [current]) - const lastDay = useMemo(() => endOfMonth(current), [current]) - - const days = useMemo(() => { - const startWeekday = firstDay.getDay() // 0 周日 - const prevPadding = startWeekday // 周日为第一列 - const total = prevPadding + lastDay.getDate() - const rows = Math.ceil(total / 7) - const grid: (Date | null)[] = [] - for (let i = 0; i < rows * 7; i++) { - const day = i - prevPadding + 1 - if (day < 1 || day > lastDay.getDate()) { - grid.push(null) - } else { - grid.push(new Date(current.getFullYear(), current.getMonth(), day)) - } - } - return grid - }, [firstDay, lastDay, current]) - - const isDisabled = (d: Date) => { - if (minDate && d < minDate) return true - if (maxDate && d > maxDate) return true - return false - } - - const gotoMonth = (delta: number) => setCurrent(prev => addMonths(prev, delta)) - - const handleHeaderClick = () => { - onHeaderClick && onHeaderClick(current) - } - - const handleSelectDay = (d: Date | null) => { - if (!d || isDisabled(d)) return - setSelected(d) - onChange && onChange(d) - } - - - - - - - - return ( - - - - {formatHeader(current)} - gotoMonth(1)} /> - - - gotoMonth(-1)} /> - gotoMonth(1)} /> - - - - - {['周日','周一','周二','周三','周四','周五','周六'].map((w) => ( - {w} - ))} - - - - {days.map((d, idx) => { - const isSelected = !!(d && selected && d.toDateString() === new Date(selected.getFullYear(), selected.getMonth(), selected.getDate()).toDateString()) - return ( - handleSelectDay(d)} - > - {d ? {d.getDate()} : null} - - ) - })} - - - - - - - ) -} - -export default CalendarCard diff --git a/src/components/CalendarCard/DialogCalendarCard.tsx b/src/components/CalendarCard/DialogCalendarCard.tsx deleted file mode 100644 index 92bfec4..0000000 --- a/src/components/CalendarCard/DialogCalendarCard.tsx +++ /dev/null @@ -1,130 +0,0 @@ -import React, { useState, useEffect } from 'react' -import CommonPopup from '@/components/CommonPopup' -import CalendarCard from './CalendarCard' -import DateTimePicker from '@/components/DateTimePicker' -import HourMinutePicker from '@/components/HourMinutePicker' -export interface DialogCalendarCardProps { - value?: Date - minDate?: Date - maxDate?: Date - onChange?: (date: Date) => void - onNext?: (date: Date) => void - visible: boolean - onClose: () => void - title?: React.ReactNode -} - -const DialogCalendarCard: React.FC = ({ - visible, - onClose, - title, - value, - minDate, - maxDate, - onChange, - onNext -}) => { - const [selected, setSelected] = useState(value || new Date()) - const [type, setType] = useState<'year' | 'month' | 'time'>('year'); - const [selectedHour, setSelectedHour] = useState(8) - const [selectedMinute, setSelectedMinute] = useState(0) - - const handleConfirm = () => { - if (type === 'year') { - // 年份选择完成后,进入月份选择 - setType('time') - } else if (type === 'month') { - // 月份选择完成后,进入时间选择 - setType('year') - } else if (type === 'time') { - // 时间选择完成后,调用onNext回调 - const finalDate = new Date(selected.getFullYear(), selected.getMonth(), selected.getDate(), selectedHour, selectedMinute) - console.log('finalDate', finalDate) - if (onChange) onChange(finalDate) - onClose() - } - } - - const handleChange = (d: Date) => { - console.log('handleChange', d) - setSelected(d) - // if (onChange) onChange(d) - } - const onHeaderClick = (date: Date) => { - console.log('onHeaderClick', date) - setSelected(date) - setType('month') - } - const getConfirmText = () => { - if (type === 'time' || type === 'month') return '完成' - return '下一步' - } - const handleDateTimePickerChange = (year: number, month: number) => { - console.log('year', year) - console.log('month', month) - setSelected(new Date(year, month - 1, 1)) - } - const dialogClose = () => { - if (type === 'month') { - setType('year') - } else if (type === 'time') { - setType('year') - } else { - onClose() - } - } - useEffect(() => { - setSelected(value || new Date()) - if (visible) { - setType('year') - setSelectedHour(8) - setSelectedMinute(0) - } - }, [value, visible]) - - - return ( - - { - type === 'year' && - } - { - type === 'month' && - } - { - type === 'time' && { - setSelectedHour(hour) - setSelectedMinute(minute) - }} - defaultHour={selectedHour} - defaultMinute={selectedMinute} - /> - } - - ) -} - -export default DialogCalendarCard diff --git a/src/components/CalendarCard/index.ts b/src/components/CalendarCard/index.ts deleted file mode 100644 index 15ceb7e..0000000 --- a/src/components/CalendarCard/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './CalendarCard' -export { default as DialogCalendarCard } from './DialogCalendarCard' diff --git a/src/components/CommonPopup/index.module.scss b/src/components/CommonPopup/index.module.scss index 1fb1e10..7210f10 100644 --- a/src/components/CommonPopup/index.module.scss +++ b/src/components/CommonPopup/index.module.scss @@ -75,7 +75,7 @@ height: 44px; border: 0.5px solid rgba(0, 0, 0, 0.06); background: #000; - border-radius: 12px; + border-radius: 12px!important; padding: 4px 10px; } } \ No newline at end of file diff --git a/src/components/DateTimePicker/DateTimePicker.tsx b/src/components/DateTimePicker/DateTimePicker.tsx deleted file mode 100644 index c5714e9..0000000 --- a/src/components/DateTimePicker/DateTimePicker.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import React, { useState, useEffect } from 'react' -import { View, Text, PickerView, PickerViewColumn } from '@tarojs/components' -import styles from './index.module.scss' - - - -export interface DateTimePickerProps { - onChange: (year: number, month: number) => void - defaultYear?: number - defaultMonth?: number - minYear?: number - maxYear?: number -} - -const DateTimePicker: React.FC = ({ - - onChange, - defaultYear = new Date().getFullYear(), - defaultMonth = new Date().getMonth() + 1, - minYear = 2020, - maxYear = 2030 -}) => { - console.log('defaultYear', defaultYear) - console.log('defaultMonth', defaultMonth) - const [selectedYear, setSelectedYear] = useState(defaultYear) - const [selectedMonth, setSelectedMonth] = useState(defaultMonth) - - // 计算当前选项在数组中的索引 - const getYearIndex = (year: number) => year - minYear - const getMonthIndex = (month: number) => month - 1 - - // 生成多列选择器的选项数据 - const pickerOptions = [ - // 年份列 - Array.from({ length: maxYear - minYear + 1 }, (_, index) => ({ - text: `${minYear + index}年`, - value: minYear + index - })), - // 月份列 - Array.from({ length: 12 }, (_, index) => ({ - text: `${index + 1}月`, - value: index + 1 - })) - ] - - - - useEffect(() => { - setSelectedYear(defaultYear) - setSelectedMonth(defaultMonth) - }, [ defaultYear, defaultMonth]) - - const handlePickerChange = (event: any) => { - const values = event.detail.value - if (values && values.length >= 2) { - // 根据索引获取实际值 - const yearIndex = values[0] - const monthIndex = values[1] - const year = minYear + yearIndex - const month = monthIndex + 1 - setSelectedYear(year) - setSelectedMonth(month) - onChange(year, month) - } - } - - return ( - - e.stopPropagation()}> - {/* 拖拽手柄 */} - - - {/* 时间选择器 */} - - {/* 多列选择器 */} - - - - {pickerOptions[0].map((option, index) => ( - - {option.text} - - ))} - - - {pickerOptions[1].map((option, index) => ( - - {option.text} - - ))} - - - - - - - ) -} - -export default DateTimePicker diff --git a/src/components/DateTimePicker/index.module.scss b/src/components/DateTimePicker/index.module.scss deleted file mode 100644 index 67c6587..0000000 --- a/src/components/DateTimePicker/index.module.scss +++ /dev/null @@ -1,89 +0,0 @@ -/* 日期选择器弹出层样式 */ -.date-time-picker-popup { - .common-popup-content { - padding: 0; - } -} - -.popup-handle { - width: 32px; - height: 4px; - background: #e0e0e0; - border-radius: 2px; - margin: 12px auto; -} - -.picker-container { - padding: 26px 16px 0 16px; - background: #fff; -} - -.picker-header { - text-align: center; - margin-bottom: 20px; -} - -.picker-title { - font-size: 18px; - font-weight: 500; - color: #333; -} - -.picker-wrapper { - position: relative; -} - -.multi-column-picker { - width: 100%; - height: 216px; - background: #fff; - border-radius: 8px; - overflow: hidden; - box-shadow: none; - /* 自定义选择器样式 */ - ::-webkit-scrollbar { - width: 0; - background: transparent; - } - - /* 选中项指示器 */ - &::before { - content: ''; - position: absolute; - top: 50%; - left: 0; - right: 0; - height: 48px; - background: rgba(22, 24, 35, 0.05); - transform: translateY(-50%); - pointer-events: none; - z-index: 1; - border-radius: 4px; - } -} - -.picker-item { - display: flex; - align-items: center; - justify-content: center; - font-size: 20px; - color: #161823; - transition: all 0.3s ease; - &.picker-item-active { - color: rgba(22, 24, 35, 0.05); - font-weight: 600; - transform: scale(1.05); - } -} - -.picker-column { - border: none; - outline: none; -} - -.picker-item-text { - font-size: 16px; - color: inherit; - text-align: center; -} - diff --git a/src/components/DateTimePicker/index.ts b/src/components/DateTimePicker/index.ts deleted file mode 100644 index 4817df4..0000000 --- a/src/components/DateTimePicker/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import DateTimePicker from './DateTimePicker' -export default DateTimePicker diff --git a/src/components/EditModal/EditModal.scss b/src/components/EditModal/EditModal.scss index aae757b..a5f11fd 100644 --- a/src/components/EditModal/EditModal.scss +++ b/src/components/EditModal/EditModal.scss @@ -82,10 +82,11 @@ // 内容区域 .modal_content { - padding: 0px 16px 20px; + padding: 16px 20px; display: flex; flex-direction: column; gap: 20px; + box-sizing: border-box; .input_container { display: flex; @@ -96,7 +97,13 @@ border-radius: 12px; padding: 10px 16px; box-shadow: 0px 4px 36px 0px rgba(0, 0, 0, 0.06); - min-height: 120px; + + + // 名字输入时的容器样式 + &:has(.nickname_input) { + min-height: 40px; + padding: 10px 16px; + } .text_input { flex: 1; @@ -109,11 +116,21 @@ background: transparent; outline: none; resize: none; - min-height: 80px; + + min-height: 120px; &::placeholder { color: rgba(60, 60, 67, 0.3); } + + // 名字输入特殊样式 + &.nickname_input { + min-height: 80px; + min-height: 20px; + height: 20px; + line-height: 20px; + padding: 0; + } } .char_count { diff --git a/src/components/EditModal/index.tsx b/src/components/EditModal/index.tsx index 0f97ce9..3fb59b6 100644 --- a/src/components/EditModal/index.tsx +++ b/src/components/EditModal/index.tsx @@ -1,11 +1,12 @@ import React, { useState, useEffect } from 'react'; -import { View, Text, Textarea, Button } from '@tarojs/components'; +import { View, Text, Textarea, Input, Picker } from '@tarojs/components'; import Taro from '@tarojs/taro'; import './EditModal.scss'; interface EditModalProps { visible: boolean; title: string; + type: string; placeholder: string; initialValue: string; maxLength: number; @@ -17,6 +18,7 @@ interface EditModalProps { const EditModal: React.FC = ({ visible, title, + type, placeholder, initialValue, maxLength, @@ -82,17 +84,34 @@ const EditModal: React.FC = ({ {/* 文本输入区域 */} -