| | |
| | | import useShareTripRuntime from './hooks/use-share-trip-runtime'; |
| | | import ShareTripView from './components/share-trip-view'; |
| | | import { TripStatus } from '../begin-route/constants/trip-status'; |
| | | import { isWhiteList } from '../../api/home'; |
| | | import { subscribeAfterOrderSuccess } from '../../../utils/subscribe'; |
| | | import { checkOtp } from '../../../utils/tools'; |
| | | import { jumpToHome } from '../../../utils/jump'; |
| | | |
| | | type StatusRule = { |
| | | showPickup: boolean; |
| | |
| | | const [showReminder, setShowReminder] = useState(true); // 是否展示提醒 |
| | | const [tripStatus, setTripStatus] = useState<TripStatus>(TripStatus.PublishRoute); // 当前行程状态 |
| | | const [authReady, setAuthReady] = useState(false); // 登录校验通过后才允许加载分享页 |
| | | const [isRobotaxiWhiteList, setIsRobotaxiWhiteList] = useState(false); // 用户是否命中 Robotaxi 白名单 |
| | | |
| | | useDidShow(() => { |
| | | // 分享页需要先登录,登录成功后小程序会返回当前页并再次触发校验 |
| | | void checkOtp(true).then((otp) => { |
| | | setAuthReady(Boolean(otp)); |
| | | const hasLogin = Boolean(otp); |
| | | setAuthReady(hasLogin); |
| | | if (!hasLogin) { |
| | | setIsRobotaxiWhiteList(false); |
| | | return; |
| | | } |
| | | // 登录成功后校验白名单,控制左上角 home 返回落点 |
| | | void isWhiteList() |
| | | .then((res: boolean) => { |
| | | setIsRobotaxiWhiteList(!res); |
| | | }) |
| | | .catch(() => { |
| | | setIsRobotaxiWhiteList(false); |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | |
| | | }); // 地图浮层视图委托 |
| | | |
| | | const goHome = () => { |
| | | Taro.reLaunch({ url: '/pages/robotaxi/home/index' }); |
| | | if (isRobotaxiWhiteList) { |
| | | Taro.reLaunch({ url: '/pages/robotaxi/home/index' }); |
| | | return; |
| | | } |
| | | // 非白名单用户先回到小鹏汽车首页,页面内容后续再补充 |
| | | jumpToHome(); |
| | | }; // 返回首页 |
| | | |
| | | const handleContactService = () => { |