chore: fix typescript type hint
This commit is contained in:
parent
9dada7428a
commit
a6a671def5
@ -11,7 +11,15 @@ const layout = 'total,sizes,prev, pager,next'
|
|||||||
|
|
||||||
const pageSizes = [10, 20, 30, 50]
|
const pageSizes = [10, 20, 30, 50]
|
||||||
|
|
||||||
const { page, limit, total, changePage, changeLimit } = inject('paginate')
|
interface paginate {
|
||||||
|
page: number
|
||||||
|
limit: number
|
||||||
|
total: number
|
||||||
|
changePage: number
|
||||||
|
changeLimit: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const { page, limit, total, changePage, changeLimit } = inject('paginate') as paginate
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
@ -48,7 +48,7 @@ const getOptions = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const elOptions = props.group ? ref<Array<GroupOption>>() : ref<Array<Option>>()
|
const elOptions: any = props.group ? ref<Array<GroupOption>>() : ref<Array<Option>>()
|
||||||
if (props.api) {
|
if (props.api) {
|
||||||
if (!props.query) {
|
if (!props.query) {
|
||||||
getOptions()
|
getOptions()
|
||||||
|
@ -8,13 +8,19 @@ import { Status } from '/admin/enum/app'
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: Boolean | Number | String,
|
modelValue: [Boolean, Number, String],
|
||||||
api: String,
|
api: {
|
||||||
id: Number | String,
|
required: true,
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
required: true,
|
||||||
|
type: [String, Number],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits(['update:modelValue', 'refresh'])
|
const emits = defineEmits(['update:modelValue', 'refresh'])
|
||||||
|
// @ts-ignore
|
||||||
const { enabled, success, loading, afterEnabled } = useEnabled()
|
const { enabled, success, loading, afterEnabled } = useEnabled()
|
||||||
|
|
||||||
const activeValue = ref<boolean | number | string>()
|
const activeValue = ref<boolean | number | string>()
|
||||||
|
@ -1,59 +1,59 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-upload ref="upload" :action="action" :auto-upload="auto" v-bind="$attrs" :data="data" :before-upload="initOss" :on-success="handleSuccess">
|
<el-upload ref="upload" :action="action" :auto-upload="auto" v-bind="$attrs" :data="data" :before-upload="initOss" :on-success="handleSuccess">
|
||||||
<template v-for="(index, name) in $slots" v-slot:[name]>
|
<template v-for="(index, name) in $slots" v-slot:[name]>
|
||||||
<slot :name="name"></slot>
|
<slot :name="name"></slot>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import http from "/admin/support/http"
|
import http from '/admin/support/http'
|
||||||
import {ref} from "vue";
|
import { ref } from 'vue'
|
||||||
import Message from "/admin/support/message";
|
import Message from '/admin/support/message'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
auto: {
|
auto: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
require: true,
|
require: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const action = ref('')
|
const action = ref('')
|
||||||
const data = ref({
|
const data = ref({
|
||||||
OSSAccessKeyId: '',
|
OSSAccessKeyId: '',
|
||||||
policy: '',
|
policy: '',
|
||||||
Signature: '',
|
Signature: '',
|
||||||
key: '',
|
key: '',
|
||||||
host: '',
|
host: '',
|
||||||
dir: '',
|
dir: '',
|
||||||
expire: '',
|
expire: '',
|
||||||
success_action_status: 200
|
success_action_status: 200,
|
||||||
})
|
})
|
||||||
const emits = defineEmits(['update:modelValue'])
|
const emits = defineEmits(['update:modelValue'])
|
||||||
const initOss = async (file) => {
|
const initOss = async (file: { size: number; name: any }) => {
|
||||||
if (file.size > 10 * 1024 * 1024) {
|
if (file.size > 10 * 1024 * 1024) {
|
||||||
Message.error('最大支持 10MB 文件')
|
Message.error('最大支持 10MB 文件')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await http.get('upload/oss').then(r => {
|
await http.get('upload/oss').then(r => {
|
||||||
const {accessKeyId, bucket, dir, expire, host, policy, signature, url} = r.data.data
|
const { accessKeyId, bucket, dir, expire, host, policy, signature, url } = r.data.data
|
||||||
action.value = host
|
action.value = host
|
||||||
data.value.OSSAccessKeyId = accessKeyId
|
data.value.OSSAccessKeyId = accessKeyId
|
||||||
data.value.policy = policy
|
data.value.policy = policy
|
||||||
data.value.Signature = signature
|
data.value.Signature = signature
|
||||||
data.value.key = dir + file.name
|
data.value.key = dir + file.name
|
||||||
data.value.host = host
|
data.value.host = host
|
||||||
data.value.dir = dir
|
data.value.dir = dir
|
||||||
data.value.expire = expire
|
data.value.expire = expire
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSuccess = (r) => {
|
const handleSuccess = (r: any) => {
|
||||||
emits('update:modelValue', action.value + data.value.key)
|
emits('update:modelValue', action.value + data.value.key)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -21,7 +21,7 @@ const breadcrumbs = ref<string[]>([])
|
|||||||
watch(router.currentRoute, (newValue, oldValue) => {
|
watch(router.currentRoute, (newValue, oldValue) => {
|
||||||
// 激活菜单
|
// 激活菜单
|
||||||
if (newValue.meta.active_menu) {
|
if (newValue.meta.active_menu) {
|
||||||
appStore.setActiveMenu(newValue.meta.active_menu)
|
appStore.setActiveMenu(newValue.meta.active_menu as string)
|
||||||
}
|
}
|
||||||
setActiveMenu(newValue)
|
setActiveMenu(newValue)
|
||||||
getBreadcrumbs(newValue)
|
getBreadcrumbs(newValue)
|
||||||
@ -33,11 +33,11 @@ onMounted(() => {
|
|||||||
getBreadcrumbs(router.currentRoute.value)
|
getBreadcrumbs(router.currentRoute.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
const setActiveMenu = route => {
|
const setActiveMenu = (route: RouteLocationNormalizedLoaded) => {
|
||||||
if (route.path !== '/') {
|
if (route.path !== '/') {
|
||||||
// 如果是内页,并且设置激活菜单
|
// 如果是内页,并且设置激活菜单
|
||||||
if (route.meta.active_menu) {
|
if (route.meta.active_menu) {
|
||||||
appStore.setActiveMenu(route.meta.active_menu)
|
appStore.setActiveMenu(route.meta.active_menu as string)
|
||||||
} else {
|
} else {
|
||||||
appStore.setActiveMenu(route.path)
|
appStore.setActiveMenu(route.path)
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const aipKey: string = 's1ntkmnev0ggx0hhaqnubrdxhv0ly99uyrdbckeaycx7iz6v'
|
const aipKey: string = 's1ntkmnev0ggx0hhaqnubrdxhv0ly99uyrdbckeaycx7iz6v'
|
||||||
const uploaded = (blobInfo, progress) =>
|
const uploaded = (blobInfo: any, progress: any) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
if (blobInfo.blob().size / 1024 / 1024 > 10) {
|
if (blobInfo.blob().size / 1024 / 1024 > 10) {
|
||||||
Message.error('上传失败,图片大小请控制在 10M 以内')
|
Message.error('上传失败,图片大小请控制在 10M 以内')
|
||||||
@ -102,7 +102,7 @@ const uploaded = (blobInfo, progress) =>
|
|||||||
if (res.data.code === 10000) {
|
if (res.data.code === 10000) {
|
||||||
resolve(res.data.data.path)
|
resolve(res.data.data.path)
|
||||||
} else {
|
} else {
|
||||||
Message.error(res.message)
|
Message.error(res.data.message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -6,7 +6,9 @@ export function getModuleRoutes() {
|
|||||||
let moduleRoutes: RouteRecordRaw[] = []
|
let moduleRoutes: RouteRecordRaw[] = []
|
||||||
|
|
||||||
Object.keys(modules).forEach(routePath => {
|
Object.keys(modules).forEach(routePath => {
|
||||||
|
// @ts-ignore
|
||||||
if (!isUndefined(modules[routePath].default)) {
|
if (!isUndefined(modules[routePath].default)) {
|
||||||
|
// @ts-ignore
|
||||||
moduleRoutes = moduleRoutes.concat(modules[routePath].default)
|
moduleRoutes = moduleRoutes.concat(modules[routePath].default)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -62,6 +62,7 @@ export default class CatchAdmin {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
protected useElementPlus(): CatchAdmin {
|
protected useElementPlus(): CatchAdmin {
|
||||||
|
// @ts-ignore
|
||||||
this.app.use(ElementPlus, {
|
this.app.use(ElementPlus, {
|
||||||
locale: Cache.get('language') === 'zh' && zh,
|
locale: Cache.get('language') === 'zh' && zh,
|
||||||
})
|
})
|
||||||
|
@ -153,7 +153,8 @@ class Http {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interceptorsOfRequest(): void {
|
public interceptorsOfRequest(): void {
|
||||||
this.request.interceptors.request.use(function (config: AxiosRequestConfig) {
|
// @ts-ignore
|
||||||
|
this.request.interceptors.request.use((config: AxiosRequestConfig) => {
|
||||||
const token = getAuthToken()
|
const token = getAuthToken()
|
||||||
if (token) {
|
if (token) {
|
||||||
if (!config.headers) {
|
if (!config.headers) {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import packages from '/admin/../package.json'
|
import packages from '../../../../package.json'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const dependencies = computed(() => {
|
const dependencies = computed(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user