提交 3a453b66 作者: 龚洪江

Merge branch 'master' into develop

......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/admin
newTag: 87957d9f539966e874d29ef4af89cbe5eb93b07f
newTag: 52bc46b4c275e1531b86c5da46972c6af3093aba
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,7 +10,6 @@ const { VITE_REQUEST_BASE_URL } = import.meta.env;
export const uploadImgURL = `${VITE_REQUEST_BASE_URL}/pms/upload/imgOsses`;
export const uploadVideoURL = `${VITE_REQUEST_BASE_URL}/ossservlet/upload/videoOss`;
export const uploadFileURL = `${VITE_REQUEST_BASE_URL}/ossservlet/upload/oss`;
console.log('数据-->', VITE_REQUEST_BASE_URL);
// 创建服务
const service = axios.create({
baseURL: VITE_REQUEST_BASE_URL,
......
import '@wangeditor/editor/dist/css/style.css'; // 引入 css
import React, { useState, useEffect } from 'react';
import { Editor, Toolbar } from '@wangeditor/editor-for-react';
import { IDomEditor, IEditorConfig, IToolbarConfig, InsertFnType } from '@wangeditor/editor';
import { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor/editor';
import { message } from 'antd';
import { CommonAPI } from '~/api';
......@@ -25,9 +25,6 @@ const RichText: React.FC<PropsType> = ({
// editor 实例
const [editor, setEditor] = useState<IDomEditor | null>(null);
// 编辑器内容
const [html, setHtml] = useState<string>('');
// 工具栏配置
const toolbarConfig: Partial<IToolbarConfig> = {};
......@@ -38,7 +35,7 @@ const RichText: React.FC<PropsType> = ({
MENU_CONF: {
uploadImage: {
// 自定义上传
async customUpload(file: File, insertFn: InsertFnType) {
async customUpload(file: File, insertFn: any) {
if (file.size / 1024 / 1024 > (imgSize || 5)) {
return message.warning(`上传文件大小最大${imgSize || 5}M`);
}
......@@ -54,7 +51,7 @@ const RichText: React.FC<PropsType> = ({
},
uploadVideo: {
// 自定义上传
async customUpload(file: File, insertFn: InsertFnType) {
async customUpload(file: File, insertFn: any) {
if (file.size / 1024 / 1024 > (videoSize || 5)) {
return message.warning(`上传文件大小最大${videoSize || 5}M`);
}
......@@ -72,12 +69,10 @@ const RichText: React.FC<PropsType> = ({
};
//富文本修改
const richTextChange = (editor: IDomEditor) => {
setHtml(editor.getHtml());
if (onChange) {
onChange(editor.getHtml() || '');
}
};
// 及时销毁 editor ,重要!
useEffect(() => {
return () => {
if (editor == null) return;
......@@ -87,7 +82,7 @@ const RichText: React.FC<PropsType> = ({
}, [editor]);
useEffect(() => {
setHtml(value || '');
editor?.setHtml(value || '');
}, [value]);
useEffect(() => {
......@@ -107,7 +102,6 @@ const RichText: React.FC<PropsType> = ({
/>
<Editor
defaultConfig={editorConfig}
value={html}
onCreated={setEditor}
onChange={richTextChange}
mode='default'
......
......@@ -205,7 +205,9 @@ const GoodsAddOrEditOrDetail = () => {
});
cusPre = [
...cusPre,
bol ? filterObjAttr(cusCur, ['fileList']) : filterObjAttr(cusCur, ['id', 'fileList']),
bol
? filterObjAttr({ ...cusCur, id: cusCur.productSpec }, ['fileList'])
: filterObjAttr(cusCur, ['id', 'fileList']),
];
return cusPre;
}, []);
......
......@@ -179,7 +179,7 @@ const GoodsList = () => {
//编辑商品
const toEditGoods = (id: number) => {
navigate({
pathname: '/mallManage/mallGoods/add',
pathname: '/mallManage/mallGoods/edit',
search: `id=${id}`,
});
};
......
......@@ -58,6 +58,9 @@ const AddOrEditNewsModal: FC<ModalProps & selfProps> = ({
}).then(({ code }) => {
if (code === '200') {
message.success(currentIndustryNews ? '编辑成功' : '新增成功');
form.resetFields();
setSurfaceImgList([]);
setRichTextValue('');
handleOk();
}
});
......@@ -135,7 +138,7 @@ const AddOrEditNewsModal: FC<ModalProps & selfProps> = ({
</Uploader>
</Form.Item>
<Form.Item label='主题内容' name='newsContents'>
<RichText onChange={richTextChange} value={richTextValue} />
<RichText onChange={richTextChange} value={richTextValue} videoSize={100} />
</Form.Item>
</Form>
</Modal>
......
......@@ -13,5 +13,9 @@
}
&-content{
margin-top: 10px;
img,video{
max-width: 100%;
height: auto;
}
}
}
......@@ -25,7 +25,7 @@ const PreviewNewsModal: FC<ModalProps & selfProps> = ({ open, onCancel, currentI
});
};
useEffect(() => {
if (currentIndustryNews) {
if (currentIndustryNews && open) {
getIndustryNewsDetail(currentIndustryNews.id);
}
}, [currentIndustryNews]);
......
......@@ -42,7 +42,7 @@ const TagManage = () => {
),
},
];
const [tableData, setTableData] = useState<any>([{ id: 1 }]);
const [tableData] = useState<any>([{ id: 1 }]);
const [addOrEditTagModalShow, setAddOrEditTagModalShow] = useState<boolean>(false);
const addOrEditTagClick = () => {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论