feat: 更新lint配置,优化代码格式化和修复脚本;修改配网逻辑中的变量名以提高可读性

This commit is contained in:
范鹏 2025-05-04 14:19:06 +08:00
parent f34f3aa14a
commit 0cc4dc3ec5
3 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,9 @@
{ {
"src/**/*.{vue,js}": ["npm run prettier", "npm run eslint"], "*.{vue,js}": [
"src/**/*.{vue,scss,css,less}": ["npm run stylelint:out"] "prettier --write",
"eslint --fix"
],
"*.{vue,scss,css,less}": [
"stylelint --fix"
]
} }

View File

@ -32,6 +32,7 @@
"vite-plugin-eslint": "^1.8.1" "vite-plugin-eslint": "^1.8.1"
}, },
"scripts": { "scripts": {
"prepare": "husky install",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"", "format": "prettier --write \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"", "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"",
"lint": "eslint --fix \"**/*.{js,jsx,ts,tsx,vue}\"", "lint": "eslint --fix \"**/*.{js,jsx,ts,tsx,vue}\"",

View File

@ -77,11 +77,12 @@
const pending = ref(false) const pending = ref(false)
const result = ref(false) const requestResult = ref(false)
onMounted(async () => { onMounted(async () => {
uni.showLoading({ uni.showLoading({
title: '搜索中' title: '搜索中',
mask: true
}) })
const result = await $bluetooth.getWifiList({ const result = await $bluetooth.getWifiList({
uid: $user.userInfo.uid.toString() uid: $user.userInfo.uid.toString()
@ -124,7 +125,7 @@
} }
}) })
uni.$on('distributionNetworkResult', async data => { uni.$on('distributionNetworkResult', async data => {
result.value = false requestResult.value = false
uni.hideLoading() uni.hideLoading()
pending.value = false pending.value = false
if (data.status === 0) { if (data.status === 0) {
@ -190,10 +191,10 @@
}) })
if (res.code === 0) { if (res.code === 0) {
result.value = true requestResult.value = true
setTimeout(() => { setTimeout(() => {
pending.value = false pending.value = false
if (result.value) { if (requestResult.value) {
uni.showToast({ uni.showToast({
title: '配网失败,请检查密码是否正确', title: '配网失败,请检查密码是否正确',
icon: 'none' icon: 'none'