zlisen 4 gadus atpakaļ
vecāks
revīzija
bcb17cdade

+ 2
- 2
config/dev.js Parādīt failu

@@ -6,8 +6,8 @@ module.exports = {
6 6
   defineConstants: {
7 7
     // HOST: '"http://localhost:7080"',
8 8
     // HOST: '"https://sgl.ycjcjy.com"',
9
-    HOST: '"http://192.168.31.211:7080"',
10
-    // HOST: '"http://192.168.211.105:7080"',
9
+    // HOST: '"http://192.168.31.211:7080"',
10
+    HOST: '"http://192.168.211.105:7080"',
11 11
  
12 12
     // OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
13 13
     // OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",

+ 1
- 1
src/app.scss Parādīt failu

@@ -65,5 +65,5 @@ page {
65 65
 
66 66
 
67 67
  .scrol{
68
-  height: calc(100vh - 173.33px)
68
+  height: calc(100vh - 85px)
69 69
  }

+ 5
- 5
src/compents/tab/index.scss Parādīt failu

@@ -3,10 +3,10 @@
3 3
     position:absolute;
4 4
     bottom: 0;
5 5
     width: 100%;
6
-    height: 173.33px;
7
-    border-radius:40px 40px 0 0;
6
+    height: 85px;
7
+    border-radius:30px 30px 0 0;
8 8
     text-align: center;
9
-    line-height: 173px;
9
+    line-height: 85px;
10 10
     z-index:999;
11 11
     &-btn{
12 12
         line-height: unset;
@@ -14,14 +14,14 @@
14 14
 
15 15
     .tab1 {
16 16
         background-color: #274291;
17
-        font-size: 44px;
17
+        font-size: 40px;
18 18
         font-weight: 600;
19 19
         letter-spacing: 14px;
20 20
     }
21 21
 
22 22
     .tab2 {
23 23
         background-color: #ffffff;
24
-        font-size: 34px;
24
+        font-size: 30px;
25 25
         color: #d2d2d2;
26 26
         font-weight: 500;
27 27
        

+ 119
- 81
src/pages/recommend/index.jsx Parādīt failu

@@ -1,78 +1,117 @@
1
-import React, { useEffect, useState } from 'react'
2
-import Taro from '@tarojs/taro'
3
-import { View, Text, Image, Button } from '@tarojs/components'
4
-import ContainerLayout from '../../compents/container/index'
5
-import more from '../../assets/more.png'
6
-import deleteicon from '../../assets/deleteicon.png'
7
-import userRloe from '../../util/userRole'
8
-import './index.scss'
9
-import { useSelector } from 'react-redux'
10
-import { AtFab } from 'taro-ui'
11
-import request from '../../util/request'
12
-
13
-const recommend = (props) => {
14
-
15
-    const user = useSelector(state => state.user)
16
-
17
-    const { value, houseId,...prop } = props
18
-
19
-    // const [state, setState] = useState(1)
20
-    const [list, setList] = useState([])
21
-    const [id, setId] = useState()
22
-
23
-    // let list = props.dataSource || []
24
-
25
-    useEffect(() => {
26
-        setList(props.dataSource || [])
27
-    }, [props.dataSource])
28
-
29
-    // const getImageList=()=>{
30
-    //     request({url:'/taHouseSurround',params:{houseId:houseId}}).then((res)=>{
31
-    //         const {records,...page} =res.data.data  
32
-    //         setList(records)
33
-    //     })
34
-    // }
35
-
36
-
37
-    // 
1
+import React, { useEffect, useState } from "react";
2
+import Taro from "@tarojs/taro";
3
+import { View, Text, Image, Button } from "@tarojs/components";
4
+import ContainerLayout from "../../compents/container/index";
5
+import more from "../../assets/more.png";
6
+import deleteicon from "../../assets/deleteicon.png";
7
+import userRloe from "../../util/userRole";
8
+import "./index.scss";
9
+import { useSelector } from "react-redux";
10
+import { AtFab } from "taro-ui";
11
+import request from "../../util/request";
12
+
13
+const ImageCard = props => {
14
+  const { image,onDelete } = props;
15
+  const user = useSelector(state => state.user);
16
+  const [isopen, setIsOpen] = useState(false);
17
+
18
+  return  (
19
+    <View
20
+      className="recommend-view-card"
21
+      style={
22
+
23
+          { height: !isopen?'330rpx':undefined, overflow: "hidden"}
24
+         
25
+      }
26
+    >
27
+      <Image className="recommend-view-img" mode="widthFix" src={image} onClick={() => setIsOpen(!isopen)}></Image>
28
+
29
+      {userRloe.customer == user.role ? undefined : (
30
+        <Image
31
+          className="icon"
32
+          src={deleteicon}
33
+          mode="widthFix"
34
+          style={{ width: "40rpx" }}
35
+          onClick={() => onDelete()}
36
+        ></Image>
37
+      )}
38
+    </View>
39
+  )
40
+//   : (
41
+//     <View>
42
+//       <Image className="recommend-view-img" mode="widthFix" src={image} onClick={() => setIsOpen(!isopen)}></Image>
43
+//     </View>
44
+//   );
45
+};
38 46
 
39
-    const onClick = (item) => {
40
-        if (user.role == userRloe.customer) {
41
-            setId(item.surroundId)
42
-        }
43
-        else {
44
-
45
-           
46
-            Taro.showModal({
47
-                title: '确定删除该图片吗?',
48
-                content: '确定后,相关房东推荐会即时更新',
49
-                cancelColor: '#d2d2d2',
50
-                confirmColor: "#274191",
51
-                success: function (res) {
52
-                    if (res.confirm) {
53
-                        console.log('用户点击确定')
54
-                        request({url: `/taHouseSurround/${item.surroundId}`, method: 'DELETE'}).then((res)=>{
55
-                            setList(list.filter((x)=>x.surroundId!=item.surroundId))
56
-                        })
57
-                       
58
-
59
-                    } else if (res.cancel) {
60
-                        console.log('用户点击取消')
61
-                    }
62
-                }
63
-            })
47
+const recommend = props => {
48
+  const user = useSelector(state => state.user);
49
+
50
+  const { value, houseId, ...prop } = props;
51
+
52
+  // const [state, setState] = useState(1)
53
+  const [list, setList] = useState([]);
54
+  const [id, setId] = useState();
55
+
56
+  // let list = props.dataSource || []
57
+
58
+  useEffect(() => {
59
+    setList(props.dataSource || []);
60
+  }, [props.dataSource]);
61
+
62
+  // const getImageList=()=>{
63
+  //     request({url:'/taHouseSurround',params:{houseId:houseId}}).then((res)=>{
64
+  //         const {records,...page} =res.data.data
65
+  //         setList(records)
66
+  //     })
67
+  // }
68
+
69
+  //
70
+
71
+  const onClick = item => {
72
+    if (user.role == userRloe.customer) {
73
+      setId(item.surroundId);
74
+    } else {
75
+      Taro.showModal({
76
+        title: "确定删除该图片吗?",
77
+        content: "确定后,相关房东推荐会即时更新",
78
+        cancelColor: "#d2d2d2",
79
+        confirmColor: "#274191",
80
+        success: function(res) {
81
+          if (res.confirm) {
82
+            console.log("用户点击确定");
83
+            request({
84
+              url: `/taHouseSurround/${item.surroundId}`,
85
+              method: "DELETE"
86
+            }).then(res => {
87
+              setList(list.filter(x => x.surroundId != item.surroundId));
88
+            });
89
+          } else if (res.cancel) {
90
+            console.log("用户点击取消");
91
+          }
64 92
         }
65
-
93
+      });
66 94
     }
67
-   
68
-
69
-    return <View className='recommend'>
70
-      {user.role == userRloe.landlord && <Button onClick={()=>Taro.navigateTo({url:`/pages/material/index?houseId=${houseId}`})}>添加图片</Button>}
71
-        {
72
-            true && list.map((x) => {
73
-                return <View className='recommend-view'>
74
-                    <ContainerLayout className='recommend-view-layout'  >
75
-                        {id != x.surroundId ? <View className='recommend-view-card' style={userRloe.customer == user.role ? { height: "300rpx",overflow:'hidden' }:''}>
95
+  };
96
+
97
+  return (
98
+    <View className="recommend">
99
+      {user.role == userRloe.landlord && (
100
+        <Button
101
+          onClick={() =>
102
+            Taro.navigateTo({ url: `/pages/material/index?houseId=${houseId}` })
103
+          }
104
+        >
105
+          添加图片
106
+        </Button>
107
+      )}
108
+      {true &&
109
+        list.map(x => {
110
+          return (
111
+            <View className="recommend-view">
112
+              <ContainerLayout className="recommend-view-layout">
113
+                <ImageCard image={x.image} onDelete={()=>onClick(x)}/>
114
+                {/* {id != x.surroundId ? <View className='recommend-view-card' style={userRloe.customer == user.role ? { height: "300rpx",overflow:'hidden' }:''}>
76 115
 
77 116
                             <Image className='recommend-view-img' mode='widthFix' src={x.image} ></Image>
78 117
 
@@ -87,16 +126,15 @@ const recommend = (props) => {
87 126
                                 <Image className='recommend-view-img' mode='widthFix' src={x.image}></Image>
88 127
 
89 128
                             </View>
90
-                        }
91
-                    </ContainerLayout>
92
-
93
-                </View>
94
-            })
95
-        }
96
-        
97
-        {list.length==0&& < View className='nodata'> 暂无数据</View>}
129
+                        } */}
130
+              </ContainerLayout>
131
+            </View>
132
+          );
133
+        })}
98 134
 
135
+      {list.length == 0 && <View className="nodata"> 暂无数据</View>}
99 136
     </View>
137
+  );
100 138
 };
101 139
 
102
-export default recommend
140
+export default recommend;

+ 2
- 1
src/pages/recommend/index.scss Parādīt failu

@@ -6,11 +6,12 @@
6 6
     &-card{
7 7
       width: 100%;
8 8
       // height: 420px;
9
+      border-radius: 30px;
9 10
     }
10 11
     &-img{
11 12
       width: 100%;
12 13
       height:  100%;
13
-      border-radius: 40px;
14
+      border-radius: 30px;
14 15
       
15 16
 
16 17