初步代替几个bat脚本的功能

This commit is contained in:
zhbaor 2024-09-23 16:12:34 +08:00
commit d0fbc89012
19 changed files with 4002 additions and 0 deletions

View file

@ -0,0 +1,48 @@
<script setup>
import PlayIcon from '@vicons/ionicons5/Play'
import { inject } from 'vue'
const running = inject('running')
const log = inject('log')
const steps = inject('steps')
const current_step = inject('current_step')
const current_state = inject('current_state')
async function start() {
log.value = ''
running.value = true
for (const [i, step] of steps.value.entries()) {
current_step.value = i + 1
current_state.value = 'process'
for (const cmd of step.command) {
await pywebview.api.run(cmd, step.cwd)
}
}
current_state.value = 'finish'
running.value = false
}
</script>
<template>
<n-button class="float" type="primary" :loading="running" :disabled="running" @click="start">
<template #icon>
<n-icon>
<play-icon />
</n-icon>
</template>
{{ running ? '' : '运行' }}
</n-button>
</template>
<style scoped>
.float {
position: absolute;
right: 25px;
bottom: 25px;
opacity: 0.8;
}
.float:hover {
opacity: 1;
}
</style>

View file

@ -0,0 +1,8 @@
<script setup>
const log = inject('log')
const log_ele = inject('log_ele')
</script>
<template>
<n-log :log="log" style="flex-grow: 1" ref="log_ele" />
</template>