提交 cf325497 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 11f5e536
...@@ -28,7 +28,7 @@ const HelpAddEdit = () => { ...@@ -28,7 +28,7 @@ const HelpAddEdit = () => {
const [loading, setLoading] = useState(false) // 定义 loading 状态和 setLoading 函数 const [loading, setLoading] = useState(false) // 定义 loading 状态和 setLoading 函数
const [uploadProgress, setUploadProgress] = useState(0) const [uploadProgress, setUploadProgress] = useState(0)
const getHelpInfo = async id => { const getHelpInfo = async (id) => {
const { help_title, help_content } = await HelpInfo({ id }) const { help_title, help_content } = await HelpInfo({ id })
form.setFieldValue('help_title', help_title) form.setFieldValue('help_title', help_title)
form.setFieldValue('help_content', help_content) form.setFieldValue('help_content', help_content)
...@@ -49,7 +49,7 @@ const HelpAddEdit = () => { ...@@ -49,7 +49,7 @@ const HelpAddEdit = () => {
let ossClientTemp let ossClientTemp
const getStsAuthToken = () => { const getStsAuthToken = () => {
return new Promise(async resolve => { return new Promise(async (resolve) => {
const data = await getAliOSSSTSToken() const data = await getAliOSSSTSToken()
if (data) { if (data) {
window.sessionStorage.setItem('sts', JSON.stringify(data)) window.sessionStorage.setItem('sts', JSON.stringify(data))
...@@ -67,10 +67,10 @@ const HelpAddEdit = () => { ...@@ -67,10 +67,10 @@ const HelpAddEdit = () => {
return { return {
AccessKeyId: info.AccessKeyId, AccessKeyId: info.AccessKeyId,
AccessKeySecret: info.AccessKeySecret, AccessKeySecret: info.AccessKeySecret,
SecurityToken: info.SecurityToken SecurityToken: info.SecurityToken,
} }
}, },
refreshSTSTokenInterval: 14 * 60 * 1000 refreshSTSTokenInterval: 14 * 60 * 1000,
}) })
setOssClient(ossClientTemp) setOssClient(ossClientTemp)
console.log('AliOSS', ossClientTemp) console.log('AliOSS', ossClientTemp)
...@@ -103,9 +103,9 @@ const HelpAddEdit = () => { ...@@ -103,9 +103,9 @@ const HelpAddEdit = () => {
'codeBlock', 'codeBlock',
'blockquote', 'blockquote',
'code', 'code',
'group-more-style' 'group-more-style',
// 'insertTable', // 'insertTable',
] //删除工具栏 ], //删除工具栏
} // JS 语法 } // JS 语法
const editorConfig = { const editorConfig = {
...@@ -130,11 +130,11 @@ const HelpAddEdit = () => { ...@@ -130,11 +130,11 @@ const HelpAddEdit = () => {
{ name: '六号', value: '10px' }, { name: '六号', value: '10px' },
{ name: '小六', value: '8px' }, { name: '小六', value: '8px' },
{ name: '七号', value: '7px' }, { name: '七号', value: '7px' },
{ name: '八号', value: '8px' } { name: '八号', value: '8px' },
] ],
}, },
lineHeight: { lineHeight: {
lineHeightList: ['1', '1.25', '1.5', '2', '2.5', '3'] lineHeightList: ['1', '1.25', '1.5', '2', '2.5', '3'],
}, },
// 配置上传图片 // 配置上传图片
uploadImage: { uploadImage: {
...@@ -143,7 +143,7 @@ const HelpAddEdit = () => { ...@@ -143,7 +143,7 @@ const HelpAddEdit = () => {
fieldName: 'image', fieldName: 'image',
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
Authorization: 'Bearer ' + localStorage.getItem('token') || '' Authorization: 'Bearer ' + localStorage.getItem('token') || '',
}, },
maxFileSize: 10 * 1024 * 1024, // 10M maxFileSize: 10 * 1024 * 1024, // 10M
base64LimitSize: 5 * 1024, // 5kb 以下插入 base64 // 用户自定义上传图片 base64LimitSize: 5 * 1024, // 5kb 以下插入 base64 // 用户自定义上传图片
...@@ -166,7 +166,7 @@ const HelpAddEdit = () => { ...@@ -166,7 +166,7 @@ const HelpAddEdit = () => {
// insertFn(url, '题库图片'); // insertFn(url, '题库图片');
setLoading(false) setLoading(false)
} },
}, },
uploadVideo: { uploadVideo: {
...@@ -174,7 +174,7 @@ const HelpAddEdit = () => { ...@@ -174,7 +174,7 @@ const HelpAddEdit = () => {
fieldName: 'video', fieldName: 'video',
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
Authorization: 'Bearer ' + localStorage.getItem('token') || '' Authorization: 'Bearer ' + localStorage.getItem('token') || '',
}, },
maxFileSize: 10 * 1024 * 1024, // 10M maxFileSize: 10 * 1024 * 1024, // 10M
base64LimitSize: 5 * 1024, // 5kb 以下插入 base64 // 用户自定义上传图片 base64LimitSize: 5 * 1024, // 5kb 以下插入 base64 // 用户自定义上传图片
...@@ -212,9 +212,9 @@ const HelpAddEdit = () => { ...@@ -212,9 +212,9 @@ const HelpAddEdit = () => {
console.error('上传视频失败:', error) console.error('上传视频失败:', error)
setLoading(false) setLoading(false)
} }
} },
} },
} },
} }
useEffect(() => { useEffect(() => {
...@@ -222,7 +222,7 @@ const HelpAddEdit = () => { ...@@ -222,7 +222,7 @@ const HelpAddEdit = () => {
}, []) }, [])
//添加、修改 //添加、修改
const onFinish = async obj => { const onFinish = async (obj) => {
let bool let bool
const html = editor.getHtml() // 获取最新的编辑器内容 const html = editor.getHtml() // 获取最新的编辑器内容
obj.help_content = html // 更新 help_content 字段 obj.help_content = html // 更新 help_content 字段
...@@ -235,7 +235,7 @@ const HelpAddEdit = () => { ...@@ -235,7 +235,7 @@ const HelpAddEdit = () => {
} }
//点击预览的添加、修改 //点击预览的添加、修改
const onFinishPre = async obj => { const onFinishPre = async (obj) => {
let bool let bool
const html = editor.getHtml() // 获取最新的编辑器内容 const html = editor.getHtml() // 获取最新的编辑器内容
obj.help_content = html // 更新 help_content 字段 obj.help_content = html // 更新 help_content 字段
...@@ -288,7 +288,7 @@ const HelpAddEdit = () => { ...@@ -288,7 +288,7 @@ const HelpAddEdit = () => {
onClick={async () => { onClick={async () => {
setShowPhone(true) setShowPhone(true)
// 在这里等待帮助信息获取完成后再调用onFinish // 在这里等待帮助信息获取完成后再调用onFinish
await new Promise(resolve => setTimeout(resolve, 0)) // 使用微任务延时来确保setHtml完成状态更新 await new Promise((resolve) => setTimeout(resolve, 0)) // 使用微任务延时来确保setHtml完成状态更新
const formData = form.getFieldsValue() const formData = form.getFieldsValue()
formData.help_content = html // 获取并设置最新的编辑器内容 formData.help_content = html // 获取并设置最新的编辑器内容
...@@ -328,7 +328,7 @@ const HelpAddEdit = () => { ...@@ -328,7 +328,7 @@ const HelpAddEdit = () => {
defaultConfig={editorConfig} defaultConfig={editorConfig}
value={html} // 使用 html 作为 value 属性的值 value={html} // 使用 html 作为 value 属性的值
onCreated={setEditor} onCreated={setEditor}
onChange={editor => { onChange={(editor) => {
form.setFieldValue('help_content', editor.getHtml()) form.setFieldValue('help_content', editor.getHtml())
}} }}
config={editorConfig} config={editorConfig}
...@@ -346,7 +346,7 @@ const HelpAddEdit = () => { ...@@ -346,7 +346,7 @@ const HelpAddEdit = () => {
}}> }}>
取消 取消
</Button> </Button>
<Button type="primary" htmlType="submit" type="primary"> <Button type="primary" htmlType="submit">
确认 确认
</Button> </Button>
</Space> </Space>
......
...@@ -12,11 +12,11 @@ export default defineConfig(() => { ...@@ -12,11 +12,11 @@ export default defineConfig(() => {
open: true, open: true,
host: 'dev.ezijing.com', host: 'dev.ezijing.com',
proxy: { proxy: {
'/api/wenku': { // '/api/wenku': {
target: 'https://wenchain.baidu.com', // target: 'https://wenchain.baidu.com',
changeOrigin: true, // changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/wenku/, '/'), // rewrite: (path) => path.replace(/^\/api\/wenku/, '/'),
}, // },
'/api': { '/api': {
target: 'https://zijingebook.ezijing.com', target: 'https://zijingebook.ezijing.com',
changeOrigin: true, changeOrigin: true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论