|
|
@@ -1,101 +1,134 @@
|
|
|
<template>
|
|
|
<div class="game-stage-3">
|
|
|
- <div class="step-list" >
|
|
|
- <a-row style="width: 100%">
|
|
|
- <a-col :span="24" style="margin-bottom: 16px">
|
|
|
- <a-space>
|
|
|
- <div class="step-title" >正确按钮</div>
|
|
|
- <a-button type="primary" size="small" @click="showAddStepModal('success')"> 新增 </a-button>
|
|
|
-
|
|
|
- </a-space>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <VueDraggableNext
|
|
|
- :list="steps.ok_key"
|
|
|
- group="people"
|
|
|
- item-key="id"
|
|
|
- :animation="300"
|
|
|
- @end="onDragEnd"
|
|
|
- >
|
|
|
- <div v-for="(element, index) in steps.ok_key" :key="index" class="step-item-wrapper">
|
|
|
- <div
|
|
|
- class="step-item"
|
|
|
- :class="{ 'step-item-active': activeStepIndex === element.value }"
|
|
|
- @click="selectStep(element.value)"
|
|
|
- >
|
|
|
- <div class="step-info">
|
|
|
- <span class="step-number">按钮 {{ index + 1 }}</span>
|
|
|
- <div class="step-details">
|
|
|
- <span>按钮: <strong>{{ getButtonLabel(element.value) }}</strong></span>
|
|
|
- <span>音频: <strong>{{ element.music_name }}</strong></span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="step-actions">
|
|
|
- <a-popconfirm
|
|
|
- title="确定要删除这个步骤吗?"
|
|
|
- ok-text="确定"
|
|
|
- cancel-text="取消"
|
|
|
- @confirm.stop="deleteGameStep(index, 'ok_key')"
|
|
|
-
|
|
|
- @cancel.stop
|
|
|
- >
|
|
|
- <delete-outlined @click.stop />
|
|
|
- </a-popconfirm>
|
|
|
+ <div class="top-config">
|
|
|
+ <a-collapse :bordered="false">
|
|
|
+ <a-collapse-panel key="1">
|
|
|
+ <template #header>
|
|
|
+ <div class="collapse-header">
|
|
|
+ <span>顶部按钮配置</span>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </VueDraggableNext>
|
|
|
- <a-empty v-if="steps.ok_key.length === 0" description="暂无正确按钮,请点击新增按钮" />
|
|
|
+ </template>
|
|
|
+ <a-form layout="vertical">
|
|
|
+ <a-form-item label="按钮音频">
|
|
|
+ <SelectAudioNew
|
|
|
+ v-model="touch_keys[0][0].music_name"
|
|
|
+ placeholder="请选择队员按钮音频"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+
|
|
|
+ <a-form-item label="刷新按钮音频">
|
|
|
+ <SelectAudioNew
|
|
|
+ v-model="touch_keys[1][0].music_name"
|
|
|
+ placeholder="请选择刷新按钮音频"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
|
|
|
+ <a-form-item label="提示按钮音频">
|
|
|
+ <SelectAudioNew
|
|
|
+ v-model="touch_keys[2][0].music_name"
|
|
|
+ placeholder="请选择提示按钮音频"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
+ </a-collapse-panel>
|
|
|
+ </a-collapse>
|
|
|
</div>
|
|
|
- <div class="step-list" >
|
|
|
- <a-row style="width: 100%">
|
|
|
- <a-col :span="24" style="margin-bottom: 16px">
|
|
|
- <a-space>
|
|
|
- <div class="step-title" >错误按钮</div>
|
|
|
- <a-button type="primary" size="small" @click="showAddStepModal('error')"> 新增</a-button>
|
|
|
- </a-space>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <VueDraggableNext
|
|
|
- :list="steps.err_key"
|
|
|
- group="people"
|
|
|
- item-key="id"
|
|
|
- :animation="300"
|
|
|
- @end="onDragEnd"
|
|
|
- >
|
|
|
- <div v-for="(element, index) in steps.err_key" :key="index" class="step-item-wrapper">
|
|
|
- <div
|
|
|
- class="step-item"
|
|
|
- :class="{ 'step-item-active': activeStepIndex === element.value }"
|
|
|
- @click="selectStep(element.value)"
|
|
|
+ <div class="step-list" v-if="getBtnRuleByRule === 'multiple'">
|
|
|
+ <a-collapse :bordered="false" >
|
|
|
+ <a-collapse-panel key="2" >
|
|
|
+ <template #header>
|
|
|
+ <div class="collapse-header">
|
|
|
+ <span>正确按钮 ({{ steps.ok_key.length }})</span>
|
|
|
+ <a-button type="primary" size="small" @click.stop="showAddStepModal('success')">新增</a-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <VueDraggableNext
|
|
|
+ :list="steps.ok_key"
|
|
|
+ group="people"
|
|
|
+ item-key="id"
|
|
|
+ :animation="300"
|
|
|
+ @end="onDragEnd"
|
|
|
>
|
|
|
- <div class="step-info">
|
|
|
- <span class="step-number">按钮 {{ index + 1 }}</span>
|
|
|
- <div class="step-details">
|
|
|
- <span>按钮: <strong>{{ getButtonLabel(element.value) }}</strong></span>
|
|
|
- <span>音频: <strong>{{ element.music_name }}</strong></span>
|
|
|
+ <div v-for="(element, index) in steps.ok_key" :key="index" class="step-item-wrapper">
|
|
|
+ <div
|
|
|
+ class="step-item"
|
|
|
+ :class="{ 'step-item-active': activeStepIndex === element.value }"
|
|
|
+ @click="selectStep(element.value)"
|
|
|
+ >
|
|
|
+ <div class="step-info">
|
|
|
+ <span class="step-number">按钮 {{ index + 1 }}</span>
|
|
|
+ <div class="step-details">
|
|
|
+ <span>按钮: <strong>{{ getButtonLabel(element.value) }}</strong></span>
|
|
|
+ <span>音频: <strong>{{ element.music_name }}</strong></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="step-actions">
|
|
|
+ <a-popconfirm
|
|
|
+ title="确定要删除这个步骤吗?"
|
|
|
+ ok-text="确定"
|
|
|
+ cancel-text="取消"
|
|
|
+ @confirm.stop="deleteGameStep(index, 'ok_key')"
|
|
|
+ @cancel.stop
|
|
|
+ >
|
|
|
+ <delete-outlined @click.stop />
|
|
|
+ </a-popconfirm>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="step-actions">
|
|
|
- <a-popconfirm
|
|
|
- title="确定要删除这个步骤吗?"
|
|
|
- ok-text="确定"
|
|
|
- cancel-text="取消"
|
|
|
- @confirm.stop="deleteGameStep(index, 'err_key')"
|
|
|
-
|
|
|
- @cancel.stop
|
|
|
+ </VueDraggableNext>
|
|
|
+ <a-empty v-if="steps.ok_key.length === 0" description="暂无正确按钮,请点击新增按钮" />
|
|
|
+ </a-collapse-panel>
|
|
|
+ </a-collapse>
|
|
|
+ </div>
|
|
|
+ <div class="step-list" v-if="getBtnRuleByRule === 'multiple'">
|
|
|
+ <a-collapse :bordered="false">
|
|
|
+ <a-collapse-panel key="3">
|
|
|
+ <template #header>
|
|
|
+ <div class="collapse-header">
|
|
|
+ <span>错误按钮 ({{ steps.err_key.length }})</span>
|
|
|
+ <a-button type="primary" size="small" @click.stop="showAddStepModal('error')">新增</a-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <VueDraggableNext
|
|
|
+ :list="steps.err_key"
|
|
|
+ group="people"
|
|
|
+ item-key="id"
|
|
|
+ :animation="300"
|
|
|
+ @end="onDragEnd"
|
|
|
+ >
|
|
|
+ <div v-for="(element, index) in steps.err_key" :key="index" class="step-item-wrapper">
|
|
|
+ <div
|
|
|
+ class="step-item"
|
|
|
+ :class="{ 'step-item-active': activeStepIndex === element.value }"
|
|
|
+ @click="selectStep(element.value)"
|
|
|
>
|
|
|
- <delete-outlined @click.stop />
|
|
|
- </a-popconfirm>
|
|
|
+ <div class="step-info">
|
|
|
+ <span class="step-number">按钮 {{ index + 1 }}</span>
|
|
|
+ <div class="step-details">
|
|
|
+ <span>按钮: <strong>{{ getButtonLabel(element.value) }}</strong></span>
|
|
|
+ <span>音频: <strong>{{ element.music_name }}</strong></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="step-actions">
|
|
|
+ <a-popconfirm
|
|
|
+ title="确定要删除这个步骤吗?"
|
|
|
+ ok-text="确定"
|
|
|
+ cancel-text="取消"
|
|
|
+ @confirm.stop="deleteGameStep(index, 'err_key')"
|
|
|
+ @cancel.stop
|
|
|
+ >
|
|
|
+ <delete-outlined @click.stop />
|
|
|
+ </a-popconfirm>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </VueDraggableNext>
|
|
|
- <a-empty v-if="steps.err_key.length === 0" description="暂无错误按钮,请点击新增按钮" />
|
|
|
-
|
|
|
+ </VueDraggableNext>
|
|
|
+ <a-empty v-if="steps.err_key.length === 0" description="暂无错误按钮,请点击新增按钮" />
|
|
|
+ </a-collapse-panel>
|
|
|
+ </a-collapse>
|
|
|
</div>
|
|
|
-
|
|
|
<a-modal
|
|
|
v-model:open="addStepModalVisible"
|
|
|
width="600px"
|
|
|
@@ -188,19 +221,9 @@ import { VueDraggableNext } from 'vue-draggable-next'
|
|
|
import SelectAudioNew from './select-audio-new.vue'
|
|
|
import { message } from 'ant-design-vue'
|
|
|
|
|
|
-interface Step {
|
|
|
- success: {
|
|
|
- button_key: number;
|
|
|
- audio_name: string;
|
|
|
- }[]
|
|
|
- error: {
|
|
|
- button_key: number;
|
|
|
- audio_name: string;
|
|
|
- }[]
|
|
|
-}
|
|
|
-
|
|
|
interface Props {
|
|
|
modelValue: API.CardJson21Item,
|
|
|
+ touch_key: API.CardJson21TouchKey
|
|
|
rule: API.Rule
|
|
|
}
|
|
|
|
|
|
@@ -211,15 +234,27 @@ watch(
|
|
|
},
|
|
|
{ immediate: true }
|
|
|
)
|
|
|
+watch(
|
|
|
+ () => props.touch_key,
|
|
|
+ (newVal) => {
|
|
|
+ console.log('touch_keys 的改变:', props.touch_key)
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+)
|
|
|
|
|
|
const props = defineProps<Props>()
|
|
|
-const emits = defineEmits(['update:modelValue', 'step-selected'])
|
|
|
+const emits = defineEmits(['update:modelValue', 'step-selected', 'update:touch_key'])
|
|
|
|
|
|
const steps = computed({
|
|
|
get: () => props.modelValue,
|
|
|
set: (value) => emits('update:modelValue', value)
|
|
|
})
|
|
|
|
|
|
+const touch_keys = computed({
|
|
|
+ get: () => props.touch_key,
|
|
|
+ set: (value) => emits('update:touch_key', value)
|
|
|
+})
|
|
|
+
|
|
|
// 有的是单选(7、10) 有的是多选(9 , 11, 12, 13, 14, 15, 16) 17 单和多都可以,直接用多选
|
|
|
const getBtnRuleByRule = computed(() => {
|
|
|
if (props.rule === 7 || props.rule === 10) {
|
|
|
@@ -375,11 +410,12 @@ const handleDeleteButton = (value: number) => {
|
|
|
}
|
|
|
|
|
|
.step-item-wrapper {
|
|
|
+ // width: 100%;
|
|
|
margin-bottom: 12px;
|
|
|
}
|
|
|
|
|
|
.step-item {
|
|
|
- width: 100%;
|
|
|
+ width: 90%;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
@@ -435,13 +471,6 @@ const handleDeleteButton = (value: number) => {
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="less" scoped>
|
|
|
-.step-list {
|
|
|
- width: 100%;
|
|
|
- margin-bottom: 24px;
|
|
|
- .step-title {
|
|
|
- // margin-bottom: 24px;
|
|
|
- }
|
|
|
-}
|
|
|
.game-stage-3-modal {
|
|
|
.header {
|
|
|
display: flex;
|
|
|
@@ -488,6 +517,16 @@ const handleDeleteButton = (value: number) => {
|
|
|
z-index: 10;
|
|
|
}
|
|
|
|
|
|
+.top-config {
|
|
|
+ margin-bottom: 24px;
|
|
|
+}
|
|
|
+
|
|
|
+.button-type-hint {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 4px;
|
|
|
+}
|
|
|
+
|
|
|
.button-wrapper {
|
|
|
position: relative;
|
|
|
}
|
|
|
@@ -505,4 +544,35 @@ const handleDeleteButton = (value: number) => {
|
|
|
cursor: pointer;
|
|
|
z-index: 10;
|
|
|
}
|
|
|
+
|
|
|
+.panel-header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ margin-bottom: 16px;
|
|
|
+}
|
|
|
+
|
|
|
+.collapse-header {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.step-list {
|
|
|
+ width: 100%;
|
|
|
+ margin-bottom: 24px;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.ant-collapse-content-box) {
|
|
|
+ padding: 16px;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.ant-collapse) {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.ant-collapse-item) {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
</style>
|