5.9 高质量运营优化
This commit is contained in:
@ -178,6 +178,7 @@ const Detail: React.FC<DetailLocationProps> = (props) => {
|
|||||||
<List
|
<List
|
||||||
itemLayout="horizontal"
|
itemLayout="horizontal"
|
||||||
dataSource={commentList}
|
dataSource={commentList}
|
||||||
|
locale={{ emptyText: "暂无评论" }}
|
||||||
renderItem={(item, index) => (
|
renderItem={(item, index) => (
|
||||||
<List.Item id={`item${index}`}>
|
<List.Item id={`item${index}`}>
|
||||||
<Skeleton loading={item.loading} active avatar title={false}>
|
<Skeleton loading={item.loading} active avatar title={false}>
|
||||||
|
@ -6,10 +6,12 @@ import React, { useState } from 'react';
|
|||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import EventMaintenanceModal from './components/EventMaintenanceModal';
|
import EventMaintenanceModal from './components/EventMaintenanceModal';
|
||||||
import { changeEventStatus, deleteEvent, getEventList } from './service';
|
import { changeEventStatus, deleteEvent, getEventList } from './service';
|
||||||
import { managerAuthority } from '../../utils';
|
import { authCheck, managerAuthority } from '../../utils';
|
||||||
|
|
||||||
const EventMaintenance: React.FC<{}> = () => {
|
const EventMaintenance: React.FC<{}> = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
|
//权限校验
|
||||||
|
const auth = useRef<boolean>(authCheck(["ebtp-party-admin"]));
|
||||||
//新建 编辑 查看
|
//新建 编辑 查看
|
||||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||||
//行数据
|
//行数据
|
||||||
@ -192,23 +194,20 @@ const EventMaintenance: React.FC<{}> = () => {
|
|||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
|
if (auth.current) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
return await getEventList(params).then(res => {
|
return await getEventList(params).then(res => {
|
||||||
if (res?.success) {
|
|
||||||
return {
|
return {
|
||||||
data: res?.data.records,
|
data: res?.data.records,
|
||||||
success: res?.success,
|
success: res?.success,
|
||||||
total: res?.data.total
|
total: res?.data.total
|
||||||
};
|
};
|
||||||
}
|
|
||||||
return {
|
|
||||||
data: [],
|
|
||||||
success: false,
|
|
||||||
total: 0,
|
|
||||||
};
|
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
options={false}
|
options={false}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { pictureDisplayPath } from "@/utils/DownloadUtils";
|
import { pictureDisplayPath } from "@/utils/DownloadUtils";
|
||||||
import { getSessionUserData } from "@/utils/session";
|
import { getSessionUserData } from "@/utils/session";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import { history } from 'umi';
|
||||||
/**
|
/**
|
||||||
* 图片路径拼接
|
* 图片路径拼接
|
||||||
* @param filePath 图片路径
|
* @param filePath 图片路径
|
||||||
@ -97,3 +98,17 @@ export const formatCreateTime = (createTime: string) => {
|
|||||||
return `${Math.floor(diff / (60 * 60 * 24 * 365))}年前`;
|
return `${Math.floor(diff / (60 * 60 * 24 * 365))}年前`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//角色校验
|
||||||
|
export const authCheck = (authority: string[]) => {
|
||||||
|
//获取角色列表
|
||||||
|
const authorityList: any[] | undefined = getSessionUserData()?.authorityList;
|
||||||
|
if (isEmpty(authorityList)) {
|
||||||
|
history.replace({ pathname: "/404" });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (authority.findIndex(item => authorityList?.findIndex(ite => ite.roleCode == item) != -1) == -1) {//角色权限校验
|
||||||
|
history.replace({ pathname: "/401", query: { code: "405" } });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
Reference in New Issue
Block a user