Sfoglia il codice sorgente

✨ feat(index): 更新首页广告和代金券展示样式
- 修改广告图片源为ad.imageFile.fullUrl
- 将代金券封面图替换为红色到橙色的渐变背景和"代金券"文字
- 移除代金券描述文本显示

♻️ refactor(wechat-pay): 调整微信代金券批次号字段为可空
- 将wechat-coupon-stock.entity.ts中的stockId字段设为可空
- 更新wechat-coupon-stock.schema.ts,将stockId schema设为可空类型

yourname 3 mesi fa
parent
commit
5814d7cb95

+ 5 - 9
mini/src/pages/index/index.tsx

@@ -142,7 +142,7 @@ export default function IndexPage() {
             {advertisements.map((ad) => (
               <SwiperItem key={ad.id} onClick={() => handleAdClick(ad)}>
                 <Image
-                  src={ad.imageUrl}
+                  src={ad.imageFile?.fullUrl || ''}
                   className="w-full h-full"
                   mode="aspectFill"
                 />
@@ -172,11 +172,9 @@ export default function IndexPage() {
             {stocks.map((stock) => (
               <Card key={stock.id} className="overflow-hidden">
                 <CardHeader className="p-0">
-                  <Image
-                    src={stock.coverImage}
-                    className="w-full h-32"
-                    mode="aspectFill"
-                  />
+                  <View className="w-full h-32 bg-gradient-to-r from-red-500 to-orange-500 flex items-center justify-center">
+                    <Text className="text-white text-xl font-bold">代金券</Text>
+                  </View>
                 </CardHeader>
                 <CardContent className="p-4">
                   <View className="flex justify-between items-start mb-2">
@@ -188,9 +186,7 @@ export default function IndexPage() {
                     </Text>
                   </View>
                   
-                  <Text className="text-sm text-gray-600 mb-2">
-                    {stock.stockDescription}
-                  </Text>
+                  
                   
                   <View className="flex justify-between items-center">
                     <Text className="text-xs text-gray-500">

+ 2 - 2
src/server/modules/wechat-pay/wechat-coupon-stock.entity.ts

@@ -6,8 +6,8 @@ export class WechatCouponStock {
   @PrimaryGeneratedColumn({ unsigned: true })
   id!: number;
 
-  @Column({ name: 'stock_id', type: 'varchar', length: 32, unique: true, comment: '微信支付批次号' })
-  stockId!: string;
+  @Column({ name: 'stock_id', type: 'varchar', length: 32, unique: true, nullable: true, comment: '微信支付批次号' })
+  stockId!: string | null;
 
   @Column({ name: 'stock_name', type: 'varchar', length: 64, comment: '批次名称' })
   stockName!: string;

+ 1 - 1
src/server/modules/wechat-pay/wechat-coupon-stock.schema.ts

@@ -2,7 +2,7 @@ import { z } from '@hono/zod-openapi';
 
 export const WechatCouponStockSchema = z.object({
   id: z.number().int().positive().openapi({ description: '批次ID' }),
-  stockId: z.string().max(32).openapi({ description: '微信支付批次号', example: '1234567890' }),
+  stockId: z.string().max(32).nullable().openapi({ description: '微信支付批次号', example: '1234567890' }),
   stockName: z.string().max(64).openapi({ description: '批次名称', example: '春节代金券' }),
   stockCreatorMchid: z.string().max(32).openapi({ description: '创建批次的商户号', example: '1234567890' }),
   couponType: z.string().max(20).openapi({ description: '代金券类型', example: 'NORMAL' }),