fix(resource)
This commit is contained in:
parent
49e55b1e99
commit
63496f77b0
|
@ -3,6 +3,7 @@ import "@wangeditor/editor/dist/css/style.css"; // 引入 css
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Editor, Toolbar } from "@wangeditor/editor-for-react";
|
import { Editor, Toolbar } from "@wangeditor/editor-for-react";
|
||||||
import { IDomEditor, IEditorConfig, IToolbarConfig } from "@wangeditor/editor";
|
import { IDomEditor, IEditorConfig, IToolbarConfig } from "@wangeditor/editor";
|
||||||
|
import { base } from "@/service/base";
|
||||||
interface EditorProps {
|
interface EditorProps {
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
|
@ -16,7 +17,7 @@ function MyEditor(props:EditorProps) {
|
||||||
// 模拟 ajax 请求,异步设置 html
|
// 模拟 ajax 请求,异步设置 html
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.value) {
|
if (props.value) {
|
||||||
setHtml(props.value)
|
setHtml(props.value);
|
||||||
}
|
}
|
||||||
}, [props.value]);
|
}, [props.value]);
|
||||||
|
|
||||||
|
@ -25,8 +26,23 @@ function MyEditor(props:EditorProps) {
|
||||||
|
|
||||||
// 编辑器配置
|
// 编辑器配置
|
||||||
const editorConfig: Partial<IEditorConfig> = {
|
const editorConfig: Partial<IEditorConfig> = {
|
||||||
// TS 语法
|
|
||||||
placeholder: "请输入内容...",
|
placeholder: "请输入内容...",
|
||||||
|
MENU_CONF: {
|
||||||
|
uploadImage: {
|
||||||
|
server: "/public/fts/upload",
|
||||||
|
fieldName: "file",
|
||||||
|
async customUpload(file: File, insertFn) {
|
||||||
|
let uploadUrl = "/public/fts/upload";
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("file", file);
|
||||||
|
let res = await base.upload(uploadUrl, formData);
|
||||||
|
if (res.code === 200) {
|
||||||
|
let url = res.data.record.file_url;
|
||||||
|
insertFn(url, "", "");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// 及时销毁 editor ,重要!
|
// 及时销毁 editor ,重要!
|
||||||
|
@ -52,8 +68,8 @@ function MyEditor(props:EditorProps) {
|
||||||
value={html}
|
value={html}
|
||||||
onCreated={setEditor}
|
onCreated={setEditor}
|
||||||
onChange={(editor) => {
|
onChange={(editor) => {
|
||||||
setHtml(editor.getHtml())
|
setHtml(editor.getHtml());
|
||||||
props.onChange(editor.getHtml())
|
props.onChange(editor.getHtml());
|
||||||
}}
|
}}
|
||||||
mode="default"
|
mode="default"
|
||||||
style={{ height: "500px", overflowY: "hidden" }}
|
style={{ height: "500px", overflowY: "hidden" }}
|
||||||
|
|
|
@ -30,6 +30,7 @@ const LayOut = (props: Store) => {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
|
|
||||||
};
|
};
|
||||||
const logoStyle = { width: 140, color: "white",display:"flex" };
|
const logoStyle = { width: 140, color: "white",display:"flex" };
|
||||||
const contentstyle = {
|
const contentstyle = {
|
||||||
|
@ -76,7 +77,7 @@ const LayOut = (props: Store) => {
|
||||||
theme="dark"
|
theme="dark"
|
||||||
defaultSelectedKeys={["1"]}
|
defaultSelectedKeys={["1"]}
|
||||||
defaultOpenKeys={["sub1"]}
|
defaultOpenKeys={["sub1"]}
|
||||||
style={{ height: "100%", borderRight: 0 }}
|
style={{ height: "100%", borderRight: 0 ,overflowY:"auto"}}
|
||||||
items={items}
|
items={items}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
nav(e.key);
|
nav(e.key);
|
||||||
|
|
|
@ -26,10 +26,10 @@ export const columns: ColumnsType<UserDataType> = [
|
||||||
return <Image width={50} src={text} />;
|
return <Image width={50} src={text} />;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: "商品介绍",
|
// title: "商品介绍",
|
||||||
dataIndex: "sku_desc",
|
// dataIndex: "sku_desc",
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: "所属城市",
|
title: "所属城市",
|
||||||
dataIndex: "city",
|
dataIndex: "city",
|
||||||
|
|
|
@ -8,9 +8,7 @@ import BTable from "@/components/b_table";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
const Sku = (props: Store) => {
|
const Sku = (props: Store) => {
|
||||||
const { skuStore } = props;
|
const { skuStore } = props;
|
||||||
|
|
||||||
const nav = useNavigate();
|
const nav = useNavigate();
|
||||||
|
|
||||||
// 获取列表数据
|
// 获取列表数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
skuStore.getlist();
|
skuStore.getlist();
|
||||||
|
|
|
@ -54,9 +54,9 @@ export const formConfig = [
|
||||||
rules: [{ required: true, message: "附件图不能为空" }],
|
rules: [{ required: true, message: "附件图不能为空" }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.textarea,
|
type: FormType.editor,
|
||||||
label: "描述",
|
label: "商品介绍",
|
||||||
name: "sku_desc",
|
name: "sku_desc",
|
||||||
rules: [{ required: true, message: "描述不能为空" }],
|
rules: [{ required: true, message: "商品介绍为空" }],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue