提交 be857981 作者: ZhangLingKun

功能:问题修复

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