Commit ffd248a3 authored by 张烨's avatar 张烨

fix: 保存配置和添加ace编辑器

parent 5ebb8e4d
......@@ -7,6 +7,8 @@ stats.json
# Cruft
.DS_Store
npm-debug.log
yarn.lock
package-lock.json
.idea
src/umi
src/.umi
......
......@@ -87,6 +87,7 @@
"@babel/polyfill": "7.4.3",
"@babel/preset-typescript": "^7.12.1",
"@babel/runtime": "^7.10.5",
"ace-builds": "^1.4.12",
"antd-img-crop": "^3.13.2",
"bizcharts": "^4.0.15",
"chalk": "2.4.2",
......@@ -107,6 +108,7 @@
"minimist": "1.2.0",
"prop-types": "15.7.2",
"react": "16.8.6",
"react-ace": "^9.2.0",
"react-dom": "16.8.6",
"react-helmet": "6.0.0-beta",
"react-intl": "2.8.0",
......
import { getConfigContent, saveConfigContent } from '@/services/webConfig/api';
import { Button, Input, Modal, notification } from 'antd';
import { Button, Modal, notification } from 'antd';
import React, { Children, useState } from 'react';
import AceEditor from 'react-ace';
import styles from './webMenu.less';
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-solarized_light';
const ConfigWrapper = props => {
const { value, children, onChange, ...rest } = props;
......@@ -40,13 +44,14 @@ const ConfigWrapper = props => {
err = true;
}
if (!err) {
saveConfigContent(JSON.stringify(JSON.parse(text), null, 4))
saveConfigContent(value, JSON.stringify(JSON.parse(text), null, 4))
.then(res => {
if (res.success) {
notification.success({
message: '保存成功',
duration: 3,
});
setVisible(false);
}
})
.catch(error => {
......@@ -74,13 +79,31 @@ const ConfigWrapper = props => {
title="编辑配置"
visible={visible}
onOk={handleOk}
width={650}
className={styles.modal}
maskClosable={false}
onCancel={() => setVisible(false)}
>
<Input.TextArea
<AceEditor
mode="json"
theme="solarized_light"
value={text}
onChange={e => {
setText(e.target.value);
name="UNIQUE_ID_OF_DIV"
fontSize={14}
showPrintMargin
showGutter
width="100%"
wrapEnabled
highlightActiveLine
setOptions={{
enableBasicAutocompletion: false,
enableLiveAutocompletion: false,
enableSnippets: false,
showLineNumbers: true,
tabSize: 2,
}}
onChange={v => {
setText(v);
}}
rows={10}
/>
......
......@@ -301,11 +301,7 @@ const MiniMenu = props => {
})}
>
菜单列表
<div
className={classnames({
[styles.tRight]: true,
})}
>
<div className={classnames(styles.tRight)}>
<Tooltip title="新增菜单组">
<FolderAddTwoTone
className={`${styles.icon1} ${styles.icon}`}
......
......@@ -76,4 +76,9 @@
min-height: 100%;
border: 1px solid #eee;
padding: 10px;
}
.modal{
.ant-modal-body{
padding: 0 !important;
}
}
\ No newline at end of file
......@@ -92,9 +92,9 @@ export const deleteWebMenu = param =>
export const getWebMenuInfo = param =>
get(`${CITY_SERVICE}/OMS.svc/P_GetMenuInfo?_version=9999`, param);
export const saveConfigContent = content =>
export const saveConfigContent = (fileName, content) =>
post(
`${CITY_SERVICE}/OMS.svc/W4_SaveConfigContent?_version=9999`,
`${CITY_SERVICE}/OMS.svc/W4_SaveConfigContent?_version=9999&fileName=${fileName}`,
qs.stringify({ web4ConfigContent: content }),
{
headers: {
......
......@@ -24,6 +24,7 @@ const bizRedirectHandler = response => {
);
notification.warning({
key,
title: '提示',
message: '授权失败,即将跳转到登录页',
duration: 4,
btn,
......
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