|
@@ -2,9 +2,9 @@
|
|
|
import '@wangeditor/editor/dist/css/style.css'
|
|
import '@wangeditor/editor/dist/css/style.css'
|
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
|
|
import type { IToolbarConfig, IEditorConfig } from '@wangeditor/editor'
|
|
import type { IToolbarConfig, IEditorConfig } from '@wangeditor/editor'
|
|
|
-import { useUserStore } from '@/stores/user'
|
|
|
|
|
-import { ACCESS_TOKEN } from '@/utils/constants'
|
|
|
|
|
|
|
+import { ACCESS_TOKEN, TOKEN_PREFIX } from '@/utils/constants'
|
|
|
import { isAbsolutePath } from '@/utils/utils'
|
|
import { isAbsolutePath } from '@/utils/utils'
|
|
|
|
|
+import { getToken } from '@/utils/micro'
|
|
|
import config from '@/config/defaultSetting'
|
|
import config from '@/config/defaultSetting'
|
|
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
@@ -34,13 +34,12 @@ const valueHtml = computed({
|
|
|
set: value => emits('update:modelValue', value)
|
|
set: value => emits('update:modelValue', value)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const userStore = useUserStore()
|
|
|
|
|
const editorConfig = {
|
|
const editorConfig = {
|
|
|
placeholder: '请输入内容...',
|
|
placeholder: '请输入内容...',
|
|
|
MENU_CONF: {
|
|
MENU_CONF: {
|
|
|
uploadImage: {
|
|
uploadImage: {
|
|
|
server: isAbsolutePath(props.uploadApi) ? props.uploadApi : import.meta.env.VITE_BASE_API + props.uploadApi,
|
|
server: isAbsolutePath(props.uploadApi) ? props.uploadApi : import.meta.env.VITE_BASE_API + props.uploadApi,
|
|
|
- headers: { [ACCESS_TOKEN]: userStore.token },
|
|
|
|
|
|
|
+ headers: { [ACCESS_TOKEN]: TOKEN_PREFIX + getToken() },
|
|
|
fieldName: props.fieldName,
|
|
fieldName: props.fieldName,
|
|
|
// 自定义插入图片
|
|
// 自定义插入图片
|
|
|
customInsert(res: any, insertFn: Function) {
|
|
customInsert(res: any, insertFn: Function) {
|