Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sukbearai committed Sep 6, 2024
1 parent 5a41e02 commit 90d2b60
Show file tree
Hide file tree
Showing 71 changed files with 99,041 additions and 99,072 deletions.
6 changes: 3 additions & 3 deletions app/components/AiAssistant.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { CircleCloseFilled } from '@element-plus/icons-vue'
import { Vue3Lottie } from 'vue3-lottie'
import ChatInput from './ChatPanel/components/ChatInput.vue'
// import ChatInput from './ChatPanel/components/ChatInput.vue'
import ChatItem from './ChatPanel/components/ChatItem.vue'
import ChatPanel from './ChatPanel/index.vue'
import chatData from '~/services/chat'
Expand Down Expand Up @@ -44,7 +44,7 @@ function handleClose(done: () => void) {
}
const comRef = ref()
const inputBar = ref()
// const inputBar = ref()
const list = ref<any>([])
const scrollbar = ref(true)
const loading = ref(true)
Expand Down Expand Up @@ -234,7 +234,7 @@ function onOpen() {
</div>
</template>
<template #item="{ item, index }">
<ChatItem :key="index" :item="item" />
<ChatItem :key="index" :item="item!" />
</template>
</ChatPanel>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/components/ChatPanel/components/ChatInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
default: false,
},
},
emits: ['send', 'emojiTypeChange'],
data() {
return {
msg: '',
Expand Down
2 changes: 1 addition & 1 deletion app/components/ChatPanel/components/VirtualList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const props = defineProps({
default: 200,
},
data: {
type: Array,
type: Array<any>,
default: () => [],
},
threshold: {
Expand Down
3 changes: 2 additions & 1 deletion app/components/ChatPanel/hooks/useSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function useSize({
return _estimatedSize.value

const _key = dataKeys.value[index]
return sizeMap.get(_key) ?? _estimatedSize.value
return sizeMap.get(_key!) ?? _estimatedSize.value
}

const hasItemSize = (key: string | number) => {
Expand Down Expand Up @@ -105,6 +105,7 @@ export function useSize({
let offsetIndex = 0
while (offset > 0) {
offset -= getItemSize(_start + offsetIndex)!
// eslint-disable-next-line ts/no-unused-expressions
isForward ? offsetIndex++ : offsetIndex--
}
return offsetIndex
Expand Down
1 change: 1 addition & 0 deletions app/components/ChatPanel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const contentCls = computed(() => [
])
// 优化Cumulative Layout Shift, CLS
// eslint-disable-next-line vue/return-in-computed-property
const emptyStyle = computed(() => {
if (props.virtualListProps?.height) {
return {
Expand Down
2 changes: 2 additions & 0 deletions app/components/ChatPanel/utils/is.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable regexp/no-super-linear-backtracking */
/* eslint-disable regexp/no-unused-capturing-group */
/* eslint-disable eslint-comments/no-unlimited-disable */
import type { ComponentPublicInstance, VNode, VNodeNormalizedChildren } from 'vue'
import type { Dayjs } from 'dayjs'
Expand Down
2 changes: 1 addition & 1 deletion app/components/ChatPanel/utils/vue-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable ts/prefer-literal-enum-member */
import type { Component, Slots, VNode, VNodeTypes } from 'vue'
import { isArray, isFunction, isNumber, isObject, isString } from './is'
import { isArray } from './is'

export enum ShapeFlags {
ELEMENT = 1,
Expand Down
9 changes: 4 additions & 5 deletions app/components/TaskPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import type { ComponentPublicInstance } from 'vue'
import { computed, ref } from 'vue'
import { useElementSize } from '@vueuse/core'
import type { ElScrollbar } from 'element-plus'
Expand All @@ -14,7 +13,7 @@ interface Step {
const taskListEl = ref(null)
const { height } = useElementSize(taskListEl)
const currentRefEl = ref<HTMLElement | ComponentPublicInstance | null>(null)
// const currentRefEl = ref<HTMLElement | ComponentPublicInstance | null>(null)
const scrollbarRefEl = ref<InstanceType<typeof ElScrollbar>>()
const listHeight = computed(() => `${height.value - 10}px`)
const dialog = ref(false)
Expand All @@ -34,9 +33,9 @@ function generateSteps(initialStep: Step, count: number): Step[] {
return steps
}
function onClick() {
(currentRefEl.value as HTMLElement).scrollIntoView({ behavior: 'smooth', block: 'center' })
}
// function onClick() {
// (currentRefEl.value as HTMLElement).scrollIntoView({ behavior: 'smooth', block: 'center' })
// }
const initialStep: Step = {
title: '初始步骤',
Expand Down
2 changes: 1 addition & 1 deletion app/components/VBorderBox13.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, nextTick, onBeforeUpdate, ref } from 'vue'
import { computed, ref } from 'vue'
import { merge } from 'lodash-es'
import type { PropType } from 'vue'
Expand Down
2 changes: 1 addition & 1 deletion app/components/VCountUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function loopAnim() {
loopCount++
startAnim(() => {
const isTruely = typeof props.loop === 'boolean' && props.loop
if (isTruely || props.loop > loopCount) {
if (isTruely || Number(props.loop) > loopCount) {
delay(() => {
countUp.value?.reset()
loopAnim()
Expand Down
6 changes: 3 additions & 3 deletions app/components/VHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import { reactive } from 'vue'
import dayjs from 'dayjs'
const settingStore = useSettingStore()
// const settingStore = useSettingStore()
export interface DateDataType {
dateDay: string
dateYear: string
dateWeek: string
timing: NodeJS.Timer
timing: NodeJS.Timer | null
}
const dateData = reactive<DateDataType>({
Expand All @@ -23,7 +23,7 @@ const weekday = ['周日', '周一', '周二', '周三', '周四', '周五', '
function timeFn() {
dateData.timing = setInterval(() => {
dateData.dateDay = dayjs().format('YYYY-MM-DD hh : mm : ss')
dateData.dateWeek = weekday[dayjs().day()]
dateData.dateWeek = weekday[dayjs().day()]!
}, 1000)
}
timeFn()
Expand Down
2 changes: 1 addition & 1 deletion app/components/VItemWrap.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
const props = withDefaults(
withDefaults(
defineProps<{
// 标题
title: number | string
Expand Down
55 changes: 18 additions & 37 deletions app/components/VScreenBox.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- eslint-disable ts/no-unused-expressions -->
<script lang="ts" setup>
import { nextTick, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import type { CSSProperties, PropType } from 'vue'
Expand Down Expand Up @@ -33,28 +34,6 @@ const props = defineProps({
},
})

/**
* 防抖函数
* @param {Function} fn
* @param {number} delay
* @returns {() => void}
*/
function debounce(fn: Function, delay: number): () => void {
// let timer: NodeJS.Timer;
let timer: any
return function (...args: any[]): void {
if (timer)
clearTimeout(timer)
timer = setTimeout(
() => {
typeof fn === 'function' && fn.apply(null, args)
clearTimeout(timer)
},
delay > 0 ? delay : 100,
)
}
}
interface IState {
originalWidth: string | number
originalHeight: string | number
Expand Down Expand Up @@ -98,17 +77,19 @@ const styles: Record<string, CSSProperties> = {
const screenWrapper = ref<HTMLElement>()
const box = ref<HTMLElement>()

const onResize = debounce(async () => {
async function onResize() {
await initSize()
updateSize()
updateScale()
}, props.delay)
}

const debounceOnResize = useDebounceFn(onResize, props.delay)

watch(
() => props.autoScale,
async (newVal: any) => {
if (newVal) {
onResize()
debounceOnResize()
addListener()
}
else {
Expand Down Expand Up @@ -201,24 +182,24 @@ function updateScale() {
autoScale(scale)
}

function initMutationObserver() {
const observer = (state.observer = new MutationObserver(() => {
onResize()
}))
observer.observe(screenWrapper.value!, {
attributes: true,
attributeFilter: ['style'],
attributeOldValue: true,
})
}
// function initMutationObserver() {
// const observer = (state.observer = new MutationObserver(() => {
// debounceOnResize()
// }))
// observer.observe(screenWrapper.value!, {
// attributes: true,
// attributeFilter: ['style'],
// attributeOldValue: true,
// })
// }

function clearListener() {
window.removeEventListener('resize', onResize)
window.removeEventListener('resize', debounceOnResize)
// state.observer?.disconnect();
}

function addListener() {
window.addEventListener('resize', onResize)
window.addEventListener('resize', debounceOnResize)
// initMutationObserver();
}
onMounted(() => {
Expand Down
2 changes: 1 addition & 1 deletion app/components/VSeamlessScroll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface Emits {
(event: 'count', _count: number): void
(event: 'stop', _count: number): void
}
const scrollRef = ref(null)
// const scrollRef = ref(null)
const slotListRef = ref<HTMLDivElement | null>(null)
const realBoxRef = ref<HTMLDivElement | null>(null)
const reqFrame = ref<number | null>(null)
Expand Down
24 changes: 12 additions & 12 deletions app/components/VSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ function init() {
rightBottomRadio.value = indexConfig.value.rightBottomSwiper
}
init()
function handleClose() {}
// function handleClose() {}
function cancelClick() {
settingStore.setSettingShow(false)
}
// function cancelClick() {
// settingStore.setSettingShow(false)
// }
function confirmClick() {}
// function confirmClick() {}
function isScaleChange(flag: boolean) {
settingStore.setIsScale(flag)
}
function radiochange(blag: boolean) {
settingStore.setIsScale(blag)
// this.$store.commit('setting/updateSwiper', { val, type })
}
function indexRadioChange(flag: boolean) {
// function radiochange(blag: boolean) {
// settingStore.setIsScale(blag)
// // this.$store.commit('setting/updateSwiper', { val, type })
// }
function indexRadioChange() {
settingStore.setIndexConfig({
leftBottomSwiper: leftBottomRadio.value, // 左轮播
rightBottomSwiper: rightBottomRadio.value, // 右下轮播
Expand Down Expand Up @@ -74,7 +74,7 @@ function indexRadioChange(flag: boolean) {
<div class="setting_content">
<el-radio-group
v-model="leftBottomRadio"
@change="(flag) => indexRadioChange(flag as boolean)"
@change="() => indexRadioChange()"
>
<el-radio :label="true">
Expand All @@ -90,7 +90,7 @@ function indexRadioChange(flag: boolean) {
<div class="setting_content">
<el-radio-group
v-model="rightBottomRadio"
@change="(flag) => indexRadioChange(flag as boolean)"
@change="() => indexRadioChange()"
>
<el-radio :label="true">
Expand Down
2 changes: 1 addition & 1 deletion app/pages/index/components/center-bottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const option = ref({})
function getData() {
installationPlan()
.then((res) => {
.then((res: any) => {
if (res.data.success) {
setOption(res.data.data)
}
Expand Down
6 changes: 4 additions & 2 deletions app/pages/index/components/center-map.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- eslint-disable no-async-promise-executor -->
<script setup lang="ts">
import { getMap, registerMap } from 'echarts/core'
import { optionHandle, regionCodes } from './center.map'
Expand All @@ -15,7 +16,8 @@ withDefaults(
},
)
const option = ref({})
const code = ref('china'); async function dataSetHandle(regionCode: string, list: object[]) {
const code = ref('china')
async function dataSetHandle(regionCode: string, list: object[]) {
const geojson: any = await getGeojson(regionCode)
const cityCenter: any = {}
const mapData: MapdataType[] = []
Expand All @@ -39,7 +41,7 @@ const code = ref('china'); async function dataSetHandle(regionCode: string, list

async function getData(regionCode: string) {
centerMap({ regionCode })
.then((res) => {
.then((res: any) => {
if (res.data.success) {
dataSetHandle(res.data.data.regionCode, res.data.data.dataList)
}
Expand Down
6 changes: 3 additions & 3 deletions app/pages/index/components/left-bottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const state = reactive<any>({
function getData() {
leftBottom({ limitNum: 20 })
.then((res) => {
.then((res: any) => {
if (res.data.success) {
state.list = res.data.data.list
}
Expand Down Expand Up @@ -74,7 +74,7 @@ onMounted(() => {
<div class="flex">
<div class="info">
<span class="labels">设备ID:</span>
<span class="text-content zhuyao doudong wangguan"> {{ item.gatewayno }}</span>
<span class="doudong zhuyao wangguan text-content"> {{ item.gatewayno }}</span>
</div>
<div class="info">
<span class="labels">时间:</span>
Expand All @@ -83,7 +83,7 @@ onMounted(() => {
</div>

<span
class="types doudong"
class="doudong types"
:class="{
typeRed: item.onlineState === 0,
typeGreen: item.onlineState === 1,
Expand Down
6 changes: 3 additions & 3 deletions app/pages/index/components/left-center.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const state = reactive({
})
function echartsGraphic(colors: string[]) {
return new graphic.LinearGradient(1, 0, 0, 0, [
{ offset: 0, color: colors[0] },
{ offset: 1, color: colors[1] },
{ offset: 0, color: colors[0]! },
{ offset: 1, color: colors[1]! },
])
}
function getData() {
countUserNum().then((res) => {
countUserNum().then((res: any) => {
if (res.data.success) {
state.lockNum = res.data.data.lockNum
state.offlineNum = res.data.data.offlineNum
Expand Down
2 changes: 1 addition & 1 deletion app/pages/index/components/left-top.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const state = reactive({
})
function getData() {
countDeviceNum().then((res) => {
countDeviceNum().then((res: any) => {
if (res.data.success) {
state.alarmNum = res.data.data.alarmNum
state.offlineNum = res.data.data.offlineNum
Expand Down
Loading

0 comments on commit 90d2b60

Please sign in to comment.