zlisen 4 yıl önce
ebeveyn
işleme
f21b989049

+ 11
- 17
src/app.js Dosyayı Görüntüle

@@ -1,4 +1,3 @@
1
-
2 1
 import 'taro-ui/dist/style/index.scss'
3 2
 import React, { Component, useEffect } from 'react'
4 3
 import { Provider } from 'react-redux'
@@ -6,7 +5,6 @@ import configStore from './store'
6 5
 import useUser from './store/user'
7 6
 import { getCode, setCode } from './util/getCode'
8 7
 import getCodeUrl from './util/getCodeUrl' 
9
-import request from './util/request'
10 8
 import './app.scss'
11 9
 
12 10
 const store = configStore()
@@ -16,24 +14,20 @@ const App = (props)=> {
16 14
   const code = getCode()
17 15
 
18 16
   useEffect(() => {
19
-    // if (!user || !user.userId) {
20
-    //   if (!code) {
21
-    //     // 跳转
22
-    //     window.location.href=getCodeUrl(); 
23
-    //   } else {
24
-    //     // 请求 user
25
-    //     getUser(code)
26
-    //   }
27
-    // }
28
-
29
-    // return () => setCode(code)
17
+    if (!user || !user.userId) {
18
+      if (!code) {
19
+        // 跳转
20
+        window.location.href=getCodeUrl(); 
21
+      } else {
22
+        // 请求 user
23
+        getUser(code)
24
+      }
25
+    }
26
+
27
+    return () => setCode(code)
30 28
 
31 29
   }, [])
32 30
 
33
-// console.log(getCodeUrl(),'getCodeUrl')
34
-
35
-// window.location.href=getCodeUrl(); 
36
-
37 31
   // 在 App 类中的 render() 函数没有实际作用
38 32
   // 请勿修改此函数
39 33
  

+ 18
- 0
src/layout/IsLogin.jsx Dosyayı Görüntüle

@@ -0,0 +1,18 @@
1
+import React from "react";
2
+import { View, ScrollView } from "@tarojs/components";
3
+import "./index.scss";
4
+import useUser from "../store/user";
5
+
6
+const IsLogin = ({ children }) => {
7
+  const { user } = useUser();
8
+  console.log(user, "user");
9
+
10
+  return user 
11
+  ? user.personId
12
+    ? children
13
+    :<View style={{textAlign:'center'}}>您没有登录权限</View>
14
+  : <View style={{textAlign:'center'}}>登录中...</View>
15
+  ;
16
+};
17
+
18
+export default IsLogin;

+ 125
- 148
src/pages/account/edit/index.jsx Dosyayı Görüntüle

@@ -1,138 +1,111 @@
1
-import React, { useEffect, useState } from 'react'
2
-import Taro ,{useDidShow}from "@tarojs/taro";
3
-import { View, Input, Text, Image, Form, Button } from '@tarojs/components'
4
-import Layout from '../../../layout/index'
5
-import Tab from '../../../compents/tab/index'
6
-import Container from '../../../compents/container/index'
7
-import './index.scss'
8
-import request from '../../../util/request'
9
-
10
-
11
-import getQueryValue from '../../../util/getQueryValue'
12
-
13
-const index = (props) => {
14
-
15
-    const { id, keeperId } = getQueryValue()
16
-
17
-    const [data, setData] = useState({})
18
-    const [pageState, setPageState] = useState('1')
19
-    const [list, setList] = useState([])
20
-    useDidShow(() => {
21
-        console.log('useDidShow')
22
-        if (keeperId) {
23
-            getShopKeeperDetail()
24
-        }else{
25
-            setData({})
26
-        }
27
-    })
28
-
29
-
30
-    const getShopKeeperDetail = () => {
31
-        request({ url: `/taShopKeeper/${keeperId}`, method: 'get' }).then((res) => {
32
-            console.log(res,'getDetail')
33
-            setData(res.data.data)
34
-        })
35
-    }
36
-
37
-    const onRegisterChange = (e) => {
38
-        console.log(e, '111')
39
-    }
40
-    const onSave = () => {
41
-        console.log(333)
42
-
43
-        // Taro.showModal({
44
-        //     title: '修改成功',
45
-        //     content: '点击确认按钮,返回上级菜单',
46
-        //     showCancel: false,
47
-        //     success: function (res) {
48
-        //         if (res.confirm) {
49
-        //             console.log('用户点击确定')
50
-
51
-        //             Taro.navigateBack({
52
-        //                 delta: 1
53
-        //             })
54
-        //         } else if (res.cancel) {
55
-        //             console.log('用户点击取消')
56
-        //         }
57
-        //     }
58
-        // })
1
+import React, { useEffect, useState } from "react";
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import { View, Input, Text, Image, Form, Button } from "@tarojs/components";
4
+import Layout from "../../../layout/index";
5
+import Tab from "../../../compents/tab/index";
6
+import Container from "../../../compents/container/index";
7
+import "./index.scss";
8
+import request from "../../../util/request";
9
+import getQueryValue from "../../../util/getQueryValue";
10
+import IsLogin from "../../../layout/IsLogin";
11
+
12
+const index = props => {
13
+  const { id, keeperId } = getQueryValue();
14
+
15
+  const [data, setData] = useState({});
16
+
17
+  useDidShow(() => {
18
+    console.log("useDidShow");
19
+    if (keeperId) {
20
+      getShopKeeperDetail();
21
+    } else {
22
+      setData({});
59 23
     }
60
-
61
-    const editShopKeeper = (value) => {
62
-        console.log(value, 333)
63
-
64
-        if(keeperId){
65
-            Taro.showModal({
66
-                title: '确定修改该老板信息吗',
67
-                cancelColor: '#d2d2d2',
68
-                confirmColor: "#274191",
69
-                success: (res) => {
70
-                  if (res.confirm) {
71
-                    request({ url: `/taShopKeeper/${keeperId}`, data: {...data, ...value }, method: 'put' }).then((res) => {
72
-                        Taro.navigateBack({
73
-                            delta: 1
74
-                        })
75
-                    })
76
-          
77
-          
78
-                  } else if (res.cancel) {
79
-                    console.log('用户点击取消')
80
-                  }
81
-                }
82
-              })
83
-        }else{
84
-            request({ url: "/taShopKeeper", data: { ...value, shopId: id }, method: 'post' }).then((res) => {
85
-                Taro.navigateBack({
86
-                    delta: 1
87
-                })
88
-            })
24
+  });
25
+
26
+  const getShopKeeperDetail = () => {
27
+    request({ url: `/taShopKeeper/${keeperId}`, method: "get" }).then(res => {
28
+      console.log(res, "getDetail");
29
+      setData(res.data.data);
30
+    });
31
+  };
32
+
33
+  const editShopKeeper = value => {
34
+
35
+    if (keeperId) {
36
+      Taro.showModal({
37
+        title: "确定修改该老板信息吗",
38
+        cancelColor: "#d2d2d2",
39
+        confirmColor: "#274191",
40
+        success: res => {
41
+          if (res.confirm) {
42
+            request({
43
+              url: `/taShopKeeper/${keeperId}`,
44
+              data: { ...data, ...value },
45
+              method: "put"
46
+            }).then(res => {
47
+              Taro.navigateBack({
48
+                delta: 1
49
+              });
50
+            });
51
+          } else if (res.cancel) {
52
+            console.log("用户点击取消");
53
+          }
89 54
         }
90
-
91
-        
92
-
93
-    }
94
-    function formSubmit(e) {
95
-        console.log(e.detail, 'formSubmit')
96
-        editShopKeeper(e.detail.value)
97
-
98
-
99
-    }
100
-
101
-    const formReset = () => {
102
-        console.log('formReset')
55
+      });
56
+    } else {
57
+      request({
58
+        url: "/taShopKeeper",
59
+        data: { ...value, shopId: id },
60
+        method: "post"
61
+      }).then(res => {
62
+        Taro.navigateBack({
63
+          delta: 1
64
+        });
65
+      });
103 66
     }
104
-
105
-    return <View className='addnewhouse'>
106
-
107
-        {/* "createDate": "2020-12-24T11:57:16.851Z",
108
-  "keeperId": "string",
109
-  "name": "string",
110
-  "personId": "string",
111
-  "phone": "string",
112
-  "shopId": "string",
113
-  "status": 0 */}
67
+  };
68
+  function formSubmit(e) {
69
+    console.log(e.detail, "formSubmit");
70
+    editShopKeeper(e.detail.value);
71
+  }
72
+
73
+  const formReset = () => {
74
+    console.log("formReset");
75
+  };
76
+
77
+  return (
78
+    <IsLogin>
79
+      <View className="addnewhouse">
114 80
         <Form onSubmit={formSubmit} onReset={formReset}>
115
-            <Layout>
116
-
117
-                {/* <View className='inputstyle-view'>
118
-                    <Text className='title'>系统账号</Text>
119
-                    <Container className='inputstyle-view-card '  >
120
-                        <Input name='keeperId' placeholderClass='placeholderinput' placeholder='' className='input' />
121
-                    </Container>
122
-                </View> */}
123
-                <View className='inputstyle-view'>
124
-                    <Text className='title'>姓名</Text>
125
-                    <Container className='inputstyle-view-card '  >
126
-                        <Input name='name' value={data.name} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
127
-                    </Container>
128
-                </View>
129
-                <View className='inputstyle-view'>
130
-                    <Text className='title'>电话</Text>
131
-                    <Container className='inputstyle-view-card '  >
132
-                        <Input name='phone'  value={data.phone} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
133
-                    </Container>
134
-                </View>
135
-                {/* <View className='inputstyle-view'>
81
+          <Layout>
82
+            <View className="inputstyle-view">
83
+              <Text className="title">姓名</Text>
84
+              <Container className="inputstyle-view-card ">
85
+                <Input
86
+                  name="name"
87
+                  value={data.name}
88
+                  placeholderClass="placeholderinput"
89
+                  className="input"
90
+                  type="text"
91
+                  placeholder=""
92
+                />
93
+              </Container>
94
+            </View>
95
+            <View className="inputstyle-view">
96
+              <Text className="title">电话</Text>
97
+              <Container className="inputstyle-view-card ">
98
+                <Input
99
+                  name="phone"
100
+                  value={data.phone}
101
+                  placeholderClass="placeholderinput"
102
+                  className="input"
103
+                  type="text"
104
+                  placeholder=""
105
+                />
106
+              </Container>
107
+            </View>
108
+            {/* <View className='inputstyle-view'>
136 109
                     <Text className='title'>微信号</Text>
137 110
                     <Container className='inputstyle-view-card '  >
138 111
                         <Input name='personId' placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
@@ -150,23 +123,27 @@ const index = (props) => {
150 123
                         <Image className='guide-view-img'  style={{width:'100%',height:'100%'}} src={uploadicon || "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1657471424,2319316184&fm=26&gp=0.jpg"}></Image>
151 124
                     </Container>
152 125
                 </View> */}
153
-
154
-
155
-
156
-            </Layout>
157
-            {/* <Input formType="submit" > */}
158
-            <Tab formType="submit" className='addhousetab' pageState='3' value={['取消', '保存']} onClick={[(e) => {
126
+          </Layout>
127
+          <Tab
128
+            formType="submit"
129
+            className="addhousetab"
130
+            pageState="3"
131
+            value={["取消", "保存"]}
132
+            onClick={[
133
+              e => {
159 134
                 Taro.navigateBack({
160
-                    delta: 1
161
-                })
162
-            }, () => onSave()]}></Tab>
163
-
164
-            {/* </Input> */}
165
-
135
+                  delta: 1
136
+                });
137
+              },
138
+              () => {}
139
+            ]}
140
+          ></Tab>
141
+
142
+          {/* </Input> */}
166 143
         </Form>
144
+      </View>
145
+    </IsLogin>
146
+  );
147
+};
167 148
 
168
-
169
-    </View>
170
-}
171
-
172
-export default index
149
+export default index;

+ 91
- 67
src/pages/account/index.jsx Dosyayı Görüntüle

@@ -1,97 +1,121 @@
1
-import React, { useEffect, useMemo, useState, useRef } from 'react'
2
-import Taro, { useDidShow, useRouter } from '@tarojs/taro'
3
-import './index.scss'
4
-import { View, Text, Input, Image } from '@tarojs/components'
5
-import ContainerLayout from '../../compents/container/index'
6
-import Tab from '../../compents/tab/index'
7
-import Layout from '../../layout/index'
8
-import request from '../../util/request'
9
-import getQueryValue from '../../util/getQueryValue'
10
-import NoData from '@/compents/NoData'
11
-import InifiniteList from '@/compents/InifiniteList'
1
+import React, { useEffect, useMemo, useState, useRef } from "react";
2
+import Taro, { useDidShow, useRouter } from "@tarojs/taro";
3
+import "./index.scss";
4
+import { View, Text, Input, Image } from "@tarojs/components";
5
+import ContainerLayout from "../../compents/container/index";
6
+import Tab from "../../compents/tab/index";
7
+import Layout from "../../layout/index";
8
+import request from "../../util/request";
9
+import getQueryValue from "../../util/getQueryValue";
10
+import NoData from "@/compents/NoData";
11
+import InifiniteList from "@/compents/InifiniteList";
12
+import IsLogin from "../../layout/IsLogin";
12 13
 
13
-const account = (props) => {
14
-
15
-  const { id } = getQueryValue()
16
-  const [list, setList] = useState([])
17
-  const [page, setPage] = useState({ total: 0, pageNum: 0 })
14
+const account = props => {
15
+  const { id } = getQueryValue();
16
+  const [list, setList] = useState([]);
17
+  const [page, setPage] = useState({ total: 0, pageNum: 0 });
18 18
 
19 19
   useDidShow(() => {
20
-    console.log('useDidShow')
21
-    getShopKepperList({ pageNum: 1, pageSize:10 })
22
-  })
20
+    console.log("useDidShow");
21
+    getShopKepperList({ pageNum: 1, pageSize: 10 });
22
+  });
23 23
 
24 24
   function getShopKepperList(params) {
25
-    request({ url: '/taShopKeeper',params:{shopId:id,...params}, method: 'get', }).then((res)=>{
26
-      const { records, ...page} = res.data.data
27
-      setList(list.concat(records || []))
25
+    request({
26
+      url: "/taShopKeeper",
27
+      params: { shopId: id, ...params },
28
+      method: "get"
29
+    }).then(res => {
30
+      const { records, ...page } = res.data.data;
31
+      setList(list.concat(records || []));
28 32
       setPage({
29 33
         ...page,
30 34
         pageNum: page.current
31
-      })
32
-    })
35
+      });
36
+    });
33 37
   }
34 38
 
35
-  const onDelete = (keeperId) => {
39
+  const onDelete = keeperId => {
36 40
     Taro.showModal({
37
-      title: '确定删除该老板账号吗',
38
-      content: '确定后,该老板房源信息将一并删除',
39
-      cancelColor: '#d2d2d2',
41
+      title: "确定删除该老板账号吗",
42
+      content: "确定后,该老板房源信息将一并删除",
43
+      cancelColor: "#d2d2d2",
40 44
       confirmColor: "#274191",
41
-      success: (res) => {
45
+      success: res => {
42 46
         if (res.confirm) {
43
-          console.log('用户点击确定')
44
-          request({ url: `/taShopKeeper/${keeperId}`, method: 'delete', }).then((res)=>{
45
-            setList(list.filter((x)=>x.keeperId!=keeperId))
46
-          })
47
-
47
+          console.log("用户点击确定");
48
+          request({ url: `/taShopKeeper/${keeperId}`, method: "delete" }).then(
49
+            res => {
50
+              setList(list.filter(x => x.keeperId != keeperId));
51
+            }
52
+          );
48 53
         } else if (res.cancel) {
49
-          console.log('用户点击取消')
54
+          console.log("用户点击取消");
50 55
         }
51 56
       }
52
-    })
53
-  }
54
-
57
+    });
58
+  };
55 59
 
56 60
   const loadMore = () => {
57
-    getShopKepperList({ pageNum: page.pageNum + 1 })
58
-  }
61
+    getShopKepperList({ pageNum: page.pageNum + 1 });
62
+  };
59 63
 
60
-    const renderItem = (index, key) => (
61
-      <View className='account-view' key={key}>
64
+  const renderItem = (index, key) => (
65
+    <View className="account-view" key={key}>
62 66
       {/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
63
-      <ContainerLayout className='account-view-card'>
64
-        <View className='top' >
67
+      <ContainerLayout className="account-view-card">
68
+        <View className="top">
65 69
           <View>姓名:{list[index].name}</View>
66 70
           <View>电话:{list[index].phone}</View>
67 71
           {/* <View>微信号:{x.user.name}</View>
68 72
           <View>房源数:{x.user.name}</View> */}
69 73
         </View>
70
-        <View className='bottom'>
71
-          <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?keeperId=${list[index].keeperId}` }) }}>编辑</Text>
72
-          <Text onClick={()=>onDelete(list[index].keeperId)}>删除</Text>
74
+        <View className="bottom">
75
+          <Text
76
+            onClick={() => {
77
+              Taro.navigateTo({
78
+                url: `/pages/account/edit/index?keeperId=${list[index].keeperId}`
79
+              });
80
+            }}
81
+          >
82
+            编辑
83
+          </Text>
84
+          <Text onClick={() => onDelete(list[index].keeperId)}>删除</Text>
73 85
         </View>
74 86
       </ContainerLayout>
75 87
     </View>
76
-  )
77
-
78
-  return <View className='account'>
79
-    <Layout>
80
-      <NoData nodata={!list.length} tips="暂无老板" style={{minHeight: '200px'}}>
81
-
88
+  );
82 89
 
83
-      <InifiniteList
84
-        length={list.length}
85
-        total={page.total}
86
-        height={600}
87
-        itemRenderer={renderItem}
88
-        loadMore={loadMore}
89
-      />
90
-      </NoData>
91
-    </Layout>
92
-    {/* onClick={(e)=>(e) */}
93
-    <Tab value={['+新增名宿老板账号']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?id=${id}` }) }} ></Tab>
94
-  </View>
95
-}
90
+  return (
91
+    <IsLogin>
92
+      <View className="account">
93
+        <Layout>
94
+          <NoData
95
+            nodata={!list.length}
96
+            tips="暂无老板"
97
+            style={{ minHeight: "200px" }}
98
+          >
99
+            <InifiniteList
100
+              length={list.length}
101
+              total={page.total}
102
+              height={600}
103
+              itemRenderer={renderItem}
104
+              loadMore={loadMore}
105
+            />
106
+          </NoData>
107
+        </Layout>
108
+        {/* onClick={(e)=>(e) */}
109
+        <Tab
110
+          value={["+新增民宿老板账号"]}
111
+          color="#ffffff"
112
+          onClick={() => {
113
+            Taro.navigateTo({ url: `/pages/account/edit/index?id=${id}` });
114
+          }}
115
+        ></Tab>
116
+      </View>
117
+    </IsLogin>
118
+  );
119
+};
96 120
 
97
-export default account
121
+export default account;

+ 1
- 1
src/pages/adminUser/index.jsx Dosyayı Görüntüle

@@ -16,7 +16,7 @@ const menuList = [
16 16
     icon: usericon,
17 17
     url: '/pages/shop/index'
18 18
   },{
19
-//   title: '宿老板账号管理',
19
+//   title: '宿老板账号管理',
20 20
 //   icon: usericon,
21 21
 //   url: '/pages/account/index'
22 22
 // }, {

+ 157
- 147
src/pages/batchimport/index.jsx Dosyayı Görüntüle

@@ -1,155 +1,165 @@
1
-import React, { useEffect, useMemo, useState, useRef } from 'react'
2
-import Taro, { useDidShow } from '@tarojs/taro'
3
-import './index.scss'
4
-import { View, Text, Input, Image } from '@tarojs/components'
5
-import ContainerLayout from '../../compents/container/index'
6
-import Tab from '../../compents/tab/index'
7
-import Layout from '../../layout/index'
8
-import Tags from '../../compents/tags/index'
9
-import { AtImagePicker } from 'taro-ui'
10
-import request, { uploadFiles } from '../../util/request'
11
-import uploadicon from '../../assets/uploadicon.png'
12
-
13
-const batchimport = (props) => {
14
-    const [pageState, setPageState] = useState('1')
15
-    const [labelList, setLabelList] = useState([])
16
-    const [imgUrl, setImgUrl] = useState({})
17
-    const [tagList, setTagList] = useState([])
18
-
19
-    let [arrList, setArrList] = useState({})
20
-    useDidShow(() => {
21
-        getMateTagGroupList()
22
-    })
23
-
24
-
25
-    const getMateTagGroupList = () => {
26
-        request({ url: '/taMateTagGroup', params: { pageSize: 1, pageSize: 9999 }}).then((res) => {
27
-            const { records, ...page } = res.data.data
28
-            setTagList(records)
29
-        })
30
-    }
31
-
32
-
33
-    const onSave = (e) => {
34
-        // console.log(labelList,imgUrl, 'onSave')
35
-        const data = labelList.map((x) => { return { tagId: x.tagId, imageId: imgUrl.imageId } })
36
-        // console.log(, 'onSave333')
37
-
38
-        request({ url: "/taMetaImageTag", data: data, method: 'post' }).then((res) => {
39
-            Taro.showModal({
40
-                title: '上传成功',
41
-                content: '点击确认按钮,返回上级菜单',
42
-                showCancel: false,
43
-                success: function (res) {
44
-                    if (res.confirm) {
45
-                        console.log('用户点击确定')
46
-                        setImgUrl({})
47
-                    } else if (res.cancel) {
48
-                        console.log('用户点击取消')
49
-                    }
50
-                }
51
-            })
52
-        })
53
-    }
54
-
55
-    const onFail = (e) => {
56
-        console.log(e, 'w')
57
-    }
58
-    const onImageClick = (e) => {
59
-        console.log(e, 'w')
60
-    }
61
-
62
-    const onLabelChange = (e, index) => {
63
-        console.log(e, index, 'onLabelChange')
64
-        let newArrArrList={
65
-            ...arrList,
66
-            [index]: e
67
-        }
68
-        setArrList(newArrArrList)
69
-        console.log(newArrArrList, 'arrList')
70
-        let newArr = Object.values(newArrArrList).reduce((pre, cur) => {
71
-
72
-            return pre.concat(cur)
73
-
74
-        }, [])
75
-        setLabelList(newArr)
76
-        // console.log(newArr, 'newArr')
77
-        // // arrList[index] = e
78
-        // // const [arrList, setArrList] = useState([[],[],[]])
79
-        // setLabelList(e)
80
-
81
-        // // console.log(arrList.flat(), 'labelList')
82
-    }
83
-
84
-
85
-    const onUpImage = () => {
86
-        Taro.chooseImage({
87
-            sourceType: ['album'],
88
-            success: (res) => {
89
-                const tempFilePaths = res.tempFilePaths
90
-                uploadFiles(tempFilePaths, '/api/mp/taMetaImage').then((res) => {
91
-                    console.log(res, 'uploadFiles')
92
-                    setImgUrl(res[0])
93
-                })
1
+import React, { useState } from "react";
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import "./index.scss";
4
+import { View, Text, Input, Image } from "@tarojs/components";
5
+import Tab from "../../compents/tab/index";
6
+import Tags from "../../compents/tags/index";
7
+import { AtImagePicker } from "taro-ui";
8
+import request, { uploadFiles } from "../../util/request";
9
+import uploadicon from "../../assets/uploadicon.png";
10
+import IsLogin from "../../layout/IsLogin";
11
+
12
+const batchimport = props => {
13
+  const [pageState, setPageState] = useState("1");
14
+  const [labelList, setLabelList] = useState([]);
15
+  const [imgUrl, setImgUrl] = useState({});
16
+  const [tagList, setTagList] = useState([]);
17
+
18
+  let [arrList, setArrList] = useState({});
19
+  useDidShow(() => {
20
+    getMateTagGroupList();
21
+  });
22
+
23
+  const getMateTagGroupList = () => {
24
+    request({
25
+      url: "/taMateTagGroup",
26
+      params: { pageSize: 1, pageSize: 9999 }
27
+    }).then(res => {
28
+      const { records, ...page } = res.data.data;
29
+      setTagList(records);
30
+    });
31
+  };
32
+
33
+  const onSave = e => {
34
+    const data = labelList.map(x => {
35
+      return { tagId: x.tagId, imageId: imgUrl.imageId };
36
+    });
37
+
38
+    request({ url: "/taMetaImageTag", data: data, method: "post" }).then(
39
+      res => {
40
+        Taro.showModal({
41
+          title: "上传成功",
42
+          content: "点击确认按钮,返回上级菜单",
43
+          showCancel: false,
44
+          success: function(res) {
45
+            if (res.confirm) {
46
+              console.log("用户点击确定");
47
+              setImgUrl({});
48
+            } else if (res.cancel) {
49
+              console.log("用户点击取消");
94 50
             }
95
-        })
96
-    }
97
-
98
-    return <View className='batchimport'>
99
-        <View style={{ display: pageState == '1' ? 'none' : 'block' }}>
100
-            <Text>标签</Text>
101
-            <View style={{ padding: '0 20px' }}>
102
-
103
-                <View className='at-row  at-row--wrap at-row__justify--center' style={{ marginTop: '0.15rem' }}>
104
-
105
-                    {
106
-                        labelList.map((item, index) => {
107
-                            return <View className='at-col at-col-4' key={index}>
108
-                                <View className='tags-btn' >{item.name}</View>
109
-                            </View>
110
-                        })
111
-
112
-                    }
113
-                    {/* <View className='at-col at-col-4 ' >
51
+          }
52
+        });
53
+      }
54
+    );
55
+  };
56
+
57
+  const onLabelChange = (e, index) => {
58
+    console.log(e, index, "onLabelChange");
59
+    let newArrArrList = {
60
+      ...arrList,
61
+      [index]: e
62
+    };
63
+    setArrList(newArrArrList);
64
+    console.log(newArrArrList, "arrList");
65
+    let newArr = Object.values(newArrArrList).reduce((pre, cur) => {
66
+      return pre.concat(cur);
67
+    }, []);
68
+    setLabelList(newArr);
69
+  };
70
+
71
+  const onUpImage = () => {
72
+    Taro.chooseImage({
73
+      sourceType: ["album"],
74
+      success: res => {
75
+        const tempFilePaths = res.tempFilePaths;
76
+        uploadFiles(tempFilePaths, "/api/mp/taMetaImage").then(res => {
77
+          console.log(res, "uploadFiles");
78
+          setImgUrl(res[0]);
79
+        });
80
+      }
81
+    });
82
+  };
83
+
84
+  return (
85
+    <IsLogin>
86
+      <View className="batchimport">
87
+        <View style={{ display: pageState == "1" ? "none" : "block" }}>
88
+          <Text>标签</Text>
89
+          <View style={{ padding: "0 20px" }}>
90
+            <View
91
+              className="at-row  at-row--wrap at-row__justify--center"
92
+              style={{ marginTop: "0.15rem" }}
93
+            >
94
+              {labelList.map((item, index) => {
95
+                return (
96
+                  <View className="at-col at-col-4" key={index}>
97
+                    <View className="tags-btn">{item.name}</View>
98
+                  </View>
99
+                );
100
+              })}
101
+              {/* <View className='at-col at-col-4 ' >
114 102
                         <View className='tags-btn tags-btn-on' onClick={() => setPageState('1')} >添加</View>
115 103
                     </View> */}
116
-                </View>
117
-            </View>
118
-
119
-            <Text>照片</Text>
120
-            < View style={{ padding: '30px' }}>
121
-                {/* <AtImagePicker
122
-                    // multiple={true}
123
-                    length={4}
124
-                    files={imgList}
125
-                    onChange={onImgChange}
126
-                    onFail={onFail}
127
-                    onImageClick={onImageClick}
128
-                /> */}
129
-                <Image className='guide-view-img' style={{ width: imgUrl.image ? '100%' : '10%', height: '100%' }} onClick={() => onUpImage()} src={imgUrl.image || uploadicon}></Image>
130 104
             </View>
131
-
132
-            {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
133
-            <Tab pageState='3' value={['取消', '上传']} onClick={[(e) => { setLabelList([]); setPageState('1') }, (e) => onSave(e)]}></Tab>
105
+          </View>
106
+
107
+          <Text>照片</Text>
108
+          <View style={{ padding: "30px" }}>
109
+            <Image
110
+              className="guide-view-img"
111
+              style={{ width: imgUrl.image ? "100%" : "10%", height: "100%" }}
112
+              onClick={() => onUpImage()}
113
+              src={imgUrl.image || uploadicon}
114
+            ></Image>
115
+          </View>
116
+
117
+          {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
118
+          <Tab
119
+            pageState="3"
120
+            value={["取消", "上传"]}
121
+            onClick={[
122
+              e => {
123
+                setLabelList([]);
124
+                setPageState("1");
125
+              },
126
+              e => onSave(e)
127
+            ]}
128
+          ></Tab>
134 129
         </View>
135
-        
136
-       <View style={{ display: pageState == '2' ? 'none' : 'block' }}>
137
-            <View style={{ padding: '0 20px' }}>
138 130
 
139
-                {
140
-                    tagList.map((item, index) => {
141
-                        return <View className='material-card'>
142
-                            <Text>{item.name}</Text>
143
-                            <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} style={{ marginTop: '90rpx' }}> </Tags>
144
-                        </View>
145
-                    })
146
-                }
147
-            </View>
148
-            {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
149
-            <Tab pageState='3' value={['取消', '选择']} onClick={[(e) =>{ setPageState('2')}, (e) => setPageState('2')]}></Tab>
131
+        <View style={{ display: pageState == "2" ? "none" : "block" }}>
132
+          <View style={{ padding: "0 20px" }}>
133
+            {tagList.map((item, index) => {
134
+              return (
135
+                <View className="material-card">
136
+                  <Text>{item.name}</Text>
137
+                  <Tags
138
+                    list={item.taMateTagList}
139
+                    onChange={e => onLabelChange(e, index)}
140
+                    style={{ marginTop: "90rpx" }}
141
+                  >
142
+                    {" "}
143
+                  </Tags>
144
+                </View>
145
+              );
146
+            })}
147
+          </View>
148
+          {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
149
+          <Tab
150
+            pageState="3"
151
+            value={["取消", "选择"]}
152
+            onClick={[
153
+              e => {
154
+                setPageState("2");
155
+              },
156
+              e => setPageState("2")
157
+            ]}
158
+          ></Tab>
150 159
         </View>
151
-        
152
-    </View >
153
-}
160
+      </View>
161
+    </IsLogin>
162
+  );
163
+};
154 164
 
155
-export default batchimport
165
+export default batchimport;

+ 215
- 233
src/pages/imglist/index.jsx Dosyayı Görüntüle

@@ -1,244 +1,226 @@
1
-import React, { useEffect, useMemo, useState } from 'react'
1
+import React, { useState } from "react";
2 2
 // import { useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo } from '@tarojs/taro'
3 3
 import Taro, { useDidShow } from "@tarojs/taro";
4
-import { useSelector, } from 'react-redux'
5
-import { View, Text, Button, Image } from '@tarojs/components'
6
-import Layout from '../../layout/index'
7
-import Tab from '../../compents/tab/index'
8
-import Container from '../../compents/container/index'
9
-import locationicon from '../../assets/locationicon.png'
10
-import Tags from '../../compents/tags/index'
11
-import './index.scss'
12
-import { AtFloatLayout } from "taro-ui"
13
-import getQueryValue from '../../util/getQueryValue';
14
-import request, { uploadFiles } from '../../util/request';
15
-import groupby from 'lodash.groupby';
16
-import NoData from '@/compents/NoData'
17
-
18
-// Page({
19
-//     data: {
20
-//         text: 'init data',
21
-//         array: [{ msg: '1' }, { msg: '2' }]
22
-//     }
23
-// })
24
-
25
-const index = (props) => {
26
-
27
-    const { query } = getQueryValue()
28
-
29
-    const [isOpened, setIsOpened] = useState(false)
30
-    const [labelState, setLabelState] = useState(false)
31
-    const [list, setList] = useState({})
32
-    const [labelList, setLabelList] = useState([])
33
-    const [data, setData] = useState({})
34
-    const [tagList, setTagList] = useState([])
35
-
36
-    let [arrList, setArrList] = useState({})
37
-    useDidShow(() => {
38
-        // console.log(query)
39
-        getImageList()
40
-        getMateTagGroupList()
41
-    })
42
-
43
-
44
-    const getMateTagGroupList = () => {
45
-        request({ url: '/taMateTagGroup', params: { pageSize: 1, pageSize: 9999 }}).then((res) => {
46
-            const { records, ...page } = res.data.data
47
-            setTagList(records)
48
-        })
49
-    }
50
-
51
-    const getImageList = () => {
52
-        request({ url: '/taMetaImageTag', params: { tagIds: query } }).then((res) => {
53
-            const { records, ...page } = res.data.data
54
-            console.log(groupby(records, item => item.imageId),'------')
55
-            // _.groupBy([6.1, 4.2, 6.3], Math.floor);
56
-            setList(groupby(records, item => item.imageId))
57
-
58
-        })
59
-
60
-    }
61
-    const updateImage = () => {
62
-        // console.log('onUpImage')
63
-
64
-        console.log(data, 'onUpImage')
65
-
66
-        Taro.chooseImage({
67
-            sourceType: ['album'],
68
-            success: (res) => {
69
-                const tempFilePaths = res.tempFilePaths
70
-                uploadFiles(tempFilePaths, '/api/mp/taMetaImage',).then((res) => {
71
-                    console.log(res, 'uploadFiles')
72
-                    const newInfo = {
73
-                        newImage: res[0].imageId,
74
-                        newTags: data.map((x) => x.tagId)
75
-                    }
76
-                    updatainfo(newInfo)
77
-
78
-
79
-                })
80
-            }
81
-        })
82
-
83
-
84
-        setIsOpened(false);
85
-    }
86
-
87
-    const ontagsClick = () => {
88
-        // console.log('onUpImage')
89
-
90
-     
91
-
92
-        const newInfo = {
93
-            newImage: data[0].imageId,
94
-            newTags: labelList.map((x) => x.tagId)
4
+import { View, Text, Image } from "@tarojs/components";
5
+import Tab from "../../compents/tab/index";
6
+import Tags from "../../compents/tags/index";
7
+import "./index.scss";
8
+import { AtFloatLayout } from "taro-ui";
9
+import getQueryValue from "../../util/getQueryValue";
10
+import request, { uploadFiles } from "../../util/request";
11
+import groupby from "lodash.groupby";
12
+import NoData from "@/compents/NoData";
13
+import IsLogin from "../../layout/IsLogin";
14
+
15
+
16
+const index = props => {
17
+  const { query } = getQueryValue();
18
+
19
+  const [isOpened, setIsOpened] = useState(false);
20
+  const [labelState, setLabelState] = useState(false);
21
+  const [list, setList] = useState({});
22
+  const [labelList, setLabelList] = useState([]);
23
+  const [data, setData] = useState({});
24
+  const [tagList, setTagList] = useState([]);
25
+
26
+  let [arrList, setArrList] = useState({});
27
+  useDidShow(() => {
28
+    getImageList();
29
+    getMateTagGroupList();
30
+  });
31
+
32
+  const getMateTagGroupList = () => {
33
+    request({
34
+      url: "/taMateTagGroup",
35
+      params: { pageSize: 1, pageSize: 9999 }
36
+    }).then(res => {
37
+      const { records, ...page } = res.data.data;
38
+      setTagList(records);
39
+    });
40
+  };
41
+
42
+  const getImageList = () => {
43
+    request({ url: "/taMetaImageTag", params: { tagIds: query } }).then(res => {
44
+      const { records, ...page } = res.data.data;
45
+      setList(groupby(records, item => item.imageId));
46
+    });
47
+  };
48
+  const updateImage = () => {
49
+
50
+
51
+    Taro.chooseImage({
52
+      sourceType: ["album"],
53
+      success: res => {
54
+        const tempFilePaths = res.tempFilePaths;
55
+        uploadFiles(tempFilePaths, "/api/mp/taMetaImage").then(res => {
56
+          console.log(res, "uploadFiles");
57
+          const newInfo = {
58
+            newImage: res[0].imageId,
59
+            newTags: data.map(x => x.tagId)
60
+          };
61
+          updatainfo(newInfo);
62
+        });
63
+      }
64
+    });
65
+
66
+    setIsOpened(false);
67
+  };
68
+
69
+  const ontagsClick = () => {
70
+    const newInfo = {
71
+      newImage: data[0].imageId,
72
+      newTags: labelList.map(x => x.tagId)
73
+    };
74
+    updatainfo(newInfo);
75
+  };
76
+
77
+  const updatainfo = newInfo => {
78
+    const oldinfo = {
79
+      originImage: data[0].imageId,
80
+      originTags: data.map(x => x.tagId)
81
+    };
82
+    request({
83
+      url: "/taMetaImageTag",
84
+      data: { ...oldinfo, ...newInfo },
85
+      method: "put"
86
+    }).then(() => {
87
+      getImageList();
88
+      setLabelState(false);
89
+    });
90
+  };
91
+
92
+  const updateLabel = e => {
93
+    setIsOpened(false);
94
+    setLabelState(true);
95
+  };
96
+  const handleClose = e => {
97
+    console.log(e, "111");
98
+
99
+    setIsOpened(false);
100
+  };
101
+
102
+  const deleteImage = e => {
103
+    Taro.showModal({
104
+      title: "确定删除该图片吗?",
105
+
106
+      cancelColor: "#d2d2d2",
107
+      confirmColor: "#274191",
108
+      success: function(res) {
109
+        if (res.confirm) {
110
+          console.log("用户点击确定");
111
+
112
+          setIsOpened(false);
113
+          // Taro.showModal({
114
+          //   title: `改标签组有${row.user.number}个标签仍在使用。请先清空标签,再删除标签组`,
115
+          //   showCancel: false,
116
+          //   // cancelColor:'#d2d2d2',
117
+          //   confirmColor: "#274191",
118
+          //   success: function (res) {
119
+          //     if (res.confirm) {
120
+          //       console.log('用户点击确定')
121
+
122
+          //     } else if (res.cancel) {
123
+          //       console.log('用户点击取消')
124
+          //     }
125
+          //   }
126
+          // })
127
+        } else if (res.cancel) {
128
+          setIsOpened(false);
95 129
         }
96
-        updatainfo(newInfo)
97
-        console.log(newInfo,labelList, 'onUpImage')
98
-        // setIsOpened(false);
99
-    }
100
-
101
-    
102
-
103
-    //     "newImage": "string",
104
-    //   "newTags": [
105
-    //     "string"
106
-    //   ],
107
-    //   "originImage": "string",
108
-    //   "originTags": [
109
-    //     "string"
110
-    //   ]
111
-
112
-    const updatainfo = (newInfo) => {
113
-        const oldinfo = {
114
-            originImage: data[0].imageId,
115
-            originTags: data.map((x) => x.tagId)
116
-        }
117
-        request({ url: "/taMetaImageTag", data: { ...oldinfo, ...newInfo }, method: "put" }).then(() => {
118
-            getImageList()
119
-            setLabelState(false)
120
-        })
121
-    }
122
-
123
-
124
-    const updateLabel = (e) => {
125
-
126
-        setIsOpened(false)
127
-        setLabelState(true)
128
-        // Taro.navigateTo({ url: "/pages/material/index?type=uplabel" })
129
-    }
130
-    const handleClose = (e) => {
131
-        console.log(e, '111')
132
-
133
-        setIsOpened(false)
134
-    }
135
-
136
-    const deleteImage = (e) => {
137
-        Taro.showModal({
138
-            title: '确定删除该图片吗?',
139
-            
140
-            cancelColor: '#d2d2d2',
141
-            confirmColor: "#274191",
142
-            success: function (res) {
143
-              if (res.confirm) {
144
-                console.log('用户点击确定')
145
-      
146
-                setIsOpened(false)
147
-                // Taro.showModal({
148
-                //   title: `改标签组有${row.user.number}个标签仍在使用。请先清空标签,再删除标签组`,
149
-                //   showCancel: false,
150
-                //   // cancelColor:'#d2d2d2',
151
-                //   confirmColor: "#274191",
152
-                //   success: function (res) {
153
-                //     if (res.confirm) {
154
-                //       console.log('用户点击确定')
155
-      
156
-      
157
-                //     } else if (res.cancel) {
158
-                //       console.log('用户点击取消')
159
-                //     }
160
-                //   }
161
-                // })
162
-      
163
-              } else if (res.cancel) {
164
-                setIsOpened(false)
165
-              }
166
-            }
167
-       
168
-    })
169
- 
170
-    }
171
-
172
-    const onLabelChange = (e, index) => {
173
-        let newArrArrList={
174
-            ...arrList,
175
-            [index]: e
176
-        }
177
-        setArrList(newArrArrList)
178
-        let newArr = Object.values(newArrArrList).reduce((pre, cur) => {
179
-
180
-            return pre.concat(cur)
181
-
182
-        }, [])
183
-        setLabelList([...newArr])
184
-    }
185
-
186
-    return <View className='imglist'>
187
-
188
-        
130
+      }
131
+    });
132
+  };
133
+
134
+  const onLabelChange = (e, index) => {
135
+    let newArrArrList = {
136
+      ...arrList,
137
+      [index]: e
138
+    };
139
+    setArrList(newArrArrList);
140
+    let newArr = Object.values(newArrArrList).reduce((pre, cur) => {
141
+      return pre.concat(cur);
142
+    }, []);
143
+    setLabelList([...newArr]);
144
+  };
145
+
146
+  return (
147
+    <IsLogin>
148
+      <View className="imglist">
189 149
         <NoData nodata={Object.keys(list).length === 0}>
190
-        {console.log(labelState,'-------------------')
191
-}
192
-        {!labelState&&<View style={{ padding: '0 30px' }}>
193
-           
194
-            {
195
-
196
-                Object.keys(list).map((item) => {
197
-
198
-                    return <View className='imglist-card'>
199
-                        <View className='imglist-card-tags' style={{ display: 'flex' }}>
200
-                            {/* imageimageimageimage34 */}
201
-                            {list[item].map((x) => {
202
-                                console.log(x.tagName)
203
-                                return <View className='tag' >{x.tagName}</View>
204
-                            })}
205
-                        </View>
206
-                        <Image src={list[item][0].image} style={{ width: '100%' }} onClick={() => { setData(list[item]); setIsOpened(true) }}></Image>
150
+          {!labelState && (
151
+            <View style={{ padding: "0 30px" }}>
152
+              {Object.keys(list).map(item => {
153
+                return (
154
+                  <View className="imglist-card">
155
+                    <View
156
+                      className="imglist-card-tags"
157
+                      style={{ display: "flex" }}
158
+                    >
159
+                      {/* imageimageimageimage34 */}
160
+                      {list[item].map(x => {
161
+                        console.log(x.tagName);
162
+                        return <View className="tag">{x.tagName}</View>;
163
+                      })}
207 164
                     </View>
208
-                })
209
-            }
210
-        </View>}
211
-
212
-        {labelState&&
213
-            <View style={{textAlign:'center'}}> 
214
-            <View style={{ padding: '0 20px' }}>
215
-
216
-                {
217
-                    tagList.map((item, index) => {
218
-                        return <View className='imglist-tagcard'>
219
-                            <Text>{item.name}</Text>
220
-                            <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} style={{ marginTop: '90rpx' }}> </Tags>
221
-                        </View>
222
-                    })
223
-                }
165
+                    <Image
166
+                      src={list[item][0].image}
167
+                      style={{ width: "100%" }}
168
+                      onClick={() => {
169
+                        setData(list[item]);
170
+                        setIsOpened(true);
171
+                      }}
172
+                    ></Image>
173
+                  </View>
174
+                );
175
+              })}
224 176
             </View>
225
-            {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
226
-            <Tab pageState='3' value={['取消', '选择']} onClick={[(e) => setLabelState(false), (e) => ontagsClick()]}></Tab>
227
-        </View>
228
-        }
229
-
177
+          )}
178
+
179
+          {labelState && (
180
+            <View style={{ textAlign: "center" }}>
181
+              <View style={{ padding: "0 20px" }}>
182
+                {tagList.map((item, index) => {
183
+                  return (
184
+                    <View className="imglist-tagcard">
185
+                      <Text>{item.name}</Text>
186
+                      <Tags
187
+                        list={item.taMateTagList}
188
+                        onChange={e => onLabelChange(e, index)}
189
+                        style={{ marginTop: "90rpx" }}
190
+                      />
191
+                    </View>
192
+                  );
193
+                })}
194
+              </View>
195
+              <Tab
196
+                pageState="3"
197
+                value={["取消", "选择"]}
198
+                onClick={[e => setLabelState(false), e => ontagsClick()]}
199
+              ></Tab>
200
+            </View>
201
+          )}
230 202
         </NoData>
231 203
 
232
-        <AtFloatLayout isOpened={isOpened} onClose={() => handleClose()} style={{ zIndex: '1000' }}>
233
-            <View className='floatmodel' >
234
-                <View onClick={() => updateLabel()}>更改标签</View>
235
-                <View onClick={() => updateImage()}>更换图片</View>
236
-                <View onClick={() => deleteImage() }>删除</View>
237
-                <View style={{ color: '#d2d2d2' }} onClick={() => setIsOpened(false)}>取消</View>
204
+        <AtFloatLayout
205
+          isOpened={isOpened}
206
+          onClose={() => handleClose()}
207
+          style={{ zIndex: "1000" }}
208
+        >
209
+          <View className="floatmodel">
210
+            <View onClick={() => updateLabel()}>更改标签</View>
211
+            <View onClick={() => updateImage()}>更换图片</View>
212
+            <View onClick={() => deleteImage()}>删除</View>
213
+            <View
214
+              style={{ color: "#d2d2d2" }}
215
+              onClick={() => setIsOpened(false)}
216
+            >
217
+              取消
238 218
             </View>
239
-
219
+          </View>
240 220
         </AtFloatLayout>
241
-    </View>
242
-}
221
+      </View>
222
+    </IsLogin>
223
+  );
224
+};
243 225
 
244
-export default index
226
+export default index;

+ 15
- 11
src/pages/index/index.jsx Dosyayı Görüntüle

@@ -1,14 +1,18 @@
1
-import React, { useEffect, useMemo, useState } from 'react'
2
-import { View } from '@tarojs/components'
1
+import React, { useEffect, useMemo, useState } from "react";
2
+import { View } from "@tarojs/components";
3
+import IsLogin from "../../layout/IsLogin";
4
+import AdminUser from "../adminUser/index";
3 5
 
4
-import AdminUser from '../adminUser/index'
6
+import "./index.scss";
5 7
 
6
-import './index.scss'
8
+const index = props => {
9
+  return (
10
+    <IsLogin>
11
+      <View className="index">
12
+        <AdminUser></AdminUser>
13
+      </View>
14
+    </IsLogin>
15
+  );
16
+};
7 17
 
8
-const index = (props) => {
9
-  return <View className='index'>
10
-      <AdminUser></AdminUser>
11
-  </View>
12
-}
13
-
14
-export default index
18
+export default index;

+ 107
- 153
src/pages/label/edit/index.jsx Dosyayı Görüntüle

@@ -1,165 +1,119 @@
1
-import React, { useEffect, useMemo, useState } from 'react'
1
+import React, { useState } from "react";
2 2
 import Taro, { useDidShow } from "@tarojs/taro";
3
-import { useSelector } from 'react-redux'
4
-import { View, Input, Text, Image, Form } from '@tarojs/components'
5
-import Layout from '../../../layout/index'
6
-import Tab from '../../../compents/tab/index'
7
-import Container from '../../../compents/container/index'
8
-import './index.scss'
9
-import getQueryValue from '../../../util/getQueryValue'
10
-import request from '../../../util/request';
11
-
12
-const index = (props) => {
13
-
14
-    const { id } = getQueryValue()
15
-
16
-    const [name, setName] = useState('')
17
-    const [data, setData] = useState({})
18
-    const [pageState, setPageState] = useState('1')
19
-    const [list, setList] = useState([])
20
-
21
-
22
-    useDidShow(() => {
23
-        if (id) {
24
-            getMateTagGroupDetail()
25
-        }
26
-
27
-    })
28
-    const getMateTagGroupDetail = () => {
29
-        request({ url: `/taMateTagGroup/${id}`, }).then((res) => {
30
-            setName(res.data.data.name)
31
-            setData(res.data.data)
32
-        })
3
+import { View, Input, Text } from "@tarojs/components";
4
+import Layout from "../../../layout/index";
5
+import Tab from "../../../compents/tab/index";
6
+import Container from "../../../compents/container/index";
7
+import "./index.scss";
8
+import getQueryValue from "../../../util/getQueryValue";
9
+import request from "../../../util/request";
10
+import IsLogin from "../../../layout/IsLogin";
11
+const index = props => {
12
+  const { id } = getQueryValue();
13
+
14
+  const [name, setName] = useState("");
15
+  const [data, setData] = useState({});
16
+
17
+  useDidShow(() => {
18
+    if (id) {
19
+      getMateTagGroupDetail();
33 20
     }
34
-
35
-
36
-    const onSave = () => {
37
-        console.log(333)
38
-
39
-        if (id) {
40
-
41
-            Taro.showModal({
42
-                title: '确定修改该标签组吗?',
43
-                // content: row.name,
44
-                cancelColor: '#d2d2d2',
45
-                confirmColor: "#274191",
46
-                success: function (res) {
21
+  });
22
+  const getMateTagGroupDetail = () => {
23
+    request({ url: `/taMateTagGroup/${id}` }).then(res => {
24
+      setName(res.data.data.name);
25
+      setData(res.data.data);
26
+    });
27
+  };
28
+
29
+  const onSave = () => {
30
+    console.log(333);
31
+
32
+    if (id) {
33
+      Taro.showModal({
34
+        title: "确定修改该标签组吗?",
35
+        // content: row.name,
36
+        cancelColor: "#d2d2d2",
37
+        confirmColor: "#274191",
38
+        success: function(res) {
39
+          if (res.confirm) {
40
+            console.log("用户点击确定");
41
+
42
+            request({
43
+              url: `/taMateTagGroup/${id}`,
44
+              data: { ...data, name: name },
45
+              method: "put"
46
+            }).then(res => {
47
+              Taro.showModal({
48
+                title: "修改成功",
49
+                content: "点击确认按钮,返回上级菜单",
50
+                showCancel: false,
51
+                success: function(res) {
47 52
                   if (res.confirm) {
48
-                    console.log('用户点击确定')
49
-          
50
-                    request({url: `/taMateTagGroup/${id}`, data: { ...data, name: name }, method: 'put' }).then((res) => {
51
-                        Taro.showModal({
52
-                            title: '修改成功',
53
-                            content: '点击确认按钮,返回上级菜单',
54
-                            showCancel: false,
55
-                            success: function (res) {
56
-                                if (res.confirm) {
57
-                                    console.log('用户点击确定')
58
-        
59
-                                    Taro.navigateBack({
60
-                                        delta: 1
61
-                                    })
62
-                                } else if (res.cancel) {
63
-                                    console.log('用户点击取消')
64
-                                }
65
-                            }
66
-                        })
67
-        
68
-                    })
69
-          
53
+                    console.log("用户点击确定");
54
+
55
+                    Taro.navigateBack({
56
+                      delta: 1
57
+                    });
70 58
                   } else if (res.cancel) {
71
-                    console.log('用户点击取消')
59
+                    console.log("用户点击取消");
72 60
                   }
73 61
                 }
74
-              })
75
-
76
-            
77
-        } else {
78
-            request({ url: '/taMateTagGroup', data: { name }, method: 'post' }).then((res) => {
79
-                Taro.navigateBack({
80
-                    delta: 1
81
-                })
82
-            })
62
+              });
63
+            });
64
+          } else if (res.cancel) {
65
+            console.log("用户点击取消");
66
+          }
83 67
         }
84
-
85
-
86
-
87
-        // Taro.showModal({
88
-        //     title: '修改成功',
89
-        //     content: '点击确认按钮,返回上级菜单',
90
-        //     showCancel: false,
91
-        //     success: function (res) {
92
-        //         if (res.confirm) {
93
-        //             console.log('用户点击确定')
94
-
95
-        //             Taro.navigateBack({
96
-        //                 delta: 1
97
-        //             })
98
-        //         } else if (res.cancel) {
99
-        //             console.log('用户点击取消')
100
-        //         }
101
-        //     }
102
-        // })
103
-    }
104
-
105
-    const onChooseLocation = () => {
106
-        console.log(333)
107
-        wx.chooseLocation({
108
-            success: (res) => {
109
-                console.log(res)
110
-            }
111
-        })
112
-    }
113
-    function handNameChange(e) {
114
-
115
-        setName(e.detail.value)
116
-
117
-
118
-
68
+      });
69
+    } else {
70
+      request({ url: "/taMateTagGroup", data: { name }, method: "post" }).then(
71
+        res => {
72
+          Taro.navigateBack({
73
+            delta: 1
74
+          });
75
+        }
76
+      );
119 77
     }
78
+  };
120 79
 
121
-    return <View className='addnewhouse'>
122
-
123
-
124
-        {/* <Form onSubmit={this.formSubmit} onReset={this.formReset} >
125
-        <View className='example-body'>
126
-          <Switch name='switch' className='form-switch'></Switch>
127
-        </View>
128
-      </Form> */}
80
+  function handNameChange(e) {
81
+    setName(e.detail.value);
82
+  }
129 83
 
84
+  return (
85
+    <IsLogin>
86
+      <View className="addnewhouse">
130 87
         <Layout>
131
-            {/* <Form onSubmit={formSubmit} onReset={formReset}> */}
132
-            {/* <View className='inputstyle-view'>
133
-                    <Text className='title'>标签组编号</Text>
134
-                    <Container className='inputstyle-view-card ' >
135
-                        <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
136
-                    </Container>
137
-                </View> */}
138
-            <View className='inputstyle-view'>
139
-                <Text className='title'>标签组名称</Text>
140
-                <Container className='inputstyle-view-card ' >
141
-                    <Input placeholderClass='placeholderinput' value={name} onInput={handNameChange} className='input' type='text' placeholder='' />
142
-                </Container>
143
-            </View>
144
-            {/* <View className='inputstyle-view'>
145
-                    <Text className='title'>标签数量</Text>
146
-                    <Container className='inputstyle-view-card ' >
147
-                        <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
148
-                    </Container>
149
-                </View> */}
150
-
151
-            {/* </Form> */}
152
-
88
+          <View className="inputstyle-view">
89
+            <Text className="title">标签组名称</Text>
90
+            <Container className="inputstyle-view-card ">
91
+              <Input
92
+                placeholderClass="placeholderinput"
93
+                value={name}
94
+                onInput={handNameChange}
95
+                className="input"
96
+                type="text"
97
+                placeholder=""
98
+              />
99
+            </Container>
100
+          </View>
153 101
         </Layout>
154
-        <Tab className='addhousetab' pageState='3' value={['取消', id ? '确认修改' : '确认添加']} onClick={[(e) => Taro.navigateBack({
155
-            delta: 1
156
-        }), () => onSave()]}></Tab>
157
-
158
-
159
-
160
-
161
-
162
-    </View>
163
-}
164
-
165
-export default index
102
+        <Tab
103
+          className="addhousetab"
104
+          pageState="3"
105
+          value={["取消", id ? "确认修改" : "确认添加"]}
106
+          onClick={[
107
+            e =>
108
+              Taro.navigateBack({
109
+                delta: 1
110
+              }),
111
+            () => onSave()
112
+          ]}
113
+        ></Tab>
114
+      </View>
115
+    </IsLogin>
116
+  );
117
+};
118
+
119
+export default index;

+ 86
- 69
src/pages/label/index.jsx Dosyayı Görüntüle

@@ -1,46 +1,45 @@
1
-import React, { useEffect, useMemo, useState, useRef } from 'react'
2
-import Taro, { useDidShow } from '@tarojs/taro'
3
-import './index.scss'
4
-import { View, Text, Input, Image } from '@tarojs/components'
5
-import ContainerLayout from '../../compents/container/index'
6
-import Tab from '../../compents/tab/index'
7
-import Layout from '../../layout/index'
8
-import request from '../../util/request'
9
-
10
-const house = (props) => {
11
-
12
-  const [list, setList] = useState([])
13
-  const [radioHouse, setRadioHouse] = useState()
14
-
15
-  const ref = useRef();
16
-
1
+import React, { useState } from "react";
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import "./index.scss";
4
+import { View, Text } from "@tarojs/components";
5
+import ContainerLayout from "../../compents/container/index";
6
+import Tab from "../../compents/tab/index";
7
+import Layout from "../../layout/index";
8
+import request from "../../util/request";
9
+import IsLogin from "../../layout/IsLogin";
10
+
11
+const house = props => {
12
+  const [list, setList] = useState([]);
17 13
 
18 14
   useDidShow(() => {
19
-    getMateTagGroupList()
20
-  })
21
-
15
+    getMateTagGroupList();
16
+  });
22 17
 
23 18
   const getMateTagGroupList = () => {
24
-    request({ url: '/taMateTagGroup', params:{pageSize:9999}}).then((res) => {
25
-      const { records, ...page} = res.data.data
26
-      setList(records)
27
-    })
28
-  }
29
-
19
+    request({ url: "/taMateTagGroup", params: { pageSize: 9999 } }).then(
20
+      res => {
21
+        const { records, ...page } = res.data.data;
22
+        setList(records);
23
+      }
24
+    );
25
+  };
30 26
 
31
-  const onDelete = (row) => {
27
+  const onDelete = row => {
32 28
     Taro.showModal({
33
-      title: '确定删除该标签组吗?',
29
+      title: "确定删除该标签组吗?",
34 30
       content: row.name,
35
-      cancelColor: '#d2d2d2',
31
+      cancelColor: "#d2d2d2",
36 32
       confirmColor: "#274191",
37
-      success: function (res) {
33
+      success: function(res) {
38 34
         if (res.confirm) {
39
-          console.log('用户点击确定')
40
-
41
-          request({ url: `/taMateTagGroup/${row.groupId}`, method: 'delete', }).then((res)=>{
42
-            getMateTagGroupList({ pageNum: 1, pageSize:10 })
43
-          })
35
+          console.log("用户点击确定");
36
+
37
+          request({
38
+            url: `/taMateTagGroup/${row.groupId}`,
39
+            method: "delete"
40
+          }).then(res => {
41
+            getMateTagGroupList({ pageNum: 1, pageSize: 10 });
42
+          });
44 43
           // Taro.showModal({
45 44
           //   title: `改标签组有${row.user.number}个标签仍在使用。请先清空标签,再删除标签组`,
46 45
           //   showCancel: false,
@@ -50,46 +49,64 @@ const house = (props) => {
50 49
           //     if (res.confirm) {
51 50
           //       console.log('用户点击确定')
52 51
 
53
-
54 52
           //     } else if (res.cancel) {
55 53
           //       console.log('用户点击取消')
56 54
           //     }
57 55
           //   }
58 56
           // })
59
-
60 57
         } else if (res.cancel) {
61
-          console.log('用户点击取消')
58
+          console.log("用户点击取消");
62 59
         }
63 60
       }
64
-    })
65
-  }
66
-
67
-
68
-
69
-
70
-  return <View className='account'>
71
-    <Layout>
72
-      {list.map((x, index) => {
73
-        return <View className='account-view'>
74
-          {/* <Text className='account-view-title'>标签组编号:{index + 1}</Text> */}
75
-          <ContainerLayout className='account-view-card'>
76
-            <View className='top' onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/index?id=${x.groupId}` }) }}>
77
-              <View>标签组名称:{x.name}</View>
78
-
79
-            </View>
80
-            <View className='bottom'>
81
-              <Text onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index?id=${x.groupId}` }) }}>编辑</Text>
82
-              <Text onClick={() => onDelete(x)}>删除</Text>
83
-            </View>
84
-          </ContainerLayout>
85
-
86
-        </View>
87
-
88
-      })}
89
-    </Layout>
90
-    {/* onClick={(e)=>(e) */}
91
-    <Tab value={['+新增标签组']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab>
92
-  </View>
93
-}
94
-
95
-export default house
61
+    });
62
+  };
63
+
64
+  return (
65
+    <IsLogin>
66
+      <View className="account">
67
+        <Layout>
68
+          {list.map((x, index) => {
69
+            return (
70
+              <View className="account-view">
71
+                {/* <Text className='account-view-title'>标签组编号:{index + 1}</Text> */}
72
+                <ContainerLayout className="account-view-card">
73
+                  <View
74
+                    className="top"
75
+                    onClick={() => {
76
+                      Taro.navigateTo({
77
+                        url: `/pages/mateTag/index?id=${x.groupId}`
78
+                      });
79
+                    }}
80
+                  >
81
+                    <View>标签组名称:{x.name}</View>
82
+                  </View>
83
+                  <View className="bottom">
84
+                    <Text
85
+                      onClick={() => {
86
+                        Taro.navigateTo({
87
+                          url: `/pages/label/edit/index?id=${x.groupId}`
88
+                        });
89
+                      }}
90
+                    >
91
+                      编辑
92
+                    </Text>
93
+                    <Text onClick={() => onDelete(x)}>删除</Text>
94
+                  </View>
95
+                </ContainerLayout>
96
+              </View>
97
+            );
98
+          })}
99
+        </Layout>
100
+        <Tab
101
+          value={["+新增标签组"]}
102
+          color="#ffffff"
103
+          onClick={() => {
104
+            Taro.navigateTo({ url: `/pages/label/edit/index` });
105
+          }}
106
+        ></Tab>
107
+      </View>
108
+    </IsLogin>
109
+  );
110
+};
111
+
112
+export default house;

+ 109
- 128
src/pages/mateTag/edit/index.jsx Dosyayı Görüntüle

@@ -1,140 +1,121 @@
1
-import React, { useEffect, useMemo, useState } from 'react'
1
+import React, { useState } from "react";
2 2
 import Taro, { useDidShow } from "@tarojs/taro";
3
-import { useSelector } from 'react-redux'
4
-import { View, Input, Text, Image, Form } from '@tarojs/components'
5
-import Layout from '../../../layout/index'
6
-import Tab from '../../../compents/tab/index'
7
-import Container from '../../../compents/container/index'
8
-import './index.scss'
9
-import getQueryValue from '../../../util/getQueryValue'
10
-import request from '../../../util/request';
11
-
12
-const index = (props) => {
13
-
14
-    const { id,tagId } = getQueryValue()
15
-
16
-    const [name, setName] = useState('')
17
-    const [data, setData] = useState({})
18
-    const [pageState, setPageState] = useState('1')
19
-    const [list, setList] = useState([])
20
-
21
-
22
-    useDidShow(() => {
23
-        if (tagId) {
24
-            getMateTagGroupDetail()
25
-        }
26
-
27
-    })
28
-    const getMateTagGroupDetail = () => {
29
-        request({ url: `/taMateTag/${tagId}` }).then((res) => {
30
-            setName(res.data.data.name)
31
-            setData(res.data.data)
32
-        })
3
+import { View, Input, Text } from "@tarojs/components";
4
+import Layout from "../../../layout/index";
5
+import Tab from "../../../compents/tab/index";
6
+import Container from "../../../compents/container/index";
7
+import "./index.scss";
8
+import getQueryValue from "../../../util/getQueryValue";
9
+import request from "../../../util/request";
10
+import IsLogin from "../../../layout/IsLogin";
11
+
12
+const index = props => {
13
+  const { id, tagId } = getQueryValue();
14
+
15
+  const [name, setName] = useState("");
16
+  const [data, setData] = useState({});
17
+
18
+  useDidShow(() => {
19
+    if (tagId) {
20
+      getMateTagGroupDetail();
33 21
     }
34
-
35
-
36
-    const onSave = () => {
37
-        console.log(333)
38
-
39
-        if (tagId) {
40
-
41
-            Taro.showModal({
42
-                title: '确定修改该标签吗?',
43
-                // content: row.name,
44
-                cancelColor: '#d2d2d2',
45
-                confirmColor: "#274191",
46
-                success: function (res) {
22
+  });
23
+  const getMateTagGroupDetail = () => {
24
+    request({ url: `/taMateTag/${tagId}` }).then(res => {
25
+      setName(res.data.data.name);
26
+      setData(res.data.data);
27
+    });
28
+  };
29
+
30
+  const onSave = () => {
31
+    console.log(333);
32
+
33
+    if (tagId) {
34
+      Taro.showModal({
35
+        title: "确定修改该标签吗?",
36
+        // content: row.name,
37
+        cancelColor: "#d2d2d2",
38
+        confirmColor: "#274191",
39
+        success: function(res) {
40
+          if (res.confirm) {
41
+            console.log("用户点击确定");
42
+
43
+            request({
44
+              url: `/taMateTag/${tagId}`,
45
+              data: { ...data, name: name },
46
+              method: "put"
47
+            }).then(res => {
48
+              Taro.showModal({
49
+                title: "修改成功",
50
+                content: "点击确认按钮,返回上级菜单",
51
+                showCancel: false,
52
+                success: function(res) {
47 53
                   if (res.confirm) {
48
-                    console.log('用户点击确定')
49
-          
50
-                    request({url: `/taMateTag/${tagId}`, data: { ...data, name: name }, method: 'put' }).then((res) => {
51
-                        Taro.showModal({
52
-                            title: '修改成功',
53
-                            content: '点击确认按钮,返回上级菜单',
54
-                            showCancel: false,
55
-                            success: function (res) {
56
-                                if (res.confirm) {
57
-                                    console.log('用户点击确定')
58
-        
59
-                                    Taro.navigateBack({
60
-                                        delta: 1
61
-                                    })
62
-                                } else if (res.cancel) {
63
-                                    console.log('用户点击取消')
64
-                                }
65
-                            }
66
-                        })
67
-        
68
-                    })
69
-          
54
+                    console.log("用户点击确定");
55
+
56
+                    Taro.navigateBack({
57
+                      delta: 1
58
+                    });
70 59
                   } else if (res.cancel) {
71
-                    console.log('用户点击取消')
60
+                    console.log("用户点击取消");
72 61
                   }
73 62
                 }
74
-              })
75
-
76
-            
77
-        } else {
78
-            request({ url: '/taMateTag', data: { name:name,groupId: id}, method: 'post' }).then((res) => {
79
-                Taro.navigateBack({
80
-                    delta: 1
81
-                })
82
-            })
63
+              });
64
+            });
65
+          } else if (res.cancel) {
66
+            console.log("用户点击取消");
67
+          }
83 68
         }
84
-
85
-
86
-
87
-        // Taro.showModal({
88
-        //     title: '修改成功',
89
-        //     content: '点击确认按钮,返回上级菜单',
90
-        //     showCancel: false,
91
-        //     success: function (res) {
92
-        //         if (res.confirm) {
93
-        //             console.log('用户点击确定')
94
-
95
-        //             Taro.navigateBack({
96
-        //                 delta: 1
97
-        //             })
98
-        //         } else if (res.cancel) {
99
-        //             console.log('用户点击取消')
100
-        //         }
101
-        //     }
102
-        // })
103
-    }
104
-
105
-    function handNameChange(e) {
106
-
107
-        setName(e.detail.value)
108
-
109
-
110
-
69
+      });
70
+    } else {
71
+      request({
72
+        url: "/taMateTag",
73
+        data: { name: name, groupId: id },
74
+        method: "post"
75
+      }).then(res => {
76
+        Taro.navigateBack({
77
+          delta: 1
78
+        });
79
+      });
111 80
     }
81
+  };
112 82
 
113
-    return <View className='addnewhouse'>
114
-
115
-
116
-        {/* <Form onSubmit={this.formSubmit} onReset={this.formReset} >
117
-        <View className='example-body'>
118
-          <Switch name='switch' className='form-switch'></Switch>
119
-        </View>
120
-      </Form> */}
83
+  function handNameChange(e) {
84
+    setName(e.detail.value);
85
+  }
121 86
 
87
+  return (
88
+    <IsLogin>
89
+      <View className="addnewhouse">
122 90
         <Layout>
123
-   
124
-            <View className='inputstyle-view'>
125
-                <Text className='title'>标签名称</Text>
126
-                <Container className='inputstyle-view-card ' >
127
-                    <Input placeholderClass='placeholderinput' value={name} onInput={handNameChange} className='input' type='text' placeholder='' />
128
-                </Container>
129
-            </View>
130
-   
91
+          <View className="inputstyle-view">
92
+            <Text className="title">标签名称</Text>
93
+            <Container className="inputstyle-view-card ">
94
+              <Input
95
+                placeholderClass="placeholderinput"
96
+                value={name}
97
+                onInput={handNameChange}
98
+                className="input"
99
+                type="text"
100
+                placeholder=""
101
+              /></Container>
102
+          </View>
131 103
         </Layout>
132
-        <Tab className='addhousetab' pageState='3' value={['取消', tagId ? '确认修改' : '确认添加']} onClick={[(e) => Taro.navigateBack({
133
-            delta: 1
134
-        }), () => onSave()]}></Tab>
135
-
136
-
137
-    </View>
138
-}
139
-
140
-export default index
104
+        <Tab
105
+          className="addhousetab"
106
+          pageState="3"
107
+          value={["取消", tagId ? "确认修改" : "确认添加"]}
108
+          onClick={[
109
+            e =>
110
+              Taro.navigateBack({
111
+                delta: 1
112
+              }),
113
+            () => onSave()
114
+          ]}
115
+        ></Tab>
116
+      </View>
117
+    </IsLogin>
118
+  );
119
+};
120
+
121
+export default index;

+ 85
- 90
src/pages/mateTag/index.jsx Dosyayı Görüntüle

@@ -1,102 +1,97 @@
1
-import React, { useEffect, useMemo, useState, useRef } from 'react'
2
-import Taro, { useDidShow } from '@tarojs/taro'
3
-import './index.scss'
4
-import { View, Text, Input, Image } from '@tarojs/components'
5
-import ContainerLayout from '../../compents/container/index'
6
-import Tab from '../../compents/tab/index'
7
-import Layout from '../../layout/index'
8
-import request from '../../util/request'
9
-import getQueryValue from '../../util/getQueryValue'
10
-import NoData from '@/compents/NoData'
11
-
12
-const house = (props) => {
13
-
14
-  const {id} = getQueryValue()
15
-
16
-  const [list, setList] = useState([])
17
-
1
+import React, { useState } from "react";
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import "./index.scss";
4
+import { View, Text } from "@tarojs/components";
5
+import ContainerLayout from "../../compents/container/index";
6
+import Tab from "../../compents/tab/index";
7
+import Layout from "../../layout/index";
8
+import request from "../../util/request";
9
+import getQueryValue from "../../util/getQueryValue";
10
+import NoData from "@/compents/NoData";
11
+import IsLogin from "../../layout/IsLogin";
12
+
13
+const house = props => {
14
+  const { id } = getQueryValue();
15
+
16
+  const [list, setList] = useState([]);
18 17
 
19 18
   useDidShow(() => {
20
-    getMateTagList()
21
-  })
19
+    getMateTagList();
20
+  });
22 21
 
23
-  // request({ url: '/taShopKeeper',params:{shopId:id}, method: 'get', }).then((res)=>{
24
-  //   const { records, ...page} = res.data.data
25
-  //   setList(records)
26
-  // })
27 22
   const getMateTagList = () => {
28
-    console.log(id,'getMateTagList')
29
-    request({ url: '/taMateTag',params:{groupId:id,pageSize:9999},method: 'get', }).then((res) => {
30
-      const { records, ...page} = res.data.data
31
-      setList(records)
32
-    })
33
-  }
34
-
35
-
36
-  const onDelete = (row) => {
23
+    console.log(id, "getMateTagList");
24
+    request({
25
+      url: "/taMateTag",
26
+      params: { groupId: id, pageSize: 9999 },
27
+      method: "get"
28
+    }).then(res => {
29
+      const { records, ...page } = res.data.data;
30
+      setList(records);
31
+    });
32
+  };
33
+
34
+  const onDelete = row => {
37 35
     Taro.showModal({
38
-      title: '确定删除该标签组吗?',
36
+      title: "确定删除该标签组吗?",
39 37
       content: row.name,
40
-      cancelColor: '#d2d2d2',
38
+      cancelColor: "#d2d2d2",
41 39
       confirmColor: "#274191",
42
-      success: function (res) {
40
+      success: function(res) {
43 41
         if (res.confirm) {
44
-          console.log('用户点击确定')
45
-
46
-          request({ url: `/taMateTag/${row.tagId}`, method: 'delete', }).then((res)=>{
47
-            getMateTagList({ pageNum: 1, pageSize:999 })
48
-          })
49
-          // Taro.showModal({
50
-          //   title: `改标签组有${row.user.number}个标签仍在使用。请先清空标签,再删除标签组`,
51
-          //   showCancel: false,
52
-          //   // cancelColor:'#d2d2d2',
53
-          //   confirmColor: "#274191",
54
-          //   success: function (res) {
55
-          //     if (res.confirm) {
56
-          //       console.log('用户点击确定')
57
-
58
-
59
-          //     } else if (res.cancel) {
60
-          //       console.log('用户点击取消')
61
-          //     }
62
-          //   }
63
-          // })
42
+          console.log("用户点击确定");
64 43
 
44
+          request({ url: `/taMateTag/${row.tagId}`, method: "delete" }).then(
45
+            res => {
46
+              getMateTagList({ pageNum: 1, pageSize: 999 });
47
+            }
48
+          );
65 49
         } else if (res.cancel) {
66
-          console.log('用户点击取消')
50
+          console.log("用户点击取消");
67 51
         }
68 52
       }
69
-    })
70
-  }
71
-
72
-
73
-
74
-
75
-  return <View className='account'>
76
-    <Layout>
77
-      <NoData nodata={!list.length} tips="暂无标签">
78
-      {list.map((x, index) => {
79
-        return <View className='account-view'>
80
-  
81
-          <ContainerLayout className='account-view-card'>
82
-            <View className='top' >
83
-              <View>标签名称:{x.name}</View>
84
-
85
-            </View>
86
-            <View className='bottom'>
87
-              <Text onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/edit/index?tagId=${x.tagId}` }) }}>编辑</Text>
88
-              <Text onClick={() => onDelete(x)}>删除</Text>
89
-            </View>
90
-          </ContainerLayout>
91
-
92
-        </View>
93
-
94
-      })}
95
-      </NoData>
96
-    </Layout>
97
-    {/* onClick={(e)=>(e) */}
98
-    <Tab value={['+新增标签']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/edit/index?id=${id}` }) }} ></Tab>
99
-  </View>
100
-}
101
-
102
-export default house
53
+    });
54
+  };
55
+
56
+  return (
57
+    <IsLogin>
58
+      <View className="account">
59
+        <Layout>
60
+          <NoData nodata={!list.length} tips="暂无标签">
61
+            {list.map((x, index) => {
62
+              return (
63
+                <View className="account-view">
64
+                  <ContainerLayout className="account-view-card">
65
+                    <View className="top">
66
+                      <View>标签名称:{x.name}</View>
67
+                    </View>
68
+                    <View className="bottom">
69
+                      <Text
70
+                        onClick={() => {
71
+                          Taro.navigateTo({
72
+                            url: `/pages/mateTag/edit/index?tagId=${x.tagId}`
73
+                          });
74
+                        }}
75
+                      >编辑</Text>
76
+                      <Text onClick={() => onDelete(x)}>删除</Text>
77
+                    </View>
78
+                  </ContainerLayout>
79
+                </View>
80
+              );
81
+            })}
82
+          </NoData>
83
+        </Layout>
84
+        {/* onClick={(e)=>(e) */}
85
+        <Tab
86
+          value={["+新增标签"]}
87
+          color="#ffffff"
88
+          onClick={() => {
89
+            Taro.navigateTo({ url: `/pages/mateTag/edit/index?id=${id}` });
90
+          }}
91
+        ></Tab>
92
+      </View>
93
+    </IsLogin>
94
+  );
95
+};
96
+
97
+export default house;

+ 82
- 116
src/pages/material/index.jsx Dosyayı Görüntüle

@@ -1,120 +1,86 @@
1
-import React, { useEffect, useMemo, useState } from 'react'
1
+import React, { useState } from "react";
2 2
 // import { useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo } from '@tarojs/taro'
3
-import Taro, { useDidShow, useShareAppMessage } from "@tarojs/taro";
4
-import { useSelector, } from 'react-redux'
5
-import { View, Input, Text, Image } from '@tarojs/components'
6
-import Layout from '../../layout/index'
7
-import Tab from '../../compents/tab/index'
8
-import Container from '../../compents/container/index'
9
-import locationicon from '../../assets/locationicon.png'
10
-import Tags from '../../compents/tags/index'
11
-import request from '../../util/request'
12
-import NoData from '@/compents/NoData'
13
-import './index.scss'
14
-
15
-// Page({
16
-//     data: {
17
-//         text: 'init data',
18
-//         array: [{ msg: '1' }, { msg: '2' }]
19
-//     }
20
-// })
21
-
22
-const index = (props) => {
23
-
24
-
25
-
26
-    let [arrList, setArrList] = useState({})
27
-    const [labelList, setLabelList] = useState([])
28
-    const [list, setList] = useState([])
29
-    useEffect(() => {
30
-
31
-        // console.log(page, 'page')
32
-
33
-    }, [])
34
-
35
-    useDidShow(() => {
36
-        getMateTagGroupList()
37
-    })
38
-
39
-
40
-    const getMateTagGroupList = () => {
41
-        request({ url: '/taMateTagGroup', params: { pageSize: 1, pageSize: 9999 } }).then((res) => {
42
-            const { records, ...page } = res.data.data
43
-            setList(records)
44
-        })
45
-    }
46
-    const onTabClick = (e) => {
47
-        console.log(e, '111')
48
-        setUserRole(e)
49
-    }
50
-
51
-    const onLabelChange = (e, index) => {
52
-          
53
-        let newArrArrList={
54
-            ...arrList,
55
-            [index]: e
56
-        }
57
-        setArrList(newArrArrList)
58
-        console.log(newArrArrList, 'arrList')
59
-        let newArr = Object.values(newArrArrList).reduce((pre, cur) => {
60
-
61
-            return pre.concat(cur)
62
-
63
-        }, [])
64
-        setLabelList([...newArr])
65
-        console.log(newArr, 'newArr11111111')
66
-
67
-    }
68
-
69
-
70
-    const onClick = () => {
71
-        
72
-
73
-        const query = labelList.map(x=>x.tagId).join(',')
74
-        console.log(query, '', 'eeee')
75
-        Taro.navigateTo({
76
-            url: `/pages/imglist/index?query=${query}`
77
-        })
78
-        // Taro.showModal({
79
-        //     title: '修改成功',
80
-        //     content: '点击确认按钮,返回上级菜单',
81
-        //     showCancel: false,
82
-        //     success: function (res) {
83
-        //         if (res.confirm) {
84
-        //             console.log('用户点击确定')
85
-
86
-        //             Taro.navigateBack({
87
-        //                 delta: 1
88
-        //             })
89
-        //         } else if (res.cancel) {
90
-        //             console.log('用户点击取消')
91
-        //         }
92
-        //     }
93
-        // })
94
-    }
95
-
96
-    return <View className='material'>
97
-
98
-
99
-
100
-
3
+import Taro, { useDidShow } from "@tarojs/taro";
4
+import { View ,Text } from "@tarojs/components";
5
+import Layout from "../../layout/index";
6
+import Tab from "../../compents/tab/index";
7
+import Tags from "../../compents/tags/index";
8
+import request from "../../util/request";
9
+import NoData from "@/compents/NoData";
10
+import "./index.scss";
11
+import IsLogin from "../../layout/IsLogin";
12
+
13
+const index = props => {
14
+  let [arrList, setArrList] = useState({});
15
+  const [labelList, setLabelList] = useState([]);
16
+  const [list, setList] = useState([]);
17
+
18
+
19
+  useDidShow(() => {
20
+    getMateTagGroupList();
21
+  });
22
+
23
+  const getMateTagGroupList = () => {
24
+    request({
25
+      url: "/taMateTagGroup",
26
+      params: { pageSize: 1, pageSize: 9999 }
27
+    }).then(res => {
28
+      const { records, ...page } = res.data.data;
29
+      setList(records);
30
+    });
31
+  };
32
+
33
+  const onLabelChange = (e, index) => {
34
+    let newArrArrList = {
35
+      ...arrList,
36
+      [index]: e
37
+    };
38
+    setArrList(newArrArrList);
39
+    let newArr = Object.values(newArrArrList).reduce((pre, cur) => {
40
+      return pre.concat(cur);
41
+    }, []);
42
+    setLabelList([...newArr]);
43
+  };
44
+
45
+  const onClick = () => {
46
+    const query = labelList.map(x => x.tagId).join(",");
47
+    Taro.navigateTo({
48
+      url: `/pages/imglist/index?query=${query}`
49
+    });
50
+  };
51
+
52
+  return (
53
+    <IsLogin>
54
+      <View className="material">
101 55
         <Layout>
102
-            <NoData nodata={!list.length}>
103
-            {
104
-                list.map((item,index) => {
105
-                    return <View className='material-card' key={index}>
106
-                        <Text>{item.name}</Text>
107
-                        <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} > </Tags>
108
-                    </View>
109
-                })
110
-            }
111
-            </NoData>
56
+          <NoData nodata={!list.length}>
57
+            {list.map((item, index) => {
58
+              return (
59
+                <View className="material-card" key={index}>
60
+                  <Text>{item.name}</Text>
61
+                  <Tags
62
+                    list={item.taMateTagList}
63
+                    onChange={e => onLabelChange(e, index)}
64
+                  ></Tags>
65
+                </View>
66
+              );
67
+            })}
68
+          </NoData>
112 69
         </Layout>
113
-        {/* className='addhousetab' */}
114
-        <Tab pageState='3' value={['取消', '开始查询']} onClick={[(e) => Taro.navigateBack({
70
+        <Tab
71
+          pageState="3"
72
+          value={["取消", "开始查询"]}
73
+          onClick={[
74
+            e =>
75
+              Taro.navigateBack({
115 76
                 delta: 1
116
-            }), (e) => onClick(e)]}></Tab>
117
-    </View>
118
-}
119
-
120
-export default index
77
+              }),
78
+            e => onClick(e)
79
+          ]}
80
+        ></Tab>
81
+      </View>
82
+    </IsLogin>
83
+  );
84
+};
85
+
86
+export default index;

+ 116
- 145
src/pages/shop/edit/index.jsx Dosyayı Görüntüle

@@ -1,153 +1,124 @@
1
-import React, { useEffect, useMemo, useState } from 'react'
1
+import React, { useEffect, useState } from "react";
2 2
 import Taro from "@tarojs/taro";
3
-import { View, Input, Text, Image, Form, Button } from '@tarojs/components'
4
-import Layout from '../../../layout/index'
5
-import Tab from '../../../compents/tab/index'
6
-import Container from '../../../compents/container/index'
7
-import locationicon from '../../../assets/locationicon.png'
8
-import uploadicon from '../../../assets/uploadicon.png'
9
-import './index.scss'
10
-import request, { uploadFiles } from '../../../util/request'
11
-const index = (props) => {
12
-
13
-
14
-    const [userRole, setUserRole] = useState('1')
15
-
16
-    const [name, setName] = useState('')
17
-    const [imgUrl, setImgUrl] = useState('')
18
-    useEffect(() => {
19
-
20
-
21
-    }, [])
22
-
23
-
24
-    const onTabClick = (e) => {
25
-        console.log(e, '111')
26
-        setUserRole(e)
3
+import { View, Input, Text, Image } from "@tarojs/components";
4
+import Layout from "../../../layout/index";
5
+import Tab from "../../../compents/tab/index";
6
+import Container from "../../../compents/container/index";
7
+import uploadicon from "../../../assets/uploadicon.png";
8
+import "./index.scss";
9
+import request, { uploadFiles } from "../../../util/request";
10
+import IsLogin from "../../../layout/IsLogin";
11
+
12
+const index = props => {
13
+  const [name, setName] = useState("");
14
+  const [imgUrl, setImgUrl] = useState("");
15
+  useEffect(() => {}, []);
16
+
17
+  const editShopKeeper = () => {
18
+    if (!name) {
19
+      Taro.showToast({
20
+        title: "请输入名称",
21
+        icon: "none",
22
+        duration: 2000
23
+      });
24
+      return;
27 25
     }
28
-
29
-    const onRegisterChange = (e) => {
30
-        console.log(e, '111')
31
-    }
32
-    const onSave = () => {
33
-        console.log(333)
34
-
35
-        // Taro.showModal({
36
-        //     title: '修改成功',
37
-        //     content: '点击确认按钮,返回上级菜单',
38
-        //     showCancel: false,
39
-        //     success: function (res) {
40
-        //         if (res.confirm) {
41
-        //             console.log('用户点击确定')
42
-
43
-        //             Taro.navigateBack({
44
-        //                 delta: 1
45
-        //             })
46
-        //         } else if (res.cancel) {
47
-        //             console.log('用户点击取消')
48
-        //         }
49
-        //     }
50
-        // })
26
+    if (!imgUrl) {
27
+      Taro.showToast({
28
+        title: "请上传图片",
29
+        icon: "none",
30
+        duration: 2000
31
+      });
32
+      return;
51 33
     }
52
-    // /api/taShopKeeper
53
-    const editShopKeeper = () => {
54
-
55
-
56
-        if (!name) {
34
+    request({
35
+      url: "/taShop",
36
+      data: { name: name, logo: imgUrl },
37
+      method: "post"
38
+    }).then(res => {
39
+      Taro.showModal({
40
+        title: "新增成功",
41
+        content: "点击确认按钮,返回上级菜单",
42
+        showCancel: false,
43
+        success: function(res) {
44
+          if (res.confirm) {
45
+            console.log("用户点击确定");
57 46
 
58
-            Taro.showToast({
59
-                title: '请输入名称',
60
-                icon: 'none',
61
-                duration: 2000
62
-              })
63
-            return
64
-        }
65
-        if (!imgUrl) {
66
-            Taro.showToast({
67
-                title: '请上传图片',
68
-                icon: 'none',
69
-                duration: 2000
70
-              })
71
-            return
47
+            Taro.navigateBack({
48
+              delta: 1
49
+            });
50
+          } else if (res.cancel) {
51
+            console.log("用户点击取消");
52
+          }
72 53
         }
73
-        request({ url: "/taShop", data: { name: name, logo: imgUrl }, method: 'post' }).then((res) => {
74
-            Taro.showModal({
75
-                title: '新增成功',
76
-                content: '点击确认按钮,返回上级菜单',
77
-                showCancel: false,
78
-                success: function (res) {
79
-                    if (res.confirm) {
80
-                        console.log('用户点击确定')
81
-
82
-                        Taro.navigateBack({
83
-                            delta: 1
84
-                        })
85
-                    } else if (res.cancel) {
86
-                        console.log('用户点击取消')
87
-                    }
88
-                }
89
-            })
90
-        })
91
-
92
-    }
93
-    function handNameChange(e) {
94
-        console.log(e.detail, 'handNameChange')
95
-        setName(e.detail.value)
96
-        // editShopKeeper(e.detail.value)
97
-
98
-
99
-    }
100
-
101
-    const onUpImage = () => {
102
-        console.log('onUpImage')
103
-
104
-
105
-
106
-        Taro.chooseImage({
107
-            sourceType: ['album'],
108
-            success: (res) => {
109
-                const tempFilePaths = res.tempFilePaths
110
-                uploadFiles(tempFilePaths).then((res) => {
111
-                    console.log(res, 'uploadFiles')
112
-                    setImgUrl(res[0])
113
-                })
114
-            }
115
-        })
116
-    }
117
-
118
-    return <View className='addnewhouse'>
119
-
54
+      });
55
+    });
56
+  };
57
+  function handNameChange(e) {
58
+    setName(e.detail.value);
59
+  }
60
+
61
+  const onUpImage = () => {
62
+    Taro.chooseImage({
63
+      sourceType: ["album"],
64
+      success: res => {
65
+        const tempFilePaths = res.tempFilePaths;
66
+        uploadFiles(tempFilePaths).then(res => {
67
+          setImgUrl(res[0]);
68
+        });
69
+      }
70
+    });
71
+  };
72
+
73
+  return (
74
+    <IsLogin>
75
+      <View className="addnewhouse">
120 76
         <Layout>
121
-
122
-            <View className='inputstyle-view'>
123
-                <Text className='title'>店铺名称</Text>
124
-                <Container className='inputstyle-view-card '  >
125
-                    <Input name='keeperId' value={name} placeholderClass='placeholderinput' onInput={handNameChange} placeholder='' className='input' />
126
-                </Container>
127
-            </View>
128
-
129
-
130
-            <View className='inputstyle-view'>
131
-                <Text className='title'>logo</Text>
132
-                <Container className='inputstyle-view-card ' style={{ padding: '0.6rem', width: '2rem', height: '2rem' }} >
133
-                    <Image className='guide-view-img' style={{ width: '100%', height: '100%' }} onClick={() => onUpImage()} src={imgUrl || uploadicon}></Image>
134
-                </Container>
135
-            </View>
136
-
77
+          <View className="inputstyle-view">
78
+            <Text className="title">店铺名称</Text>
79
+            <Container className="inputstyle-view-card ">
80
+              <Input
81
+                name="keeperId"
82
+                value={name}
83
+                placeholderClass="placeholderinput"
84
+                onInput={handNameChange}
85
+                placeholder=""
86
+                className="input"
87
+              />
88
+            </Container>
89
+          </View>
90
+
91
+          <View className="inputstyle-view">
92
+            <Text className="title">logo</Text>
93
+            <Container
94
+              className="inputstyle-view-card "
95
+              style={{ padding: "0.6rem", width: "2rem", height: "2rem" }}
96
+            >
97
+              <Image
98
+                className="guide-view-img"
99
+                style={{ width: "100%", height: "100%" }}
100
+                onClick={() => onUpImage()}
101
+                src={imgUrl || uploadicon}
102
+              ></Image>
103
+            </Container>
104
+          </View>
137 105
         </Layout>
138
-        {/* <Input formType="submit" > */}
139
-        <Tab className='addhousetab' pageState='3' value={['取消', '确认添加']} onClick={[(e) => {
140
-            Taro.navigateBack({
106
+        <Tab
107
+          className="addhousetab"
108
+          pageState="3"
109
+          value={["取消", "确认添加"]}
110
+          onClick={[
111
+            e => {
112
+              Taro.navigateBack({
141 113
                 delta: 1
142
-            })
143
-        }, () => editShopKeeper()]}></Tab>
144
-
145
-        {/* </Input> */}
146
-
147
-
148
-
149
-
150
-    </View>
151
-}
152
-
153
-export default index
114
+              });
115
+            },
116
+            () => editShopKeeper()
117
+          ]}
118
+        ></Tab>
119
+      </View>
120
+    </IsLogin>
121
+  );
122
+};
123
+
124
+export default index;

+ 86
- 107
src/pages/shop/index.jsx Dosyayı Görüntüle

@@ -1,134 +1,113 @@
1
-import React, { useEffect, useMemo, useState, useRef } from 'react'
2
-import Taro, { useDidShow } from '@tarojs/taro'
3
-import './index.scss'
4
-import { View, Text, Input, Image } from '@tarojs/components'
5
-import ContainerLayout from '../../compents/container/index'
6
-import Tab from '../../compents/tab/index'
7
-import Layout from '../../layout/index'
8
-import request from '../../util/request'
9
-import InifiniteList from '@/compents/InifiniteList'
10
-
11
-const account = (props) => {
12
-
13
-  const [list, setList] = useState([])
14
-  const [page, setPage] = useState({ total: 0, pageNum: 0 })
15
-  const [radioHouse, setRadioHouse] = useState()
16
-  const [loading, setLoading] = useState(false)
17
-
18
-  const radioHouseState = useMemo(() => props.radioHouseState, [props.radioHouseState])
19
-
20
-  console.log(props, radioHouseState)
21
-  useEffect(() => {
22
-
23
-
24
-  }, [])
1
+import React, { useEffect, useMemo, useState } from "react";
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import "./index.scss";
4
+import { View, Text } from "@tarojs/components";
5
+import ContainerLayout from "../../compents/container/index";
6
+import Tab from "../../compents/tab/index";
7
+import Layout from "../../layout/index";
8
+import request from "../../util/request";
9
+import InifiniteList from "@/compents/InifiniteList";
10
+import IsLogin from "../../layout/IsLogin";
11
+
12
+const account = props => {
13
+  const [list, setList] = useState([]);
14
+  const [page, setPage] = useState({ total: 0, pageNum: 0 });
15
+  const [loading, setLoading] = useState(false);
16
+
17
+  const radioHouseState = useMemo(() => props.radioHouseState, [
18
+    props.radioHouseState
19
+  ]);
20
+
21
+  console.log(props, radioHouseState);
22
+  useEffect(() => {}, []);
25 23
 
26 24
   useDidShow(() => {
27
-    getShopList({ pageNum: 1, pageSize:10 })
28
-  })
25
+    getShopList({ pageNum: 1, pageSize: 10 });
26
+  });
29 27
 
30 28
   function getShopList(params) {
31
-    // setLoading(true)
32
-    request({ url: "/taShop",params,  method: 'get' })
33
-      .then((res) => {
34
-        const { records, ...page} = res.data.data
35
-
36
-        // setLoading(false)
29
+    request({ url: "/taShop", params, method: "get" })
30
+      .then(res => {
31
+        const { records, ...page } = res.data.data;
37 32
         setPage({
38 33
           ...page,
39 34
           pageNum: page.current
40
-        })
41
-
42
-        setList(list.concat(records || []))
43
-
44
-      }).catch(() => setLoading(false))
35
+        });
36
+        setList(list.concat(records || []));
37
+      })
38
+      .catch(() => setLoading(false));
45 39
   }
46 40
 
47
-  const onDelete = (shopId) => {
41
+  const onDelete = shopId => {
48 42
     Taro.showModal({
49
-      title: '确定删除该店铺吗',
43
+      title: "确定删除该店铺吗",
50 44
       // content: '确定后,该老板房源信息将一并删除',
51
-      cancelColor: '#d2d2d2',
45
+      cancelColor: "#d2d2d2",
52 46
       confirmColor: "#274191",
53
-      success: function (res) {
47
+      success: function(res) {
54 48
         if (res.confirm) {
55
-         
56
-          request({ url: `/taShop/${shopId}`,  method: 'delete' })
57
-          .then((res) => {
58
-            setList(list.filter((x)=>x.shopId!=shopId))
59
-          })
60
-
61
-
49
+          request({ url: `/taShop/${shopId}`, method: "delete" }).then(res => {
50
+            setList(list.filter(x => x.shopId != shopId));
51
+          });
62 52
         } else if (res.cancel) {
63
-          console.log('用户点击取消')
53
+          console.log("用户点击取消");
64 54
         }
65 55
       }
66
-    })
67
-  }
56
+    });
57
+  };
68 58
 
69 59
   const loadMore = () => {
70
-    console.log('----------------')
71
-    getShopList({ pageNum: page.pageNum + 1 })
72
-  }
60
+    getShopList({ pageNum: page.pageNum + 1 });
61
+  };
73 62
 
74 63
   const renderItem = (index, key) => (
75
-    <View className='account-view' key={key}>
64
+    <View className="account-view" key={key}>
76 65
       {/* <Text className='account-view-title'>店铺编号:{index}</Text> */}
77
-      <ContainerLayout className='account-view-card'>
78
-        <View className='top' >
79
-          <View>店铺名称:{list[index].name||''}</View>
66
+      <ContainerLayout className="account-view-card">
67
+        <View className="top">
68
+          <View>店铺名称:{list[index].name || ""}</View>
80 69
           {/* <View>电话:{x.user.name}</View>
81 70
         <View>微信号:{x.user.name}</View>
82 71
         <View>房源数:{x.user.name}</View> */}
83 72
         </View>
84
-        <View className='bottom'>
85
-          <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/index?id=${list[index].shopId}` }) }}>店主</Text>
86
-          <Text onClick={()=>onDelete(list[index].shopId)}>删除</Text>
73
+        <View className="bottom">
74
+          <Text
75
+            onClick={() => {
76
+              Taro.navigateTo({
77
+                url: `/pages/account/index?id=${list[index].shopId}`
78
+              });
79
+            }}
80
+          >
81
+            店主
82
+          </Text>
83
+          <Text onClick={() => onDelete(list[index].shopId)}>删除</Text>
87 84
         </View>
88
-      </ContainerLayout>  
85
+      </ContainerLayout>
89 86
     </View>
90
-  )
91
-  
92
-
93
-  return <View className='account'>
94
-    <Layout>
95
-      {/* <VirtualList
96
-        className='List'
97
-        height={500}
98
-        itemData={list}
99
-        itemCount={list.length}
100
-        itemSize={100}
101
-        width='100%'
102
-        onScroll={({ scrollDirection, scrollOffset }) => {
103
-          console.log(scrollDirection, scrollOffset, 'onScroll')
104
-          if (
105
-          
106
-            !loading &&
107
-          
108
-            scrollDirection === 'forward' &&
109
-          
110
-            scrollOffset > ((list.length - 6) * 100 + 50)
111
-          ) {
112
-            console.log('listReachBottom')
113
-            listReachBottom()
114
-          }
115
-        }}
116
-      >
117
-        {Row}
118
-      </VirtualList> */}
119
-
120
-      <InifiniteList
121
-        length={list.length}
122
-        total={page.total}
123
-        height={600}
124
-        itemRenderer={renderItem}
125
-        loadMore={loadMore}
126
-      />
127
-
128
-    </Layout>
129
-    {/* onClick={(e)=>(e) */}
130
-    <Tab value={['+新增店铺']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/shop/edit/index` }) }} ></Tab>
131
-  </View>
132
-}
133
-
134
-export default account
87
+  );
88
+
89
+  return (
90
+    <IsLogin>
91
+      <View className="account">
92
+        <Layout>
93
+          <InifiniteList
94
+            length={list.length}
95
+            total={page.total}
96
+            height={600}
97
+            itemRenderer={renderItem}
98
+            loadMore={loadMore}
99
+          />
100
+        </Layout>
101
+        <Tab
102
+          value={["+新增店铺"]}
103
+          color="#ffffff"
104
+          onClick={() => {
105
+            Taro.navigateTo({ url: `/pages/shop/edit/index` });
106
+          }}
107
+        ></Tab>
108
+      </View>
109
+    </IsLogin>
110
+  );
111
+};
112
+
113
+export default account;