Parcourir la source

小程序调试

skyline il y a 1 mois
Parent
commit
6eaac42f05
3 fichiers modifiés avec 44 ajouts et 178 suppressions
  1. 43 21
      haha-mp/src/pages/my/my.vue
  2. 1 1
      haha-mp/src/pages/products/products.vue
  3. 0 156
      haha-mp/src/utils/mock.ts

+ 43 - 21
haha-mp/src/pages/my/my.vue

@@ -3,10 +3,9 @@
     <!-- 用户信息卡片 -->
     <view class="user-card">
       <view class="user-avatar">
-        <image class="avatar-icon" src="/static/icons/user.svg" mode="aspectFit"></image>
+        <view class="avatar-icon-modern"></view>
       </view>
       <view class="user-details">
-        <view class="user-name">{{ displayName }}</view>
         <view class="user-phone">{{ displayPhone }}</view>
       </view>
     </view>
@@ -116,9 +115,9 @@ import { clearAuth, getUserInfo as getStoredUserInfo } from '../../utils/auth';
 const userInfo = ref<any>(null);
 const availableCouponCount = ref(0);
 
-// 显示用户名
+// 显示用户名(已隐藏,仅显示手机号)
 const displayName = computed(() => {
-  return userInfo.value?.nickname || '微信用户';
+  return '';
 });
 
 // 显示手机号(脱敏)
@@ -267,25 +266,54 @@ const handleLogout = () => {
 /* ========== 用户信息卡片 ========== */
 .user-card {
   background: linear-gradient(135deg, $color-primary-light 0%, $color-primary 100%);
-  padding: $spacing-xxl $spacing-lg $spacing-xl;
+  padding: $spacing-lg $spacing-lg;
+  padding-bottom: $spacing-md;
   display: flex;
   align-items: center;
   animation: slideDown 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
   
   .user-avatar {
-    width: 120rpx;
-    height: 120rpx;
+    width: 88rpx;
+    height: 88rpx;
     border-radius: $radius-circle;
-    background: rgba(255, 255, 255, 0.9);
+    background: rgba(255, 255, 255, 0.95);
     display: flex;
     align-items: center;
     justify-content: center;
-    margin-right: $spacing-lg;
-    box-shadow: $shadow-md;
+    margin-right: $spacing-md;
+    box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.12);
+    flex-shrink: 0;
     
-    .avatar-icon {
-      width: 72rpx;
-      height: 72rpx;
+    .avatar-icon-modern {
+      width: 44rpx;
+      height: 44rpx;
+      background: linear-gradient(135deg, $color-primary-light, $color-primary);
+      border-radius: 50%;
+      position: relative;
+      
+      &::before {
+        content: '';
+        position: absolute;
+        width: 20rpx;
+        height: 20rpx;
+        background: #ffffff;
+        border-radius: 50%;
+        top: 6rpx;
+        left: 50%;
+        transform: translateX(-50%);
+      }
+      
+      &::after {
+        content: '';
+        position: absolute;
+        width: 36rpx;
+        height: 24rpx;
+        background: #ffffff;
+        border-radius: 18rpx 18rpx 0 0;
+        bottom: 0;
+        left: 50%;
+        transform: translateX(-50%);
+      }
     }
   }
   
@@ -293,16 +321,10 @@ const handleLogout = () => {
     flex: 1;
   }
   
-  .user-name {
-    font-size: 36rpx;
+  .user-phone {
+    font-size: 28rpx;
     font-weight: 500;
     color: $color-text-primary;
-    margin-bottom: $spacing-xs;
-  }
-  
-  .user-phone {
-    font-size: 24rpx;
-    color: rgba(44, 44, 44, 0.7);
   }
 }
 

+ 1 - 1
haha-mp/src/pages/products/products.vue

@@ -212,7 +212,7 @@ const handleOpenDoor = async () => {
       showCancel: false,
       success: () => {
         uni.reLaunch({
-          url: '/pages/login/login?redirect=/pages/products/products?deviceId=' + deviceId.value
+          url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/products/products?deviceId=' + deviceId.value)
         });
       }
     });

+ 0 - 156
haha-mp/src/utils/mock.ts

@@ -1,156 +0,0 @@
-// Mock数据管理
-export const mockData = {
-  // 用户信息
-  userInfo: {
-    id: '1001',
-    name: '测试用户',
-    avatar: 'https://wx.qlogo.cn/mmopen/vi_32/SYiaibeiaiaV2RiaU9cEJWV6KibjBjEia9TQ15b4mSxVj0xIibN6k2Lb3w6HlYw/132',
-    wechatScore: 650,
-    balance: 100
-  },
-  
-  // 商品列表
-  products: [
-    {
-      id: '1',
-      name: '可口可乐',
-      price: 3.5,
-      stock: 20,
-      image: 'https://img.yzcdn.cn/vant/apple-1.jpg'
-    },
-    {
-      id: '2',
-      name: '雪碧',
-      price: 3.5,
-      stock: 15,
-      image: 'https://img.yzcdn.cn/vant/apple-2.jpg'
-    },
-    {
-      id: '3',
-      name: '矿泉水',
-      price: 2,
-      stock: 30,
-      image: 'https://img.yzcdn.cn/vant/apple-3.jpg'
-    },
-    {
-      id: '4',
-      name: '红牛',
-      price: 6,
-      stock: 10,
-      image: 'https://img.yzcdn.cn/vant/apple-4.jpg'
-    }
-  ],
-  
-  // 订单列表
-  orders: [
-    {
-      id: 'order_001',
-      status: 'completed',
-      amount: 7,
-      products: [
-        { id: '1', name: '可口可乐', price: 3.5, quantity: 2 }
-      ],
-      createTime: '2026-01-23 10:30:00',
-      videoUrl: 'https://example.com/video1.mp4'
-    },
-    {
-      id: 'order_002',
-      status: 'pending',
-      amount: 3.5,
-      products: [
-        { id: '2', name: '雪碧', price: 3.5, quantity: 1 }
-      ],
-      createTime: '2026-01-23 09:15:00',
-      videoUrl: 'https://example.com/video2.mp4'
-    }
-  ],
-  
-  // 设备信息
-  deviceInfo: {
-    id: 'device_001',
-    name: '测试设备',
-    status: 'online',
-    location: '北京市朝阳区',
-    stockRate: 85
-  }
-};
-
-// Mock API 类型定义
-interface MockResponse<T> {
-  success: boolean;
-  data: T;
-}
-
-// Mock API 函数
-export const mockApi = {
-  // 获取用户信息
-  getUserInfo: (): Promise<MockResponse<typeof mockData.userInfo>> => {
-    return new Promise((resolve) => {
-      setTimeout(() => {
-        resolve({ success: true, data: mockData.userInfo });
-      }, 300);
-    });
-  },
-  
-  // 获取商品列表
-  getProducts: () => {
-    return new Promise((resolve) => {
-      setTimeout(() => {
-        resolve({ success: true, data: mockData.products });
-      }, 300);
-    });
-  },
-  
-  // 获取订单列表
-  getOrders: () => {
-    return new Promise((resolve) => {
-      setTimeout(() => {
-        resolve({ success: true, data: mockData.orders });
-      }, 300);
-    });
-  },
-  
-  // 获取设备信息
-  getDeviceInfo: () => {
-    return new Promise((resolve) => {
-      setTimeout(() => {
-        resolve({ success: true, data: mockData.deviceInfo });
-      }, 300);
-    });
-  },
-  
-  // 扫码开门
-  scanDoor: (code: string) => {
-    return new Promise((resolve) => {
-      setTimeout(() => {
-        resolve({ 
-          success: true, 
-          data: { 
-            doorOpened: true, 
-            message: '开门成功',
-            deviceId: 'device_001'
-          }
-        });
-      }, 500);
-    });
-  },
-  
-  // 关门结算
-  closeDoor: (deviceId: string) => {
-    return new Promise((resolve) => {
-      setTimeout(() => {
-        resolve({ 
-          success: true, 
-          data: { 
-            orderId: 'order_' + Date.now(),
-            amount: 7,
-            products: [
-              { id: '1', name: '可口可乐', price: 3.5, quantity: 2 }
-            ],
-            status: 'completed'
-          }
-        });
-      }, 2000);
-    });
-  }
-};