前端eslint调整
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<el-drawer v-model="drawer" title="媒体库" size="650px">
|
||||
<el-drawer
|
||||
v-model="drawer"
|
||||
title="媒体库"
|
||||
size="650px"
|
||||
>
|
||||
<warning-bar
|
||||
title="点击“文件名/备注”可以编辑文件名或者备注内容。"
|
||||
/>
|
||||
@@ -16,18 +20,34 @@
|
||||
class="upload-btn-media-library"
|
||||
@on-success="open"
|
||||
/>
|
||||
<el-form ref="searchForm" :inline="true" :model="search">
|
||||
<el-form
|
||||
ref="searchForm"
|
||||
:inline="true"
|
||||
:model="search"
|
||||
>
|
||||
<el-form-item label="">
|
||||
<el-input v-model="search.keyword" class="keyword" placeholder="请输入文件名或备注" />
|
||||
<el-input
|
||||
v-model="search.keyword"
|
||||
class="keyword"
|
||||
placeholder="请输入文件名或备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="open">查询</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="search"
|
||||
@click="open"
|
||||
>查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="media">
|
||||
<div v-for="(item,key) in picList" :key="key" class="media-box">
|
||||
<div
|
||||
v-for="(item,key) in picList"
|
||||
:key="key"
|
||||
class="media-box"
|
||||
>
|
||||
<div class="header-img-box-list">
|
||||
<el-image
|
||||
:key="key"
|
||||
@@ -43,7 +63,10 @@
|
||||
</template>
|
||||
</el-image>
|
||||
</div>
|
||||
<div class="img-title" @click="editFileNameFunc(item)">{{ item.name }}</div>
|
||||
<div
|
||||
class="img-title"
|
||||
@click="editFileNameFunc(item)"
|
||||
>{{ item.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-pagination
|
||||
|
||||
@@ -6,12 +6,27 @@
|
||||
:show-close="false"
|
||||
>
|
||||
<template #header>
|
||||
<input v-model="searchInput" class="quick-input" placeholder="请输入你需要快捷到达的功能">
|
||||
<input
|
||||
v-model="searchInput"
|
||||
class="quick-input"
|
||||
placeholder="请输入你需要快捷到达的功能"
|
||||
>
|
||||
</template>
|
||||
|
||||
<div v-for="(option,index) in options" :key="index">
|
||||
<div v-if="option.children.length" class="quick-title">{{ option.label }}</div>
|
||||
<div v-for="(item,key) in option.children" :key="index+'-'+key" class="quick-item" @click="item.func">
|
||||
<div
|
||||
v-for="(option,index) in options"
|
||||
:key="index"
|
||||
>
|
||||
<div
|
||||
v-if="option.children.length"
|
||||
class="quick-title"
|
||||
>{{ option.label }}</div>
|
||||
<div
|
||||
v-for="(item,key) in option.children"
|
||||
:key="index+'-'+key"
|
||||
class="quick-item"
|
||||
@click="item.func"
|
||||
>
|
||||
{{ item.label }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,16 +39,16 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CommandMenu',
|
||||
}
|
||||
</script>
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { useRouter,useRoute } from 'vue-router'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useRouterStore } from '@/pinia/modules/router'
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
|
||||
defineOptions({
|
||||
name: 'CommandMenu',
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRouter()
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -1,29 +1,49 @@
|
||||
<template>
|
||||
<span class="headerAvatar">
|
||||
<template v-if="picType === 'avatar'">
|
||||
<el-avatar v-if="userStore.userInfo.headerImg" :size="30" :src="avatar" />
|
||||
<el-avatar v-else :size="30" :src="noAvatar" />
|
||||
<el-avatar
|
||||
v-if="userStore.userInfo.headerImg"
|
||||
:size="30"
|
||||
:src="avatar"
|
||||
/>
|
||||
<el-avatar
|
||||
v-else
|
||||
:size="30"
|
||||
:src="noAvatar"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="picType === 'img'">
|
||||
<img v-if="userStore.userInfo.headerImg" :src="avatar" class="avatar">
|
||||
<img v-else :src="noAvatar" class="avatar">
|
||||
<img
|
||||
v-if="userStore.userInfo.headerImg"
|
||||
:src="avatar"
|
||||
class="avatar"
|
||||
>
|
||||
<img
|
||||
v-else
|
||||
:src="noAvatar"
|
||||
class="avatar"
|
||||
>
|
||||
</template>
|
||||
<template v-if="picType === 'file'">
|
||||
<el-image :src="file" class="file" :preview-src-list="previewSrcList" :preview-teleported="true"/>
|
||||
<el-image
|
||||
:src="file"
|
||||
class="file"
|
||||
:preview-src-list="previewSrcList"
|
||||
:preview-teleported="true"
|
||||
/>
|
||||
</template>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CustomPic'
|
||||
}
|
||||
</script>
|
||||
|
||||
<script setup>
|
||||
import noAvatarPng from '@/assets/noBody.png'
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'CustomPic'
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
picType: {
|
||||
type: String,
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<template>
|
||||
<div class="border border-solid border-gray-100 h-full">
|
||||
<Toolbar
|
||||
:editor="editorRef"
|
||||
:defaultConfig="toolbarConfig"
|
||||
mode="default"
|
||||
/>
|
||||
<Editor
|
||||
class="overflow-y-hidden mt-0.5"
|
||||
style="height: 18rem;"
|
||||
v-model="valueHtml"
|
||||
:defaultConfig="editorConfig"
|
||||
mode="default"
|
||||
@onCreated="handleCreated"
|
||||
@onChange="change"
|
||||
/>
|
||||
</div>
|
||||
<div class="border border-solid border-gray-100 h-full">
|
||||
<Toolbar
|
||||
:editor="editorRef"
|
||||
:default-config="toolbarConfig"
|
||||
mode="default"
|
||||
/>
|
||||
<Editor
|
||||
v-model="valueHtml"
|
||||
class="overflow-y-hidden mt-0.5"
|
||||
style="height: 18rem;"
|
||||
:default-config="editorConfig"
|
||||
mode="default"
|
||||
@onCreated="handleCreated"
|
||||
@onChange="change"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -26,17 +26,17 @@ const basePath = import.meta.env.VITE_BASE_API
|
||||
import { onBeforeUnmount, ref, shallowRef, watch } from 'vue'
|
||||
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
||||
|
||||
import {useUserStore} from "@/pinia/modules/user";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {getUrl} from "@/utils/image";
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getUrl } from '@/utils/image'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const emits = defineEmits(['change','update:modelValue'])
|
||||
const emits = defineEmits(['change', 'update:modelValue'])
|
||||
|
||||
const change = (editor) =>{
|
||||
emits('change',editor)
|
||||
emits('update:modelValue',valueHtml.value)
|
||||
const change = (editor) => {
|
||||
emits('change', editor)
|
||||
emits('update:modelValue', valueHtml.value)
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
@@ -52,25 +52,24 @@ const valueHtml = ref('')
|
||||
const toolbarConfig = {}
|
||||
const editorConfig = {
|
||||
placeholder: '请输入内容...',
|
||||
MENU_CONF:{}
|
||||
MENU_CONF: {}
|
||||
}
|
||||
editorConfig.MENU_CONF['uploadImage'] = {
|
||||
fieldName: 'file',
|
||||
headers: {
|
||||
"x-token": userStore.token,
|
||||
'x-token': userStore.token,
|
||||
},
|
||||
server: basePath + '/fileUploadAndDownload/upload?noSave=1',
|
||||
customInsert(res, insertFn){
|
||||
if(res.code === 0){
|
||||
server: basePath + '/fileUploadAndDownload/upload?noSave=1',
|
||||
customInsert(res, insertFn) {
|
||||
if (res.code === 0) {
|
||||
const urlPath = getUrl(res.data.file.url)
|
||||
insertFn(urlPath,res.data.file.name)
|
||||
insertFn(urlPath, res.data.file.name)
|
||||
return
|
||||
}
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 组件销毁时,也及时销毁编辑器
|
||||
onBeforeUnmount(() => {
|
||||
const editor = editorRef.value
|
||||
@@ -82,7 +81,7 @@ const handleCreated = (editor) => {
|
||||
editorRef.value = editor
|
||||
}
|
||||
|
||||
watch(()=>props.modelValue,()=>{
|
||||
watch(() => props.modelValue, () => {
|
||||
valueHtml.value = props.modelValue
|
||||
})
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="border border-solid border-gray-100 h-full">
|
||||
<Editor
|
||||
class="overflow-y-hidden mt-0.5"
|
||||
v-model="valueHtml"
|
||||
:defaultConfig="editorConfig"
|
||||
mode="default"
|
||||
@onCreated="handleCreated"
|
||||
@onChange="change"
|
||||
v-model="valueHtml"
|
||||
class="overflow-y-hidden mt-0.5"
|
||||
:default-config="editorConfig"
|
||||
mode="default"
|
||||
@onCreated="handleCreated"
|
||||
@onChange="change"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -14,17 +14,16 @@
|
||||
|
||||
import '@wangeditor/editor/dist/css/style.css' // 引入 css
|
||||
|
||||
import { onBeforeUnmount, ref, shallowRef, watch } from 'vue'
|
||||
import { Editor } from '@wangeditor/editor-for-vue'
|
||||
|
||||
import {onBeforeUnmount, ref, shallowRef, watch} from 'vue'
|
||||
import {Editor} from '@wangeditor/editor-for-vue'
|
||||
|
||||
import {useUserStore} from "@/pinia/modules/user";
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const emits = defineEmits(['change', 'update:modelValue'])
|
||||
const editorConfig = ref({
|
||||
readOnly : true
|
||||
readOnly: true
|
||||
})
|
||||
const change = (editor) => {
|
||||
emits('change', editor)
|
||||
@@ -52,7 +51,7 @@ const handleCreated = (editor) => {
|
||||
editorRef.value = editor
|
||||
}
|
||||
|
||||
watch(()=>props.modelValue,()=>{
|
||||
watch(() => props.modelValue, () => {
|
||||
valueHtml.value = props.modelValue
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -21,6 +21,10 @@ import { ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
|
||||
defineOptions({
|
||||
name: 'UploadCommon',
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array,
|
||||
@@ -63,12 +67,3 @@ const uploadError = () => {
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'UploadCommon',
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -6,13 +6,19 @@
|
||||
'background-image': `url(${getUrl(modelValue)})`,
|
||||
}"
|
||||
>
|
||||
<span class="update" @click="openChooseImg">
|
||||
<span
|
||||
class="update"
|
||||
@click="openChooseImg"
|
||||
>
|
||||
<el-icon>
|
||||
<edit />
|
||||
</el-icon>
|
||||
重新上传</span>
|
||||
</div>
|
||||
<div v-else class="multiple-img">
|
||||
<div
|
||||
v-else
|
||||
class="multiple-img"
|
||||
>
|
||||
<div
|
||||
v-for="(item, index) in multipleValue"
|
||||
:key="index"
|
||||
@@ -21,14 +27,20 @@
|
||||
'background-image': `url(${getUrl(item)})`,
|
||||
}"
|
||||
>
|
||||
<span class="update" @click="deleteImg(index)">
|
||||
<span
|
||||
class="update"
|
||||
@click="deleteImg(index)"
|
||||
>
|
||||
<el-icon>
|
||||
<delete />
|
||||
</el-icon>
|
||||
删除图片</span>
|
||||
</div>
|
||||
<div class="add-image">
|
||||
<span class="update" @click="openChooseImg">
|
||||
<span
|
||||
class="update"
|
||||
@click="openChooseImg"
|
||||
>
|
||||
<el-icon>
|
||||
<folder-add />
|
||||
</el-icon>
|
||||
@@ -36,7 +48,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-drawer v-model="drawer" title="媒体库" size="650px">
|
||||
<el-drawer
|
||||
v-model="drawer"
|
||||
title="媒体库"
|
||||
size="650px"
|
||||
>
|
||||
<warning-bar
|
||||
title="点击“文件名/备注”可以编辑文件名或者备注内容。"
|
||||
/>
|
||||
@@ -53,18 +69,34 @@
|
||||
class="upload-btn-media-library"
|
||||
@on-success="getImageList"
|
||||
/>
|
||||
<el-form ref="searchForm" :inline="true" :model="search">
|
||||
<el-form
|
||||
ref="searchForm"
|
||||
:inline="true"
|
||||
:model="search"
|
||||
>
|
||||
<el-form-item label="">
|
||||
<el-input v-model="search.keyword" class="keyword" placeholder="请输入文件名或备注" />
|
||||
<el-input
|
||||
v-model="search.keyword"
|
||||
class="keyword"
|
||||
placeholder="请输入文件名或备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="getImageList">查询</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="search"
|
||||
@click="getImageList"
|
||||
>查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="media">
|
||||
<div v-for="(item,key) in picList" :key="key" class="media-box">
|
||||
<div
|
||||
v-for="(item,key) in picList"
|
||||
:key="key"
|
||||
class="media-box"
|
||||
>
|
||||
<div class="header-img-box-list">
|
||||
<el-image
|
||||
:key="key"
|
||||
@@ -80,7 +112,10 @@
|
||||
</template>
|
||||
</el-image>
|
||||
</div>
|
||||
<div class="img-title" @click="editFileNameFunc(item)">{{ item.name }}</div>
|
||||
<div
|
||||
class="img-title"
|
||||
@click="editFileNameFunc(item)"
|
||||
>{{ item.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-pagination
|
||||
|
||||
@@ -20,6 +20,10 @@ import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
|
||||
defineOptions({
|
||||
name: 'UploadCommon',
|
||||
})
|
||||
|
||||
const emit = defineEmits(['on-success'])
|
||||
const path = ref(import.meta.env.VITE_BASE_API)
|
||||
|
||||
@@ -59,12 +63,3 @@ const uploadError = () => {
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'UploadCommon',
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -20,6 +20,10 @@ import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
|
||||
defineOptions({
|
||||
name: 'UploadImage',
|
||||
})
|
||||
|
||||
const emit = defineEmits(['on-success'])
|
||||
const props = defineProps({
|
||||
imageUrl: {
|
||||
@@ -66,16 +70,6 @@ const handleImageSuccess = (res) => {
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'UploadImage',
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.image-uploader {
|
||||
border: 1px dashed #d9d9d9;
|
||||
|
||||
Reference in New Issue
Block a user