diff --git a/.lintstagedrc.json b/.lintstagedrc.json index 3ae556d..ed2a987 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,4 +1,9 @@ { - "src/**/*.{vue,js}": ["npm run prettier", "npm run eslint"], - "src/**/*.{vue,scss,css,less}": ["npm run stylelint:out"] -} + "*.{vue,js}": [ + "prettier --write", + "eslint --fix" + ], + "*.{vue,scss,css,less}": [ + "stylelint --fix" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 51c700d..5a12c60 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "vite-plugin-eslint": "^1.8.1" }, "scripts": { + "prepare": "husky install", "format": "prettier --write \"**/*.{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}\"", diff --git a/pages/addDevice/distributionNetwork.vue b/pages/addDevice/distributionNetwork.vue index 6c96deb..2290a35 100644 --- a/pages/addDevice/distributionNetwork.vue +++ b/pages/addDevice/distributionNetwork.vue @@ -77,11 +77,12 @@ const pending = ref(false) - const result = ref(false) + const requestResult = ref(false) onMounted(async () => { uni.showLoading({ - title: '搜索中' + title: '搜索中', + mask: true }) const result = await $bluetooth.getWifiList({ uid: $user.userInfo.uid.toString() @@ -124,7 +125,7 @@ } }) uni.$on('distributionNetworkResult', async data => { - result.value = false + requestResult.value = false uni.hideLoading() pending.value = false if (data.status === 0) { @@ -190,10 +191,10 @@ }) if (res.code === 0) { - result.value = true + requestResult.value = true setTimeout(() => { pending.value = false - if (result.value) { + if (requestResult.value) { uni.showToast({ title: '配网失败,请检查密码是否正确', icon: 'none'