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

chore: update

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