新增功能:添加zhaozuohong.vip镜像选项
This commit is contained in:
parent
501259b420
commit
de2c2af2bd
9 changed files with 123 additions and 14 deletions
30
ui/src/components/BaseMirrorOption.vue
Normal file
30
ui/src/components/BaseMirrorOption.vue
Normal file
|
@ -0,0 +1,30 @@
|
|||
<script setup>
|
||||
import { form_item_label_style } from '@/styles/styles.js'
|
||||
import { useConfigStore } from '@/stores/config.js'
|
||||
|
||||
const conf = useConfigStore().config
|
||||
|
||||
const running = inject('running')
|
||||
|
||||
async function test_connect() {
|
||||
running.value = true
|
||||
await pywebview.api.test_base_url_connect()
|
||||
running.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-form-item label="镜像模式" :label-style="form_item_label_style">
|
||||
<n-radio-group v-model:value="conf.base_mirror" :disabled="running">
|
||||
<n-flex>
|
||||
<n-radio value="0">默认模式</n-radio>
|
||||
<n-radio value="1">镜像模式(-cf后缀)</n-radio>
|
||||
</n-flex>
|
||||
</n-radio-group>
|
||||
<n-button strong secondary type="primary" size="small" @click="test_connect" :disabled="running"
|
||||
>测试连接</n-button
|
||||
>
|
||||
</n-form-item>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
|
@ -1,4 +1,6 @@
|
|||
<script setup>
|
||||
import BaseMirrorOption from '@/components/BaseMirrorOption.vue'
|
||||
|
||||
const steps = ref([
|
||||
{
|
||||
title: '下载 git、python',
|
||||
|
@ -22,6 +24,9 @@ provide('current_state', current_state)
|
|||
|
||||
<template>
|
||||
<n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box">
|
||||
<n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
|
||||
<base-mirror-option />
|
||||
</n-form>
|
||||
<n-alert title="以下步骤仅需运行一次" type="warning" />
|
||||
<n-steps :current="current_step" :status="current_state" size="small">
|
||||
<n-step v-for="step in steps" :title="step.title" />
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { SyncCircle } from '@vicons/ionicons5'
|
||||
import { Sync } from '@vicons/ionicons5'
|
||||
import { form_item_label_style } from '@/styles/styles.js'
|
||||
import BaseMirrorOption from '@/components/BaseMirrorOption.vue'
|
||||
|
||||
const notification = useNotification()
|
||||
|
||||
|
@ -58,17 +59,20 @@ async function check_update() {
|
|||
<template>
|
||||
<n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box">
|
||||
<n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
|
||||
<base-mirror-option />
|
||||
<n-form-item label="版本" :label-style="form_item_label_style">
|
||||
<n-space align="center">
|
||||
{{ version }}
|
||||
<n-button
|
||||
type="success"
|
||||
secondary
|
||||
size="small"
|
||||
:loading="check_running"
|
||||
:disabled="running"
|
||||
@click="check_update"
|
||||
>
|
||||
<template #icon>
|
||||
<n-icon :component="SyncCircle"></n-icon>
|
||||
<n-icon :component="Sync"></n-icon>
|
||||
</template>
|
||||
检查更新
|
||||
</n-button>
|
||||
|
@ -77,11 +81,14 @@ async function check_update() {
|
|||
<n-alert style="margin: 8px 0" type="success" v-if="update_able">
|
||||
<template #header>
|
||||
最新版本:{{ `${new_version.tag_name} ${new_version.name}` }}
|
||||
<n-button style="float: right" @click="open_new_version_html">了解此版本</n-button>
|
||||
<n-button type="success" secondary style="float: right" @click="open_new_version_html">
|
||||
了解此版本
|
||||
</n-button>
|
||||
</template>
|
||||
<n-space>
|
||||
<n-button
|
||||
type="success"
|
||||
secondary
|
||||
:loading="update_self_running"
|
||||
:disabled="running"
|
||||
@click="update_self"
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
<script setup>
|
||||
import { useConfigStore } from '@/stores/config.js'
|
||||
import { form_item_label_style } from '@/styles/styles.js'
|
||||
import BaseMirrorOption from '@/components/BaseMirrorOption.vue'
|
||||
|
||||
const conf = useConfigStore().config
|
||||
const branch = ref(null)
|
||||
const mirror = ref(null)
|
||||
const running = inject('running')
|
||||
|
||||
const steps = computed(() => [
|
||||
{
|
||||
title: '更新源码',
|
||||
command: ['fetch', 'switch', 'reset'],
|
||||
command: ['set_remote', 'set_lfs', 'fetch', 'switch', 'reset'],
|
||||
cwd: 'mower-ng'
|
||||
},
|
||||
{
|
||||
|
@ -28,8 +30,9 @@ provide('current_state', current_state)
|
|||
<template>
|
||||
<n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box">
|
||||
<n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
|
||||
<base-mirror-option />
|
||||
<n-form-item label="mower-ng 代码分支" :label-style="form_item_label_style">
|
||||
<n-radio-group v-model:value="conf.branch">
|
||||
<n-radio-group v-model:value="conf.branch" :disabled="running">
|
||||
<n-flex>
|
||||
<n-radio value="fast">测试版</n-radio>
|
||||
<n-radio value="slow">稳定版</n-radio>
|
||||
|
@ -37,7 +40,7 @@ provide('current_state', current_state)
|
|||
</n-radio-group>
|
||||
</n-form-item>
|
||||
<n-form-item label="PyPI 仓库镜像" :label-style="form_item_label_style">
|
||||
<n-radio-group v-model:value="conf.mirror">
|
||||
<n-radio-group v-model:value="conf.mirror" :disabled="running">
|
||||
<n-flex>
|
||||
<n-radio value="pypi">PyPI</n-radio>
|
||||
<n-radio value="aliyun">阿里云镜像站</n-radio>
|
||||
|
|
|
@ -20,6 +20,8 @@ export const useConfigStore = defineStore('config', () => {
|
|||
// 启动程序 LaunchPart
|
||||
this.instances = []
|
||||
this.is_show_log = conf.is_show_log
|
||||
// 其他部分 OtherPart
|
||||
this.base_mirror = conf.base_mirror
|
||||
Object.assign(this, conf)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue