prettier format
This commit is contained in:
parent
8fd5b4c6e5
commit
d1b3d34c7a
2 changed files with 80 additions and 63 deletions
|
@ -3,39 +3,48 @@ const running = inject('running')
|
||||||
const notification = useNotification()
|
const notification = useNotification()
|
||||||
|
|
||||||
async function rm_site_packages_and_python_scripts() {
|
async function rm_site_packages_and_python_scripts() {
|
||||||
running.value = true
|
running.value = true
|
||||||
notification['info']({
|
notification['info']({
|
||||||
content: '提示',
|
content: '提示',
|
||||||
meta: '开始移除site-packages和python/Script目录',
|
meta: '开始移除site-packages和python/Script目录',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
const response = await pywebview.api.rm_site_packages()
|
const response = await pywebview.api.rm_site_packages()
|
||||||
notification['info']({
|
notification['info']({
|
||||||
content: '提示',
|
content: '提示',
|
||||||
meta: response,
|
meta: response,
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
const response2 = await pywebview.api.rm_python_scripts()
|
const response2 = await pywebview.api.rm_python_scripts()
|
||||||
notification['info']({
|
notification['info']({
|
||||||
content: '提示',
|
content: '提示',
|
||||||
meta: response2,
|
meta: response2,
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
running.value = false
|
running.value = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-flex vertical style="
|
<n-flex
|
||||||
|
vertical
|
||||||
|
style="
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
">
|
"
|
||||||
<n-button class="fix-btn" type="error" secondary size="large" @click="rm_site_packages_and_python_scripts">
|
>
|
||||||
移除 site-packages 和 python/Scripts 目录
|
<n-button
|
||||||
|
class="fix-btn"
|
||||||
|
type="error"
|
||||||
|
secondary
|
||||||
|
size="large"
|
||||||
|
@click="rm_site_packages_and_python_scripts"
|
||||||
|
>
|
||||||
|
移除 site-packages 和 python/Scripts 目录
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -14,43 +14,45 @@ const check_running = ref(false)
|
||||||
const update_self_running = ref(false)
|
const update_self_running = ref(false)
|
||||||
|
|
||||||
async function update_self() {
|
async function update_self() {
|
||||||
running.value = true
|
running.value = true
|
||||||
update_self_running.value = true
|
update_self_running.value = true
|
||||||
const response = await pywebview.api.update_self(new_version.value['assets'][0]['browser_download_url'])
|
const response = await pywebview.api.update_self(
|
||||||
notification['error']({
|
new_version.value['assets'][0]['browser_download_url']
|
||||||
content: '错误',
|
)
|
||||||
meta: response,
|
notification['error']({
|
||||||
duration: 3000
|
content: '错误',
|
||||||
})
|
meta: response,
|
||||||
update_self_running.value = false
|
duration: 3000
|
||||||
running.value = false
|
})
|
||||||
|
update_self_running.value = false
|
||||||
|
running.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
async function open_new_version_html() {
|
async function open_new_version_html() {
|
||||||
window.open(new_version.value['html_url'])
|
window.open(new_version.value['html_url'])
|
||||||
}
|
}
|
||||||
|
|
||||||
async function check_update() {
|
async function check_update() {
|
||||||
running.value = true
|
running.value = true
|
||||||
check_running.value = true
|
check_running.value = true
|
||||||
new_version.value = await pywebview.api.get_new_version()
|
new_version.value = await pywebview.api.get_new_version()
|
||||||
if(new_version.value.tag_name > version.value){
|
if (new_version.value.tag_name > version.value) {
|
||||||
update_able.value = true
|
update_able.value = true
|
||||||
notification['info']({
|
notification['info']({
|
||||||
content: '提示',
|
content: '提示',
|
||||||
meta: "有新版本可更新",
|
meta: '有新版本可更新',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
update_able.value = false
|
update_able.value = false
|
||||||
notification['info']({
|
notification['info']({
|
||||||
content: '提示',
|
content: '提示',
|
||||||
meta: "当前已是最新版本",
|
meta: '当前已是最新版本',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
check_running.value = false
|
check_running.value = false
|
||||||
running.value = false
|
running.value = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -59,8 +61,13 @@ async function check_update() {
|
||||||
<n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
|
<n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
|
||||||
<n-form-item label="版本">
|
<n-form-item label="版本">
|
||||||
<n-space align="center">
|
<n-space align="center">
|
||||||
{{version}}
|
{{ version }}
|
||||||
<n-button type="success" :loading="check_running" :disabled="running" @click="check_update">
|
<n-button
|
||||||
|
type="success"
|
||||||
|
:loading="check_running"
|
||||||
|
:disabled="running"
|
||||||
|
@click="check_update"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon :component="SyncCircle"></n-icon>
|
<n-icon :component="SyncCircle"></n-icon>
|
||||||
</template>
|
</template>
|
||||||
|
@ -68,17 +75,18 @@ async function check_update() {
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-alert
|
<n-alert style="margin: 8px 0" type="success" v-if="update_able">
|
||||||
style="margin: 8px 0"
|
|
||||||
type="success"
|
|
||||||
v-if="update_able"
|
|
||||||
>
|
|
||||||
<template #header>
|
<template #header>
|
||||||
最新版本:{{new_version.name}}
|
最新版本:{{ new_version.name }}
|
||||||
<n-button style="float: right" @click="open_new_version_html">了解此版本</n-button>
|
<n-button style="float: right" @click="open_new_version_html">了解此版本</n-button>
|
||||||
</template>
|
</template>
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button type="success" :loading="update_self_running" :disabled="running" @click="update_self">
|
<n-button
|
||||||
|
type="success"
|
||||||
|
:loading="update_self_running"
|
||||||
|
:disabled="running"
|
||||||
|
@click="update_self"
|
||||||
|
>
|
||||||
立即更新
|
立即更新
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
|
|
Loading…
Reference in a new issue