mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
add loading status for auto detect browser
This commit is contained in:
@@ -15,7 +15,12 @@
|
|||||||
>
|
>
|
||||||
<div flex flex-1>
|
<div flex flex-1>
|
||||||
<el-input v-model="formData.browserPath" />
|
<el-input v-model="formData.browserPath" />
|
||||||
<el-button type="primary" @click="autoDetectPuppeteerExecutable">自动检测</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="isAutoDetectLoading"
|
||||||
|
@click="autoDetectPuppeteerExecutable"
|
||||||
|
>自动检测</el-button
|
||||||
|
>
|
||||||
<el-button :style="{ marginLeft: 0 }" @click="browserExecutableFile">浏览</el-button>
|
<el-button :style="{ marginLeft: 0 }" @click="browserExecutableFile">浏览</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -47,6 +52,7 @@
|
|||||||
Google Chrome
|
Google Chrome
|
||||||
官方网站,找到浏览器下载页面来下载安装程序。下载完毕后,执行安装程序。安装完成后,点击上方<a
|
官方网站,找到浏览器下载页面来下载安装程序。下载完毕后,执行安装程序。安装完成后,点击上方<a
|
||||||
href="javascript:;"
|
href="javascript:;"
|
||||||
|
:loading="isAutoDetectLoading"
|
||||||
@click="autoDetectPuppeteerExecutable"
|
@click="autoDetectPuppeteerExecutable"
|
||||||
>自动检测</a
|
>自动检测</a
|
||||||
>按钮再次尝试。目前(2026.2.7)已知 Chrome 最新版本为 144.0.7559.133
|
>按钮再次尝试。目前(2026.2.7)已知 Chrome 最新版本为 144.0.7559.133
|
||||||
@@ -99,7 +105,7 @@ import debounce from 'lodash/debounce'
|
|||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||||
import { EXPECT_CHROMIUM_BUILD_ID } from '../../../../common/constant'
|
import { EXPECT_CHROMIUM_BUILD_ID } from '../../../../common/constant'
|
||||||
|
import { sleep } from '@geekgeekrun/utils/sleep.mjs'
|
||||||
const { ipcRenderer } = electron
|
const { ipcRenderer } = electron
|
||||||
useRouter()
|
useRouter()
|
||||||
// const checkDependenciesResult = ref({})
|
// const checkDependenciesResult = ref({})
|
||||||
@@ -143,25 +149,32 @@ const rules = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isAutoDetectLoading = ref(false)
|
||||||
async function autoDetectPuppeteerExecutable() {
|
async function autoDetectPuppeteerExecutable() {
|
||||||
const result = await ipcRenderer.invoke('get-any-available-puppeteer-executable', {
|
isAutoDetectLoading.value = true
|
||||||
ignoreCached: true,
|
await sleep(50)
|
||||||
noSave: true
|
try {
|
||||||
})
|
const result = await ipcRenderer.invoke('get-any-available-puppeteer-executable', {
|
||||||
if (!result) {
|
ignoreCached: true,
|
||||||
|
noSave: true
|
||||||
|
})
|
||||||
|
if (!result) {
|
||||||
|
ElMessage({
|
||||||
|
message: '未检测到可用浏览器的可执行文件',
|
||||||
|
type: 'warning',
|
||||||
|
grouping: true
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
formData.value.browserPath = result.executablePath
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '未检测到可用浏览器的可执行文件',
|
message: '已找到可用浏览器,可执行文件路径已填入输入框',
|
||||||
type: 'warning',
|
type: 'success',
|
||||||
grouping: true
|
grouping: true
|
||||||
})
|
})
|
||||||
return
|
} finally {
|
||||||
|
isAutoDetectLoading.value = false
|
||||||
}
|
}
|
||||||
formData.value.browserPath = result.executablePath
|
|
||||||
ElMessage({
|
|
||||||
message: '已找到可用浏览器,可执行文件路径已填入输入框',
|
|
||||||
type: 'success',
|
|
||||||
grouping: true
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function browserExecutableFile() {
|
async function browserExecutableFile() {
|
||||||
|
|||||||
Reference in New Issue
Block a user