5.9 高质量运营优化

This commit is contained in:
jl-zhoujl2
2023-05-09 09:56:52 +08:00
parent c47f65dc36
commit 10bb13b13e
3 changed files with 29 additions and 14 deletions

View File

@ -178,6 +178,7 @@ const Detail: React.FC<DetailLocationProps> = (props) => {
<List
itemLayout="horizontal"
dataSource={commentList}
locale={{ emptyText: "暂无评论" }}
renderItem={(item, index) => (
<List.Item id={`item${index}`}>
<Skeleton loading={item.loading} active avatar title={false}>

View File

@ -6,10 +6,12 @@ import React, { useState } from 'react';
import { useRef } from 'react';
import EventMaintenanceModal from './components/EventMaintenanceModal';
import { changeEventStatus, deleteEvent, getEventList } from './service';
import { managerAuthority } from '../../utils';
import { authCheck, managerAuthority } from '../../utils';
const EventMaintenance: React.FC<{}> = () => {
const actionRef = useRef<ActionType>();
//权限校验
const auth = useRef<boolean>(authCheck(["ebtp-party-admin"]));
//新建 编辑 查看
const [modalVisible, setModalVisible] = useState<boolean>(false);
//行数据
@ -192,23 +194,20 @@ const EventMaintenance: React.FC<{}> = () => {
actionRef={actionRef}
loading={loading}
request={async (params) => {
setLoading(true);
return await getEventList(params).then(res => {
if (res?.success) {
if (auth.current) {
setLoading(true);
return await getEventList(params).then(res => {
return {
data: res?.data.records,
success: res?.success,
total: res?.data.total
};
}
return {
data: [],
success: false,
total: 0,
};
}).finally(() => {
setLoading(false);
})
}).finally(() => {
setLoading(false);
})
} else {
return {};
}
}}
rowKey="id"
options={false}

View File

@ -1,6 +1,7 @@
import { pictureDisplayPath } from "@/utils/DownloadUtils";
import { getSessionUserData } from "@/utils/session";
import moment from "moment";
import { history } from 'umi';
/**
* 图片路径拼接
* @param filePath 图片路径
@ -96,4 +97,18 @@ export const formatCreateTime = (createTime: string) => {
} else {
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;
}