fix: 提示打包提交并重置表单
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
<label for="obfuscation">启用混淆</label>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="submitNotice" class="submit-notice" role="status" aria-live="polite">{{ submitNotice }}</p>
|
||||
<button class="btn btn-primary" @click="submitTask" :disabled="submitting">
|
||||
{{ submitting ? '提交中...' : '开始打包' }}
|
||||
</button>
|
||||
@@ -193,6 +194,7 @@ const form = ref({
|
||||
branch: 'main',
|
||||
})
|
||||
const submitting = ref(false)
|
||||
const submitNotice = ref('')
|
||||
const currentTaskId = ref(null)
|
||||
const completedTask = ref(null)
|
||||
const logs = ref([])
|
||||
@@ -294,7 +296,12 @@ watch(selectedServer, () => {
|
||||
form.value.app_id = ''
|
||||
})
|
||||
|
||||
watch(() => form.value.app_id, () => {
|
||||
watch(() => form.value.app_id, (appId) => {
|
||||
if (!appId) {
|
||||
form.value.scheme_id = ''
|
||||
form.value.build_type = ''
|
||||
return
|
||||
}
|
||||
form.value.scheme_id = filteredSchemes.value[0]?.[0] || ''
|
||||
form.value.build_type = availableBuildTypes.value[0] || ''
|
||||
})
|
||||
@@ -347,6 +354,7 @@ onMounted(async () => {
|
||||
})
|
||||
|
||||
const submitTask = async () => {
|
||||
if (submitting.value) return
|
||||
if (!form.value.app_id) {
|
||||
alert('请选择 App')
|
||||
return
|
||||
@@ -362,11 +370,20 @@ const submitTask = async () => {
|
||||
const task = await res.json()
|
||||
currentTaskId.value = task.id
|
||||
tasks.value.unshift(task)
|
||||
submitNotice.value = '打包任务已创建,正在排队,请勿重复点击。'
|
||||
selectedServer.value = ''
|
||||
form.value = {
|
||||
app_id: '',
|
||||
build_type: '',
|
||||
scheme_id: '',
|
||||
obfuscation: false,
|
||||
branch: branches.value[0] || 'main',
|
||||
}
|
||||
} else {
|
||||
alert('提交失败')
|
||||
submitNotice.value = '提交失败,请检查配置后重试。'
|
||||
}
|
||||
} catch (e) {
|
||||
alert('提交失败')
|
||||
submitNotice.value = '提交失败,请检查网络后重试。'
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
@@ -443,6 +460,7 @@ const errorCategoryHint = (cat) => {
|
||||
.btn-primary { background: #1890ff; color: white; }
|
||||
.btn-primary:hover { background: #40a9ff; }
|
||||
.btn-primary:disabled { background: #d9d9d9; cursor: not-allowed; }
|
||||
.submit-notice { margin: 0 0 12px; padding: 9px 12px; border-radius: 6px; background: #e6f7ff; color: #096dd9; font-size: 13px; line-height: 1.5; }
|
||||
.btn-danger { background: #ff4d4f; color: white; }
|
||||
|
||||
.right-panel { display: flex; flex-direction: column; gap: 16px; height: calc(100vh - 120px); overflow: hidden; }
|
||||
|
||||
Reference in New Issue
Block a user