hookehuyr

feat(PosterCheckin): 优化海报打卡页面布局和样式

调整页面布局结构,修改海报配置尺寸和位置
移除按钮中的emoji图标,简化样式代码
更新海报预览和保存功能逻辑
1 +/*
2 + * @Date: 2025-09-03 14:53:06
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2025-09-03 14:56:21
5 + * @FilePath: /lls_program/src/pages/PosterCheckin/index.config.js
6 + * @Description: 文件描述
7 + */
8 +export default {
9 + navigationBarTitleText: '海报打卡',
10 + usingComponents: {
11 + },
12 +}
1 <template> 1 <template>
2 - <view class="poster-checkin-page bg-gray-50 min-h-screen pb-20"> 2 + <view class="poster-checkin-page bg-gray-50 h-screen flex flex-col">
3 <!-- 海报预览区域 --> 3 <!-- 海报预览区域 -->
4 - <view class="mx-4 mt-4 bg-white rounded-lg shadow-sm overflow-hidden"> 4 + <view class="flex-1 mx-4 mt-4 mb-4 rounded-lg overflow-hidden">
5 - <view class="aspect-[3/4] relative bg-gray-100 flex items-center justify-center"> 5 + <view class="h-full relative flex items-center justify-center">
6 <view v-if="posterPath" class="w-full h-full relative"> 6 <view v-if="posterPath" class="w-full h-full relative">
7 <image 7 <image
8 :src="posterPath" 8 :src="posterPath"
9 mode="aspectFit" 9 mode="aspectFit"
10 class="w-full h-full" 10 class="w-full h-full"
11 - @click="previewPoster" 11 +
12 /> 12 />
13 <!-- 点击预览提示 --> 13 <!-- 点击预览提示 -->
14 - <view class="absolute bottom-2 right-2 bg-black bg-opacity-50 text-white text-xs px-2 py-1 rounded"> 14 + <view @tap="previewPoster" class="absolute bottom-4 right-4 bg-black bg-opacity-50 text-white text-xs px-2 py-1 rounded">
15 点击预览 15 点击预览
16 </view> 16 </view>
17 </view> 17 </view>
18 - <view v-else class="text-center text-gray-500"> 18 + <!-- <view v-else class="text-center text-gray-500">
19 <view class="text-4xl mb-2">🎨</view> 19 <view class="text-4xl mb-2">🎨</view>
20 <text class="text-sm">海报生成中...</text> 20 <text class="text-sm">海报生成中...</text>
21 <view class="mt-2"> 21 <view class="mt-2">
22 <view class="w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto"></view> 22 <view class="w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto"></view>
23 </view> 23 </view>
24 - </view> 24 + </view> -->
25 </view> 25 </view>
26 </view> 26 </view>
27 27
28 <!-- 底部操作按钮 --> 28 <!-- 底部操作按钮 -->
29 - <view class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 p-4 safe-area-bottom"> 29 + <view class="bg-white border-t border-gray-200 p-4 safe-area-bottom">
30 <view class="flex gap-4"> 30 <view class="flex gap-4">
31 - <button 31 + <view
32 class="flex-1 bg-gradient-to-r from-orange-400 to-orange-500 text-white py-3 px-6 rounded-lg font-medium shadow-lg active:scale-95 transition-transform duration-150 flex items-center justify-center gap-2" 32 class="flex-1 bg-gradient-to-r from-orange-400 to-orange-500 text-white py-3 px-6 rounded-lg font-medium shadow-lg active:scale-95 transition-transform duration-150 flex items-center justify-center gap-2"
33 @click="chooseBackgroundImage" 33 @click="chooseBackgroundImage"
34 > 34 >
35 - <text class="text-lg">📷</text>
36 <text>{{ backgroundImage ? '更改照片' : '上传照片' }}</text> 35 <text>{{ backgroundImage ? '更改照片' : '上传照片' }}</text>
37 - </button> 36 + </view>
38 - <button 37 + <view
39 class="flex-1 text-white py-3 px-6 rounded-lg font-medium shadow-lg active:scale-95 transition-transform duration-150 flex items-center justify-center gap-2" 38 class="flex-1 text-white py-3 px-6 rounded-lg font-medium shadow-lg active:scale-95 transition-transform duration-150 flex items-center justify-center gap-2"
40 :class="posterPath ? 'bg-gradient-to-r from-green-400 to-green-500' : 'bg-gray-400'" 39 :class="posterPath ? 'bg-gradient-to-r from-green-400 to-green-500' : 'bg-gray-400'"
41 @click="savePoster" 40 @click="savePoster"
42 :disabled="!posterPath" 41 :disabled="!posterPath"
43 > 42 >
44 - <text class="text-lg">💾</text>
45 <text>保存海报</text> 43 <text>保存海报</text>
46 - </button> 44 + </view>
47 </view> 45 </view>
48 </view> 46 </view>
49 47
...@@ -141,7 +139,7 @@ const posterConfig = computed(() => { ...@@ -141,7 +139,7 @@ const posterConfig = computed(() => {
141 x: 0, 139 x: 0,
142 y: 0, 140 y: 0,
143 width: 750, 141 width: 750,
144 - height: 800, 142 + height: 1100,
145 url: bgImage, 143 url: bgImage,
146 zIndex: 0 144 zIndex: 0
147 }, 145 },
...@@ -166,17 +164,17 @@ const posterConfig = computed(() => { ...@@ -166,17 +164,17 @@ const posterConfig = computed(() => {
166 }, 164 },
167 // 关卡徽章 165 // 关卡徽章
168 { 166 {
169 - x: 580, 167 + x: 80,
170 - y: 680, 168 + y: 750,
171 - width: 120, 169 + width: 240,
172 - height: 80, 170 + height: 240,
173 url: mockData.value.level.logo, 171 url: mockData.value.level.logo,
174 zIndex: 2 172 zIndex: 2
175 }, 173 },
176 // 小程序码 174 // 小程序码
177 { 175 {
178 x: 50, 176 x: 50,
179 - y: 850, 177 + y: 1100,
180 width: 200, 178 width: 200,
181 height: 200, 179 height: 200,
182 url: mockData.value.qrcode, 180 url: mockData.value.qrcode,
...@@ -208,7 +206,7 @@ const posterConfig = computed(() => { ...@@ -208,7 +206,7 @@ const posterConfig = computed(() => {
208 // 小程序码描述 206 // 小程序码描述
209 { 207 {
210 x: 280, 208 x: 280,
211 - y: 900, 209 + y: 1150,
212 text: mockData.value.qrcodeDesc, 210 text: mockData.value.qrcodeDesc,
213 fontSize: 28, 211 fontSize: 28,
214 color: '#333333', 212 color: '#333333',
...@@ -223,7 +221,7 @@ const posterConfig = computed(() => { ...@@ -223,7 +221,7 @@ const posterConfig = computed(() => {
223 // 下半部分白色背景 221 // 下半部分白色背景
224 { 222 {
225 x: 0, 223 x: 0,
226 - y: 800, 224 + y: 1050,
227 width: 750, 225 width: 750,
228 height: 534, 226 height: 534,
229 backgroundColor: '#ffffff', 227 backgroundColor: '#ffffff',
...@@ -359,6 +357,7 @@ const onPosterFail = (error) => { ...@@ -359,6 +357,7 @@ const onPosterFail = (error) => {
359 * 预览海报 357 * 预览海报
360 */ 358 */
361 const previewPoster = () => { 359 const previewPoster = () => {
360 + console.warn('预览海报', posterPath.value)
362 if (!posterPath.value) return 361 if (!posterPath.value) return
363 362
364 previewImages.value = [{ src: posterPath.value }] 363 previewImages.value = [{ src: posterPath.value }]
...@@ -405,7 +404,7 @@ const savePoster = () => { ...@@ -405,7 +404,7 @@ const savePoster = () => {
405 } 404 }
406 </script> 405 </script>
407 406
408 -<style lang="less" scoped> 407 +<style lang="less">
409 .poster-checkin-page { 408 .poster-checkin-page {
410 .aspect-\[3\/4\] { 409 .aspect-\[3\/4\] {
411 aspect-ratio: 3/4; 410 aspect-ratio: 3/4;
......