|
|
@@ -1,13 +1,26 @@
|
|
|
<template>
|
|
|
- <modal-pro
|
|
|
+ <div
|
|
|
+ :style="{
|
|
|
+ height: 'calc(100vh - 120px)',
|
|
|
+ backgroundColor: 'red',
|
|
|
+ position: 'fixed',
|
|
|
+ top: '0px',
|
|
|
+ right: '0px',
|
|
|
+ zIndex: 1000,
|
|
|
+ }"
|
|
|
+ >
|
|
|
+
|
|
|
+ <a-drawer
|
|
|
:label="getModalTitle()"
|
|
|
+ size="600px"
|
|
|
:open="open"
|
|
|
:mask="false"
|
|
|
- width="640px"
|
|
|
- @close="emits('update:open', false)"
|
|
|
- @confirm="saveGameConfig"
|
|
|
- styles="position: fixed;top: 60px;right: 90px; pointer-events: none;"
|
|
|
+ :closable="false"
|
|
|
+ placement="right"
|
|
|
+ :get-container="false"
|
|
|
+ :style="{ position: 'absolute', top: '0px', right: '0px', width: '600px' }"
|
|
|
>
|
|
|
+ <!-- -->
|
|
|
<template #title>
|
|
|
<div style="display: flex;justify-content: space-between;" >
|
|
|
<div>
|
|
|
@@ -21,13 +34,19 @@
|
|
|
</a-tooltip>
|
|
|
</a-space>
|
|
|
</div>
|
|
|
- <a-button v-if="currentLevel === 0" type="primary" size="small" @click="createGameOne">
|
|
|
- <template #icon><plus-outlined /></template>
|
|
|
- 新增
|
|
|
- </a-button>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
+ <template #extra >
|
|
|
+ <a-space>
|
|
|
+ <a-button v-if="currentLevel === 0" type="primary" @click="createGameOne">
|
|
|
+ <template #icon><plus-outlined /></template>
|
|
|
+ 新增
|
|
|
+ </a-button>
|
|
|
+ <a-button @click="emits('update:open', false)">取消</a-button>
|
|
|
+ <a-button type="primary" @click="saveGameConfig" :loading="saveLoading" ghost>保存</a-button>
|
|
|
+ </a-space>
|
|
|
+ </template>
|
|
|
<div class="config-game-page">
|
|
|
<div class="game-modal-content">
|
|
|
<!-- 显示返回按钮和新增按钮,仅在非顶级目录显示 -->
|
|
|
@@ -107,9 +126,9 @@
|
|
|
<a-space>
|
|
|
<div>游戏 {{ index + 1 }}</div>
|
|
|
<div class="folder-info">
|
|
|
- <div v-if="item.sub_subject?.ok" class="music-badge">
|
|
|
+ <div v-if="item.sub_subject?.music_name ? item.sub_subject.music_name : item.sub_subject.ok" class="music-badge">
|
|
|
<sound-outlined />
|
|
|
- <span class="music-name">{{ item.sub_subject.ok }}</span>
|
|
|
+ <span class="music-name">{{ item.sub_subject?.music_name ? item.sub_subject.music_name : item.sub_subject.ok }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</a-space>
|
|
|
@@ -143,6 +162,7 @@
|
|
|
<gameStage3
|
|
|
v-if="cardJson.game_list[currentGameIndex]?.items?.[currentSubFolderIndex]"
|
|
|
v-model="cardJson.game_list[currentGameIndex].items[currentSubFolderIndex]"
|
|
|
+ :gameIndex="currentSubFolderIndex"
|
|
|
v-model:touch_key="cardJson.game_list[currentGameIndex].touch_key"
|
|
|
:rule="cardJson.game_list[currentGameIndex].rule"
|
|
|
@update:modelValue="changedSteps"
|
|
|
@@ -152,7 +172,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </modal-pro>
|
|
|
+ </a-drawer>
|
|
|
|
|
|
<!-- 新增子项目弹窗 -->
|
|
|
<a-modal
|
|
|
@@ -164,15 +184,15 @@
|
|
|
<a-form :model="subItemForm" layout="vertical">
|
|
|
<a-form-item label="子主题音乐">
|
|
|
<SelectAudioNew
|
|
|
- v-model="subItemForm.sub_subject.ok"
|
|
|
+ v-model="subItemForm.sub_subject[editForm.rule == '7' ? 'ok' : 'music_name']"
|
|
|
placeholder="请选择子主题音乐"
|
|
|
/>
|
|
|
|
|
|
<!-- 已选择的音乐名称展示区域 -->
|
|
|
- <div v-if="subItemForm.sub_subject.ok" class="selected-music-display">
|
|
|
+ <div v-if="subItemForm.sub_subject[editForm.rule == '7' ? 'ok' : 'music_name']" class="selected-music-display">
|
|
|
<div class="music-info">
|
|
|
<sound-outlined />
|
|
|
- <span class="music-name">{{ subItemForm.sub_subject.ok }}</span>
|
|
|
+ <span class="music-name">{{ subItemForm.sub_subject[editForm.rule == '7' ? 'ok' : 'music_name'] }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</a-form-item>
|
|
|
@@ -190,15 +210,15 @@
|
|
|
<a-form :model="editSubItemForm" layout="vertical">
|
|
|
<a-form-item label="子主题音乐">
|
|
|
<SelectAudioNew
|
|
|
- v-model="editSubItemForm.sub_subject.ok"
|
|
|
+ v-model="editSubItemForm.sub_subject[editForm.rule == '7' ? 'ok' : 'music_name']"
|
|
|
placeholder="请选择子主题音乐"
|
|
|
/>
|
|
|
|
|
|
<!-- 已选择的音乐名称展示区域 -->
|
|
|
- <div v-if="editSubItemForm.sub_subject.ok" class="selected-music-display">
|
|
|
+ <div v-if="editSubItemForm.sub_subject[editForm.rule == '7' ? 'ok' : 'music_name']" class="selected-music-display">
|
|
|
<div class="music-info">
|
|
|
<sound-outlined />
|
|
|
- <span class="music-name">{{ editSubItemForm.sub_subject.ok }}</span>
|
|
|
+ <span class="music-name">{{ editSubItemForm.sub_subject[editForm.rule == '7' ? 'ok' : 'music_name'] }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</a-form-item>
|
|
|
@@ -296,6 +316,8 @@
|
|
|
</a-row> -->
|
|
|
</a-form>
|
|
|
</a-modal>
|
|
|
+
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script lang='ts' setup>
|
|
|
@@ -334,6 +356,8 @@ const props = defineProps({
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+const saveLoading = ref(false)
|
|
|
+
|
|
|
const gameStateComputed = computed(() => {
|
|
|
if (cardJson.value.game_list.length === 0) return ''
|
|
|
const rule = cardJson.value.game_list[currentGameIndex.value].rule
|
|
|
@@ -445,13 +469,13 @@ const createGameOne = () => {
|
|
|
const validateGameConfig = (gameConfig: any) => {
|
|
|
const requiredFields = [
|
|
|
'rule',
|
|
|
- 'main_subject.music_name',
|
|
|
- 'ordered_multiple_err.music_name',
|
|
|
- 'has_click_single.music_name',
|
|
|
- 'still_have.music_name',
|
|
|
- 'has_click_group.music_name',
|
|
|
- 'wait_30s.music_name',
|
|
|
- 'wait_90s.music_name'
|
|
|
+ 'main_subject.music_name'
|
|
|
+ // 'ordered_multiple_err.music_name',
|
|
|
+ // 'has_click_single.music_name',
|
|
|
+ // 'still_have.music_name',
|
|
|
+ // 'has_click_group.music_name',
|
|
|
+ // 'wait_30s.music_name',
|
|
|
+ // 'wait_90s.music_name'
|
|
|
]
|
|
|
|
|
|
const missingFields: string[] = []
|
|
|
@@ -483,13 +507,13 @@ const enterFolder = (index: number) => {
|
|
|
if (!validation.isValid) {
|
|
|
const fieldNames = {
|
|
|
rule: '规则',
|
|
|
- 'main_subject.music_name': '主题音乐',
|
|
|
- 'ordered_multiple_err.music_name': '顺序多选错误音乐',
|
|
|
- 'has_click_single.music_name': '重复单击音乐',
|
|
|
- 'still_have.music_name': '再次点击音乐',
|
|
|
- 'has_click_group.music_name': '重复组点击音乐',
|
|
|
- 'wait_30s.music_name': '等待30秒音乐',
|
|
|
- 'wait_90s.music_name': '等待90秒音乐'
|
|
|
+ 'main_subject.music_name': '主题音乐'
|
|
|
+ // 'ordered_multiple_err.music_name': '顺序多选错误音乐',
|
|
|
+ // 'has_click_single.music_name': '重复单击音乐',
|
|
|
+ // 'still_have.music_name': '再次点击音乐',
|
|
|
+ // 'has_click_group.music_name': '重复组点击音乐',
|
|
|
+ // 'wait_30s.music_name': '等待30秒音乐',
|
|
|
+ // 'wait_90s.music_name': '等待90秒音乐'
|
|
|
}
|
|
|
|
|
|
const missingFieldNames = validation.missingFields.map(field => fieldNames[field] || field)
|
|
|
@@ -532,10 +556,10 @@ const createSubItem = () => {
|
|
|
// 新建二级文件夹
|
|
|
const handleSaveSubItem = () => {
|
|
|
// 基础校验:必须选择子主题音乐
|
|
|
- if (!subItemForm.sub_subject.music_name) {
|
|
|
- message.warning('请选择子主题音乐')
|
|
|
- return
|
|
|
- }
|
|
|
+ // if (!subItemForm.sub_subject.music_name) {
|
|
|
+ // message.warning('请选择子主题音乐')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
const index = currentGameIndex.value
|
|
|
const currentGame = cardJson.value.game_list[index]
|
|
|
@@ -577,12 +601,21 @@ const handleSaveSubItem = () => {
|
|
|
// 进入卡片配置
|
|
|
const enterCardConfig = (index: number) => {
|
|
|
currentSubFolderIndex.value = index
|
|
|
- const currentItem = cardJson.value.game_list[currentGameIndex.value]?.items?.[index]
|
|
|
+ const currentSubGame = cardJson.value.game_list[currentGameIndex.value]
|
|
|
+ const currentItem = currentSubGame?.items?.[index]
|
|
|
if (currentItem) {
|
|
|
if (!currentItem.steps) {
|
|
|
currentItem.steps = []
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (currentSubGame.touch_key[2].length <= index + 1) {
|
|
|
+ currentSubGame.touch_key[2].push({
|
|
|
+ is_break: 1,
|
|
|
+ music_name: '',
|
|
|
+ value: 2
|
|
|
+ })
|
|
|
+ }
|
|
|
currentLevel.value = 2
|
|
|
}
|
|
|
|
|
|
@@ -613,12 +646,10 @@ const handleEditSubItem = (index: number) => {
|
|
|
// 将当前子项目数据复制到编辑表单
|
|
|
const currentItem = cardJson.value.game_list[currentGameIndex.value].items[index]
|
|
|
editSubItemForm.sub_subject.music_name = currentItem.sub_subject.music_name
|
|
|
- editSubItemForm.sub_subject.mb = currentItem.sub_subject.mb
|
|
|
editSubItemForm.sub_subject.ok = currentItem.sub_subject.ok
|
|
|
- editSubItemForm.sub_subject.ob = currentItem.sub_subject.ob
|
|
|
editSubItemForm.sub_subject.err = currentItem.sub_subject.err
|
|
|
- editSubItemForm.sub_subject.eb = currentItem.sub_subject.eb
|
|
|
editSubItemModalVisible.value = true
|
|
|
+ console.log(editForm)
|
|
|
}
|
|
|
|
|
|
// 处理删除子项目
|
|
|
@@ -630,25 +661,11 @@ const handleDeleteSubItem = (index: number) => {
|
|
|
// 保存子项目编辑
|
|
|
const handleSaveSubItemEdit = () => {
|
|
|
if (editingSubItemIndex.value >= 0) {
|
|
|
- // 基础校验:必须选择子主题音乐
|
|
|
- if (!editSubItemForm.sub_subject.music_name) {
|
|
|
- message.warning('请选择子主题音乐')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
// 将编辑表单的数据保存到子项目列表
|
|
|
const currentItem = cardJson.value.game_list[currentGameIndex.value].items[editingSubItemIndex.value]
|
|
|
- currentItem.sub_subject.music_name = editSubItemForm.sub_subject.music_name
|
|
|
- currentItem.sub_subject.mb = editSubItemForm.sub_subject.mb || 1
|
|
|
+ currentItem.sub_subject.music_name = editSubItemForm.sub_subject.music_name || ''
|
|
|
currentItem.sub_subject.ok = editSubItemForm.sub_subject.ok || ''
|
|
|
- currentItem.sub_subject.ob = editSubItemForm.sub_subject.ob || 1
|
|
|
currentItem.sub_subject.err = editSubItemForm.sub_subject.err || ''
|
|
|
- currentItem.sub_subject.eb = editSubItemForm.sub_subject.eb || 1
|
|
|
-
|
|
|
- // if (!currentItem.ok_key) currentItem.ok_key = []
|
|
|
- // if (!currentItem.err_key) currentItem.err_key = []
|
|
|
- // if (!currentItem.ok_key_voice) currentItem.ok_key_voice = { value: 0, music_name: '', is_break: 1 }
|
|
|
- // if (!currentItem.err_key_voice) currentItem.err_key_voice = { value: 0, music_name: '', is_break: 1 }
|
|
|
}
|
|
|
editSubItemModalVisible.value = false
|
|
|
editingSubItemIndex.value = -1
|
|
|
@@ -685,14 +702,14 @@ const handleCancelEdit = () => {
|
|
|
}
|
|
|
|
|
|
// 保存游戏配置
|
|
|
-const saveGameConfig = async ({ confirmStart, confirmed }) => {
|
|
|
- confirmStart()
|
|
|
+const saveGameConfig = async () => {
|
|
|
+ saveLoading.value = true
|
|
|
// const defaultJson = await Car dController.getDefaultJson()
|
|
|
await CardController.add({
|
|
|
header: cardJson.value.header,
|
|
|
game_list: cardJson.value.game_list
|
|
|
})
|
|
|
- confirmed()
|
|
|
+ saveLoading.value = false
|
|
|
}
|
|
|
|
|
|
</script>
|