浏览代码

提交首页

viczhq 1 月之前
父节点
当前提交
b090af1cdf
共有 39 个文件被更改,包括 81260 次插入80 次删除
  1. 35 0
      .gitignore
  2. 80128 0
      package-lock.json
  3. 15 15
      project.config.json
  4. 8 0
      project.private.config.json
  5. 7 7
      src/app.config.js
  6. 19 0
      src/components/index/CategoryList/index.jsx
  7. 37 0
      src/components/index/CategoryList/index.less
  8. 60 0
      src/components/index/OperationArea/index.jsx
  9. 93 0
      src/components/index/OperationArea/index.less
  10. 91 0
      src/components/index/ProductList/index.jsx
  11. 151 0
      src/components/index/ProductList/index.less
  12. 104 0
      src/components/index/RecommendList/index.jsx
  13. 136 0
      src/components/index/RecommendList/index.less
  14. 35 0
      src/components/index/SearchBar/index.jsx
  15. 32 0
      src/components/index/SearchBar/index.less
  16. 二进制
      src/images/index/back-top.png
  17. 二进制
      src/images/index/jionStore.png
  18. 二进制
      src/images/index/joinStoreAc.png
  19. 二进制
      src/images/index/myStore.png
  20. 二进制
      src/images/index/recommend-bg1.png
  21. 二进制
      src/images/index/recommend-bg2.png
  22. 二进制
      src/images/index/save-money.png
  23. 二进制
      src/images/index/share-earn.png
  24. 二进制
      src/images/nav/home.png
  25. 二进制
      src/images/nav/home_active.png
  26. 二进制
      src/images/nav/like.png
  27. 二进制
      src/images/nav/like_pin.png
  28. 二进制
      src/images/nav/my.png
  29. 二进制
      src/images/nav/my_acitve.png
  30. 二进制
      src/images/nav/my_pin.png
  31. 二进制
      src/images/nav/play.png
  32. 二进制
      src/images/nav/play_pin.png
  33. 二进制
      src/images/nav/task.png
  34. 二进制
      src/images/nav/task_pin.png
  35. 二进制
      src/images/nav/vip.png
  36. 二进制
      src/images/nav/vip_active.png
  37. 0 1
      src/pages/index/index.config.js
  38. 162 32
      src/pages/index/index.jsx
  39. 147 25
      src/pages/index/index.less

+ 35 - 0
.gitignore

@@ -0,0 +1,35 @@
1
+# IDE配置文件
2
+.idea/
3
+.vscode/
4
+*.sublime-project
5
+*.sublime-workspace
6
+
7
+# 依赖包目录
8
+node_modules/
9
+vendor/
10
+venv/
11
+env/
12
+
13
+# 编译生成的文件
14
+dist/
15
+build/
16
+*.pyc
17
+__pycache__/
18
+
19
+# 日志文件
20
+*.log
21
+logs/
22
+
23
+# 环境配置文件
24
+.env
25
+.env.local
26
+.env.*.local
27
+
28
+# 系统文件
29
+.DS_Store
30
+Thumbs.db
31
+
32
+# 临时文件
33
+*.swp
34
+*.swo
35
+*~ 

文件差异内容过多而无法显示
+ 80128 - 0
package-lock.json


+ 15 - 15
project.config.json

@@ -1,29 +1,29 @@
1 1
 {
2
-  "miniprogramRoot": "dist/weapp/",
2
+  "miniprogramRoot": "dist/",
3 3
   "projectname": "鱼市",
4 4
   "description": "鱼市",
5
-  "appid": "wxcf756553cfb65cb8",
5
+  "appid": "wx7f70846c2292aa85",
6 6
   "setting": {
7
-      "urlCheck": true,
8
-      "es6": false,
9
-      "postcss": false,
10
-      "minified": false,
11
-      "babelSetting": {
12
-          "ignore": [],
13
-          "disablePlugins": [],
14
-          "outputPath": ""
15
-      }
7
+    "urlCheck": true,
8
+    "es6": false,
9
+    "postcss": false,
10
+    "minified": false,
11
+    "babelSetting": {
12
+      "ignore": [],
13
+      "disablePlugins": [],
14
+      "outputPath": ""
15
+    }
16 16
   },
17 17
   "compileType": "miniprogram",
18 18
   "libVersion": "2.26.0",
19 19
   "srcMiniprogramRoot": "dist/",
20 20
   "packOptions": {
21
-      "ignore": [],
22
-      "include": []
21
+    "ignore": [],
22
+    "include": []
23 23
   },
24 24
   "condition": {},
25 25
   "editorSetting": {
26
-      "tabIndent": "insertSpaces",
27
-      "tabSize": 2
26
+    "tabIndent": "insertSpaces",
27
+    "tabSize": 2
28 28
   }
29 29
 }

+ 8 - 0
project.private.config.json

@@ -0,0 +1,8 @@
1
+{
2
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
+  "projectname": "%E9%B1%BC%E5%B8%82",
4
+  "setting": {
5
+    "compileHotReLoad": true
6
+  },
7
+  "libVersion": "3.6.4"
8
+}

+ 7 - 7
src/app.config.js

@@ -19,21 +19,21 @@ export default defineAppConfig({
19 19
     backgroundColor: "#FFFFFF"
20 20
   },
21 21
   tabBar: {
22
-    color: "#C6C6C6",
23
-    selectedColor: "#0F84EC",
22
+    color: "#000000",
23
+    selectedColor: "#000000",
24 24
     borderStyle: "black",
25 25
     backgroundColor: "#FFFFFF",
26 26
     list: [
27 27
       {
28 28
         pagePath: "pages/index/index",
29
-        iconPath: "images/nav/play.png",
30
-        selectedIconPath: "images/nav/play_pin.png",
29
+        iconPath: "images/nav/home.png",
30
+        selectedIconPath: "images/nav/home_active.png",
31 31
         text: "首页"
32 32
       },
33 33
       {
34 34
         pagePath: "pages/member/index",
35
-        iconPath: "images/nav/like.png",
36
-        selectedIconPath: "images/nav/like_pin.png",
35
+        iconPath: "images/nav/vip.png",
36
+        selectedIconPath: "images/nav/vip_active.png",
37 37
         text: "会员"
38 38
 
39 39
       },
@@ -41,7 +41,7 @@ export default defineAppConfig({
41 41
       {
42 42
         pagePath: "pages/mine/index",
43 43
         iconPath: "images/nav/my.png",
44
-        selectedIconPath: "images/nav/my_pin.png",
44
+        selectedIconPath: "images/nav/my_acitve.png",
45 45
         text: "我的"
46 46
       }
47 47
     ]

+ 19 - 0
src/components/index/CategoryList/index.jsx

@@ -0,0 +1,19 @@
1
+import { View, Image, Text } from "@tarojs/components";
2
+import "./index.less";
3
+
4
+const CategoryList = ({ categoryList }) => {
5
+  return (
6
+    <View className="category-wrap">
7
+      <View className="category-list">
8
+        {categoryList.map(item => (
9
+          <View key={item.id} className="category-item">
10
+            <Image className="category-icon" src={item.icon} mode="aspectFit" />
11
+            <Text className="category-name">{item.name}</Text>
12
+          </View>
13
+        ))}
14
+      </View>
15
+    </View>
16
+  );
17
+};
18
+
19
+export default CategoryList; 

+ 37 - 0
src/components/index/CategoryList/index.less

@@ -0,0 +1,37 @@
1
+.category-wrap {
2
+  margin: 16px 16px 0;
3
+  
4
+  .category-list {
5
+    display: flex;
6
+    flex-wrap: wrap;
7
+    justify-content: space-between;
8
+    background: #FFFFFF;
9
+    border-radius: 20px;
10
+    padding: 25px 17px 22px 17px;
11
+    
12
+    .category-item {
13
+      width: 20%;
14
+      display: flex;
15
+      flex-direction: column;
16
+      align-items: center;
17
+      margin-bottom: 20px;
18
+      
19
+      .category-icon {
20
+        width: 96px;
21
+        height: 96px;
22
+        margin-bottom: 8px;
23
+      }
24
+      
25
+      .category-name {
26
+        color: #000000;
27
+        font-size: 24px;
28
+        color: #333333;
29
+        line-height: 1.2;
30
+      }
31
+      
32
+      &:active {
33
+        opacity: 0.8;
34
+      }
35
+    }
36
+  }
37
+} 

+ 60 - 0
src/components/index/OperationArea/index.jsx

@@ -0,0 +1,60 @@
1
+import { View, Text, Image } from "@tarojs/components";
2
+import "./index.less";
3
+
4
+const OperationArea = () => {
5
+  // 模拟商品数据
6
+  const seckillProducts = [
7
+    {
8
+      id: 1,
9
+      name: "商品1",
10
+      price: 20.20,
11
+      originalPrice: 30.00,
12
+      image: "商品图片地址1"
13
+    },
14
+    {
15
+      id: 2,
16
+      name: "商品2",
17
+      price: 25.50,
18
+      originalPrice: 35.00,
19
+      image: "商品图片地址2"
20
+    },
21
+    {
22
+      id: 3,
23
+      name: "商品3",
24
+      price: 15.80,
25
+      originalPrice: 28.00,
26
+      image: "商品图片地址3"
27
+    }
28
+  ];
29
+
30
+  return (
31
+    <View className="operation-wrap">
32
+      <View className="operation-item">
33
+        <View className="title">限时秒杀</View>
34
+        <View className="product-list">
35
+          {seckillProducts.map(product => (
36
+            <View key={product.id} className="product-item">
37
+              <Image className="product-img" src={product.image} mode="aspectFill" />
38
+              <View className="price-wrap">
39
+                <View className="current-price">
40
+                  <Text className="symbol">¥</Text>
41
+                  <Text className="number">{product.price.toFixed(2)}</Text>
42
+                </View>
43
+                <Text className="original-price">¥{product.originalPrice.toFixed(2)}</Text>
44
+              </View>
45
+            </View>
46
+          ))}
47
+        </View>
48
+      </View>
49
+      <View className="operation-item">
50
+        <View className="title-wrap">
51
+          <Text className="title">高佣专项</Text>
52
+          <Text className="tag">高佣金必囤爆品</Text>
53
+        </View>
54
+        {/* 这里可以添加高佣专项的具体内容 */}
55
+      </View>
56
+    </View>
57
+  );
58
+};
59
+
60
+export default OperationArea; 

+ 93 - 0
src/components/index/OperationArea/index.less

@@ -0,0 +1,93 @@
1
+.operation-wrap {
2
+    margin: 16px 16px 0;
3
+    display: flex;
4
+    justify-content: space-between;
5
+
6
+    .operation-item {
7
+        width: 350px;
8
+        height: 256px;
9
+        background: #FFFFFF;
10
+        border-radius: 16px;
11
+        border: 1px solid #FFFFFF;
12
+
13
+        .title {
14
+            font-size: 28px;
15
+            font-weight: bold;
16
+            padding: 16px 0 0 17px;
17
+            line-height: 39px;
18
+        }
19
+
20
+        .title-wrap {
21
+            display: flex;
22
+            align-items: center;
23
+            padding: 16px 0 0 17px;
24
+
25
+            .title {
26
+                font-size: 28px;
27
+                font-weight: bold;
28
+                padding: 0;
29
+                margin-right: 9px;
30
+                line-height: 39px;
31
+            }
32
+
33
+            .tag {
34
+                font-size: 20px;
35
+                color: #FFCC19;
36
+                line-height: 28px;
37
+                border: 1px solid #FFCC19;
38
+                border-radius: 24px;
39
+                padding: 5px 20px;
40
+            }
41
+        }
42
+
43
+        .product-list {
44
+            margin-top: 17px;
45
+            padding: 0 17px;
46
+            display: flex;
47
+            justify-content: space-between;
48
+
49
+            .product-item {
50
+                flex: 1;
51
+                margin-right: 10px;
52
+                text-align: center;
53
+
54
+                &:last-child {
55
+                    margin-right: 0;
56
+                }
57
+
58
+                .product-img {
59
+                    width: 100%;
60
+                    height: 99px;
61
+                    border-radius: 8px;
62
+                    background-color: red;
63
+                }
64
+
65
+                .price-wrap {
66
+                    line-height: 1;
67
+                    margin-top: 8px;
68
+
69
+                    .current-price {
70
+                        display: flex;
71
+                        justify-content: center;
72
+                        color: #000000;
73
+
74
+                        .symbol {
75
+                            font-size: 20px;
76
+                        }
77
+
78
+                        .number {
79
+                            font-size: 24px;
80
+                        }
81
+                    }
82
+
83
+                    .original-price {
84
+                        font-size: 16px;
85
+                        color: #B5B5B5;
86
+                        text-decoration: line-through;
87
+                        line-height: 1;
88
+                    }
89
+                }
90
+            }
91
+        }
92
+    }
93
+}

+ 91 - 0
src/components/index/ProductList/index.jsx

@@ -0,0 +1,91 @@
1
+import { View, Text, Image } from "@tarojs/components";
2
+import "./index.less";
3
+import joinStoreBg from '../../../images/index/jionStore.png'
4
+import saveMoneyBg from '../../../images/index/save-money.png'
5
+import shareEarnBg from '../../../images/index/share-earn.png'
6
+
7
+const ProductList = () => {
8
+  // 模拟商品数据
9
+  const products = [
10
+    {
11
+      id: 1,
12
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
13
+      name: "这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称",
14
+      price: 99.99,
15
+      originalPrice: 199.99,
16
+      saveMoney: 10,
17
+      shareEarn: 20
18
+    },
19
+    {
20
+      id: 1,
21
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
22
+      name: "这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称",
23
+      price: 99.99,
24
+      originalPrice: 199.99,
25
+      saveMoney: 10,
26
+      shareEarn: 20
27
+    },
28
+    {
29
+      id: 1,
30
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
31
+      name: "这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称",
32
+      price: 99.99,
33
+      originalPrice: 199.99,
34
+      saveMoney: 10,
35
+      shareEarn: 20
36
+    },
37
+    // ... 其他商品数据
38
+  ];
39
+
40
+  return (
41
+    <View className="product-list-wrap">
42
+      {products.map((product, index) => (
43
+        <View key={product.id}>
44
+          <View className="product-item">
45
+            <Image className="product-img" src={product.image} mode="aspectFill" />
46
+            <View className="product-info">
47
+              <View className="product-name" style={{"WebkitBoxOrient": "vertical"}}>
48
+                <Text className="self-tag">自营</Text>
49
+                {product.name}
50
+              </View>
51
+              <View className="price-line">
52
+                <View className="price-info">
53
+                  <Text className="symbol">¥</Text>
54
+                  <Text className="price">{product.price}</Text>
55
+                  <Text className="original-price">¥{product.originalPrice}</Text>
56
+                </View>
57
+                <View className="add-btn">
58
+                  <Image 
59
+                    className="join-store-bg" 
60
+                    src={joinStoreBg}
61
+                    mode="aspectFit"
62
+                  />
63
+                  <Text className="btn-text">加入小店</Text>
64
+                </View>
65
+              </View>
66
+              <View className="profit-line">
67
+                <View className="save-money">
68
+                  <Image className="bg" src={saveMoneyBg} mode="aspectFit" />
69
+                  <View className="content">
70
+                    <Text className="label">自购省</Text>
71
+                    <Text className="money">¥{product.saveMoney}</Text>
72
+                  </View>
73
+                </View>
74
+                <View className="share-earn">
75
+                  <Image className="bg" src={shareEarnBg} mode="aspectFit" />
76
+                  <View className="content">
77
+                    <Text className="label">分享赚</Text>
78
+                    <Text className="money">¥{product.shareEarn}</Text>
79
+                  </View>
80
+                </View>
81
+              </View>
82
+            </View>
83
+          </View>
84
+          {index !== products.length - 1 && <View className="divider"></View>}
85
+        </View>
86
+      ))}
87
+    </View>
88
+  );
89
+};
90
+
91
+export default ProductList; 

+ 151 - 0
src/components/index/ProductList/index.less

@@ -0,0 +1,151 @@
1
+.product-list-wrap {
2
+  margin: 21px 16px 0;
3
+  background: #FFFFFF;
4
+  border-radius: 16px;
5
+  position: relative;
6
+  
7
+  .product-item {
8
+    padding: 27px 20px 27px 17px;
9
+    display: flex;
10
+    
11
+    .product-img {
12
+      width: 260px;
13
+      height: 256px;
14
+      margin-right: 20px;
15
+      flex-shrink: 0;
16
+    }
17
+    
18
+    .product-info {
19
+      flex: 1;
20
+      min-width: 0; // 解决flex布局下文本溢出问题
21
+      display: flex;
22
+      flex-direction: column;
23
+      justify-content: space-between;
24
+      .product-name {
25
+        font-size: 28px;
26
+        overflow : hidden;
27
+        text-overflow: ellipsis;
28
+        display: -webkit-box;
29
+        -webkit-line-clamp: 2;
30
+        /* autoprefixer: ignore next */
31
+        -webkit-box-orient: vertical;
32
+        
33
+        
34
+        .self-tag {
35
+          display: inline-block;
36
+          padding: 2px 8px;
37
+          background: #FFD43A;
38
+          border-radius: 4px;
39
+          color: #803A04;
40
+          font-size: 24px;
41
+          line-height: 28px;
42
+          margin-right: 8px;
43
+          vertical-align: middle;
44
+        }
45
+      }
46
+      
47
+      .price-line {
48
+        display: flex;
49
+        justify-content: space-between;
50
+        align-items: center;
51
+        
52
+        .price-info {
53
+          display: flex;
54
+          align-items: baseline;
55
+          
56
+          .symbol {
57
+            font-size: 22px;
58
+            color: #FF1D17;
59
+          }
60
+          
61
+          .price {
62
+            font-size: 36px;
63
+            color: #FF1D17;
64
+            font-weight: bold;
65
+            margin-right: 8px;
66
+          }
67
+          
68
+          .original-price {
69
+            font-size: 26px;
70
+            color: #999999;
71
+            text-decoration: line-through;
72
+          }
73
+        }
74
+        
75
+        .add-btn {
76
+          position: relative;
77
+          width: 158px;
78
+          height: 58px;
79
+          
80
+          .join-store-bg {
81
+            width: 100%;
82
+            height: 100%;
83
+            position: absolute;
84
+            top: 0;
85
+            left: 0;
86
+          }
87
+          
88
+          .btn-text {
89
+            padding-left: 8px;
90
+            position: absolute;
91
+            width: 100%;
92
+            height: 100%;
93
+            display: flex;
94
+            align-items: center;
95
+            justify-content: center;
96
+            color: #FFFFFF;
97
+            font-size: 24px;
98
+            z-index: 1;
99
+          }
100
+        }
101
+      }
102
+      
103
+      .profit-line {
104
+        display: flex;
105
+        gap: 20px;
106
+        .save-money{
107
+            color: #F6C71A;
108
+        }
109
+        .share-earn{
110
+            color: #fff;
111
+        }
112
+        .save-money,
113
+        .share-earn {
114
+          position: relative;
115
+          width: 192px;
116
+          height: 84px;
117
+          
118
+          .bg {
119
+            width: 100%;
120
+            height: 100%;
121
+            position: absolute;
122
+            top: 0;
123
+            left: 0;
124
+          }
125
+          
126
+          .content {
127
+            position: relative;
128
+            z-index: 1;
129
+            height: 100%;
130
+            display: flex;
131
+            flex-direction: column;
132
+            align-items: center;
133
+            justify-content: center;
134
+            font-size: 28px;
135
+            
136
+            .label,
137
+            .money {
138
+              line-height: 41px;
139
+            }
140
+          }
141
+        }
142
+      }
143
+    }
144
+  }
145
+  
146
+  .divider {
147
+    height: 1px;
148
+    margin: 0 17px 0 20px;
149
+    border-top: 1px dashed #D8D8D8;
150
+  }
151
+} 

+ 104 - 0
src/components/index/RecommendList/index.jsx

@@ -0,0 +1,104 @@
1
+import { View, Text, Swiper, SwiperItem, Image } from "@tarojs/components";
2
+import recommendBg1 from '../../../images/index/recommend-bg1.png'
3
+import recommendBg2 from '../../../images/index/recommend-bg2.png'
4
+import "./index.less";
5
+
6
+const RecommendList = () => {
7
+  // 模拟推荐商品数据
8
+  const recommendProducts = [
9
+    {
10
+      id: 1,
11
+      name: "商品名称商品名称商品名称商品名称商品名称",
12
+      price: 99.99,
13
+      sharePrice: 0.12,
14
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6"
15
+    },
16
+    {
17
+      id: 2,
18
+      name: "商品名称商品名称商品名称商品名称",
19
+      price: 88.88,
20
+      sharePrice: 0.12,
21
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6"
22
+    },
23
+    {
24
+      id: 3,
25
+      name: "商品名称商品名称商品名称",
26
+      price: 77.77,
27
+      sharePrice: 0.12,
28
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6"
29
+    },
30
+    {
31
+      id: 4,
32
+      name: "商品名称商品名称商品名称商品名称",
33
+      price: 66.66,
34
+      sharePrice: 0.12,
35
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6"
36
+    },
37
+    {
38
+      id: 5,
39
+      name: "商品名称商品名称商品名称",
40
+      price: 55.55,
41
+      sharePrice: 0.12,
42
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6"
43
+    },
44
+    {
45
+      id: 6,
46
+      name: "商品名称商品名称商品名称商品名称",
47
+      price: 44.44,
48
+      sharePrice: 0.12,
49
+      image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6"
50
+    }
51
+  ];
52
+
53
+  // 将商品数据按每3个分组
54
+  const groupedProducts = recommendProducts.reduce((groups, product, index) => {
55
+    const groupIndex = Math.floor(index / 3);
56
+    if (!groups[groupIndex]) {
57
+      groups[groupIndex] = [];
58
+    }
59
+    groups[groupIndex].push(product);
60
+    return groups;
61
+  }, []);
62
+
63
+  return (
64
+    <View className="recommend-wrap">
65
+      <View className="title">邀请人推荐</View>
66
+      <Swiper
67
+        className="recommend-swiper"
68
+        indicatorDots
69
+        indicatorColor="#d8d8d8"
70
+        indicatorActiveColor="#ffcc1a"
71
+      >
72
+        {groupedProducts.map((group, groupIndex) => (
73
+          <SwiperItem key={groupIndex} className="swiper-item">
74
+            <View className="product-group">
75
+              {group.map(product => (
76
+                <View key={product.id} className="product-item">
77
+                  <Image className="product-img" src={product.image} mode="aspectFill" />
78
+                  <Text className="product-name">{product.name}</Text>
79
+                  <View className="price-info">
80
+                    <Text className="symbol">¥</Text>
81
+                    <Text className="price">{product.price.toFixed(2)}</Text>
82
+                  </View>
83
+                  <View className="share-price-tag">
84
+                    <Text className="share-text">分享价</Text>
85
+                    <Text className="share-symbol">¥</Text>
86
+                    <Text className="share-price">{product.sharePrice.toFixed(2)}</Text>
87
+                  </View>
88
+                </View>
89
+              ))}
90
+            </View>
91
+          </SwiperItem>
92
+        ))}
93
+      </Swiper>
94
+      
95
+      {/* 底部背景图 */}
96
+      <View className="bottom-bg">
97
+        <Image className="bg-left" src={recommendBg1} mode="aspectFit" />
98
+        <Image className="bg-right" src={recommendBg2} mode="aspectFit" />
99
+      </View>
100
+    </View>
101
+  );
102
+};
103
+
104
+export default RecommendList; 

+ 136 - 0
src/components/index/RecommendList/index.less

@@ -0,0 +1,136 @@
1
+.recommend-wrap {
2
+    margin: 16px 16px 0 16px;
3
+    background: #FFFFFF;
4
+    border-radius: 16px;
5
+    position: relative;
6
+    .title {
7
+        font-size: 28px;
8
+        font-weight: bold;
9
+        padding: 16px 0 0 17px;
10
+        line-height: 39px;
11
+    }
12
+
13
+    .recommend-swiper {
14
+        padding: 15px 0 0 15px;
15
+        width: 100%;
16
+        box-sizing: border-box;
17
+        height: 460px !important;
18
+
19
+        .swiper-item {
20
+            width: 100% !important;
21
+            padding: 0 15px;
22
+            box-sizing: border-box;
23
+
24
+            .product-group {
25
+                display: flex;
26
+                justify-content: space-between;
27
+                width: 100%;
28
+
29
+                .product-item {
30
+                    width: 210px;
31
+
32
+                    .product-img {
33
+                        width: 210px;
34
+                        height: 210px;
35
+                    }
36
+
37
+                    .product-name {
38
+                        line-height: 39px;
39
+                        font-size: 24px;
40
+                        margin-top: 8px;
41
+                        display: block;
42
+                        width: 210px;
43
+                        white-space: nowrap;
44
+                        overflow: hidden;
45
+                        text-overflow: ellipsis;
46
+                        color: #3D3D3D;
47
+                    }
48
+
49
+                    .price-info {
50
+                        display: flex;
51
+                        align-items: baseline;
52
+                        color: #FF1D17;
53
+                        line-height: 35px;
54
+
55
+                        .symbol {
56
+                            font-size: 20px;
57
+                        }
58
+
59
+                        .price {
60
+                            font-size: 24px;
61
+                        }
62
+                    }
63
+
64
+                    .share-price-tag {
65
+                        border: 2px solid #FF1D17;
66
+                        width: 210px;
67
+                        height: 44px;
68
+                        border-radius: 4px;
69
+                        color: #FFFFFF;
70
+                        margin-top: 5px;
71
+                        display: flex;
72
+                        align-items: center;
73
+                        justify-content: center;
74
+                        box-sizing: border-box;
75
+                        padding: 5px 33px;
76
+                        color: #FF1D17;
77
+                        border-radius: 12px;
78
+
79
+                        .share-text {
80
+                            font-size: 24px;
81
+                            margin-right: 4px;
82
+                        }
83
+
84
+                        .share-symbol {
85
+                            font-size: 20px;
86
+                            margin-right: 2px;
87
+                        }
88
+
89
+                        .share-price {
90
+                            font-size: 24px;
91
+                        }
92
+                    }
93
+                }
94
+            }
95
+        }
96
+
97
+        // 修改指示点样式
98
+        .wx-swiper-dots {
99
+            .wx-swiper-dot {
100
+                width: 12px !important;
101
+                height: 12px !important;
102
+
103
+                &.wx-swiper-dot-active {
104
+                    width: 30px !important; // 选中时宽度变为10px
105
+                    height: 12px !important; // 保持高度不变
106
+                    border-radius: 13px !important; // 圆角处理,让两端显示为半圆
107
+                }
108
+            }
109
+        }
110
+    }
111
+
112
+    .bottom-bg {
113
+        position: absolute;
114
+        bottom: 0;
115
+        left: 0;
116
+        right: 0;
117
+        width: 100%;
118
+        height: 45px;
119
+        
120
+        .bg-left {
121
+            position: absolute;
122
+            left: 21px;
123
+            bottom: 0;
124
+            width: 239px;
125
+            height: 36px;
126
+        }
127
+        
128
+        .bg-right {
129
+            position: absolute;
130
+            right: 28px;
131
+            bottom: 0;
132
+            width: 237px;
133
+            height: 45px;
134
+        }
135
+    }
136
+}

+ 35 - 0
src/components/index/SearchBar/index.jsx

@@ -0,0 +1,35 @@
1
+import { View, Input } from '@tarojs/components'
2
+import { AtIcon } from 'taro-ui'
3
+import { Component } from 'react'
4
+import './index.less'
5
+
6
+export default class SearchBar extends Component {
7
+  handleChange = (e) => {
8
+    this.props.onChange && this.props.onChange(e)
9
+  }
10
+
11
+  render () {
12
+    const { value, placeholder } = this.props
13
+
14
+    return (
15
+        <View className="search-wrap">
16
+        <View className="search-bar">
17
+          <AtIcon
18
+            className="search-icon"
19
+            value="search"
20
+            size="24"
21
+            color="#ACACAC"
22
+          ></AtIcon>
23
+          <Input
24
+            type="text"
25
+            className="search-input"
26
+            placeholder={placeholder}
27
+            value={value}
28
+            onInput={this.handleChange.bind(this)}
29
+          />
30
+          <View className="search-button">搜索</View>
31
+        </View>
32
+      </View>
33
+    )
34
+  }
35
+} 

+ 32 - 0
src/components/index/SearchBar/index.less

@@ -0,0 +1,32 @@
1
+.search-wrap {
2
+    margin-top: 20px;    
3
+    display: flex;
4
+    align-items: center;
5
+    justify-content: center;
6
+    position: relative;
7
+    .search-bar {
8
+      width: 90%;
9
+      display: flex;
10
+      align-items: center;
11
+      background-color: #FFFFFF; // 黄色背景
12
+      border-radius: 50px;
13
+      padding: 10px;
14
+      .search-icon {
15
+        margin: 0 20px;
16
+      }
17
+
18
+      .search-input {
19
+        flex: 1;
20
+        border: none;
21
+        outline: none;
22
+        background-color: transparent;
23
+      }
24
+
25
+      .search-button {
26
+        border: 1px solid black;
27
+        border-radius: 50px;
28
+        padding: 5px 20px;
29
+      }
30
+    }
31
+
32
+  }

二进制
src/images/index/back-top.png


二进制
src/images/index/jionStore.png


二进制
src/images/index/joinStoreAc.png


二进制
src/images/index/myStore.png


二进制
src/images/index/recommend-bg1.png


二进制
src/images/index/recommend-bg2.png


二进制
src/images/index/save-money.png


二进制
src/images/index/share-earn.png


二进制
src/images/nav/home.png


二进制
src/images/nav/home_active.png


二进制
src/images/nav/like.png


二进制
src/images/nav/like_pin.png


二进制
src/images/nav/my.png


二进制
src/images/nav/my_acitve.png


二进制
src/images/nav/my_pin.png


二进制
src/images/nav/play.png


二进制
src/images/nav/play_pin.png


二进制
src/images/nav/task.png


二进制
src/images/nav/task_pin.png


二进制
src/images/nav/vip.png


二进制
src/images/nav/vip_active.png


+ 0 - 1
src/pages/index/index.config.js

@@ -1,4 +1,3 @@
1 1
 export default definePageConfig({
2
-
3 2
   navigationStyle: 'custom'
4 3
 })

+ 162 - 32
src/pages/index/index.jsx

@@ -1,51 +1,181 @@
1
-import { Component } from 'react'
2
-import { View, Image, Button, Input } from '@tarojs/components'
3
-import { AtIcon } from 'taro-ui'
4
-import './index.less'
1
+import Taro from "@tarojs/taro"; // 导入 Taro
2
+import { Component } from "react";
3
+import { View, Image, Swiper, SwiperItem, Text } from "@tarojs/components";
4
+import { AtTabs } from "taro-ui";
5
+import "./index.less";
6
+import SearchBar from "../../components/index/SearchBar"; //搜索框
7
+import CategoryList from "../../components/index/CategoryList"; //分类列表
8
+import OperationArea from "../../components/index/OperationArea"; //运营区域
9
+import RecommendList from "../../components/index/RecommendList"; //邀请人推荐
10
+import ProductList from "../../components/index/ProductList"; //商品列表
11
+import myStoreIcon from "../../images/index/myStore.png";
12
+import backTopIcon from "../../images/index/back-top.png";
5 13
 
6 14
 export default class Index extends Component {
7 15
   state = {
8
-    value: ''
9
-  }
16
+    value: "",
17
+    navigationBarHeight: 0, // 添加一个状态来保存导航栏高度
18
+    current: 0, // 添加当前选中的tab索引
19
+    tabList: [
20
+      // 添加模拟的tab数据
21
+      { title: "推荐" },
22
+      { title: "男装" },
23
+      { title: "女装" },
24
+      { title: "运动" },
25
+      { title: "数码" },
26
+      { title: "美妆" },
27
+      { title: "箱包" },
28
+      { title: "家居" },
29
+      { title: "食品" },
30
+      { title: "母婴" },
31
+    ],
32
+    bannerList: [
33
+      {
34
+        id: 1,
35
+        img: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
36
+      },
37
+      {
38
+        id: 2,
39
+        img: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
40
+      },
41
+      {
42
+        id: 3,
43
+        img: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
44
+      },
45
+    ],
46
+    categoryList: [
47
+      { id: 1, icon: "购物袋图标URL", name: "超市" },
48
+      { id: 2, icon: "手机图标URL", name: "数码" },
49
+      { id: 3, icon: "衣服图标URL", name: "服饰" },
50
+      { id: 4, icon: "生鲜图标URL", name: "生鲜" },
51
+      { id: 5, icon: "美妆图标URL", name: "美妆" },
52
+      { id: 6, icon: "家电图标URL", name: "家电" },
53
+      { id: 7, icon: "餐具图标URL", name: "餐厨" },
54
+      { id: 8, icon: "书本图标URL", name: "图书" },
55
+      { id: 9, icon: "药品图标URL", name: "医药" },
56
+      { id: 10, icon: "更多图标URL", name: "更多" },
57
+    ],
58
+  };
10 59
 
11
-  handleChange (value) {
12
-    this.setState({ value })
60
+  handleChange(value) {
61
+    this.setState({ value });
62
+  }
63
+  // 添加tab切换处理函数
64
+  handleClick(value) {
65
+    this.setState({
66
+      current: value,
67
+    });
13 68
   }
69
+  componentDidMount() {
70
+    // 获取系统信息
71
+    const systemInfo = Taro.getSystemInfoSync();
72
+    // 获取 safeArea.top 作为导航栏的高度
73
+    const navigationBarHeight = systemInfo.safeArea.top;
14 74
 
15
-  componentWillMount () { }
75
+    // 设置导航栏高度到状态
76
+    this.setState({ navigationBarHeight });
77
+  }
16 78
 
17
-  componentDidMount () { }
79
+  componentWillUnmount() {}
18 80
 
19
-  componentWillUnmount () { }
81
+  componentDidShow() {}
20 82
 
21
-  componentDidShow () { }
83
+  componentDidHide() {}
22 84
 
23
-  componentDidHide () { }
85
+  // 添加回到顶部方法
86
+  handleBackTop = () => {
87
+    Taro.pageScrollTo({
88
+      scrollTop: 0,
89
+      duration: 300,
90
+    });
91
+  };
24 92
 
25
-  render () {
93
+  render() {
26 94
     return (
27
-      <View className='index'>
28
-        <View className='header'>
29
-          <View className='header-content'>
30
-            <Image className='header-img' src='https://video-img.fyshark.com/1731495433480WechatIMG674.jpg' />
95
+      <View className="index">
96
+        <View
97
+          className="header"
98
+          style={{ paddingTop: this.state.navigationBarHeight + "px" }}
99
+        >
100
+          <View className="header-content">
101
+            <Image
102
+              className="header-img"
103
+              src="https://video-img.fyshark.com/1731495433480WechatIMG674.jpg"
104
+            />
31 105
           </View>
32
-          <View className='search-wrap'>
33
-            <View className='search-bar'>
34
-              <AtIcon className='search-icon' value='search' size='24' color='#ACACAC'></AtIcon>
35
-              <Input
36
-                type='text'
37
-                className='search-input'
38
-                placeholder='夏季男士T恤'
39
-                value={this.state.value}
40
-                onInput={this.handleChange.bind(this)}
41
-              />
42
-              <View className='search-button'>
43
-                搜索
44
-              </View>
106
+          {/* 搜索框 */}
107
+          <SearchBar
108
+            value={this.state.value}
109
+            onChange={this.handleChange}
110
+            onSearch={this.handleSearch}
111
+          />
112
+          {/* tab分类 */}
113
+          <View className="tabs-list">
114
+            <AtTabs
115
+              current={this.state.current}
116
+              scroll
117
+              tabList={this.state.tabList}
118
+              onClick={this.handleClick.bind(this)}
119
+            />
120
+            <View className="tab-more">
121
+              <Image className="tab-more-img" />
45 122
             </View>
46 123
           </View>
124
+          {/* 轮播图 */}
125
+          <View className="banner-wrap">
126
+            <Swiper
127
+              className="banner-swiper"
128
+              circular
129
+              autoplay
130
+              indicatorDots
131
+              indicatorColor="#e8e8e8"
132
+              indicatorActiveColor="#ffffff"
133
+            >
134
+              {this.state.bannerList.map((item) => (
135
+                <SwiperItem className="banner-item" key={item.id}>
136
+                  <Image
137
+                    className="banner-img"
138
+                    src={item.img}
139
+                    mode="aspectFill"
140
+                  />
141
+                </SwiperItem>
142
+              ))}
143
+            </Swiper>
144
+          </View>
145
+        </View>
146
+        {/* 分类列表组件 */}
147
+        <CategoryList categoryList={this.state.categoryList} />
148
+        {/* 运营区域 */}
149
+        <OperationArea />
150
+        {/* 邀请人推荐 */}
151
+        <RecommendList />
152
+        {/* 商品列表 */}
153
+        <ProductList />
154
+
155
+        {/* 添加浮动按钮 */}
156
+        <View className="float-buttons">
157
+          <View
158
+            className="float-btn"
159
+          >
160
+            <Image
161
+              className="my-shop-bg"
162
+              src={myStoreIcon}
163
+              mode="aspectFit"
164
+            />
165
+            <Text>我的{"\n"}小店</Text>
166
+          </View>
167
+          <View
168
+            className="float-btn"
169
+            onClick={this.handleBackTop}
170
+          >
171
+            <Image
172
+              className="back-top"
173
+              src={backTopIcon}
174
+              mode="aspectFit"
175
+            />
176
+          </View>
47 177
         </View>
48 178
       </View>
49
-    )
179
+    );
50 180
   }
51 181
 }

+ 147 - 25
src/pages/index/index.less

@@ -1,9 +1,25 @@
1 1
 .index {
2
+  background-color: #f9f9f9;
3
+  min-height: 100vh;
4
+  padding-bottom: 40px;
5
+
2 6
   .header {
3 7
     width: 100%;
4
-    height: 500px;
5
-    background-color: #FDF652;
6
-    padding-top: 70px;
8
+    position: relative;
9
+
10
+    &::before {
11
+      content: '';
12
+      position: absolute;
13
+      top: 0;
14
+      left: 0;
15
+      right: 0;
16
+      width: 100%;
17
+      height: 100%;
18
+      background: linear-gradient(360deg, #FEF653 0%, #FDF766 100%),
19
+        linear-gradient(179deg, #FEF653 0%, #F4F11B 100%);
20
+      clip-path: ellipse(100% 97% at 50% 0);
21
+      z-index: 0; // 改为0
22
+    }
7 23
 
8 24
     .header-content {
9 25
       width: 100%;
@@ -17,37 +33,143 @@
17 33
       }
18 34
     }
19 35
 
20
-    .search-wrap {
21
-      margin-top: 20px;
36
+
37
+    .tabs-list {
38
+      box-sizing: border-box;
39
+      padding-left: 34px;
40
+      margin-top: 24px;
22 41
       display: flex;
23
-      align-items: center;
24
-      justify-content: center;
42
+      height: 40px;
25 43
 
26
-      .search-bar {
27
-        width: 90%;
44
+      .tab-more {
45
+        width: 90px;
28 46
         display: flex;
29 47
         align-items: center;
30
-        background-color: #FFFFFF; // 黄色背景
31
-        border-radius: 50px;
32
-        padding: 10px;
33
-        .search-icon {
34
-          margin: 0 20px;
48
+        padding: 0 22px 0 26px;
49
+        box-sizing: border-box;
50
+
51
+        .tab-more-img {
52
+          width: 28px;
53
+          height: 28px;
54
+          background-color: red;
35 55
         }
36
-  
37
-        .search-input {
38
-          flex: 1;
39
-          border: none;
40
-          outline: none;
41
-          background-color: transparent;
56
+      }
57
+
58
+      .at-tabs__header {
59
+        background-color: transparent;
60
+        height: 100%;
61
+      }
62
+
63
+      .at-tabs__item {
64
+        color: #000;
65
+        font-size: 26px;
66
+        padding: 0;
67
+        min-width: auto;
68
+        width: auto;
69
+        margin-right: 34px;
70
+        padding-bottom: 2px;
71
+        height: 100%;
72
+
73
+        &--active {
74
+          color: #000;
75
+          font-size: 28px;
76
+          font-weight: bold;
42 77
         }
43
-  
44
-        .search-button {
45
-          border: 1px solid #7D807E;
46
-          border-radius: 50px;
47
-          padding: 5px 20px;
78
+
79
+        &:last-child {
80
+          margin-right: 0;
48 81
         }
49 82
       }
50 83
 
84
+      .at-tabs__item-underline {
85
+        background-color: #000;
86
+        height: 4px;
87
+        border-radius: 2px;
88
+        bottom: 0;
89
+      }
90
+
91
+      .at-tabs__underline {
92
+        width: auto;
93
+      }
94
+    }
95
+
96
+    // 轮播图
97
+    .banner-wrap {
98
+      margin-top: 18px;
99
+
100
+      .banner-swiper {
101
+        height: 350px;
102
+        border-radius: 20px;
103
+        overflow: hidden;
104
+
105
+        .banner-item {
106
+          width: 718px;
107
+          padding: 0 16px;
108
+          box-sizing: border-box;
109
+
110
+          .banner-img {
111
+            width: 100%;
112
+            height: 100%;
113
+            border-radius: 20px;
114
+          }
115
+        }
116
+
117
+        // 修改指示点样式
118
+        .wx-swiper-dots {
119
+          .wx-swiper-dot {
120
+            width: 12px !important;
121
+            height: 12px !important;
122
+
123
+            &.wx-swiper-dot-active {
124
+              width: 30px !important; // 选中时宽度变为10px
125
+              height: 12px !important; // 保持高度不变
126
+              border-radius: 13px !important; // 圆角处理,让两端显示为半圆
127
+            }
128
+          }
129
+        }
130
+      }
131
+    }
132
+  }
133
+
134
+  // 添加浮动按钮样式
135
+  .float-buttons {
136
+    position: fixed;
137
+    right: 34px;
138
+    bottom: 21px;
139
+    z-index: 100;
140
+    display: flex;
141
+    flex-direction: column;
142
+    gap: 23px;
143
+
144
+    .float-btn {
145
+      width: 94px;
146
+      height: 94px;
147
+      border-radius: 50%;
148
+      display: flex;
149
+      flex-direction: column;
150
+      align-items: center;
151
+      justify-content: center;
152
+      color: #fff;
153
+      font-size: 24px;
154
+      text-align: center;
155
+      background-size: 100% 100%;
156
+      background-repeat: no-repeat;
157
+      background-position: center;
158
+      position: relative;
159
+      .back-top{
160
+        height: 100%;
161
+        width: 100%;
162
+      }
163
+      .my-shop-bg{
164
+        height: 100%;
165
+        width: 100%;
166
+        position: absolute;
167
+      }
168
+      Text {
169
+        line-height: 1.2;
170
+        white-space: pre-line;
171
+        z-index: 1;
172
+      }
51 173
     }
52 174
   }
53 175
 }