Преглед на файлове

Update dependencies and enhance home component: Upgraded miniprogram-api-typings to version 5.2.1 in package.json and package-lock.json. Improved home component with a new startup source parameter, added slide functionality, and enhanced UI elements including a carousel for better user experience.

徐福静0235668 преди 2 месеца
родител
ревизия
8096021295
променени са 5 файла, в които са добавени 211 реда и са изтрити 27 реда
  1. 24 7
      package-lock.json
  2. 1 0
      package.json
  3. 26 2
      yuban/components/home/index.js
  4. 13 5
      yuban/components/home/index.wxml
  5. 147 13
      yuban/components/home/index.wxss

+ 24 - 7
package-lock.json

@@ -32,6 +32,7 @@
         "karma-dirname-preprocessor": "^0.0.4",
         "karma-filemap-preprocessor": "^0.1.1",
         "karma-webpack": "^5.0.0",
+        "miniprogram-api-typings": "^5.2.1",
         "miniprogram-simulate": "^1.4.2",
         "webpack": "^5.55.1"
       }
@@ -2486,6 +2487,13 @@
         "miniprogram-exparser": "2.15.0"
       }
     },
+    "node_modules/j-component/node_modules/miniprogram-api-typings": {
+      "version": "3.12.3",
+      "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-3.12.3.tgz",
+      "integrity": "sha512-o7bOfrU28MEMCBWo83nXv0ROQSBFxJcfCl4f2wTYqah64ipC5RGqLJfvWJTWhlQt2ECVwspSzM8LgvnfMo7TEQ==",
+      "dev": true,
+      "license": "MIT"
+    },
     "node_modules/jest-worker": {
       "version": "27.5.1",
       "resolved": "https://registry.npmmirror.com/jest-worker/-/jest-worker-27.5.1.tgz",
@@ -3127,10 +3135,11 @@
       "dev": true
     },
     "node_modules/miniprogram-api-typings": {
-      "version": "3.4.6",
-      "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-3.4.6.tgz",
-      "integrity": "sha512-1/aAma9wWzu9KS8m/h4j43UHoKS+XO61kaUDdftnlgwEyBndr0jrPJf/gUzdZQOST0pkLWmF0IMotz+j/Nh5SQ==",
-      "dev": true
+      "version": "5.2.1",
+      "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-5.2.1.tgz",
+      "integrity": "sha512-fbB2hapWx/vaXN4olDJEIS+OOkCjHlHLX0WG74XUJqhm0VJ8dpleBdgagHATjEpcbcH2z7AV8PjpwYp9dylfYA==",
+      "dev": true,
+      "license": "MIT"
     },
     "node_modules/miniprogram-compiler": {
       "version": "0.2.1",
@@ -6871,6 +6880,14 @@
         "expr-parser": "^1.0.0",
         "miniprogram-api-typings": "^3.2.2",
         "miniprogram-exparser": "2.15.0"
+      },
+      "dependencies": {
+        "miniprogram-api-typings": {
+          "version": "3.12.3",
+          "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-3.12.3.tgz",
+          "integrity": "sha512-o7bOfrU28MEMCBWo83nXv0ROQSBFxJcfCl4f2wTYqah64ipC5RGqLJfvWJTWhlQt2ECVwspSzM8LgvnfMo7TEQ==",
+          "dev": true
+        }
       }
     },
     "jest-worker": {
@@ -7402,9 +7419,9 @@
       "dev": true
     },
     "miniprogram-api-typings": {
-      "version": "3.4.6",
-      "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-3.4.6.tgz",
-      "integrity": "sha512-1/aAma9wWzu9KS8m/h4j43UHoKS+XO61kaUDdftnlgwEyBndr0jrPJf/gUzdZQOST0pkLWmF0IMotz+j/Nh5SQ==",
+      "version": "5.2.1",
+      "resolved": "https://registry.npmmirror.com/miniprogram-api-typings/-/miniprogram-api-typings-5.2.1.tgz",
+      "integrity": "sha512-fbB2hapWx/vaXN4olDJEIS+OOkCjHlHLX0WG74XUJqhm0VJ8dpleBdgagHATjEpcbcH2z7AV8PjpwYp9dylfYA==",
       "dev": true
     },
     "miniprogram-compiler": {

+ 1 - 0
package.json

@@ -35,6 +35,7 @@
     "karma-dirname-preprocessor": "^0.0.4",
     "karma-filemap-preprocessor": "^0.1.1",
     "karma-webpack": "^5.0.0",
+    "miniprogram-api-typings": "^5.2.1",
     "miniprogram-simulate": "^1.4.2",
     "webpack": "^5.55.1"
   },

+ 26 - 2
yuban/components/home/index.js

@@ -1,5 +1,9 @@
-// 直接进入 H5 首页(对应 H5 路由 /home),用于跳过 H5 的启动页。
 const H5_BASE = 'https://www.yuban.co/home';
+const STARTUP_SOURCE_PARAMS = {
+  fromStartup: 'true',
+  startupWelcome: 'true',
+  source: 'wechat-miniprogram',
+};
 
 Component({
   properties: {},
@@ -7,6 +11,8 @@ Component({
   data: {
     loading: false,
     webViewPath: '',
+    slides: [1, 2, 3, 5],
+    activeSlide: 0,
   },
 
   lifetimes: {
@@ -43,6 +49,11 @@ Component({
       }
     },
 
+    onSwiperChange(e) {
+      const current = Number(e?.detail?.current ?? 0);
+      this.setData({ activeSlide: current });
+    },
+
     preloadCommonSubpackage() {
       if (typeof wx.loadSubpackage !== 'function') return;
       wx.loadSubpackage({
@@ -66,9 +77,22 @@ Component({
       } catch (e) {
         // Parse 不可用时直接游客模式进入 H5
       }
-      const h5Url = token ? `${H5_BASE}?token=${token}` : H5_BASE;
+      const h5Url = this.appendQuery(H5_BASE, {
+        ...STARTUP_SOURCE_PARAMS,
+        token,
+      });
       const encodedUrl = encodeURIComponent(h5Url);
       return `/common-page/pages/web-view/index?path=${encodedUrl}&skipAuth=true`;
+    },
+
+    appendQuery(url, params = {}) {
+      const query = Object.keys(params)
+        .filter((key) => params[key] !== null && params[key] !== undefined && params[key] !== '')
+        .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
+        .join('&');
+
+      if (!query) return url;
+      return `${url}${url.indexOf('?') === -1 ? '?' : '&'}${query}`;
     }
   }
 })

+ 13 - 5
yuban/components/home/index.wxml

@@ -1,14 +1,14 @@
 <view class="startup-page">
-  <!-- 启动图轮播 -->
   <swiper
     class="startup-swiper"
     autoplay="true"
     interval="4000"
     duration="500"
     circular="true"
-    indicator-dots="true"
+    indicator-dots="{{false}}"
+    bindchange="onSwiperChange"
   >
-    <swiper-item wx:for="{{[1,2,3,5]}}" wx:key="*this">
+    <swiper-item wx:for="{{slides}}" wx:key="*this">
       <image
         class="startup-slide-image"
         mode="aspectFill"
@@ -17,10 +17,18 @@
     </swiper-item>
   </swiper>
 
-  <!-- 底部进入按钮 -->
+  <view class="carousel-dots">
+    <view
+      wx:for="{{slides}}"
+      wx:key="*this"
+      class="carousel-dot {{index === activeSlide ? 'is-active' : ''}}"
+    />
+  </view>
+
   <view class="startup-actions">
     <button class="enter-btn" bindtap="onEnter" loading="{{loading}}">
-      <text wx:if="{{!loading}}">进入体验</text>
+      <text wx:if="{{!loading}}">立即使用</text>
+      <text wx:else>正在进入...</text>
     </button>
   </view>
 </view>

+ 147 - 13
yuban/components/home/index.wxss

@@ -1,23 +1,67 @@
-/* 启动页容器:全屏深色背景,仿 startup.scss */
 .startup-page {
-  min-height: 100vh;
   height: 100vh;
-  background: radial-gradient(ellipse 120% 80% at 50% 20%, #1a0a28 0%, #0a0015 45%, #000000 100%);
-  overflow: hidden;
+  min-height: 100vh;
   position: relative;
+  overflow: hidden;
+  background:
+    radial-gradient(ellipse 100% 72% at 50% 18%, rgba(124, 58, 237, 0.22), transparent 66%),
+    linear-gradient(180deg, #050712 0%, #080a18 52%, #0b0d1d 100%);
+  -webkit-user-select: none;
+  user-select: none;
 }
 
 .startup-swiper {
   width: 100%;
   height: 100%;
+  background:
+    radial-gradient(ellipse 100% 70% at 50% 24%, rgba(124, 58, 237, 0.24), transparent 62%),
+    linear-gradient(180deg, #050712 0%, #0b0d1d 100%);
+}
+
+.carousel-dots {
+  position: absolute;
+  bottom: 190rpx;
+  bottom: calc(env(safe-area-inset-bottom) + 150rpx);
+  left: 50%;
+  display: flex;
+  align-items: center;
+  gap: 18rpx;
+  width: auto;
+  padding: 18rpx 28rpx;
+  transform: translateX(-50%);
+  border: 1rpx solid rgba(255, 255, 255, 0.12);
+  border-radius: 999rpx;
+  background: rgba(8, 10, 24, 0.54);
+  box-shadow:
+    0 8rpx 48rpx rgba(0, 0, 0, 0.35),
+    inset 0 1rpx 0 rgba(255, 255, 255, 0.08);
+  z-index: 15;
+}
+
+.carousel-dot {
+  width: 16rpx;
+  height: 16rpx;
+  margin: 0;
+  border-radius: 999rpx;
+  background: rgba(255, 255, 255, 0.35);
+  opacity: 1;
+  box-shadow: 0 0 0 1rpx rgba(255, 255, 255, 0.15);
+}
+
+.carousel-dot.is-active {
+  width: 52rpx;
+  background: linear-gradient(90deg, #a855f7 0%, #7c3aed 55%, #6d28d9 100%);
+  box-shadow:
+    0 0 32rpx rgba(98, 28, 169, 0.55),
+    0 0 0 1rpx rgba(255, 255, 255, 0.25);
 }
 
 .startup-slide-image {
   width: 100%;
   height: 100%;
+  display: block;
 }
 
-/* 底部进入按钮区域 */
 .startup-actions {
   position: absolute;
   left: 0;
@@ -26,18 +70,108 @@
   display: flex;
   justify-content: center;
   align-items: center;
-  padding: 0 64rpx 80rpx;
+  padding: 0 48rpx 56rpx;
+  padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
   box-sizing: border-box;
+  z-index: 20;
+  pointer-events: auto;
 }
 
 .enter-btn {
-  width: 80%;
-  max-width: 400px;
-  background: #621ca9;
+  position: relative;
+  z-index: 1;
+  width: 88%;
+  min-height: 96rpx;
+  max-width: 800rpx;
+  padding: 20rpx 48rpx;
+  border: 1rpx solid rgba(222, 205, 255, 0.72);
   border-radius: 999rpx;
+  background:
+    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.38), transparent 28%),
+    linear-gradient(105deg, #7847ff 0%, #b13cff 34%, #6d4dff 66%, #268cff 100%);
+  background-size: 100% 100%, 180% 100%;
+  background-position: center, 0% 50%;
   color: #ffffff;
-  font-size: 32rpx;
-  font-weight: 600;
-  padding: 28rpx 0;
-  border: none;
+  font-size: 38rpx;
+  font-weight: 750;
+  letter-spacing: 0;
+  line-height: 56rpx;
+  text-shadow:
+    0 2rpx 16rpx rgba(255, 255, 255, 0.32),
+    0 4rpx 24rpx rgba(42, 13, 112, 0.7);
+  overflow: visible;
+  box-shadow:
+    0 0 0 1rpx rgba(168, 121, 255, 0.22),
+    0 0 16rpx rgba(151, 71, 255, 0.42),
+    0 0 36rpx rgba(82, 70, 255, 0.24),
+    0 24rpx 56rpx rgba(66, 26, 171, 0.4),
+    inset 0 2rpx 0 rgba(255, 255, 255, 0.54),
+    inset 0 -16rpx 36rpx rgba(49, 17, 135, 0.24);
+  animation: enter-btn-gradient 5s ease-in-out infinite;
+}
+
+.enter-btn::before {
+  content: '';
+  position: absolute;
+  inset: -4rpx;
+  z-index: -1;
+  border-radius: inherit;
+  background: linear-gradient(100deg, #7b5cff, #d946ef, #537dff, #7b5cff);
+  background-size: 220% 100%;
+  filter: blur(10rpx);
+  opacity: 0.34;
+  animation: enter-btn-halo 4.2s ease-in-out infinite;
+}
+
+.enter-btn::after {
+  content: '';
+  position: absolute;
+  top: 2rpx;
+  left: 9%;
+  right: 9%;
+  height: 42%;
+  border-radius: 999rpx;
+  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent);
+  opacity: 0.72;
+}
+
+.enter-btn::after,
+.enter-btn::before {
+  pointer-events: none;
+}
+
+.enter-btn[loading] {
+  opacity: 0.88;
+  animation-play-state: paused;
+}
+
+.enter-btn:active {
+  transform: scale(0.98);
+  filter: brightness(0.96) saturate(1.08);
+}
+
+@keyframes enter-btn-gradient {
+  0%,
+  100% {
+    background-position: center, 0% 50%;
+  }
+
+  50% {
+    background-position: center, 100% 50%;
+  }
+}
+
+@keyframes enter-btn-halo {
+  0%,
+  100% {
+    background-position: 0% 50%;
+    opacity: 0.28;
+    transform: scale(0.998);
+  }
+
+  50% {
+    background-position: 100% 50%;
+    opacity: 0.42;
+    transform: scale(1.003);
+  }
 }