Browse Source

列表tab筛选优化&鱼市说明样式优化

viczhq 4 months ago
parent
commit
e5527e235f

+ 7 - 0
project.private.config.json

@@ -10,6 +10,13 @@
10
     "miniprogram": {
10
     "miniprogram": {
11
       "list": [
11
       "list": [
12
         {
12
         {
13
+          "name": "pages/mineSub/explain/index",
14
+          "pathName": "pages/mineSub/explain/index",
15
+          "query": "",
16
+          "launchMode": "default",
17
+          "scene": null
18
+        },
19
+        {
13
           "name": "pages/indexSub/seckillIndex/index",
20
           "name": "pages/indexSub/seckillIndex/index",
14
           "pathName": "pages/indexSub/seckillIndex/index",
21
           "pathName": "pages/indexSub/seckillIndex/index",
15
           "query": "isDirect=true&title=%E5%90%83%E5%96%9D%E7%8E%A9%E4%B9%90&id=128",
22
           "query": "isDirect=true&title=%E5%90%83%E5%96%9D%E7%8E%A9%E4%B9%90&id=128",

+ 28 - 9
src/components/Modal/index.jsx

@@ -1,12 +1,22 @@
1
-import { AtModal, AtModalContent } from "taro-ui";
1
+import { AtModal, AtModalContent, ActivityIndicator } from "taro-ui";
2
 import { View, Image, Text } from "@tarojs/components";
2
 import { View, Image, Text } from "@tarojs/components";
3
 import { handleLog } from "../../common/track";
3
 import { handleLog } from "../../common/track";
4
 import "./index.less";
4
 import "./index.less";
5
 import Taro from "@tarojs/taro";
5
 import Taro from "@tarojs/taro";
6
 export default function Modal(props) {
6
 export default function Modal(props) {
7
-  const { productPromotion, isOpened, title, linkText, id, shareUserId,isSeckill } =
8
-    props;
7
+  const {
8
+    productPromotion,
9
+    isOpened,
10
+    title,
11
+    linkText,
12
+    id,
13
+    shareUserId,
14
+    isSeckill,
15
+  } = props;
9
   const handleCopyLink = () => {
16
   const handleCopyLink = () => {
17
+    if (!productPromotion.short_tpwd) {
18
+      return;
19
+    }
10
     Taro.setClipboardData({
20
     Taro.setClipboardData({
11
       data: productPromotion.short_tpwd,
21
       data: productPromotion.short_tpwd,
12
     }).then(() => {
22
     }).then(() => {
@@ -16,7 +26,7 @@ export default function Modal(props) {
16
       });
26
       });
17
       if (isSeckill) {
27
       if (isSeckill) {
18
         handleLog({
28
         handleLog({
19
-          shareUserId:shareUserId,
29
+          shareUserId: shareUserId,
20
           event_type: "buy_product_link",
30
           event_type: "buy_product_link",
21
           event_type_title: "点击购买",
31
           event_type_title: "点击购买",
22
           goods_id: Number(id),
32
           goods_id: Number(id),
@@ -39,7 +49,10 @@ export default function Modal(props) {
39
                 </View>
49
                 </View>
40
                 <View className="step-box">
50
                 <View className="step-box">
41
                   <View className="step-One">复制口令</View>
51
                   <View className="step-One">复制口令</View>
42
-                  <Image className="step-img-one" src='https://yushi.tos-cn-beijing.volces.com/productDetail/selectStep.png'/>
52
+                  <Image
53
+                    className="step-img-one"
54
+                    src="https://yushi.tos-cn-beijing.volces.com/productDetail/selectStep.png"
55
+                  />
43
                 </View>
56
                 </View>
44
               </View>
57
               </View>
45
               <View className="step-item">
58
               <View className="step-item">
@@ -48,8 +61,14 @@ export default function Modal(props) {
48
                   <Text className="desc">打开闲鱼APP</Text>
61
                   <Text className="desc">打开闲鱼APP</Text>
49
                 </View>
62
                 </View>
50
                 <View className="step-box">
63
                 <View className="step-box">
51
-                  <Image className="step-img-t" src='https://yushi.tos-cn-beijing.volces.com/productDetail/xianyu.png' />
52
-                  <Image className="step-img-two" src='https://yushi.tos-cn-beijing.volces.com/productDetail/selectStep.png' />
64
+                  <Image
65
+                    className="step-img-t"
66
+                    src="https://yushi.tos-cn-beijing.volces.com/productDetail/xianyu.png"
67
+                  />
68
+                  <Image
69
+                    className="step-img-two"
70
+                    src="https://yushi.tos-cn-beijing.volces.com/productDetail/selectStep.png"
71
+                  />
53
                 </View>
72
                 </View>
54
               </View>
73
               </View>
55
               <View className="step-item">
74
               <View className="step-item">
@@ -61,14 +80,14 @@ export default function Modal(props) {
61
                   <Image
80
                   <Image
62
                     mode="heightFix"
81
                     mode="heightFix"
63
                     className="step-img-three"
82
                     className="step-img-three"
64
-                    src='https://yushi.tos-cn-beijing.volces.com/productDetail/stepThree.png'
83
+                    src="https://yushi.tos-cn-beijing.volces.com/productDetail/stepThree.png"
65
                   />
84
                   />
66
                 </View>
85
                 </View>
67
               </View>
86
               </View>
68
             </View>
87
             </View>
69
             {/* 复制口令 */}
88
             {/* 复制口令 */}
70
             <View className="copy-link" onClick={handleCopyLink}>
89
             <View className="copy-link" onClick={handleCopyLink}>
71
-              复制口令
90
+              {productPromotion.short_tpwd ? "复制口令" : "获取中..."}
72
             </View>
91
             </View>
73
           </View>
92
           </View>
74
         </View>
93
         </View>

+ 3 - 2
src/pages/index/index.jsx

@@ -45,9 +45,10 @@ export default class Index extends Component {
45
   };
45
   };
46
   // 修改 tab 切换处理函数
46
   // 修改 tab 切换处理函数
47
   handleClick(value) {
47
   handleClick(value) {
48
+    if (this.state.current == value) return;
48
     // 添加回到顶部方法
49
     // 添加回到顶部方法
49
-      Taro.pageScrollTo({
50
-        scrollTop: 500, // 滚动到顶部位置
50
+    Taro.pageScrollTo({
51
+      scrollTop: 500, // 滚动到顶部位置
51
         duration: 200, // 滚动动画持续时间,单位 ms
52
         duration: 200, // 滚动动画持续时间,单位 ms
52
       });
53
       });
53
     this.setState(
54
     this.setState(

+ 1 - 0
src/pages/indexSub/activity/index.jsx

@@ -89,6 +89,7 @@ export default class Index extends Component {
89
   };
89
   };
90
   // 切换tab
90
   // 切换tab
91
   tabClick = (index) => {
91
   tabClick = (index) => {
92
+    if (this.state.current == index) return;
92
     this.setState(
93
     this.setState(
93
       {
94
       {
94
         current: index,
95
         current: index,

+ 4 - 3
src/pages/indexSub/productDetail/index.jsx

@@ -57,6 +57,7 @@ export default class Index extends Component {
57
     const res = await getProductPromotion({
57
     const res = await getProductPromotion({
58
       goods_id: [this.state.id],
58
       goods_id: [this.state.id],
59
       item_id: [this.state.productDetail.item_id],
59
       item_id: [this.state.productDetail.item_id],
60
+      material_type:1,//1:自购省,2:红包购买
60
     });
61
     });
61
     this.setState({
62
     this.setState({
62
       productPromotion:
63
       productPromotion:
@@ -155,12 +156,12 @@ export default class Index extends Component {
155
 
156
 
156
   // 立即购买
157
   // 立即购买
157
   handleBuy = async () => {
158
   handleBuy = async () => {
158
-    if (!this.state.productPromotion.short_tpwd) {
159
-      await this.getProductPromotion();
160
-    }
161
     this.setState({
159
     this.setState({
162
       isOpened: "self",
160
       isOpened: "self",
163
     });
161
     });
162
+    if (!this.state.productPromotion.short_tpwd) {
163
+      await this.getProductPromotion();
164
+    }
164
   };
165
   };
165
   // 绑定分享跳转标识
166
   // 绑定分享跳转标识
166
   bindShareJump = async () => {
167
   bindShareJump = async () => {

+ 6 - 7
src/pages/indexSub/seckillIndex/index.jsx

@@ -100,9 +100,11 @@ export default class Index extends Component {
100
   }
100
   }
101
   // 获取标签
101
   // 获取标签
102
   getFishMarketTags = async () => {
102
   getFishMarketTags = async () => {
103
-    let res = await getFishMarketTags();
103
+    let res = await getFishMarketTags({
104
+      tag_id: this.state.id,
105
+    });
104
     res = res.map((item, index) => ({
106
     res = res.map((item, index) => ({
105
-      title: item.name,
107
+      title: item.tab_name
106
     }));
108
     }));
107
     this.setState({ tabList: res }, () => {
109
     this.setState({ tabList: res }, () => {
108
       this.getRecommendProductList(); //获取商品
110
       this.getRecommendProductList(); //获取商品
@@ -142,15 +144,12 @@ export default class Index extends Component {
142
   };
144
   };
143
   // 点击标签页
145
   // 点击标签页
144
   handleClick(value) {
146
   handleClick(value) {
145
-    // 跳转到顶部
146
-    Taro.pageScrollTo({
147
-      scrollTop: 0,
148
-      duration: 300,
149
-    });
147
+    if (this.state.current == value) return;
150
     this.setState(
148
     this.setState(
151
       {
149
       {
152
         current: value,
150
         current: value,
153
         page: 1,
151
         page: 1,
152
+        productList: [],
154
       },
153
       },
155
       () => {
154
       () => {
156
         this.getRecommendProductList(true);
155
         this.getRecommendProductList(true);

+ 10 - 9
src/pages/indexSub/seckillIndex/index.less

@@ -3,23 +3,26 @@
3
     padding-bottom: 40px;
3
     padding-bottom: 40px;
4
     box-sizing: border-box;
4
     box-sizing: border-box;
5
     background-color: #f9f9f9;
5
     background-color: #f9f9f9;
6
-
6
+    min-height: 100vh;
7
     .seckill {
7
     .seckill {
8
         width: 100%;
8
         width: 100%;
9
         height: 300px;
9
         height: 300px;
10
     }
10
     }
11
+
11
     // 顶部固定
12
     // 顶部固定
12
     .tabs {
13
     .tabs {
13
         width: 100%;
14
         width: 100%;
14
         background: #fff;
15
         background: #fff;
15
         z-index: 100;
16
         z-index: 100;
16
-        
17
+
17
         &.fixed {
18
         &.fixed {
18
             position: fixed;
19
             position: fixed;
19
             top: 0;
20
             top: 0;
20
             left: 0;
21
             left: 0;
21
         }
22
         }
22
-
23
+        .at-tabs__header{
24
+            text-align: left;
25
+        }
23
         .at-tabs__item {
26
         .at-tabs__item {
24
             color: #787878;
27
             color: #787878;
25
         }
28
         }
@@ -43,19 +46,17 @@
43
     }
46
     }
44
 
47
 
45
     .product-list {
48
     .product-list {
49
+        min-height: calc(100vh - 300px);
46
         background-color: #fff;
50
         background-color: #fff;
47
-        margin:0 16px;
51
+        margin: 0 16px;
48
         margin-top: -196px;
52
         margin-top: -196px;
49
         border-radius: 16px;
53
         border-radius: 16px;
50
         overflow: hidden;
54
         overflow: hidden;
51
         z-index: 100;
55
         z-index: 100;
52
         position: relative;
56
         position: relative;
53
-        .product-list-wrap{
57
+
58
+        .product-list-wrap {
54
             margin: 0;
59
             margin: 0;
55
         }
60
         }
56
     }
61
     }
57
-}
58
-
59
-.tabs-placeholder {
60
-    height: 80px; // 设置为tabs的实际高度
61
 }
62
 }

+ 4 - 7
src/pages/memberSub/productClassify/index.jsx

@@ -18,28 +18,25 @@ export default class Index extends Component {
18
     page: 1, //页数
18
     page: 1, //页数
19
     loading: false, //加载状态
19
     loading: false, //加载状态
20
     totalPages: 1, // 添加总页数
20
     totalPages: 1, // 添加总页数
21
-    tabList: [], // 所有闲鱼tags
22
     value: "", // 搜索
21
     value: "", // 搜索
23
   };
22
   };
24
   // 点击标签页
23
   // 点击标签页
25
   handleClick(value) {
24
   handleClick(value) {
25
+    if (this.state.current == value) return;
26
     this.setState(
26
     this.setState(
27
       {
27
       {
28
         current: value,
28
         current: value,
29
         page: 1,
29
         page: 1,
30
         value: "",
30
         value: "",
31
+        productList: [],
31
       },
32
       },
32
       () => {
33
       () => {
33
-        Taro.pageScrollTo({
34
-          scrollTop: 0,
35
-          duration: 300,
36
-        });
37
         this.getBrowseShopProductList(true);
34
         this.getBrowseShopProductList(true);
38
       }
35
       }
39
     );
36
     );
40
   }
37
   }
41
   componentDidMount() {
38
   componentDidMount() {
42
-    this.getAllTags();
39
+    this.getAllTags(); //获取所有闲鱼tags
43
   }
40
   }
44
   // 获取商品列表
41
   // 获取商品列表
45
   getBrowseShopProductList = async (isAdd = false) => {
42
   getBrowseShopProductList = async (isAdd = false) => {
@@ -70,7 +67,6 @@ export default class Index extends Component {
70
     this.setState(
67
     this.setState(
71
       {
68
       {
72
         tabList: res,
69
         tabList: res,
73
-        productList: [],
74
       },
70
       },
75
       () => {
71
       () => {
76
         this.getBrowseShopProductList(true);
72
         this.getBrowseShopProductList(true);
@@ -85,6 +81,7 @@ export default class Index extends Component {
85
   handleSearch = () => {
81
   handleSearch = () => {
86
     this.setState({
82
     this.setState({
87
       page: 1,
83
       page: 1,
84
+      productList: [],
88
     },()=>{
85
     },()=>{
89
       this.getBrowseShopProductList(true);
86
       this.getBrowseShopProductList(true);
90
     })
87
     })

+ 2 - 0
src/pages/mineSub/explain/index.jsx

@@ -14,6 +14,8 @@ export default class Index extends Component {
14
     const res = await getUserAgreement({
14
     const res = await getUserAgreement({
15
       type:2
15
       type:2
16
     })
16
     })
17
+    // 替换图片样式
18
+    res.content = res.content.replace(/<img/g, '<img style="max-width: 100%; width: 100%; height: auto; display: block; margin: 0 auto;"')
17
     this.setState({
19
     this.setState({
18
       agreement: res.content
20
       agreement: res.content
19
     })
21
     })