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