Skip to content

Commit 7cc239a

Browse files
committed
feat: 支援卡选择页面框架
1 parent 947d54c commit 7cc239a

File tree

2 files changed

+130
-8
lines changed

2 files changed

+130
-8
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<template>
2+
<div id="support-card-select-modal" class="modal fade" data-backdrop="static" data-keyboard="false">
3+
<div class="modal-dialog modal-dialog-centered modal-md">
4+
<div class="modal-content" @click.stop>
5+
<div class="modal-header">
6+
<h5>支援卡选择</h5>
7+
</div>
8+
<div class="modal-body">
9+
<!-- 目前内容为空 -->
10+
</div>
11+
<div class="modal-footer">
12+
<span class="btn cancel-btn" @click="handleCancel">取消</span>
13+
</div>
14+
</div>
15+
</div>
16+
</div>
17+
</template>
18+
19+
<script>
20+
export default {
21+
name: "SupportCardSelectModal",
22+
props: {
23+
show: {
24+
type: Boolean,
25+
required: true
26+
}
27+
},
28+
emits: ['update:show', 'cancel'],
29+
watch: {
30+
show(newVal) {
31+
if (newVal) {
32+
// 显示弹窗
33+
$('#support-card-select-modal').modal({
34+
backdrop: 'static',
35+
keyboard: false,
36+
show: true
37+
});
38+
} else {
39+
// 隐藏弹窗
40+
$('#support-card-select-modal').modal('hide');
41+
}
42+
}
43+
},
44+
methods: {
45+
handleCancel() {
46+
this.$emit('update:show', false);
47+
this.$emit('cancel');
48+
// 恢复父modal滚动
49+
this.$nextTick(() => {
50+
this.restoreParentModalScrolling();
51+
});
52+
},
53+
restoreParentModalScrolling() {
54+
setTimeout(() => {
55+
if ($('.modal-open').length > 0) {
56+
$('body').addClass('modal-open');
57+
const parentModal = $('#create-task-list-modal');
58+
if (parentModal.hasClass('show')) {
59+
const modalBody = parentModal.find('.modal-body');
60+
if (modalBody.length > 0) {
61+
modalBody.css('overflow-y', 'auto');
62+
modalBody[0].offsetHeight;
63+
}
64+
}
65+
}
66+
}, 100);
67+
}
68+
},
69+
mounted() {
70+
$('#support-card-select-modal').on('hidden.bs.modal', () => {
71+
this.$emit('update:show', false);
72+
this.$nextTick(() => {
73+
this.restoreParentModalScrolling();
74+
});
75+
});
76+
}
77+
}
78+
</script>
79+
80+
<style scoped>
81+
.cancel-btn {
82+
background-color: #dc3545 !important;
83+
color: white !important;
84+
padding: 0.4rem 0.8rem !important;
85+
font-size: 1rem !important;
86+
border-radius: 0.25rem;
87+
border: none;
88+
cursor: pointer;
89+
}
90+
.cancel-btn:hover {
91+
background-color: #c82333 !important;
92+
color: white !important;
93+
}
94+
/* 保证弹窗在遮罩层之上 */
95+
#support-card-select-modal.modal {
96+
z-index: 1060;
97+
}
98+
#support-card-select-modal .modal-dialog {
99+
z-index: 1061;
100+
}
101+
</style>

web/src/components/TaskEditModal.vue

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<template>
22
<div id="create-task-list-modal" class="modal fade" data-backdrop="static" data-keyboard="false">
33
<div class="modal-dialog modal-dialog-centered modal-xl">
4-
<div class="modal-content" :class="{ 'dimmed': showAoharuConfigModal }">
4+
<div
5+
class="modal-content"
6+
:class="{ 'dimmed': showAoharuConfigModal || showSupportCardSelectModal }"
7+
>
58
<h5 class="modal-header">
69
新建任务
710
</h5>
@@ -102,9 +105,12 @@
102105
<div class="col-4">
103106
<div class="form-group">
104107
<label>⭐ 借用支援卡选择</label>
105-
<select v-model="selectedSupportCard" class="form-control" id="selectedSupportCard">
106-
<option v-for="card in umausumeSupportCardList" :value="card">({{card.desc}}) {{card.name}}</option>
107-
</select>
108+
<div style="display: flex; align-items: center;">
109+
<select v-model="selectedSupportCard" class="form-control" id="selectedSupportCard">
110+
<option v-for="card in umausumeSupportCardList" :value="card">({{card.desc}}) {{card.name}}</option>
111+
</select>
112+
<span class="btn auto-btn ml-2" style="white-space:nowrap;" v-on:click="openSupportCardSelectModal">更改</span>
113+
</div>
108114
</div>
109115
</div>
110116
<div class="col-2">
@@ -394,8 +400,13 @@
394400
:aoharuTeamNameSelection="aoharuTeamNameSelection"
395401
@confirm="handleAoharuConfigConfirm"
396402
></AoharuConfigModal>
397-
<!-- 遮罩层 -->
398-
<div v-if="showAoharuConfigModal" class="modal-backdrop-overlay" @click.stop></div>
403+
<!-- 支援卡选择弹窗 -->
404+
<SupportCardSelectModal
405+
v-model:show="showSupportCardSelectModal"
406+
@cancel="closeSupportCardSelectModal"
407+
></SupportCardSelectModal>
408+
<!-- 遮罩层,支持两种弹窗 -->
409+
<div v-if="showAoharuConfigModal || showSupportCardSelectModal" class="modal-backdrop-overlay" @click.stop></div>
399410
<!-- 通知 -->
400411
<div class="position-fixed" style="z-index: 5; right: 40%; width: 300px;">
401412
<div id="liveToast" class="toast hide" role="alert" aria-live="assertive" aria-atomic="true" data-delay="2000">
@@ -419,12 +430,14 @@
419430
<script>
420431
import SkillIcon from './SkillIcon.vue';
421432
import AoharuConfigModal from './AoharuConfigModal.vue';
433+
import SupportCardSelectModal from './SupportCardSelectModal.vue';
422434
423435
export default {
424436
name: "TaskEditModal",
425437
components: {
426438
SkillIcon,
427-
AoharuConfigModal
439+
AoharuConfigModal,
440+
SupportCardSelectModal
428441
},
429442
data:function () {
430443
return{
@@ -823,6 +836,7 @@ export default {
823836
preliminaryRoundSelections: [2, 1, 1, 1],
824837
aoharuTeamNameSelection: 4,
825838
showAoharuConfigModal: false,
839+
showSupportCardSelectModal: false,
826840
}
827841
},
828842
mounted() {
@@ -1072,6 +1086,12 @@ export default {
10721086
}, 2000);
10731087
}
10741088
},
1089+
openSupportCardSelectModal: function() {
1090+
this.showSupportCardSelectModal = true;
1091+
},
1092+
closeSupportCardSelectModal: function() {
1093+
this.showSupportCardSelectModal = false;
1094+
},
10751095
},
10761096
watch:{
10771097
@@ -1102,6 +1122,7 @@ export default {
11021122
border-radius: 0.25rem;
11031123
margin-right: 10px; /* 与确认按钮间距 */
11041124
border: none;
1125+
cursor: pointer;
11051126
}
11061127
11071128
.cancel-btn:hover {
@@ -1127,7 +1148,7 @@ export default {
11271148
pointer-events: auto; /* 阻止与背景元素的交互 */
11281149
}
11291150
1130-
/* 当显示青春杯配置时,让TaskEditModal的内容稍微变暗 */
1151+
/* 只有青春杯配置弹窗时让TaskEditModal变暗 */
11311152
#create-task-list-modal.modal.show .modal-content {
11321153
transition: opacity 0.3s ease;
11331154
}

0 commit comments

Comments
 (0)