瀏覽代碼

对接会员接口

viczhq 1 周之前
父節點
當前提交
5cec8f8059
共有 34 個文件被更改,包括 835 次插入179 次删除
  1. 30 9
      project.private.config.json
  2. 1 1
      src/api/config.js
  3. 16 0
      src/api/request.js
  4. 5 3
      src/app.config.js
  5. 9 0
      src/app.js
  6. 20 0
      src/common/toParams.js
  7. 34 0
      src/common/upLoadImg.js
  8. 21 14
      src/components/index/ProductList/index.jsx
  9. 二進制
      src/images/loginBg.png
  10. 二進制
      src/images/logo1.png
  11. 52 45
      src/pages/index/index.jsx
  12. 1 1
      src/pages/indexSub/productDetail/index.jsx
  13. 4 0
      src/pages/indexSub/searchList/index.config.js
  14. 16 0
      src/pages/indexSub/searchList/index.jsx
  15. 6 0
      src/pages/indexSub/searchList/index.less
  16. 41 1
      src/pages/indexSub/seckillIndex/index.jsx
  17. 2 0
      src/pages/indexSub/seckillIndex/index.less
  18. 8 2
      src/pages/member/index.jsx
  19. 11 1
      src/pages/memberSub/productClassify/index.jsx
  20. 2 1
      src/pages/memberSub/productClassify/index.less
  21. 95 38
      src/pages/memberSub/productManagement/index.jsx
  22. 5 0
      src/pages/memberSub/productManagement/index.less
  23. 7 1
      src/pages/memberSub/storeManagement/index.jsx
  24. 0 1
      src/pages/memberSub/storeManagement/index.less
  25. 74 38
      src/pages/mine/index.jsx
  26. 62 9
      src/pages/mineSub/infoEdit/index.jsx
  27. 5 0
      src/pages/mineSub/infoEdit/index.less
  28. 3 0
      src/pages/mineSub/login/index.config.js
  29. 123 0
      src/pages/mineSub/login/index.jsx
  30. 118 0
      src/pages/mineSub/login/index.less
  31. 3 0
      src/pages/search/index.config.js
  32. 20 0
      src/pages/search/index.jsx
  33. 6 0
      src/pages/search/index.less
  34. 35 14
      src/service/index.js

+ 30 - 9
project.private.config.json

@@ -10,6 +10,27 @@
10 10
     "miniprogram": {
11 11
       "list": [
12 12
         {
13
+          "name": "pages/mineSub/login/index",
14
+          "pathName": "pages/mineSub/login/index",
15
+          "query": "",
16
+          "launchMode": "default",
17
+          "scene": null
18
+        },
19
+        {
20
+          "name": "pages/searchList/index",
21
+          "pathName": "pages/indexSub/searchList/index",
22
+          "query": "",
23
+          "launchMode": "default",
24
+          "scene": null
25
+        },
26
+        {
27
+          "name": "pages/search/index",
28
+          "pathName": "pages/search/index",
29
+          "query": "",
30
+          "launchMode": "default",
31
+          "scene": null
32
+        },
33
+        {
13 34
           "name": "pages/memberSub/productManagement/index",
14 35
           "pathName": "pages/memberSub/productManagement/index",
15 36
           "query": "",
@@ -17,29 +38,29 @@
17 38
           "scene": null
18 39
         },
19 40
         {
20
-          "name": "pages/infoEdit/index",
21
-          "pathName": "pages/indexSub/productDetail/index",
22
-          "query": "id=100",
41
+          "name": "pages/memberSub/productClassify/index",
42
+          "pathName": "pages/memberSub/productClassify/index",
43
+          "query": "",
23 44
           "launchMode": "default",
24 45
           "scene": null
25 46
         },
26 47
         {
27
-          "name": "pages/productManagement/index",
28
-          "pathName": "pages/productManagement/index",
48
+          "name": "pages/mineSub/login/index",
49
+          "pathName": "pages/mineSub/login/index",
29 50
           "query": "",
30 51
           "launchMode": "default",
31 52
           "scene": null
32 53
         },
33 54
         {
34
-          "name": "pages/storeManagement/index",
35
-          "pathName": "pages/storeManagement/index",
36
-          "query": "isManager=true",
55
+          "name": "pages/infoEdit/index",
56
+          "pathName": "pages/indexSub/productDetail/index",
57
+          "query": "id=100",
37 58
           "launchMode": "default",
38 59
           "scene": null
39 60
         },
40 61
         {
41 62
           "name": "pages/productManagement/index",
42
-          "pathName": "pages/mine/index",
63
+          "pathName": "pages/productManagement/index",
43 64
           "query": "",
44 65
           "launchMode": "default",
45 66
           "scene": null

+ 1 - 1
src/api/config.js

@@ -1,6 +1,6 @@
1 1
 // 配置请求对象
2 2
 // 本地调试 dev 开发阶段
3
-export const baseUrl = "http://101.126.135.47:8000";//测试
3
+export const baseUrl = "https://api.yushixcx.com";//测试
4 4
 // export const baseUrl = "https://openai.fyshark.com";//正式
5 5
 
6 6
 

+ 16 - 0
src/api/request.js

@@ -16,8 +16,14 @@ export default async (options = { method: 'GET', data: {} }) => {
16 16
   const request_data = {
17 17
     session_key: Taro.getStorageSync('session_key') || '', // 缓存取值
18 18
     appid: getAppId(),
19
+    channel_name:'WeChat'
19 20
   };
20 21
 
22
+  // 如果是登录接口,移除 session_key
23
+  if (options.url.includes('/user/login_applet')) {
24
+    delete request_data.session_key;
25
+  }
26
+
21 27
   try {
22 28
     const res = await Taro.request({
23 29
       url: baseUrl + options.url,
@@ -56,6 +62,16 @@ export default async (options = { method: 'GET', data: {} }) => {
56 62
           icon: 'none',
57 63
           mask: true,
58 64
         });
65
+        const app = Taro.getApp()
66
+        // 获取当前跳转到登录的页面路径
67
+        const currentPage = Taro.getCurrentPages();
68
+        // 储存当前页面路径
69
+        Taro.setStorageSync('currentPage', currentPage[currentPage.length - 1].route);// 存储页面路径
70
+        // 储存当前页面数据
71
+        app.updateOptionsData(currentPage[currentPage.length - 1].options);// 更新页面数据
72
+        Taro.reLaunch({
73
+          url: '/pages/mineSub/login/index',
74
+        });
59 75
         throw new Error('需要登录');
60 76
       default:
61 77
         Taro.showToast({

+ 5 - 3
src/app.config.js

@@ -1,16 +1,17 @@
1
-
2 1
 export default defineAppConfig({
3 2
   pages: [
4 3
     'pages/index/index',
5 4
     'pages/member/index',
6
-    "pages/mine/index"
5
+    "pages/mine/index",
6
+    "pages/search/index",
7 7
   ],
8 8
   subpackages: [
9 9
     {
10 10
       root: "pages/indexSub",
11 11
       pages: [
12 12
         "productDetail/index",
13
-        "seckillIndex/index"
13
+        "seckillIndex/index",
14
+        "searchList/index"
14 15
       ]
15 16
     },
16 17
     {
@@ -32,6 +33,7 @@ export default defineAppConfig({
32 33
       pages: [
33 34
         "infoEdit/index",
34 35
         "userSpecification/index",
36
+        "login/index"
35 37
       ]
36 38
     },
37 39
   ],

+ 9 - 0
src/app.js

@@ -4,6 +4,15 @@ import './app.less'
4 4
 import 'taro-ui/dist/style/index.scss'
5 5
 
6 6
 class App extends Component {
7
+  state = {
8
+    userInfo: Taro.getStorageSync('userInfo') || {},// 用户信息
9
+    optionsData: {},// 未登录页面跳转数据
10
+  }
11
+
12
+  // 新增方法:更新 optionsData
13
+  updateOptionsData = (data) => {
14
+    this.setState({ optionsData: data });
15
+  }
7 16
 
8 17
   componentDidMount () {
9 18
     // 存储导航栏高度

+ 20 - 0
src/common/toParams.js

@@ -0,0 +1,20 @@
1
+// 转化字符串(key,value)
2
+export const objToParam = function (param) {
3
+    if (Object.prototype.toString.call(param) !== '[object Object]') {
4
+      return ''
5
+    }
6
+    let queryParam = ''
7
+    for (let key in param) {
8
+      if (param.hasOwnProperty(key)) {
9
+        let value = param[key]
10
+        queryParam += toQueryPair(key, value)
11
+      }
12
+    }
13
+    return queryParam
14
+  }
15
+  function toQueryPair(key, value) {
16
+    if (typeof value == 'undefined') {
17
+      return `${key}=&`
18
+    }
19
+    return `${key}=${value}&`
20
+  }

+ 34 - 0
src/common/upLoadImg.js

@@ -0,0 +1,34 @@
1
+import Taro from '@tarojs/taro';
2
+export const chooseAndUploadImage = (url, user = 'test') => {
3
+  return new Promise((resolve, reject) => {
4
+    Taro.chooseImage({
5
+      success (chooseRes) {
6
+        const tempFilePaths = chooseRes.tempFilePaths;
7
+        
8
+        if (tempFilePaths.length === 0) {
9
+          reject(new Error('No image selected'));
10
+          return;
11
+        }
12
+
13
+        Taro.uploadFile({
14
+          url: url, // 上传的接口地址
15
+          filePath: tempFilePaths[0],
16
+          name: 'file',
17
+          formData: {
18
+            'user': user
19
+          },
20
+          success (uploadRes) {
21
+            const data = uploadRes.data;
22
+            resolve(data); // 成功上传后返回数据
23
+          },
24
+          fail (error) {
25
+            reject(error); // 上传失败时返回错误
26
+          }
27
+        });
28
+      },
29
+      fail (chooseError) {
30
+        reject(chooseError); // 选择图片失败时返回错误
31
+      }
32
+    });
33
+  });
34
+};

+ 21 - 14
src/components/index/ProductList/index.jsx

@@ -33,6 +33,22 @@ const ProductList = forwardRef((props, ref) => {
33 33
     // 每当 selectedProducts 变化时,调用父组件的回调
34 34
     onDeleteProductSelect && onDeleteProductSelect(selectedProducts);
35 35
   }, [selectedProducts]);
36
+  // 监听 isSelectAll 的变化
37
+  useEffect(() => {
38
+    if (isSelectAll) {
39
+      // 如果 isSelectAll 为 true,选中所有商品
40
+      setSelectedProducts(productList.map((product) => product.id));
41
+    } else {
42
+      // 如果 isSelectAll 为 false,取消所有选中
43
+      setSelectedProducts([]);
44
+    }
45
+  }, [isSelectAll, productList]);
46
+  // 定义 clearSelectedItems 方法
47
+  useImperativeHandle(ref, () => ({
48
+    clearSelectedItems: () => {
49
+      setSelectedProducts([]);
50
+    }
51
+  }));
36 52
 
37 53
   // 跳转产品详情
38 54
   const toDetail = (id) => {
@@ -45,16 +61,6 @@ const ProductList = forwardRef((props, ref) => {
45 61
     }
46 62
   };
47 63
 
48
-  // 监听 isSelectAll 的变化
49
-  useEffect(() => {
50
-    if (isSelectAll) {
51
-      // 如果 isSelectAll 为 true,选中所有商品
52
-      setSelectedProducts(productList.map((product) => product.id));
53
-    } else {
54
-      // 如果 isSelectAll 为 false,取消所有选中
55
-      setSelectedProducts([]);
56
-    }
57
-  }, [isSelectAll]); // 依赖项是 isSelectAll
58 64
   // 单选
59 65
   const selectProduct = (productId) => {
60 66
     setSelectedProducts((prevSelected) => {
@@ -71,9 +77,9 @@ const ProductList = forwardRef((props, ref) => {
71 77
   // 添加商品
72 78
   const addProduct = (productId, is_collected) => {
73 79
     // 是否添加到我的商店(is_collected:为true已添加)
74
-    if(is_collected){
80
+    if (is_collected) {
75 81
       return;
76
-    }else{
82
+    } else {
77 83
       // 调用父组件的方法
78 84
       onAddProduct && onAddProduct(productId);
79 85
     }
@@ -122,11 +128,11 @@ const ProductList = forwardRef((props, ref) => {
122 128
                       </Text>
123 129
                     )}
124 130
                   </View>
125
-                  {!isSeckill && !isManagement && (
131
+                  {isProductClassify && (
126 132
                     <View
127 133
                       onClick={(e) => {
128 134
                         e.stopPropagation();
129
-                        addProduct(product.id,product.is_collected);
135
+                        addProduct(product.id, product.is_collected);
130 136
                       }}
131 137
                       className="add-btn"
132 138
                     >
@@ -178,6 +184,7 @@ const ProductList = forwardRef((props, ref) => {
178 184
       {loading && (
179 185
         <View className="loading">
180 186
           <AtActivityIndicator
187
+            content="加载中..."
181 188
             isOpened={loading}
182 189
             mode="center"
183 190
             color="#fdf764"

二進制
src/images/loginBg.png


二進制
src/images/logo1.png


+ 52 - 45
src/pages/index/index.jsx

@@ -2,7 +2,7 @@ import Taro from "@tarojs/taro"; // 导入 Taro
2 2
 import { Component } from "react";
3 3
 import { View, Image, Swiper, SwiperItem, Text } from "@tarojs/components";
4 4
 import { AtTabs } from "taro-ui";
5
-import { getHomeData,getProductList } from "../../service";
5
+import { getHomeData, getProductList } from "../../service";
6 6
 import "./index.less";
7 7
 import SearchBar from "../../components/index/SearchBar"; //搜索框
8 8
 import CategoryList from "../../components/index/CategoryList"; //分类列表
@@ -32,15 +32,19 @@ export default class Index extends Component {
32 32
     ],
33 33
     bannerList: [],
34 34
     productList: [], // 添加商品列表
35
-    page: 1,         // 添加页码
36
-    totalPages: 1,   // 添加总页数
37
-    loading: false   // 添加加载状态
35
+    page: 1, // 添加页码
36
+    totalPages: 1, // 添加总页数
37
+    loading: false, // 添加加载状态
38 38
   };
39 39
   // 获取首页数据
40 40
   getHomeData = async () => {
41 41
     const res = await getHomeData();
42
-    res.tags = res.tags.split(",").map((title) => ({ title }));
43
-    this.setState({ homeData: res });
42
+    res.tags = res.tags.map((item, index) => ({
43
+      title: item.name,
44
+    }));
45
+    this.setState({ homeData: res }, () => {
46
+      this.getProductList(true);
47
+    });
44 48
   };
45 49
   // 搜索框值改变
46 50
   handleChange(value) {
@@ -48,29 +52,32 @@ export default class Index extends Component {
48 52
   }
49 53
   // 修改 tab 切换处理函数
50 54
   handleClick(value) {
51
-    this.setState({
52
-      current: value,
53
-    }, () => {
54
-      // 跳转到列表顶部
55
-      Taro.createSelectorQuery()
56
-      .select('.product-list-wrap') 
57
-      .boundingClientRect()
58
-      .exec(res => {
59
-        if (res[0]) {
60
-          const top = res[0].top;
61
-          Taro.pageScrollTo({
62
-            scrollTop: top-40, 
63
-            duration: 300  
55
+    this.setState(
56
+      {
57
+        current: value,
58
+      },
59
+      () => {
60
+        // 跳转到列表顶部
61
+        Taro.createSelectorQuery()
62
+          .select(".product-list-wrap")
63
+          .boundingClientRect()
64
+          .exec((res) => {
65
+            if (res[0]) {
66
+              const top = res[0].top;
67
+              Taro.pageScrollTo({
68
+                scrollTop: top - 40,
69
+                duration: 300,
70
+              });
71
+              this.getProductList(true);
72
+            } else {
73
+              console.warn("未找到 .product-list-wrap 元素");
74
+            }
64 75
           });
65
-        } else {
66
-          console.warn('未找到 .product-list-wrap 元素');
67
-        }
68
-      });
69
-    });
76
+      }
77
+    );
70 78
   }
71 79
   componentDidShow() {
72 80
     this.getHomeData(); //获取首页数据
73
-    this.getProductList(true); //获取商品列表
74 81
   }
75 82
 
76 83
   // 添加回到顶部方法
@@ -86,7 +93,7 @@ export default class Index extends Component {
86 93
     const { page, totalPages, loading } = this.state;
87 94
     if (page < totalPages && !loading) {
88 95
       this.setState(
89
-        prevState => ({ page: prevState.page + 1 }),
96
+        (prevState) => ({ page: prevState.page + 1 }),
90 97
         () => this.getProductList()
91 98
       );
92 99
     }
@@ -96,17 +103,19 @@ export default class Index extends Component {
96 103
   getProductList = async (isRefresh) => {
97 104
     const { page } = this.state;
98 105
     this.setState({ loading: true });
99
-    
100 106
     const res = await getProductList({
101
-      tag_name: "",
107
+      // tag_name:  this.state.homeData.tags[this.state.current].title,
108
+      tag_name:'首页',
102 109
       page,
103 110
       page_size: 10,
104 111
     });
105 112
 
106
-    this.setState(prevState => ({
107
-      productList: isRefresh ? res.goods_list : [...prevState.productList, ...res.goods_list],
113
+    this.setState((prevState) => ({
114
+      productList: isRefresh
115
+        ? res.goods_list
116
+        : [...prevState.productList, ...res.goods_list],
108 117
       totalPages: res.total_pages,
109
-      loading: false
118
+      loading: false,
110 119
     }));
111 120
   };
112 121
 
@@ -125,12 +134,17 @@ export default class Index extends Component {
125 134
               src="https://video-img.fyshark.com/1731495433480WechatIMG674.jpg"
126 135
             />
127 136
           </View>
128
-          {/* 搜索框 */}
129
-          <SearchBar
130
-            value={this.state.value}
131
-            onChange={this.handleChange}
132
-            onSearch={this.handleSearch}
133
-          />
137
+          {/* 搜索框包裹盒子 */}
138
+          <View
139
+            className="search-bar-container"
140
+            onClick={() => Taro.navigateTo({ url: '/pages/search/index' })}
141
+          >
142
+            <SearchBar
143
+              value={this.state.value}
144
+              onChange={this.handleChange}
145
+              onSearch={this.handleSearch}
146
+            />
147
+          </View>
134 148
           {/* tab分类 */}
135 149
           <View className="tabs-list">
136 150
             {homeData.tags && (
@@ -177,14 +191,7 @@ export default class Index extends Component {
177 191
         {/* <RecommendList /> */}
178 192
         {/* 商品列表 */}
179 193
         <View className="product-list-wrap">
180
-          <ProductList
181
-          productList={productList}
182
-            loading={loading}
183
-          />
184
-          <ProductList
185
-          productList={productList}
186
-            loading={loading}
187
-          />
194
+          <ProductList productList={productList} loading={loading} />
188 195
         </View>
189 196
         {/* 添加浮动按钮 */}
190 197
         <View className="float-buttons">

+ 1 - 1
src/pages/indexSub/productDetail/index.jsx

@@ -138,7 +138,7 @@ export default class Index extends Component {
138 138
 
139 139
           {/* 商品编号行 */}
140 140
           <View className="product-number-row">
141
-            <Text className="number-label">商品编号:123456</Text>
141
+            <Text className="number-label">商品编号:{productDetail.goods_number}</Text>
142 142
             <Text
143 143
               className="copy-btn"
144 144
               onClick={() => this.handleCopy("123456")}

+ 4 - 0
src/pages/indexSub/searchList/index.config.js

@@ -0,0 +1,4 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '搜索列表'
3
+})
4
+

+ 16 - 0
src/pages/indexSub/searchList/index.jsx

@@ -0,0 +1,16 @@
1
+import { Component } from "react";
2
+import Taro from "@tarojs/taro";
3
+import { View } from "@tarojs/components";
4
+import "./index.less";
5
+import ProductList from "../../../components/index/ProductList";
6
+export default class Index extends Component {
7
+  state = {};
8
+  render() {
9
+    return (
10
+      <View className="index">
11
+        {/* 搜索列表 */}
12
+        <ProductList></ProductList>
13
+      </View>
14
+    );
15
+  }
16
+}

+ 6 - 0
src/pages/indexSub/searchList/index.less

@@ -0,0 +1,6 @@
1
+.index{
2
+    min-height: 100vh;
3
+    background-color: #f9f9f9;
4
+    padding-top: 20px;
5
+    box-sizing: border-box;
6
+}

+ 41 - 1
src/pages/indexSub/seckillIndex/index.jsx

@@ -3,15 +3,55 @@ import { View, Image } from "@tarojs/components";
3 3
 import "./index.less";
4 4
 import seckillImg from "../../../images/seckill/seckillTop.png";
5 5
 import ProductList from "../../../components/index/ProductList";
6
+import { getRecommendProductList } from "../../../service";
6 7
 export default class Index extends Component {
8
+  state = {
9
+    productList: [], //推荐商品列表
10
+    page: 1, //页数
11
+    loading: false, //加载状态
12
+    totalPages: 1, // 添加总页数
13
+  };
14
+  componentDidMount() {
15
+    this.getRecommendProductList();
16
+  }
17
+  // 获取推荐商品列表
18
+  getRecommendProductList = async () => {
19
+    const { page } = this.state;
20
+    this.setState({ loading: true });
21
+
22
+    const res = await getRecommendProductList({
23
+      tag_id: 120,
24
+      page,
25
+      page_size: 10,
26
+    });
7 27
 
28
+    this.setState((prevState) => ({
29
+      productList: [...prevState.productList, ...res.goods_list],
30
+      totalPages: res.total_pages,
31
+      loading: false,
32
+    }));
33
+  };
34
+  // 页面上拉触底
35
+  onReachBottom = () => {
36
+    const { page, totalPages, loading } = this.state;
37
+    if (page < totalPages && !loading) {
38
+      this.setState(
39
+        (prevState) => ({ page: prevState.page + 1 }),
40
+        () => this.getRecommendProductList()
41
+      );
42
+    }
43
+  };
8 44
   render() {
9 45
     return (
10 46
       <View className="index">
11 47
         <Image className="seckill" src={seckillImg} mode="aspectFill" />
12 48
         {/* 商品列表 */}
13 49
         <View className="product-list">
14
-          <ProductList isSeckill={true} />
50
+          <ProductList
51
+            isSeckill={true}
52
+            productList={this.state.productList}
53
+            loading={this.state.loading}
54
+          />
15 55
         </View>
16 56
       </View>
17 57
     );

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

@@ -1,5 +1,7 @@
1 1
 .index{
2 2
     width: 100%;
3
+    padding-bottom: 40px;
4
+    box-sizing: border-box;
3 5
     .seckill{
4 6
         width: 100%;
5 7
         height: 300px;

+ 8 - 2
src/pages/member/index.jsx

@@ -10,6 +10,7 @@ import toDetail from "../../images/member/toDetail.png";
10 10
 import warning from "../../images/member/warning.png";
11 11
 import withdrawable from "../../images/member/withdrawable.png";
12 12
 import order from "../../images/member/order.png";
13
+import avatar from "../../images/mine/avatar.png";
13 14
 export default class Index extends Component {
14 15
   state={
15 16
     vipInfo:{},//会员信息 
@@ -18,7 +19,12 @@ export default class Index extends Component {
18 19
   getVipInfo = async () =>{
19 20
     const res = await getVipInfo()
20 21
     this.setState({
21
-      vipInfo:res
22
+      vipInfo: res || {
23
+        users: { name: "未登录", icon: avatar },
24
+        earnings: { store_earnings_now: 0, store_earnings_all: 0 },
25
+        draw_money: { store_earnings_now: 0 },
26
+        order: { order_all: 0, order_promotion: 0, order_pay: 0 }
27
+      }
22 28
     })
23 29
   }
24 30
   componentDidShow() {
@@ -36,7 +42,7 @@ export default class Index extends Component {
36 42
             <View className="member-info-card-header">
37 43
               {vipInfo.users && <Image className="avatar" src={vipInfo.users.icon} mode="aspectFill" />}
38 44
               <View className="member-info-card-header-text">
39
-                {vipInfo.users && <Text className="user-name">{vipInfo.users.channel_name}</Text>}
45
+                {vipInfo.users && <Text className="user-name">{vipInfo.users.name}</Text>}
40 46
                 <View className="member-info-card-header-text-level">
41 47
                   <Text className="level-text">店长</Text>
42 48
                   <Image className="level-icon" src={vip} />

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

@@ -50,7 +50,17 @@ export default class Index extends Component {
50 50
       goods_ids: [productId],
51 51
     }).then(res => {
52 52
       if(res.success==true){
53
-        this.getBrowseShopProductList(true);
53
+        // this.getBrowseShopProductList(true);
54
+        this.setState((prevState) => ({
55
+          productList: prevState.productList.map(item => {
56
+            if(item.id === productId){
57
+              return { ...item, is_collected: true };
58
+            }
59
+            return item;
60
+          })
61
+        }));
62
+        console.log(this.state.productList);
63
+        
54 64
         Taro.showToast({
55 65
           title: '添加成功',
56 66
           icon: 'none',

+ 2 - 1
src/pages/memberSub/productClassify/index.less

@@ -1,7 +1,8 @@
1 1
 .index {
2 2
     background-color: #f9f9f9;
3
-    padding-bottom: 100px;
3
+    padding-bottom: 130px;
4 4
     padding-top: 80px;
5
+    box-sizing: border-box;
5 6
     .at-tabs__header{
6 7
         position: fixed;
7 8
         top: 0;

+ 95 - 38
src/pages/memberSub/productManagement/index.jsx

@@ -1,9 +1,13 @@
1
-import { Component } from "react";
1
+import React, { Component, createRef } from "react";
2 2
 import { View, Picker, Image, Text } from "@tarojs/components";
3 3
 import { AtTabs, AtTabsPane, AtCheckbox } from "taro-ui";
4 4
 import Taro from "@tarojs/taro";
5 5
 import "./index.less";
6
-import { getMyShopList,deleteShopProduct,updateProductSort } from "../../../service";
6
+import {
7
+  getMyShopList,
8
+  deleteShopProduct,
9
+  updateProductSort,
10
+} from "../../../service";
7 11
 import ProductList from "../../../components/index/ProductList"; //商品列表
8 12
 import add from "../../../images/productManagement/add.png";
9 13
 import back from "../../../images/productManagement/back.png";
@@ -12,12 +16,13 @@ import selectIcon from "../../../images/productManagement/selectIcon.png";
12 16
 import deleteIcon from "../../../images/productManagement/delete.png";
13 17
 import toTop from "../../../images/productManagement/toTop.png";
14 18
 export default class Index extends Component {
19
+  childComponentRef = React.createRef(); // 创建 ref
15 20
   state = {
16 21
     isManagementStatus: false, //是否是管理状态
17 22
     current: 0, //tabs坐标
18 23
     isSelectAll: false, //是否全选
19 24
     selectedOption: "全部商品", //商品默认名称
20
-    tabList: [{ title: "在售中 (20)" }], //tabs标题
25
+    tabList: [{ title: "在售中 (0)" }], //tabs标题
21 26
     options: ["全部商品", "选项2", "选项3"], //商品下拉选项
22 27
     checkedList: [""], //全选
23 28
     checkboxOption: [
@@ -46,11 +51,20 @@ export default class Index extends Component {
46 51
       page_size: 10,
47 52
     });
48 53
 
49
-    this.setState((prevState) => ({
50
-      productList: isDelete ? res.goods_list : [...prevState.productList, ...res.goods_list],
51
-      totalPages: res.total_pages,
52
-      loading: false,
53
-    }));
54
+    this.setState(
55
+      (prevState) => ({
56
+        productList: isDelete
57
+          ? res.goods_list
58
+          : [...prevState.productList, ...res.goods_list],
59
+        totalPages: res.total_pages,
60
+        loading: false,
61
+      }),
62
+      () => {
63
+        this.setState((prevState) => ({
64
+          tabList: [{ title: `在售中 (${res.total_count})` }],
65
+        }));
66
+      }
67
+    );
54 68
   };
55 69
   // tabs切换
56 70
   handleClick(value) {
@@ -70,9 +84,15 @@ export default class Index extends Component {
70 84
         isManagementStatus: true,
71 85
       });
72 86
     } else {
73
-      this.setState({
74
-        isManagementStatus: false,
75
-      });
87
+      this.setState(
88
+        {
89
+          isManagementStatus: false,
90
+        },
91
+        () => {
92
+          // 在清空后通过回调清除子组件中的选中状态
93
+          this.childComponentRef.current.clearSelectedItems();
94
+        }
95
+      );
76 96
     }
77 97
   };
78 98
   // 全选
@@ -83,51 +103,84 @@ export default class Index extends Component {
83 103
     });
84 104
   }
85 105
   // 删除商品
86
-  onDeleteProduct = async() => {
87
-    if(this.state.selectedProducts.length==0){
106
+  onDeleteProduct = async () => {
107
+    if (this.state.selectedProducts.length == 0) {
88 108
       Taro.showToast({
89
-        title: '请选择商品',
90
-        icon: 'none',
109
+        title: "请选择商品",
110
+        icon: "none",
91 111
       });
92 112
       return;
93 113
     }
94
-   const res = await deleteShopProduct({
114
+    const res = await deleteShopProduct({
95 115
       goods_ids: this.state.selectedProducts,
96
-    })
97
-    if(res.success==true){
98
-      this.getMyShopList(true);
116
+    });
117
+    if (res.success == true) {
118
+      this.setState((prevState) => ({
119
+          productList: prevState.productList.filter(
120
+            (item) => !this.state.selectedProducts.includes(item.id)
121
+          ),
122
+        }),
123
+        () => {
124
+          // 在清空后通过回调清除子组件中的选中状态
125
+          this.childComponentRef.current.clearSelectedItems();
126
+          this.setState((prevState) => ({
127
+            tabList: [{ title: `在售中 (${prevState.productList.length})` }],
128
+          }));
129
+        }
130
+      );
99 131
       Taro.showToast({
100
-        title: '删除成功',
101
-        icon: 'none',
132
+        title: "删除成功",
133
+        icon: "none",
102 134
       });
103 135
     }
104 136
   };
105 137
   // 更新商品排序
106
-  updateProductSort = async() => {
107
-    if(this.state.selectedProducts.length==0){
138
+  updateProductSort = async () => {
139
+    if (this.state.selectedProducts.length === 0) {
108 140
       Taro.showToast({
109
-        title: '请选择商品',
110
-        icon: 'none',
141
+        title: "请选择商品",
142
+        icon: "none",
111 143
       });
112 144
       return;
113
-    }else if(this.state.selectedProducts.length>1){
145
+    } else if (this.state.selectedProducts.length > 1) {
114 146
       Taro.showToast({
115
-        title: '只能选择一个商品',
116
-        icon: 'none',
147
+        title: "只能选择一个商品",
148
+        icon: "none",
117 149
       });
118 150
       return;
119 151
     }
120 152
     const res = await updateProductSort({
121
-      goods_id: this.state.selectedProducts.join(','),
122
-    })
123
-    if(res.success=='排序完成'){
124
-      this.getMyShopList(true);
153
+      goods_id: this.state.selectedProducts.join(","),
154
+    });
155
+
156
+    if (res.success === "排序完成") {
157
+      this.setState(
158
+        (prevState) => {
159
+          // 从 productList 中移除选中的商品
160
+          const remainingProducts = prevState.productList.filter(
161
+            (item) => !this.state.selectedProducts.includes(item.id)
162
+          );
163
+          // 将选中的商品添加到列表的开头
164
+          const sortedProducts = this.state.selectedProducts.map((id) =>
165
+            prevState.productList.find((item) => item.id === id)
166
+          );
167
+          return {
168
+            productList: [...sortedProducts, ...remainingProducts],
169
+            selectedProducts: [],
170
+          };
171
+        },
172
+        () => {
173
+          // 在清空后通过回调清除子组件中的选中状态
174
+          this.childComponentRef.current.clearSelectedItems();
175
+        }
176
+      );
177
+
125 178
       Taro.showToast({
126
-        title: '排序完成',
127
-        icon: 'none',
179
+        title: "排序完成",
180
+        icon: "none",
128 181
       });
129 182
     }
130
-  }
183
+  };
131 184
   // 页面上拉触底
132 185
   onReachBottom = () => {
133 186
     const { page, totalPages, loading } = this.state;
@@ -142,11 +195,14 @@ export default class Index extends Component {
142 195
   onDeleteProductSelect = (selectedProducts) => {
143 196
     // 可以将选中的商品保存到父组件的状态中
144 197
     this.setState({ selectedProducts });
145
-  }
146
-
198
+  };
147 199
   render() {
148 200
     return (
149
-      <View className="index">
201
+      <View
202
+        className={`index ${
203
+          this.state.isManagementStatus ? "management-active" : ""
204
+        }`}
205
+      >
150 206
         {/* tab分类 */}
151 207
         <View className="tabs-list">
152 208
           <AtTabs
@@ -180,6 +236,7 @@ export default class Index extends Component {
180 236
                 {/* 商品列表 */}
181 237
                 {this.state.productList && (
182 238
                   <ProductList
239
+                    ref={this.childComponentRef} // 将 ref 传递给子组件
183 240
                     productList={this.state.productList}
184 241
                     isSelectAll={this.state.isSelectAll}
185 242
                     isManagement={true}

+ 5 - 0
src/pages/memberSub/productManagement/index.less

@@ -1,6 +1,11 @@
1
+.management-active{
2
+    padding-bottom: 190px !important;
3
+}
1 4
 .index {
2 5
     background-color: #f9f9f9;
6
+    padding-bottom: 170px;
3 7
     min-height: 100vh;
8
+    box-sizing: border-box;
4 9
     .tabs-list {
5 10
         box-sizing: border-box;
6 11
         box-sizing: border-box;

+ 7 - 1
src/pages/memberSub/storeManagement/index.jsx

@@ -61,6 +61,12 @@ export default class Index extends Component {
61 61
       );
62 62
     }
63 63
   };
64
+  // 更换头像
65
+  handleChangeAvatar = () => {
66
+    Taro.navigateTo({
67
+      url: "/pages/mineSub/infoEdit/index",
68
+    });
69
+  };
64 70
 
65 71
   render() {
66 72
     const { shopDetail, productList } = this.state;
@@ -76,7 +82,7 @@ export default class Index extends Component {
76 82
           </View>
77 83
           {/* 个人信息 */}
78 84
           <View className="user-info">
79
-            <View className="avatar-wrapper">
85
+            <View onClick={this.handleChangeAvatar} className="avatar-wrapper">
80 86
               <Image
81 87
                 className="avatar"
82 88
                 mode="aspectFill"

+ 0 - 1
src/pages/memberSub/storeManagement/index.less

@@ -35,7 +35,6 @@
35 35
                     width: 116px;
36 36
                     height: 116px;
37 37
                     border-radius: 50%;
38
-                    background-color: red;
39 38
                 }
40 39
 
41 40
                 .change-avatar-btn {

+ 74 - 38
src/pages/mine/index.jsx

@@ -1,65 +1,101 @@
1
-import { Component } from 'react'
2
-import Taro from '@tarojs/taro'
3
-import { View, Text, Image } from '@tarojs/components'
4
-import { AtList, AtListItem } from "taro-ui"
5
-import {getUserInfo} from '../../service'
6
-import './index.less'
7
-import loginOut from '../../images/mine/loginOut.png'
8
-import edit from '../../images/mine/edit.png'
9
-import norm from '../../images/mine/norm.png'
10
-import avatar from '../../images/mine/avatar.png'
1
+import { Component } from "react";
2
+import Taro from "@tarojs/taro";
3
+import { View, Text, Image } from "@tarojs/components";
4
+import { AtList, AtListItem } from "taro-ui";
5
+import { getUserInfo } from "../../service";
6
+import "./index.less";
7
+import loginOut from "../../images/mine/loginOut.png";
8
+import edit from "../../images/mine/edit.png";
9
+import norm from "../../images/mine/norm.png";
10
+import avatar from "../../images/mine/avatar.png";
11 11
 export default class Index extends Component {
12
+  state = {
13
+    userInfo: {}, //用户信息
14
+  };
15
+  // 退出登录
12 16
   handleLogout = () => {
13 17
     Taro.showModal({
14
-      title: '',
15
-      content: '退出后,请重新登录!',
16
-      cancelText: '暂不退出',
17
-      confirmText: '退出登录',
18
-      cancelColor: '#000000',
19
-      confirmColor: '#F6C71A',
18
+      title: "",
19
+      content: "退出后,请重新登录!",
20
+      cancelText: "暂不退出",
21
+      confirmText: "退出登录",
22
+      cancelColor: "#000000",
23
+      confirmColor: "#F6C71A",
20 24
       success: function (res) {
21 25
         if (res.confirm) {
22
-          console.log('用户点击退出登录')
26
+          Taro.removeStorageSync("session_key");
27
+          Taro.removeStorageSync("loginInfo");
28
+          Taro.removeStorageSync("userInfo");
29
+          console.log("用户点击退出登录");
23 30
         }
24
-      }
25
-    })
31
+      },
32
+    });
33
+  };
34
+  componentDidShow(){
35
+    const userInfo = Taro.getStorageSync('userInfo')
36
+    const session_key = Taro.getStorageSync('session_key')
37
+    if(!userInfo&&session_key){
38
+      this.getUserInfo()
39
+    }else{
40
+      this.setState({
41
+        userInfo: userInfo||{},
42
+      })
43
+    }
26 44
   }
45
+  // 获取用户信息
27 46
   getUserInfo = async () => {
28 47
     const res = await getUserInfo();
29
-    console.log(res);
48
+    Taro.setStorageSync("userInfo", res);
49
+    this.setState({
50
+      userInfo: res,
51
+    });
30 52
   };
31
-  componentDidMount(){
32
-    this.getUserInfo()
33
-  }
34
-  render () {
53
+  render() {
54
+    const { userInfo } = this.state;
35 55
     return (
36
-      <View className='index'>
56
+      <View className="index">
37 57
         {/* 个人信息 */}
38 58
         <View className="info">
39
-          <Image src={avatar} className="avatar" />
59
+          <Image src={userInfo.icon?userInfo.icon:avatar} className="avatar" />
40 60
           <View className="info-right">
41
-            <View className='user-info'>
42
-            <View className="name">张三</View>
43
-            <View className="account">138001</View>
61
+            <View className="user-info">
62
+              <View className="name">{userInfo.name?userInfo.name:'未登录'}</View>
63
+              <View className="account">{userInfo.id?userInfo.id:'XXXX'}</View>
44 64
             </View>
45
-            <Image onClick={() => Taro.navigateTo({ url: `/pages/mineSub/infoEdit/index` })} className='edit-icon' src={edit}></Image>
65
+            <Image
66
+              onClick={() =>
67
+                Taro.navigateTo({ url: `/pages/mineSub/infoEdit/index` })
68
+              }
69
+              className="edit-icon"
70
+              src={edit}
71
+            ></Image>
46 72
           </View>
47 73
         </View>
48 74
         {/* 功能 */}
49
-        <View className='function'>
75
+        <View className="function">
50 76
           <AtList hasBorder={false}>
51
-            <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/mineSub/userSpecification/index` })} title='用户规范' arrow='right' thumb={norm}/>
52
-            <View className='line'></View>
53
-            <AtListItem 
77
+            <AtListItem
54 78
               hasBorder={false}
55
-              title='退出登录' 
56
-              arrow='right' 
79
+              onClick={() =>
80
+                Taro.navigateTo({
81
+                  url: `/pages/mineSub/userSpecification/index`,
82
+                })
83
+              }
84
+              title="用户规范"
85
+              arrow="right"
86
+              thumb={norm}
87
+            />
88
+            {/* <View className="line"></View> */}
89
+            {/* <AtListItem
90
+              hasBorder={false}
91
+              title="退出登录"
92
+              arrow="right"
57 93
               thumb={loginOut}
58 94
               onClick={this.handleLogout}
59
-            />
95
+            /> */}
60 96
           </AtList>
61 97
         </View>
62 98
       </View>
63
-    )
99
+    );
64 100
   }
65 101
 }

+ 62 - 9
src/pages/mineSub/infoEdit/index.jsx

@@ -1,6 +1,9 @@
1 1
 import { Component } from "react";
2
-import { View, Text, Image } from "@tarojs/components";
2
+import { View, Text, Image,Input, Button } from "@tarojs/components";
3 3
 import { AtInput } from "taro-ui";
4
+import Taro from "@tarojs/taro";
5
+import { updateUserInfo,getUserInfo } from "../../../service";
6
+import avatar from "../../../images/mine/avatar.png";
4 7
 import "./index.less";
5 8
 
6 9
 export default class Index extends Component {
@@ -8,35 +11,85 @@ export default class Index extends Component {
8 11
     wxAccount: "",
9 12
     nickName: "",
10 13
     phone: "",
14
+    avatar: "",
11 15
   };
12
-  handleAccountChange (value) {
16
+  componentDidMount() {
17
+    this.getUserInfo();
18
+  }
19
+  // 获取用户信息
20
+  async getUserInfo() {
21
+    const res = await getUserInfo();
22
+    this.setState({
23
+      wxAccount: res.wechat_account,
24
+      nickName: res.name,
25
+      phone: res.phone,
26
+      avatar: res.icon,
27
+    });
28
+  }
29
+  // 微信账号
30
+  handleAccountChange(value) {
13 31
     this.setState({
14 32
       wxAccount: value,
15 33
     });
16 34
     return value;
17 35
   }
18
-  handleNickNameChange (value) {
36
+  // 昵称
37
+  handleNickNameChange(value) {
19 38
     this.setState({
20 39
       nickName: value,
21 40
     });
22 41
     return value;
23 42
   }
24
-  handlePhoneChange (value) {
43
+  // 手机号
44
+  handlePhoneChange(value) {
25 45
     this.setState({
26 46
       phone: value,
27 47
     });
28 48
     return value;
29 49
   }
50
+  // 选择头像
51
+  handleChooseAvatar = (e) => {
52
+    this.setState({
53
+      avatar: e.detail.avatarUrl,
54
+    });
55
+  }
56
+  // 提交
57
+  handleSubmit = async () => {
58
+    const phoneRegex = /^1[3-9]\d{9}$/; // 中国大陆手机号正则
59
+    if (!this.state.nickName || !this.state.phone) {
60
+      Taro.showToast({
61
+        title: "请输入完整信息",
62
+        icon: "none",
63
+      });
64
+      return;
65
+    } else if (!phoneRegex.test(this.state.phone)) {
66
+      Taro.showToast({
67
+        title: "请输入正确的手机号",
68
+        icon: "none",
69
+      });
70
+      return;
71
+    }
72
+    const res = await updateUserInfo({
73
+      icon: this.state.avatar,
74
+      name: this.state.nickName,
75
+      phone: this.state.phone,
76
+      wechat_account: this.state.wxAccount,
77
+    });
78
+    Taro.showToast({
79
+      title: '修改成功',
80
+      icon: "none",
81
+    });
82
+  };
30 83
   render() {
31 84
     return (
32 85
       <View className="index">
33 86
         {/* 头像 */}
34 87
         <View className="info-edit">
35 88
           <Image
36
-            src="https://video-img.fyshark.com/1731495433480WechatIMG674.jpg"
89
+            src={this.state.avatar||avatar}
37 90
             className="info-edit-img"
38 91
           />
39
-          <Text className="info-edit-title">更换头像</Text>
92
+          {/* <Button onChooseAvatar={this.handleChooseAvatar} open-type="chooseAvatar" className="info-edit-title">更换头像</Button> */}
40 93
         </View>
41 94
         {/* 内容 */}
42 95
         <View className="info-edit-content">
@@ -57,17 +110,17 @@ export default class Index extends Component {
57 110
             onChange={this.handleNickNameChange.bind(this)}
58 111
           />
59 112
           <AtInput
60
-          border={false}  
113
+            border={false}
61 114
             name="value"
62 115
             title="手机号"
63
-            type="text"
116
+            type="number"
64 117
             placeholder="请输入手机号"
65 118
             value={this.state.phone}
66 119
             onChange={this.handlePhoneChange.bind(this)}
67 120
           />
68 121
         </View>
69 122
         {/* 提交按钮 */}
70
-        <View className="info-edit-submit">
123
+        <View onClick={this.handleSubmit} className="info-edit-submit">
71 124
           <Text className="info-edit-submit-text">提交</Text>
72 125
         </View>
73 126
       </View>

+ 5 - 0
src/pages/mineSub/infoEdit/index.less

@@ -2,6 +2,7 @@
2 2
     padding-top: 67px;
3 3
     background-color: #f5f5f5;
4 4
     min-height: 100vh;
5
+    box-sizing: border-box;
5 6
     // 头像
6 7
     .info-edit{
7 8
         display: flex;
@@ -19,6 +20,10 @@
19 20
             line-height: 41px;
20 21
             font-size: 28px;
21 22
             color: #F09A31;
23
+            background-color: #f5f5f5;
24
+            &::after{
25
+                border: none;
26
+            }
22 27
         }
23 28
     }
24 29
     // 内容

+ 3 - 0
src/pages/mineSub/login/index.config.js

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '授权登录'
3
+})

+ 123 - 0
src/pages/mineSub/login/index.jsx

@@ -0,0 +1,123 @@
1
+import { Component } from "react";
2
+import { View, Image, Button, Checkbox } from "@tarojs/components";
3
+import Taro from "@tarojs/taro";
4
+import { AtCheckbox } from "taro-ui";
5
+import { login,getUserInfo } from "../../../service";
6
+import { objToParam } from "../../../common/toParams";
7
+import "./index.less";
8
+import logo1 from "../../../images/logo1.png";
9
+import loginBg from "../../../images/loginBg.png";
10
+export default class Index extends Component {
11
+  state = {
12
+    isChecked: false,
13
+  };
14
+  // 同意协议
15
+  handleCheckboxChange = (value) => {
16
+    this.setState({
17
+      isChecked: value.length > 0,
18
+    });
19
+  };
20
+  // 同意协议
21
+  handleAgree = () => {
22
+    Taro.navigateTo({
23
+      url: "/pages/mineSub/userSpecification/index",
24
+    });
25
+  };
26
+
27
+  // handleGetPhoneNumber = (e) => {
28
+  //   if (e.detail.errMsg === "getPhoneNumber:ok") {
29
+  //     // 处理获取到的手机号信息
30
+  //     console.log("用户手机号信息:", e);
31
+  //     // 你可以在这里调用后端接口,将手机号信息发送到服务器
32
+  //   } else {
33
+  //     console.log("用户拒绝授权获取手机号");
34
+  //   }
35
+  // };
36
+  login = () => {
37
+    if (!this.state.isChecked) {
38
+      Taro.showToast({
39
+        title: "请先同意协议",
40
+        icon: "none",
41
+      });
42
+      return;
43
+    }
44
+    Taro.getUserProfile({
45
+      desc: "获取用户信息",
46
+      success: (userInfo) => {
47
+        Taro.login({
48
+          success: (res) => {
49
+            login({
50
+              code: res.code,
51
+              head_img:userInfo.avatarUrl,
52
+              name:userInfo.nickName,
53
+            }).then((res) => {
54
+              Taro.setStorageSync('session_key', res.session_key)
55
+              Taro.setStorageSync('loginInfo', res)
56
+              Taro.showToast({
57
+                title: '登录成功',
58
+                icon: 'none',
59
+              })
60
+              getUserInfo().then(res => {
61
+                Taro.setStorageSync('userInfo', res)
62
+              })
63
+              // let lastPage = Taro.getStorageSync('currentPage')
64
+              // if (lastPage == 'pages/mineSub/login/index') {
65
+              //   lastPage = 'pages/index/index'
66
+              // }
67
+              setTimeout(() => {
68
+                // Taro.reLaunch({
69
+                //   url: `/${lastPage}?${objToParam(Taro.getStorageSync('optionsData'))}`
70
+                // })
71
+                // Taro.removeStorageSync('currentPage')
72
+                Taro.reLaunch({
73
+                  url: '/pages/index/index',
74
+                })
75
+              }, 1000)
76
+            });
77
+          },
78
+        });
79
+      },
80
+    });
81
+  };
82
+
83
+  render() {
84
+    const checkboxOption = [
85
+      {
86
+        value: "agree",
87
+        label: "",
88
+      },
89
+    ];
90
+
91
+    return (
92
+      <View className="index">
93
+        <View className="login-content">
94
+          <Image src={logo1} className="logo" />
95
+          <View className="title">鱼市</View>
96
+          <View className="desc">
97
+            您暂时未获取微信授权,将无法正常使用小程序的功能。请先阅读且同意《鱼市平台用户协议》后再授权登录。
98
+          </View>
99
+          {/* <Button open-type="getPhoneNumber" onGetPhoneNumber={this.handleGetPhoneNumber} className="login-button">授权登录</Button> */}
100
+          <View className="checkbox-container">
101
+            <AtCheckbox
102
+              options={checkboxOption}
103
+              selectedList={this.state.isChecked ? ["agree"] : []}
104
+              onChange={this.handleCheckboxChange}
105
+            />
106
+            <View onClick={this.handleAgree} className="checkbox-text">
107
+              同意《鱼市平台用户协议》
108
+            </View>
109
+          </View>
110
+
111
+          <Button
112
+            className="login-button"
113
+            // openType={this.state.isChecked ? "getPhoneNumber" : null}
114
+            onClick={this.login}
115
+          >
116
+            授权登录
117
+          </Button>
118
+        </View>
119
+        <Image src={loginBg} className="login-bg" />
120
+      </View>
121
+    );
122
+  }
123
+}

+ 118 - 0
src/pages/mineSub/login/index.less

@@ -0,0 +1,118 @@
1
+.index {
2
+    min-height: 100vh;
3
+    background-color: #f9f9f9;
4
+
5
+    .login-content {
6
+        padding: 101px 94px 0 94px;
7
+        box-sizing: border-box;
8
+        display: flex;
9
+        flex-direction: column;
10
+        align-items: center;
11
+    }
12
+
13
+    .logo {
14
+        width: 166px;
15
+        height: 166px;
16
+    }
17
+
18
+    .title {
19
+        font-size: 30px;
20
+        color: #000000;
21
+        line-height: 40px;
22
+        margin-top: 17px;
23
+    }
24
+
25
+    .desc {
26
+        margin-top: 56px;
27
+        font-size: 24px;
28
+        color: #919191;
29
+        line-height: 35px;
30
+        text-align: left;
31
+    }
32
+
33
+    .login-button {
34
+        margin-top: 22px;
35
+        width: 562px;
36
+        height: 100px;
37
+        background: #FEE30F;
38
+        font-size: 32px;
39
+        color: #000000;
40
+        line-height: 100px;
41
+        border-radius: 80px;
42
+
43
+        &::after {
44
+            border: none;
45
+        }
46
+    }
47
+
48
+    .login-bg {
49
+        position: fixed;
50
+        bottom: 0;
51
+        left: 0;
52
+        width: 100%;
53
+        height: 240px;
54
+    }
55
+}
56
+
57
+.checkbox-container {
58
+    width: 100%;
59
+    display: flex;
60
+    margin-top: 21px;
61
+}
62
+.checkbox-text{
63
+        font-size: 24px;
64
+        color: #F6C71A;
65
+        line-height: 35px;
66
+}
67
+.at-checkbox {
68
+    padding: 0;
69
+    background-color: #f9f9f9;
70
+    .at-checkbox__option-wrap{
71
+        padding: 0;
72
+    }
73
+    &::before {
74
+        content: none;
75
+    }
76
+
77
+    &::after {
78
+        content: none;
79
+    }
80
+
81
+    .at-checkbox__option--selected .at-checkbox__icon-cnt {
82
+        background-color: #f6c71a;
83
+        border: none;
84
+        width: 20px;
85
+        height: 20px;
86
+    }
87
+
88
+    &__option {
89
+        padding: 0;
90
+        margin-bottom: 0;
91
+    }
92
+    &__option:active {
93
+        background-color: transparent;
94
+    }
95
+
96
+    .at-icon-check {
97
+        height: 18px;
98
+        width: 18px;
99
+        font-size: 18px;
100
+    }
101
+
102
+    .at-checkbox__icon-cnt {
103
+        height: 20px;
104
+        width: 20px;
105
+        min-width: 20px;
106
+        border: 1px solid #919191;
107
+        box-sizing: border-box;
108
+        margin-right: 16px;
109
+        margin-top: 8px;
110
+    }
111
+
112
+
113
+}
114
+
115
+.at-checkbox__icon--checked {
116
+    box-shadow: none;
117
+    transition: none;
118
+}

+ 3 - 0
src/pages/search/index.config.js

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '搜索'
3
+})

+ 20 - 0
src/pages/search/index.jsx

@@ -0,0 +1,20 @@
1
+import { Component } from "react";
2
+import Taro from "@tarojs/taro";
3
+import { View } from "@tarojs/components";
4
+import SearchBar from "../../components/index/SearchBar"; //搜索框
5
+import "./index.less";
6
+export default class Index extends Component {
7
+  state = {};
8
+  render() {
9
+    return (
10
+      <View className="index">
11
+        {/* 搜索框 */}
12
+        <SearchBar
13
+          value={this.state.value}
14
+          onChange={this.handleChange}
15
+          onSearch={this.handleSearch}
16
+        />
17
+      </View>
18
+    );
19
+  }
20
+}

+ 6 - 0
src/pages/search/index.less

@@ -0,0 +1,6 @@
1
+.index{
2
+    min-height: 100vh;
3
+    background-color: #f9f9f9;
4
+    padding-top: 20px;
5
+    box-sizing: border-box;
6
+}

+ 35 - 14
src/service/index.js

@@ -29,13 +29,26 @@ export const getProductLikeList = data =>
29 29
     method: 'POST',
30 30
     data,
31 31
   })
32
-
32
+// 获取推荐商品列表   (包括鱼市商品 = 120;高佣专属 = 121)
33
+export const getRecommendProductList = data =>
34
+  Request({
35
+    url: '/api/get_goods_data_list_recommend',
36
+    method: 'POST',
37
+    data,
38
+  })
33 39
 
34 40
 // -----------------------用户
35 41
 // 获取用户详情
36 42
 export const getUserInfo = data =>
37 43
   Request({
38
-    url: '/user/user',
44
+    url: '/user/get_user_info',
45
+    method: 'POST',
46
+    data,
47
+  })
48
+// 更新用户信息
49
+export const updateUserInfo = data =>
50
+  Request({
51
+    url: '/user/update_user_info',
39 52
     method: 'POST',
40 53
     data,
41 54
   })
@@ -47,48 +60,56 @@ export const getVipInfo = data =>
47 60
     method: 'POST',
48 61
     data,
49 62
   })
50
-  // 获取我的店铺详情
51
-  export const getMyShopDetail = data =>
63
+// 获取我的店铺详情
64
+export const getMyShopDetail = data =>
52 65
   Request({
53 66
     url: '/vip/get_store_detail',
54 67
     method: 'POST',
55 68
     data,
56 69
   })
57
-  // 获取我的店铺数据
58
-  export const getMyShopList = data =>
70
+// 获取我的店铺数据
71
+export const getMyShopList = data =>
59 72
   Request({
60 73
     url: '/vip/get_store_data_list',
61 74
     method: 'POST',
62 75
     data,
63 76
   })
64
-  // 店铺添加指定商品
65
-  export const addShopProduct = data =>
77
+// 店铺添加指定商品
78
+export const addShopProduct = data =>
66 79
   Request({
67 80
     url: '/vip/add_store_goods',
68 81
     method: 'POST',
69 82
     data,
70 83
   })
71
-  // 删除店铺商品
72
-  export const deleteShopProduct = data =>
84
+// 删除店铺商品
85
+export const deleteShopProduct = data =>
73 86
   Request({
74 87
     url: '/vip/delete_store_goods',
75 88
     method: 'POST',
76 89
     data,
77 90
   })
78
-  // 获取浏览店铺的商品列表
79
-  export const getBrowseShopProductList = data =>
91
+// 获取浏览店铺的商品列表
92
+export const getBrowseShopProductList = data =>
80 93
   Request({
81 94
     url: '/vip/get_goods_data_list_store',
82 95
     method: 'POST',
83 96
     data,
84 97
   })
85
-  // 更新商品排序
86
-  export const updateProductSort = data =>
98
+// 更新商品排序
99
+export const updateProductSort = data =>
87 100
   Request({
88 101
     url: '/vip/update_goods_sort',
89 102
     method: 'POST',
90 103
     data,
91 104
   })
105
+// -----------------------登录
106
+// 登录
107
+export const login = data =>
108
+  Request({
109
+    url: '/user/login_applet',
110
+    method: 'POST',
111
+    data,
112
+  })
92 113
 
93 114
 
94 115