Spaces:
Sleeping
Sleeping
Commit ·
bfabb06
1
Parent(s): 731e990
feat: optimize project structure, fix jinja2 conflict, use local assets, add system notice
Browse files- .gitignore +2 -0
- static/html2canvas.min.js +0 -0
- static/tailwindcss.js +0 -0
- static/vue.global.js +0 -0
- templates/index.html +25 -10
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.pyc
|
static/html2canvas.min.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
static/tailwindcss.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
static/vue.global.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
templates/index.html
CHANGED
|
@@ -4,9 +4,9 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>社交对话生成工坊 - Chat Mockup Studio</title>
|
| 7 |
-
<script src="
|
| 8 |
-
<script src="
|
| 9 |
-
<script src="
|
| 10 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
| 11 |
<style>
|
| 12 |
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');
|
|
@@ -58,6 +58,7 @@
|
|
| 58 |
</style>
|
| 59 |
</head>
|
| 60 |
<body class="bg-gray-100 h-screen flex overflow-hidden">
|
|
|
|
| 61 |
<div id="app" class="flex w-full h-full">
|
| 62 |
<!-- Sidebar Controls -->
|
| 63 |
<div class="w-96 bg-white border-r border-gray-200 flex flex-col h-full overflow-y-auto p-4 shadow-lg z-10">
|
|
@@ -112,6 +113,7 @@
|
|
| 112 |
<div class="flex gap-2">
|
| 113 |
<button @click="addMessage('text', 'left')" class="text-xs bg-gray-200 hover:bg-gray-300 px-2 py-1 rounded" title="添加左侧消息"><i class="fas fa-arrow-left"></i></button>
|
| 114 |
<button @click="addMessage('time')" class="text-xs bg-gray-200 hover:bg-gray-300 px-2 py-1 rounded" title="添加时间"><i class="fas fa-clock"></i></button>
|
|
|
|
| 115 |
<button @click="addMessage('text', 'right')" class="text-xs bg-gray-200 hover:bg-gray-300 px-2 py-1 rounded" title="添加右侧消息"><i class="fas fa-arrow-right"></i></button>
|
| 116 |
</div>
|
| 117 |
</h2>
|
|
@@ -119,7 +121,7 @@
|
|
| 119 |
<div class="space-y-3">
|
| 120 |
<div v-for="(msg, index) in messages" :key="msg.id" class="bg-gray-50 p-3 rounded-lg border border-gray-200 group relative hover:border-green-400 transition-colors">
|
| 121 |
<!-- Tools -->
|
| 122 |
-
<div class="absolute right-2 top-2 opacity-0 group-hover:opacity-100 flex gap-1 transition-opacity">
|
| 123 |
<button @click="moveUp(index)" class="text-gray-400 hover:text-blue-500"><i class="fas fa-chevron-up"></i></button>
|
| 124 |
<button @click="moveDown(index)" class="text-gray-400 hover:text-blue-500"><i class="fas fa-chevron-down"></i></button>
|
| 125 |
<button @click="removeMessage(index)" class="text-gray-400 hover:text-red-500"><i class="fas fa-trash"></i></button>
|
|
@@ -130,6 +132,11 @@
|
|
| 130 |
<input v-model="msg.content" class="text-xs text-center bg-transparent border-b border-gray-300 focus:border-green-500 outline-none w-20" placeholder="时间">
|
| 131 |
</div>
|
| 132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
<div v-else class="flex gap-2 items-start">
|
| 134 |
<div class="flex flex-col items-center gap-1">
|
| 135 |
<span class="text-xs font-bold text-gray-500">{{ msg.side === 'left' ? '对方' : '我' }}</span>
|
|
@@ -221,7 +228,7 @@
|
|
| 221 |
<div class="h-11 px-4 flex items-center justify-between z-10 text-black dark:text-white border-b border-gray-300/50 dark:border-white/10 bg-[#ededed]/90 dark:bg-[#111111]/90 backdrop-blur-sm">
|
| 222 |
<div class="w-16 flex items-center gap-1 cursor-pointer">
|
| 223 |
<i class="fas fa-chevron-left text-lg"></i>
|
| 224 |
-
<span class="text-base">微信</span>
|
| 225 |
</div>
|
| 226 |
<div class="flex-1 text-center font-medium text-lg truncate px-2">
|
| 227 |
{{ settings.title }}
|
|
@@ -241,7 +248,10 @@
|
|
| 241 |
<span class="text-xs text-white/90 bg-gray-300/60 dark:bg-white/10 px-2 py-0.5 rounded text-shadow-sm">{{ msg.content }}</span>
|
| 242 |
</div>
|
| 243 |
|
| 244 |
-
<!-- System Notice
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
<!-- Message Bubble -->
|
| 247 |
<div v-else class="flex gap-2.5" :class="{ 'flex-row-reverse': msg.side === 'right' }">
|
|
@@ -252,9 +262,6 @@
|
|
| 252 |
|
| 253 |
<!-- Content -->
|
| 254 |
<div class="max-w-[70%]">
|
| 255 |
-
<!-- Name (Optional, usually hidden in P2P chat) -->
|
| 256 |
-
<!-- <div v-if="msg.side === 'left'" class="text-xs text-gray-500 mb-1 ml-1">{{ msg.name }}</div> -->
|
| 257 |
-
|
| 258 |
<!-- Bubble -->
|
| 259 |
<div class="relative px-3 py-2.5 rounded-md text-base leading-relaxed break-words shadow-sm min-h-[40px] flex items-center"
|
| 260 |
:class="[
|
|
@@ -377,6 +384,11 @@
|
|
| 377 |
contentType: 'redpacket',
|
| 378 |
content: '辛苦了!买杯咖啡喝',
|
| 379 |
avatar: ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
}
|
| 381 |
])
|
| 382 |
|
|
@@ -384,6 +396,8 @@
|
|
| 384 |
const id = Date.now()
|
| 385 |
if (type === 'time') {
|
| 386 |
messages.value.push({ id, type: 'time', content: '12:00' })
|
|
|
|
|
|
|
| 387 |
} else {
|
| 388 |
messages.value.push({
|
| 389 |
id,
|
|
@@ -495,5 +509,6 @@
|
|
| 495 |
}
|
| 496 |
}).mount('#app')
|
| 497 |
</script>
|
|
|
|
| 498 |
</body>
|
| 499 |
-
</html>
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>社交对话生成工坊 - Chat Mockup Studio</title>
|
| 7 |
+
<script src="/static/tailwindcss.js"></script>
|
| 8 |
+
<script src="/static/vue.global.js"></script>
|
| 9 |
+
<script src="/static/html2canvas.min.js"></script>
|
| 10 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
| 11 |
<style>
|
| 12 |
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');
|
|
|
|
| 58 |
</style>
|
| 59 |
</head>
|
| 60 |
<body class="bg-gray-100 h-screen flex overflow-hidden">
|
| 61 |
+
{% raw %}
|
| 62 |
<div id="app" class="flex w-full h-full">
|
| 63 |
<!-- Sidebar Controls -->
|
| 64 |
<div class="w-96 bg-white border-r border-gray-200 flex flex-col h-full overflow-y-auto p-4 shadow-lg z-10">
|
|
|
|
| 113 |
<div class="flex gap-2">
|
| 114 |
<button @click="addMessage('text', 'left')" class="text-xs bg-gray-200 hover:bg-gray-300 px-2 py-1 rounded" title="添加左侧消息"><i class="fas fa-arrow-left"></i></button>
|
| 115 |
<button @click="addMessage('time')" class="text-xs bg-gray-200 hover:bg-gray-300 px-2 py-1 rounded" title="添加时间"><i class="fas fa-clock"></i></button>
|
| 116 |
+
<button @click="addMessage('notice')" class="text-xs bg-gray-200 hover:bg-gray-300 px-2 py-1 rounded" title="添加系统提示"><i class="fas fa-info-circle"></i></button>
|
| 117 |
<button @click="addMessage('text', 'right')" class="text-xs bg-gray-200 hover:bg-gray-300 px-2 py-1 rounded" title="添加右侧消息"><i class="fas fa-arrow-right"></i></button>
|
| 118 |
</div>
|
| 119 |
</h2>
|
|
|
|
| 121 |
<div class="space-y-3">
|
| 122 |
<div v-for="(msg, index) in messages" :key="msg.id" class="bg-gray-50 p-3 rounded-lg border border-gray-200 group relative hover:border-green-400 transition-colors">
|
| 123 |
<!-- Tools -->
|
| 124 |
+
<div class="absolute right-2 top-2 opacity-0 group-hover:opacity-100 flex gap-1 transition-opacity z-10">
|
| 125 |
<button @click="moveUp(index)" class="text-gray-400 hover:text-blue-500"><i class="fas fa-chevron-up"></i></button>
|
| 126 |
<button @click="moveDown(index)" class="text-gray-400 hover:text-blue-500"><i class="fas fa-chevron-down"></i></button>
|
| 127 |
<button @click="removeMessage(index)" class="text-gray-400 hover:text-red-500"><i class="fas fa-trash"></i></button>
|
|
|
|
| 132 |
<input v-model="msg.content" class="text-xs text-center bg-transparent border-b border-gray-300 focus:border-green-500 outline-none w-20" placeholder="时间">
|
| 133 |
</div>
|
| 134 |
|
| 135 |
+
<div v-else-if="msg.type === 'notice'" class="text-center">
|
| 136 |
+
<span class="text-xs font-bold text-gray-500 block mb-1">系统提示</span>
|
| 137 |
+
<textarea v-model="msg.content" rows="2" class="w-full text-xs text-center bg-transparent border rounded p-1 focus:border-green-500 outline-none resize-none" placeholder="系统提示内容"></textarea>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
<div v-else class="flex gap-2 items-start">
|
| 141 |
<div class="flex flex-col items-center gap-1">
|
| 142 |
<span class="text-xs font-bold text-gray-500">{{ msg.side === 'left' ? '对方' : '我' }}</span>
|
|
|
|
| 228 |
<div class="h-11 px-4 flex items-center justify-between z-10 text-black dark:text-white border-b border-gray-300/50 dark:border-white/10 bg-[#ededed]/90 dark:bg-[#111111]/90 backdrop-blur-sm">
|
| 229 |
<div class="w-16 flex items-center gap-1 cursor-pointer">
|
| 230 |
<i class="fas fa-chevron-left text-lg"></i>
|
| 231 |
+
<span class="text-base">微信</span>
|
| 232 |
</div>
|
| 233 |
<div class="flex-1 text-center font-medium text-lg truncate px-2">
|
| 234 |
{{ settings.title }}
|
|
|
|
| 248 |
<span class="text-xs text-white/90 bg-gray-300/60 dark:bg-white/10 px-2 py-0.5 rounded text-shadow-sm">{{ msg.content }}</span>
|
| 249 |
</div>
|
| 250 |
|
| 251 |
+
<!-- System Notice -->
|
| 252 |
+
<div v-else-if="msg.type === 'notice'" class="flex justify-center mb-2 px-8 text-center">
|
| 253 |
+
<span class="text-xs text-gray-400 dark:text-gray-500 leading-tight">{{ msg.content }}</span>
|
| 254 |
+
</div>
|
| 255 |
|
| 256 |
<!-- Message Bubble -->
|
| 257 |
<div v-else class="flex gap-2.5" :class="{ 'flex-row-reverse': msg.side === 'right' }">
|
|
|
|
| 262 |
|
| 263 |
<!-- Content -->
|
| 264 |
<div class="max-w-[70%]">
|
|
|
|
|
|
|
|
|
|
| 265 |
<!-- Bubble -->
|
| 266 |
<div class="relative px-3 py-2.5 rounded-md text-base leading-relaxed break-words shadow-sm min-h-[40px] flex items-center"
|
| 267 |
:class="[
|
|
|
|
| 384 |
contentType: 'redpacket',
|
| 385 |
content: '辛苦了!买杯咖啡喝',
|
| 386 |
avatar: ''
|
| 387 |
+
},
|
| 388 |
+
{
|
| 389 |
+
id: 6,
|
| 390 |
+
type: 'notice',
|
| 391 |
+
content: '你已添加了对方为好友,现在可以开始聊天了'
|
| 392 |
}
|
| 393 |
])
|
| 394 |
|
|
|
|
| 396 |
const id = Date.now()
|
| 397 |
if (type === 'time') {
|
| 398 |
messages.value.push({ id, type: 'time', content: '12:00' })
|
| 399 |
+
} else if (type === 'notice') {
|
| 400 |
+
messages.value.push({ id, type: 'notice', content: '你已添加了对方为好友,现在可以开始聊天了' })
|
| 401 |
} else {
|
| 402 |
messages.value.push({
|
| 403 |
id,
|
|
|
|
| 509 |
}
|
| 510 |
}).mount('#app')
|
| 511 |
</script>
|
| 512 |
+
{% endraw %}
|
| 513 |
</body>
|
| 514 |
+
</html>
|