Commit f88fc16d authored by cellee's avatar cellee

修复权限无下级情况, 小区公告图片

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent d84c7021
......@@ -40,8 +40,6 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
},
} = this.props;
console.log(currentUser);
const menuHeaderDropdown = (
<Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
<Menu.Item key="logout">
......
......@@ -16,7 +16,7 @@ function getBase64(file: File) {
import { getUrlPicName } from '../../utils/string';
const PictureOptionsRow = (props: any) => {
const { value, onChange, limitNums } = props;
const { value, onChange, limitNums, imgs } = props;
const [fileList, setFileList] = useState([] as any);
const [previewVisible, setPreviewVisible] = useState(false);
const [previewImage, setPreviewImage] = useState('');
......@@ -54,6 +54,12 @@ const PictureOptionsRow = (props: any) => {
}
}, [value]);
useEffect(() => {
if (imgs != null) {
setFileList(imgs);
}
}, [imgs]);
// 加载logo
const uploadButton = (
<div>
......
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-11-26 16:33:11
* @LastEditTime: 2021-01-04 13:53:50
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\CommunityManagement\CommunityAnnouncement.ts
......@@ -32,7 +32,6 @@ export default {
return { ...state, Result };
},
returnDataSave(state, { playload }) {
console.log(playload);
let DataSave = playload.DataSave;
return { ...state, DataSave };
},
......@@ -50,7 +49,6 @@ export default {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
console.log(resp);
if (resp.error_code != '0000') {
printf(playload, resp);
......
......@@ -84,21 +84,8 @@ const Account = (props: any) => {
// 已选权限
useEffect(() => {
if (Permission != null) {
// 当前权限
let newPer = eval('(' + Permission.curUserPermission + ')');
// 上级或者下级权限
let newPerTow = eval('(' + Permission.beloginPermission + ')');
let data: any = []; // 当前权限-- 字符串
let dataTow: any = []; // 上级或者下级权限 (可编辑权限)-- 字符串
// 转字符串
for (let i in newPer) {
data[i] = newPer[i] + '';
}
for (let i in newPerTow) {
dataTow[i] = newPerTow[i] + '';
}
let data = Permission.curUserPermission ? Permission.curUserPermission.split(',') : [];
let dataTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
// 深拷贝权限列表
let treeDatas = JSON.parse(JSON.stringify(treeData));
// 如果是三级账户 可编辑的就是 上级权限,否者是登录的账户权限
......@@ -218,12 +205,7 @@ const Account = (props: any) => {
//新旧权限比对
let subPermissionArray = [];
if (values == 2) {
let newPer = eval('(' + Permission.curUserPermission + ')');
let data: any = []; // 当前权限-- 字符串
// 转字符串
for (let i in newPer) {
data[i] = newPer[i] + '';
}
let data = Permission.curUserPermission.split(',');
let Deleted = compare(data, newData); // 当前删除的权限有哪些
subPermissionArray = compares(Deleted); // 当前删除的三级权限有哪些
}
......@@ -268,12 +250,8 @@ const Account = (props: any) => {
// 看看是不是动了三级权限的东西
function compares(afterArr: any) {
// 下级权限
let newPerTow = eval('(' + Permission.beloginPermission + ')');
let dataTow: any = []; // 上级或者下级权限 (可编辑权限)-- 字符串
let dataTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
let del = [];
for (let i in newPerTow) {
dataTow[i] = newPerTow[i] + '';
}
for (let i of afterArr) {
if (dataTow.indexOf(i) !== -1) {
del.push(i);
......@@ -300,7 +278,8 @@ const Account = (props: any) => {
let checkers = (arr: any, target: any) => target.every((v: any) => arr.includes(v));
// 上级或者下级权限
let newPerTow = eval('(' + Permission.beloginPermission + ')');
let newPerTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
// 列表权限
let treeDatas = JSON.parse(JSON.stringify(treeData));
// 列表的二级权限
......@@ -309,8 +288,8 @@ const Account = (props: any) => {
let dataTow: any = [];
for (let i in newPerTow) {
// 如果不是二级就添加进去
if (TowLev.indexOf(newPerTow[i] + '') == -1) {
dataTow.push(newPerTow[i] + '');
if (TowLev.indexOf(newPerTow[i]) == -1) {
dataTow.push(newPerTow[i]);
}
}
// true 就是没有勾选到三级 false 就是勾选到三级了
......
......@@ -79,20 +79,8 @@ const Account = (props: any) => {
// 已选权限
useEffect(() => {
if (Permission != null) {
// 当前权限
let newPer = eval('(' + Permission.curUserPermission + ')');
// 上级或者下级权限
let newPerTow = eval('(' + Permission.beloginPermission + ')');
let data: any = []; // 当前权限-- 字符串
let dataTow: any = []; // 上级或者下级权限 (可编辑权限)-- 字符串
// 转字符串
for (let i in newPer) {
data[i] = newPer[i] + '';
}
for (let i in newPerTow) {
dataTow[i] = newPerTow[i] + '';
}
let data = Permission.curUserPermission ? Permission.curUserPermission.split(',') : [];
let dataTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
// 深拷贝权限列表
let treeDatas = JSON.parse(JSON.stringify(treeData));
......@@ -213,12 +201,7 @@ const Account = (props: any) => {
//新旧权限比对
let subPermissionArray = [];
if (values == 2) {
let newPer = eval('(' + Permission.curUserPermission + ')');
let data: any = []; // 当前权限-- 字符串
// 转字符串
for (let i in newPer) {
data[i] = newPer[i] + '';
}
let data = Permission.curUserPermission ? Permission.curUserPermission.split(',') : '';
let Deleted = compare(data, newData); // 当前删除的权限有哪些
subPermissionArray = compares(Deleted); // 当前删除的三级权限有哪些
}
......@@ -263,12 +246,8 @@ const Account = (props: any) => {
// 看看是不是动了三级权限的东西
function compares(afterArr: any) {
// 下级权限
let newPerTow = eval('(' + Permission.beloginPermission + ')');
let dataTow: any = []; // 上级或者下级权限 (可编辑权限)-- 字符串
let dataTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
let del = [];
for (let i in newPerTow) {
dataTow[i] = newPerTow[i] + '';
}
for (let i of afterArr) {
if (dataTow.indexOf(i) !== -1) {
del.push(i);
......@@ -295,7 +274,8 @@ const Account = (props: any) => {
let checkers = (arr: any, target: any) => target.every((v: any) => arr.includes(v));
// 上级或者下级权限
let newPerTow = eval('(' + Permission.beloginPermission + ')');
let newPerTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
// 列表权限
let treeDatas = JSON.parse(JSON.stringify(treeData));
// 列表的二级权限
......@@ -304,8 +284,8 @@ const Account = (props: any) => {
let dataTow: any = [];
for (let i in newPerTow) {
// 如果不是二级就添加进去
if (TowLev.indexOf(newPerTow[i] + '') == -1) {
dataTow.push(newPerTow[i] + '');
if (TowLev.indexOf(newPerTow[i]) == -1) {
dataTow.push(newPerTow[i]);
}
}
// true 就是没有勾选到三级 false 就是勾选到三级了
......
......@@ -12,7 +12,6 @@ import TextArea from 'antd/lib/input/TextArea';
import SelectCommunity from '@/components/SelectCommunity';
import './ann.less';
import { Notice } from '@/utils/tip';
import { getCookie } from '@/utils/method';
import moment from 'moment';
import { randomString } from '@/utils/string';
......@@ -64,7 +63,7 @@ const Add = (props: any) => {
// 监听图片状态 ImgSrc
useEffect(() => {
if (ImgSrc != null) {
if (ImgSrc) {
let a = ImgSrc.map((item: any) => {
let key = Object.keys(item)[0];
return {
......@@ -74,7 +73,6 @@ const Add = (props: any) => {
url: item[key],
};
});
// 图片列表
setImageSrc(a);
}
......@@ -200,7 +198,7 @@ const Add = (props: any) => {
imageType: 'tosNotice',
}}
limitNums={5}
defaultValue={ImageSrc}
imgs={ImageSrc}
/>
</Form.Item>
<Form.Item
......
......@@ -22,7 +22,7 @@ const Guard = (props: any) => {
return (
<div className={styles.base}>
<TitleGet title={'Version 1.5.6'} />
<TitleGet title={'Version 1.5.7'} />
{/* <p>
token:{page.token}
name:{getCookie('name')}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment