duqing2026 commited on
Commit
f32d9a6
·
1 Parent(s): 1f2d258

优化升级

Browse files
Files changed (3) hide show
  1. app.py +3 -1
  2. templates/biolink_template.html +1 -1
  3. templates/index.html +29 -10
app.py CHANGED
@@ -38,4 +38,6 @@ def export():
38
  )
39
 
40
  if __name__ == '__main__':
41
- app.run(host='0.0.0.0', port=7860, debug=True)
 
 
 
38
  )
39
 
40
  if __name__ == '__main__':
41
+ # Use environment variable for debug mode, default to False for safety in production
42
+ debug_mode = os.environ.get('FLASK_DEBUG', 'False').lower() == 'true'
43
+ app.run(host='0.0.0.0', port=7860, debug=debug_mode)
templates/biolink_template.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>[[ data.profile.name ]]</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <style>
9
  /* Custom Theme Styles */
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>[[ data.profile.name or 'My BioLink' ]]</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <style>
9
  /* Custom Theme Styles */
templates/index.html CHANGED
@@ -84,7 +84,12 @@
84
  <div class="max-w-xl mx-auto">
85
  <header class="mb-8 flex items-center justify-between">
86
  <h1 class="text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-500 to-purple-600">BioLink Pro</h1>
87
- <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-xs font-semibold">Free Export</span>
 
 
 
 
 
88
  </header>
89
 
90
  <!-- Profile Section -->
@@ -175,11 +180,12 @@
175
  </div>
176
 
177
  <!-- Preview Area -->
178
- <div class="w-full lg:w-1/2 bg-gray-100 flex items-center justify-center p-8 lg:h-screen fixed lg:static top-0 right-0 pointer-events-none lg:pointer-events-auto opacity-0 lg:opacity-100 z-0">
179
- <div class="preview-frame pointer-events-auto transition-all duration-300">
 
 
 
180
  <div class="preview-content p-6 flex flex-col items-center pt-12" :class="'theme-' + theme">
181
- <!-- Preview Profile -->
182
- <div class="mb-8 text-center w-full" style="color: var(--text-color);">
183
  <div v-if="profile.avatarUrl" class="w-24 h-24 mx-auto mb-4 rounded-full overflow-hidden border-4 border-white/20 shadow-lg">
184
  <img :src="profile.avatarUrl" class="w-full h-full object-cover">
185
  </div>
@@ -212,18 +218,20 @@
212
  createApp({
213
  setup() {
214
  const profile = reactive({
215
- name: '',
216
- bio: '',
217
- avatarUrl: ''
218
  });
219
 
220
  const links = ref([
221
  { title: '我的博客', url: 'https://example.com' },
222
- { title: 'GitHub', url: 'https://github.com' }
 
223
  ]);
224
 
225
  const theme = ref('simple');
226
  const isExporting = ref(false);
 
227
 
228
  const addLink = () => {
229
  links.value.push({ title: '', url: '' });
@@ -233,6 +241,15 @@
233
  links.value.splice(index, 1);
234
  };
235
 
 
 
 
 
 
 
 
 
 
236
  const exportHtml = async () => {
237
  if (isExporting.value) return;
238
  isExporting.value = true;
@@ -276,12 +293,14 @@
276
 
277
  return {
278
  profile,
 
279
  links,
280
  theme,
281
  addLink,
282
  removeLink,
283
  exportHtml,
284
- isExporting
 
285
  };
286
  }
287
  }).mount('#app');
 
84
  <div class="max-w-xl mx-auto">
85
  <header class="mb-8 flex items-center justify-between">
86
  <h1 class="text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-500 to-purple-600">BioLink Pro</h1>
87
+ <div class="flex gap-2">
88
+ <button @click="showPreview = !showPreview" class="lg:hidden px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-xs font-semibold border">
89
+ {{ showPreview ? '编辑' : '预览' }}
90
+ </button>
91
+ <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-xs font-semibold">Free Export</span>
92
+ </div>
93
  </header>
94
 
95
  <!-- Profile Section -->
 
180
  </div>
181
 
182
  <!-- Preview Area -->
183
+ <div :class="{'opacity-100 pointer-events-auto z-50': showPreview, 'opacity-0 pointer-events-none -z-10': !showPreview}" class="fixed inset-0 bg-gray-100 lg:static lg:w-1/2 lg:flex lg:opacity-100 lg:pointer-events-auto lg:z-0 flex items-center justify-center p-8 transition-all duration-300">
184
+ <button @click="showPreview = false" class="lg:hidden absolute top-4 right-4 p-2 bg-white rounded-full shadow-md z-50">
185
+ <i class="ph ph-x text-xl"></i>
186
+ </button>
187
+ <div class="preview-frame transition-all duration-300 transform scale-90 sm:scale-100">
188
  <div class="preview-content p-6 flex flex-col items-center pt-12" :class="'theme-' + theme">
 
 
189
  <div v-if="profile.avatarUrl" class="w-24 h-24 mx-auto mb-4 rounded-full overflow-hidden border-4 border-white/20 shadow-lg">
190
  <img :src="profile.avatarUrl" class="w-full h-full object-cover">
191
  </div>
 
218
  createApp({
219
  setup() {
220
  const profile = reactive({
221
+ name: '您的名字',
222
+ bio: '热爱生活,探索世界。\n分享技术与创意的个人主页。',
223
+ avatarUrl: 'https://ui-avatars.com/api/?name=User&background=0D8ABC&color=fff&size=200'
224
  });
225
 
226
  const links = ref([
227
  { title: '我的博客', url: 'https://example.com' },
228
+ { title: 'GitHub', url: 'https://github.com' },
229
+ { title: '联系我', url: 'mailto:hi@example.com' }
230
  ]);
231
 
232
  const theme = ref('simple');
233
  const isExporting = ref(false);
234
+ const showPreview = ref(false);
235
 
236
  const addLink = () => {
237
  links.value.push({ title: '', url: '' });
 
241
  links.value.splice(index, 1);
242
  };
243
 
244
+ const resetProfile = () => {
245
+ if (confirm('确定要清空所有数据吗?')) {
246
+ profile.name = '';
247
+ profile.bio = '';
248
+ profile.avatarUrl = '';
249
+ links.value = [];
250
+ }
251
+ };
252
+
253
  const exportHtml = async () => {
254
  if (isExporting.value) return;
255
  isExporting.value = true;
 
293
 
294
  return {
295
  profile,
296
+ resetProfile,
297
  links,
298
  theme,
299
  addLink,
300
  removeLink,
301
  exportHtml,
302
+ isExporting,
303
+ showPreview
304
  };
305
  }
306
  }).mount('#app');