提交 be857981 作者: ZhangLingKun

功能:问题修复

上级 0b148919
import React from 'react'; import React from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import AgreeModalView from '@/components/agreeModal'; import AgreeModalView from '@/components/agreeModal/index';
import ContentView from '@/components/layout/content'; import ContentView from '@/components/layout/content';
import FooterView from '@/components/layout/footer'; import FooterView from '@/components/layout/footer';
import HeaderView from '@/components/layout/header'; import HeaderView from '@/components/layout/header';
......
...@@ -120,6 +120,13 @@ const LoginModalView = ({ ...@@ -120,6 +120,13 @@ const LoginModalView = ({
onCancel?.(); onCancel?.();
// 关闭定时器 // 关闭定时器
if (timer) clearInterval(timer); if (timer) clearInterval(timer);
// 如果需要返回上一页
if (globalData?.loginModalBack) {
// 返回上一页
router.back();
// 复原状态
dispatch(setGlobalData({ loginModalBack: false }));
}
}; };
// 提交数据 // 提交数据
const handleSubmit = async () => { const handleSubmit = async () => {
......
...@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Button, Table } from 'antd'; import { Button, Table } from 'antd';
import { ColumnsType } from 'antd/es/table'; import { ColumnsType } from 'antd/es/table';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useDispatch, useSelector } from 'react-redux';
import { InterDataType, InterListType, PaginationProps } from '@/api/interface'; import { InterDataType, InterListType, PaginationProps } from '@/api/interface';
import { import {
MallOrderListType, MallOrderListType,
...@@ -9,6 +10,9 @@ import { ...@@ -9,6 +10,9 @@ import {
} from '@/api/interface/order'; } from '@/api/interface/order';
import { OrderAPI } from '@/api/modules/order'; import { OrderAPI } from '@/api/modules/order';
import TableItem from '@/components/orderTableItem'; import TableItem from '@/components/orderTableItem';
import { RootState } from '@/store';
import { setGlobalData } from '@/store/module/globalData';
import { SystemState } from '@/store/module/system';
// 列表类型 // 列表类型
type ListType = InterListType<MallOrderListType>; type ListType = InterListType<MallOrderListType>;
...@@ -16,6 +20,10 @@ type ListType = InterListType<MallOrderListType>; ...@@ -16,6 +20,10 @@ type ListType = InterListType<MallOrderListType>;
type StatusType = InterDataType<UavOrderStatusListType>; type StatusType = InterDataType<UavOrderStatusListType>;
const MallOrderListTable: React.FC = () => { const MallOrderListTable: React.FC = () => {
// store
const dispatch = useDispatch();
// system
const system = useSelector((state: RootState) => state.system) as SystemState;
// 路由钩子 // 路由钩子
const router = useRouter(); const router = useRouter();
// 订单状态列表 // 订单状态列表
...@@ -80,9 +88,18 @@ const MallOrderListTable: React.FC = () => { ...@@ -80,9 +88,18 @@ const MallOrderListTable: React.FC = () => {
}; };
// 页面挂载 // 页面挂载
useEffect(() => { useEffect(() => {
getMallOrderStatusList().then(); if (!system?.token) {
getGoodsOrderList().then(); dispatch(
}, []); setGlobalData({
loginModalVisible: true,
loginModalBack: true,
}),
);
} else {
getMallOrderStatusList().then();
getGoodsOrderList().then();
}
}, [system]);
const tableColumns: ColumnsType<ListType[0]> = [ const tableColumns: ColumnsType<ListType[0]> = [
{ {
title: '商品', title: '商品',
......
...@@ -9,6 +9,7 @@ export type GlobalDataState = { ...@@ -9,6 +9,7 @@ export type GlobalDataState = {
loadingSpinnerVisible: boolean; loadingSpinnerVisible: boolean;
loginModalVisible: boolean; loginModalVisible: boolean;
loginModalTitle?: string; loginModalTitle?: string;
loginModalBack: boolean;
qrcodeModalVisible: boolean; qrcodeModalVisible: boolean;
qrcodeModalPath?: string; qrcodeModalPath?: string;
qrcodeModalScene?: string; qrcodeModalScene?: string;
...@@ -25,6 +26,7 @@ export type GlobalDataState = { ...@@ -25,6 +26,7 @@ export type GlobalDataState = {
const initialState: GlobalDataState = { const initialState: GlobalDataState = {
loadingSpinnerVisible: false, loadingSpinnerVisible: false,
loginModalVisible: false, loginModalVisible: false,
loginModalBack: false,
qrcodeModalVisible: false, qrcodeModalVisible: false,
toastModalVisible: false, toastModalVisible: false,
toastModalBack: false, toastModalBack: false,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论