Explorar o código

隐藏安卓滚动条&&上传头像

viczhq hai 3 semanas
pai
achega
7dd9f42f44

+ 12 - 8
src/pages/index/index.jsx

@@ -7,6 +7,7 @@ import {
7 7
   SwiperItem,
8 8
   Text,
9 9
   Button,
10
+  ScrollView,
10 11
 } from "@tarojs/components";
11 12
 import { AtTabs } from "taro-ui";
12 13
 import { getHomeData, getProductList } from "../../service";
@@ -43,7 +44,7 @@ export default class Index extends Component {
43 44
   // 轮播图点击
44 45
   handleBannerClick = (item) => {
45 46
     if (item.type_jpath == 1) {
46
-      const connector = item.jpath.includes('?') ? '&' : '?';
47
+      const connector = item.jpath.includes("?") ? "&" : "?";
47 48
       Taro.navigateTo({
48 49
         url: `${item.jpath}${connector}isBanner=true`,
49 50
       });
@@ -79,13 +80,16 @@ export default class Index extends Component {
79 80
     );
80 81
   }
81 82
   componentDidShow() {
82
-    this.setState({
83
-      page: 1,
84
-      totalPages: 1,
85
-      loading: false,
86
-    }, () => {
87
-      this.getHomeData(); //获取首页数据
88
-    });
83
+    this.setState(
84
+      {
85
+        page: 1,
86
+        totalPages: 1,
87
+        loading: false,
88
+      },
89
+      () => {
90
+        this.getHomeData(); //获取首页数据
91
+      }
92
+    );
89 93
   }
90 94
   // 添加回到顶部方法
91 95
   handleBackTop = () => {

+ 7 - 1
src/pages/index/index.less

@@ -61,7 +61,13 @@
61 61
       .at-tabs__header::-webkit-scrollbar {
62 62
         display: none; /* 隐藏滚动条 */
63 63
       }
64
-
64
+      scroll-view ::-webkit-scrollbar {
65
+        appearance: none;
66
+        color: transparent;
67
+        display: none;
68
+        width: 0;
69
+        height: 0;
70
+      }
65 71
       .at-tabs__item {
66 72
         color: #000;
67 73
         font-size: 26px;

+ 10 - 8
src/pages/indexSub/productDetail/index.jsx

@@ -238,11 +238,11 @@ export default class Index extends Component {
238 238
         className="index"
239 239
         style={{ paddingTop: Taro.navigationBarHeight + "px" }}
240 240
       >
241
-        {/* {!this.state.isShare && ( */}
241
+        {!this.state.isShare && (
242 242
         <View className="back-btn" onClick={this.handleBack}>
243 243
           <AtIcon value="chevron-left" size="24" color="#999999"></AtIcon>
244
-        </View>
245
-        {/* )} */}
244
+          </View>
245
+        )}
246 246
         {/* 轮播图 */}
247 247
         <Swiper className="swiper" autoplay circular>
248 248
           {productDetail.images &&
@@ -340,11 +340,13 @@ export default class Index extends Component {
340 340
           ))}
341 341
         </View>
342 342
         {/* 底部购买模块 */}
343
-        <View className="bottom-buy">
344
-          <View onClick={this.handleToHome} className="bottom-buy-left">
345
-            <Image src={home} mode="aspectFit" />
346
-            <Text className="bottom-buy-text">首页</Text>
347
-          </View>
343
+        <View className={`bottom-buy ${this.state.isShare ? "share-active" : ""}`}>
344
+          {!this.state.isShare && (
345
+            <View onClick={this.handleToHome} className="bottom-buy-left">
346
+              <Image src={home} mode="aspectFit" />
347
+              <Text className="bottom-buy-text">首页</Text>
348
+            </View>
349
+          )}
348 350
           <View className="bottom-buy-right">
349 351
             {!this.state.isShare ? (
350 352
               <>

+ 4 - 1
src/pages/indexSub/productDetail/index.less

@@ -165,7 +165,10 @@
165 165
             font-weight: 500;
166 166
         }
167 167
     }
168
-
168
+    .share-active{
169
+        justify-content: center !important;
170
+        align-items: center !important;
171
+    }
169 172
     // 底部购买模块
170 173
     .bottom-buy {
171 174
         width: 100%;

+ 0 - 1
src/pages/indexSub/seckillIndex/index.less

@@ -6,7 +6,6 @@
6 6
     .seckill{
7 7
         width: 100%;
8 8
         height: 300px;
9
-        background-color: yellow;
10 9
     }
11 10
     .product-list{
12 11
         margin-top: -71px;

+ 1 - 1
src/pages/memberSub/productClassify/index.jsx

@@ -1,6 +1,6 @@
1 1
 import { Component } from "react";
2 2
 import { View } from "@tarojs/components";
3
-import { AtTabs, AtTabsPane } from "taro-ui";
3
+import { AtTabs } from "taro-ui";
4 4
 import "./index.less";
5 5
 import Taro from "@tarojs/taro";
6 6
 import ProductList from "../../../components/index/ProductList";

+ 7 - 0
src/pages/memberSub/productClassify/index.less

@@ -9,6 +9,13 @@
9 9
         width: 100%;
10 10
         z-index: 1;
11 11
     }
12
+    scroll-view ::-webkit-scrollbar {
13
+        appearance: none;
14
+        color: transparent;
15
+        display: none;
16
+        width: 0;
17
+        height: 0;
18
+      }
12 19
     .at-tabs__item {
13 20
         color: #787878;
14 21
     }

+ 7 - 1
src/pages/memberSub/productManagement/index.less

@@ -17,7 +17,13 @@
17 17
         padding-left: 22px;
18 18
 
19 19
         }
20
-  
20
+        scroll-view ::-webkit-scrollbar {
21
+            appearance: none;
22
+            color: transparent;
23
+            display: none;
24
+            width: 0;
25
+            height: 0;
26
+          }
21 27
         .at-tabs__item {
22 28
           color: #000;
23 29
           font-size: 26px;

+ 27 - 5
src/pages/mineSub/infoEdit/index.jsx

@@ -3,6 +3,7 @@ import { View, Text, Image, Input, Button } from "@tarojs/components";
3 3
 import { AtInput } from "taro-ui";
4 4
 import Taro from "@tarojs/taro";
5 5
 import { updateUserInfo, getUserInfo } from "../../../service";
6
+import { baseUrl } from "../../../api/config";
6 7
 import "./index.less";
7 8
 
8 9
 export default class Index extends Component {
@@ -47,9 +48,30 @@ export default class Index extends Component {
47 48
     return value;
48 49
   }
49 50
   // 选择头像
50
-  handleChooseAvatar = (e) => {
51
-    this.setState({
52
-      avatar: e.detail.avatarUrl,
51
+  handleChooseAvatar = async (e) => {
52
+    Taro.showLoading({
53
+      title: '上传中...',
54
+      mask: true
55
+    });
56
+    Taro.uploadFile({
57
+      url: baseUrl + '/user/tos_upload_file', // 上传的接口地址
58
+      filePath: e.detail.avatarUrl,
59
+      name: 'file',
60
+      success: (uploadRes) => {
61
+        const data = uploadRes.data;
62
+        Taro.hideLoading();
63
+        this.setState({
64
+          avatar: JSON.parse(data).data.file_url,
65
+        });
66
+      },
67
+      fail: (error) => {
68
+        Taro.hideLoading();
69
+        Taro.showToast({
70
+          title: '上传失败',
71
+          icon: 'none',
72
+        });
73
+        console.log(error, 'error');
74
+      }
53 75
     });
54 76
   };
55 77
   // 提交
@@ -92,13 +114,13 @@ export default class Index extends Component {
92 114
         {/* 头像 */}
93 115
         <View className="info-edit">
94 116
           <Image src={this.state.avatar || 'https://yushi.tos-cn-beijing.volces.com/mine/avatar.png'} className="info-edit-img" />
95
-          {/* <Button
117
+          <Button
96 118
             onChooseAvatar={this.handleChooseAvatar}
97 119
             open-type="chooseAvatar"
98 120
             className="info-edit-title"
99 121
           >
100 122
             更换头像
101
-          </Button> */}
123
+          </Button>
102 124
         </View>
103 125
         {/* 内容 */}
104 126
         <View className="info-edit-content">