材质资源管理权限测试,没有bug。

This commit is contained in:
tengge1 2019-11-19 21:45:50 +08:00
parent 0e74da0c16
commit b41ffb65d0
6 changed files with 25 additions and 10 deletions

View File

@ -18,6 +18,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en
5. 音频资源管理权限测试没有bug。
6. 人物资源管理权限测试没有bug。没完成忽视
7. 贴图资源管理权限测试没有bug。
8. 材质资源管理权限测试没有bug。
## v0.3.7更新

View File

@ -1,9 +1,6 @@
import { classNames, PropTypes, SearchField, ImageList } from '../../third_party';
import EditWindow from './window/EditWindow.jsx';
import ModelLoader from '../../loader/ModelLoader';
import AddObjectCommand from '../../command/AddObjectCommand';
import Ajax from '../../utils/Ajax';
import UploadUtils from '../../utils/UploadUtils';
import MaterialsSerializer from '../../serialization/material/MaterialsSerializer';
/**
@ -31,6 +28,7 @@ class MaterialPanel extends React.Component {
render() {
const { className, style } = this.props;
const { data, categoryData, name, categories } = this.state;
const { enableAuthority, authorities } = app.server;
let list = data;
@ -69,6 +67,8 @@ class MaterialPanel extends React.Component {
/>
<ImageList
data={imageListData}
showEditButton={!enableAuthority || authorities.includes('EDIT_MATERIAL')}
showDeleteButton={!enableAuthority || authorities.includes('DELETE_MATERIAL')}
onClick={this.handleClick}
onEdit={this.handleEdit}
onDelete={this.handleDelete}

View File

@ -207,6 +207,7 @@ class MaterialComponent extends React.Component {
displacementScale, showRoughnessMap, roughnessMap, showMetalnessMap, metalnessMap, showSpecularMap, specularMap, showEnvMap, envMap,
reflectivity, showLightMap, lightMap, showAoMap, aoMap, aoScale, showEmissiveMap, emissiveMap, side, flatShading, blending, opacity, transparent,
alphaTest, wireframe, wireframeLinewidth } = this.state;
const { enableAuthority, authorities } = app.server;
if (!show) {
return null;
@ -218,8 +219,12 @@ class MaterialComponent extends React.Component {
onExpand={this.handleExpand}
>
<ButtonsProperty label={''}>
<Button onClick={this.onSave}>{_t('Save')}</Button>
<Button onClick={this.onLoad}>{_t('Select')}</Button>
<Button show={!enableAuthority || authorities.includes('SAVE_MATERIAL')}
onClick={this.onSave}
>{_t('Save')}</Button>
<Button show={!enableAuthority || authorities.includes('LIST_MATERIAL')}
onClick={this.onLoad}
>{_t('Select')}</Button>
</ButtonsProperty>
<SelectProperty label={_t('Type')}
options={this.materials}
@ -993,6 +998,7 @@ class MaterialComponent extends React.Component {
}, result => {
obj = JSON.parse(result);
if (obj.Code === 200) {
// TODO:
app.call(`showBottomPanel`, this, 'material');
}
app.toast(_t(obj.Msg));

View File

@ -14,10 +14,10 @@ class Button extends React.Component {
}
render() {
const { className, style, children, color, disabled } = this.props;
const { className, style, children, color, disabled, show } = this.props;
return <button
className={classNames('Button', color, disabled && 'disabled', className)}
className={classNames('Button', color, disabled && 'disabled', !show && 'hidden', className)}
style={style}
disabled={disabled}
onClick={this.handleClick}
@ -39,6 +39,7 @@ Button.propTypes = {
children: PropTypes.node,
color: PropTypes.oneOf(['primary', 'success', 'warn', 'danger']),
disabled: PropTypes.bool,
show: PropTypes.bool,
onClick: PropTypes.func
};
@ -49,6 +50,7 @@ Button.defaultProps = {
children: null,
color: null,
disabled: false,
show: true,
onClick: null
};

View File

@ -29,4 +29,8 @@
.Button.disabled {
color: #fff;
background-color: #ebebeb;
}
.Button.hidden {
display: none;
}

View File

@ -14,20 +14,22 @@ class ButtonsProperty extends React.Component {
render() {
const { className, style, children } = this.props;
return <div className={classNames('buttons', className)} style={style}>{children}</div>;
return <div className={classNames('buttons', className)}
style={style}
>{children}</div>;
}
}
ButtonsProperty.propTypes = {
className: PropTypes.string,
style: PropTypes.object,
children: PropTypes.node,
children: PropTypes.node
};
ButtonsProperty.defaultProps = {
className: null,
style: null,
children: null,
children: null
};
export default ButtonsProperty;