Kaynağa Gözat

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

viczhq 4 ay önce
ebeveyn
işleme
e5527e235f

+ 7 - 0
project.private.config.json

@@ -10,6 +10,13 @@
10 10
     "miniprogram": {
11 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 20
           "name": "pages/indexSub/seckillIndex/index",
14 21
           "pathName": "pages/indexSub/seckillIndex/index",
15 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 2
 import { View, Image, Text } from "@tarojs/components";
3 3
 import { handleLog } from "../../common/track";
4 4
 import "./index.less";
5 5
 import Taro from "@tarojs/taro";
6 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 16
   const handleCopyLink = () => {
17
+    if (!productPromotion.short_tpwd) {
18
+      return;
19
+    }
10 20
     Taro.setClipboardData({
11 21
       data: productPromotion.short_tpwd,
12 22
     }).then(() => {
@@ -16,7 +26,7 @@ export default function Modal(props) {
16 26
       });
17 27
       if (isSeckill) {
18 28
         handleLog({
19
-          shareUserId:shareUserId,
29
+          shareUserId: shareUserId,
20 30
           event_type: "buy_product_link",
21 31
           event_type_title: "点击购买",
22 32
           goods_id: Number(id),
@@ -39,7 +49,10 @@ export default function Modal(props) {
39 49
                 </View>
40 50
                 <View className="step-box">
41 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 56
                 </View>
44 57
               </View>
45 58
               <View className="step-item">
@@ -48,8 +61,14 @@ export default function Modal(props) {
48 61
                   <Text className="desc">打开闲鱼APP</Text>
49 62
                 </View>
50 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 72
                 </View>
54 73
               </View>
55 74
               <View className="step-item">
@@ -61,14 +80,14 @@ export default function Modal(props) {
61 80
                   <Image
62 81
                     mode="heightFix"
63 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 85
                 </View>
67 86
               </View>
68 87
             </View>
69 88
             {/* 复制口令 */}
70 89
             <View className="copy-link" onClick={handleCopyLink}>
71
-              复制口令
90
+              {productPromotion.short_tpwd ? "复制口令" : "获取中..."}
72 91
             </View>
73 92
           </View>
74 93
         </View>

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

@@ -45,9 +45,10 @@ export default class Index extends Component {
45 45
   };
46 46
   // 修改 tab 切换处理函数
47 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 52
         duration: 200, // 滚动动画持续时间,单位 ms
52 53
       });
53 54
     this.setState(

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

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

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

@@ -57,6 +57,7 @@ export default class Index extends Component {
57 57
     const res = await getProductPromotion({
58 58
       goods_id: [this.state.id],
59 59
       item_id: [this.state.productDetail.item_id],
60
+      material_type:1,//1:自购省,2:红包购买
60 61
     });
61 62
     this.setState({
62 63
       productPromotion:
@@ -155,12 +156,12 @@ export default class Index extends Component {
155 156
 
156 157
   // 立即购买
157 158
   handleBuy = async () => {
158
-    if (!this.state.productPromotion.short_tpwd) {
159
-      await this.getProductPromotion();
160
-    }
161 159
     this.setState({
162 160
       isOpened: "self",
163 161
     });
162
+    if (!this.state.productPromotion.short_tpwd) {
163
+      await this.getProductPromotion();
164
+    }
164 165
   };
165 166
   // 绑定分享跳转标识
166 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 102
   getFishMarketTags = async () => {
103
-    let res = await getFishMarketTags();
103
+    let res = await getFishMarketTags({
104
+      tag_id: this.state.id,
105
+    });
104 106
     res = res.map((item, index) => ({
105
-      title: item.name,
107
+      title: item.tab_name
106 108
     }));
107 109
     this.setState({ tabList: res }, () => {
108 110
       this.getRecommendProductList(); //获取商品
@@ -142,15 +144,12 @@ export default class Index extends Component {
142 144
   };
143 145
   // 点击标签页
144 146
   handleClick(value) {
145
-    // 跳转到顶部
146
-    Taro.pageScrollTo({
147
-      scrollTop: 0,
148
-      duration: 300,
149
-    });
147
+    if (this.state.current == value) return;
150 148
     this.setState(
151 149
       {
152 150
         current: value,
153 151
         page: 1,
152
+        productList: [],
154 153
       },
155 154
       () => {
156 155
         this.getRecommendProductList(true);

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

@@ -3,23 +3,26 @@
3 3
     padding-bottom: 40px;
4 4
     box-sizing: border-box;
5 5
     background-color: #f9f9f9;
6
-
6
+    min-height: 100vh;
7 7
     .seckill {
8 8
         width: 100%;
9 9
         height: 300px;
10 10
     }
11
+
11 12
     // 顶部固定
12 13
     .tabs {
13 14
         width: 100%;
14 15
         background: #fff;
15 16
         z-index: 100;
16
-        
17
+
17 18
         &.fixed {
18 19
             position: fixed;
19 20
             top: 0;
20 21
             left: 0;
21 22
         }
22
-
23
+        .at-tabs__header{
24
+            text-align: left;
25
+        }
23 26
         .at-tabs__item {
24 27
             color: #787878;
25 28
         }
@@ -43,19 +46,17 @@
43 46
     }
44 47
 
45 48
     .product-list {
49
+        min-height: calc(100vh - 300px);
46 50
         background-color: #fff;
47
-        margin:0 16px;
51
+        margin: 0 16px;
48 52
         margin-top: -196px;
49 53
         border-radius: 16px;
50 54
         overflow: hidden;
51 55
         z-index: 100;
52 56
         position: relative;
53
-        .product-list-wrap{
57
+
58
+        .product-list-wrap {
54 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 18
     page: 1, //页数
19 19
     loading: false, //加载状态
20 20
     totalPages: 1, // 添加总页数
21
-    tabList: [], // 所有闲鱼tags
22 21
     value: "", // 搜索
23 22
   };
24 23
   // 点击标签页
25 24
   handleClick(value) {
25
+    if (this.state.current == value) return;
26 26
     this.setState(
27 27
       {
28 28
         current: value,
29 29
         page: 1,
30 30
         value: "",
31
+        productList: [],
31 32
       },
32 33
       () => {
33
-        Taro.pageScrollTo({
34
-          scrollTop: 0,
35
-          duration: 300,
36
-        });
37 34
         this.getBrowseShopProductList(true);
38 35
       }
39 36
     );
40 37
   }
41 38
   componentDidMount() {
42
-    this.getAllTags();
39
+    this.getAllTags(); //获取所有闲鱼tags
43 40
   }
44 41
   // 获取商品列表
45 42
   getBrowseShopProductList = async (isAdd = false) => {
@@ -70,7 +67,6 @@ export default class Index extends Component {
70 67
     this.setState(
71 68
       {
72 69
         tabList: res,
73
-        productList: [],
74 70
       },
75 71
       () => {
76 72
         this.getBrowseShopProductList(true);
@@ -85,6 +81,7 @@ export default class Index extends Component {
85 81
   handleSearch = () => {
86 82
     this.setState({
87 83
       page: 1,
84
+      productList: [],
88 85
     },()=>{
89 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 14
     const res = await getUserAgreement({
15 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 19
     this.setState({
18 20
       agreement: res.content
19 21
     })