UserManualModal.vue
5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<template>
<transition name="help-doc-fade">
<div v-if="visible" class="help-doc-overlay">
<div class="help-doc-panel">
<!-- 头部 -->
<header class="help-doc-header">
<button
v-if="selectedManual"
class="help-doc-back"
type="button"
@click="selectedManualId = null"
>
← 返回使用手册列表
</button>
<button
v-else
class="help-doc-back"
type="button"
@click="handleBack"
>
← 返回客服中心
</button>
<h2 class="help-doc-title">
{{ selectedManual ? selectedManual.name : 'LinkMed 使用手册' }}
</h2>
</header>
<!-- 主体内容:列表视图 + 手册详情视图 -->
<main class="help-doc-main">
<!-- 手册详情视图 -->
<template v-if="selectedManual">
<section class="manual-content">
<iframe
class="manual-iframe"
:src="selectedManual.url"
frameborder="0"
></iframe>
<p class="manual-tip">
当前为线上预览地址,后续可替换为对应分类的正式使用手册链接。
</p>
</section>
</template>
<!-- 手册列表视图 -->
<template v-else>
<!-- 手册类型标签 -->
<nav class="manual-tabs">
<button
v-for="manual in manualTypes"
:key="manual.id"
type="button"
class="manual-tab"
:class="{ active: manual.id === selectedManualId }"
@click="openManual(manual.id)"
>
<span class="manual-tab-icon">❤</span>
<span class="manual-tab-text">{{ manual.name }}</span>
</button>
</nav>
</template>
</main>
</div>
</div>
</transition>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
interface ManualType {
id: string;
name: string;
url: string;
}
const DEFAULT_MANUAL_URL = 'https://www.example.com/';
const props = defineProps<{
visible: boolean;
}>();
const emit = defineEmits<{
(e: 'back'): void;
}>();
const manualTypes: ManualType[] = [
{
id: 'basic',
name: '基础使用',
url: DEFAULT_MANUAL_URL,
},
{
id: 'common',
name: '常见功能',
url: DEFAULT_MANUAL_URL,
},
{
id: 'demo',
name: '上手演示',
url: DEFAULT_MANUAL_URL,
},
{
id: 'permission',
name: '权限管理',
url: DEFAULT_MANUAL_URL,
},
{
id: 'settings',
name: '配置与设置',
url: DEFAULT_MANUAL_URL,
},
{
id: 'ops-security',
name: '运维与安全',
url: DEFAULT_MANUAL_URL,
},
];
const selectedManualId = ref<string | null>(null);
const selectedManual = computed<ManualType | null>(() => {
if (!selectedManualId.value) return null;
const found = manualTypes.find((m) => m.id === selectedManualId.value);
return found ?? null;
});
const openManual = (id: string) => {
selectedManualId.value = id;
};
const handleBack = () => {
emit('back');
};
</script>
<style scoped>
.help-doc-overlay {
pointer-events: auto;
position: fixed;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0.25);
z-index: 3999;
}
.help-doc-panel {
width: 760px;
max-width: calc(100vw - 80px);
height: 480px;
max-height: calc(100vh - 80px);
display: flex;
flex-direction: column;
background: #f5f7fa;
border-radius: 16px;
box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
overflow: hidden;
}
.help-doc-header {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 20px;
border-bottom: 1px solid #ebeef5;
background: #ffffff;
}
.help-doc-back {
border: none;
background: #f2f3f5;
color: #606266;
border-radius: 999px;
padding: 4px 12px;
font-size: 13px;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
}
.help-doc-back:hover {
background: #e4e7ed;
}
.help-doc-title {
margin: 0;
font-size: 16px;
font-weight: 600;
color: #303133;
}
.help-doc-main {
padding: 20px 24px 16px;
display: flex;
flex-direction: column;
gap: 16px;
overflow-y: auto;
background: #f5f7fa;
}
/* 手册类型标签条 */
.manual-tabs {
display: flex;
gap: 8px;
padding: 4px 4px 0;
overflow-x: auto;
}
.manual-tab {
flex-shrink: 0;
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 14px;
border-radius: 12px;
border: none;
background: linear-gradient(135deg, #edf5ff, #e0eeff);
color: #3a7bd5;
font-size: 13px;
cursor: pointer;
transition: background 0.15s ease, transform 0.15s ease,
box-shadow 0.15s ease;
}
.manual-tab-icon {
font-size: 13px;
}
.manual-tab-text {
white-space: nowrap;
}
.manual-tab.active {
background: linear-gradient(135deg, #3a7bd5, #5dade2);
color: #ffffff;
box-shadow: 0 4px 10px rgba(58, 123, 213, 0.35);
}
.manual-tab.active .manual-tab-icon {
opacity: 0.95;
}
.manual-tab:hover {
transform: translateY(-1px);
}
/* 手册内容区域 */
.manual-content {
margin-top: 12px;
flex: 1;
display: flex;
flex-direction: column;
gap: 8px;
}
.manual-iframe {
flex: 1;
width: 100%;
border: none;
border-radius: 10px;
background: #ffffff;
}
.manual-tip {
margin: 0;
font-size: 12px;
color: #909399;
}
/* 动画,与客服弹窗风格保持一致 */
.help-doc-fade-enter-active,
.help-doc-fade-leave-active {
transition: opacity 0.18s ease;
}
.help-doc-fade-enter-from,
.help-doc-fade-leave-to {
opacity: 0;
}
@media (max-width: 1024px) {
.help-doc-panel {
width: calc(100vw - 40px);
max-height: calc(100vh - 40px);
}
}
@media (max-width: 768px) {
.help-doc-panel {
width: calc(100vw - 24px);
max-height: calc(100vh - 24px);
}
}
</style>