Baozhangchao před 3 roky
rodič
revize
fb00821453

+ 1
- 0
project.config.json Zobrazit soubor

@@ -3,6 +3,7 @@
3 3
 	"projectname": "miniapp",
4 4
 	"description": "",
5 5
 	"appid": "wxe44244d1a5ea3364",
6
+	
6 7
 	"setting": {
7 8
 		"urlCheck": false,
8 9
 		"es6": false,

+ 8
- 1
src/app.config.js Zobrazit soubor

@@ -5,12 +5,19 @@ const { pages, subPackages } = getPages()
5 5
 export default {
6 6
   pages,
7 7
   subPackages,
8
+  darkmode: true,
9
+  // themeLocation: "theme.json",
10
+
11
+
8 12
   window: {
9 13
     backgroundTextStyle: 'light',
10 14
     navigationBarBackgroundColor: '#fff',
11 15
     navigationBarTitleText: 'WeChat',
12
-    navigationBarTextStyle: 'black'
16
+    navigationBarTextStyle: 'black',
17
+    // navigationBarBackgroundColor: "@navBackgroundColor",
18
+    // navigationBarTextStyle: "@navTextStyle"
13 19
   },
20
+
14 21
   tabBar: {
15 22
     color: '#666',
16 23
     selectedColor: '#193C83',

+ 161
- 0
src/components/BottomMoadl/index.jsx Zobrazit soubor

@@ -0,0 +1,161 @@
1
+
2
+import Taro from '@tarojs/taro'
3
+import { View, Button, RadioGroup, Label, Radio, ScrollView } from '@tarojs/components'
4
+import { API_GET_AGENT_BUILDINGS, API_ITEMS_LIST } from '@/constants/api'
5
+import { ROLE_CODE } from '@/constants/user'
6
+import { useSelector } from 'react-redux'
7
+import { fetch } from '@/utils/request'
8
+
9
+import { useState, useEffect, useRef } from 'react'
10
+import './style.css'
11
+
12
+
13
+export default (props) => {
14
+  const { closeModal, setBuidName, onChange = () => { }, type = '', frameTitle, flag, } = props
15
+
16
+
17
+  let wrapAnimate = 'wrap wrapAnimate'
18
+  let frameAnimate = 'frame-wrapper'
19
+  const [textNextSum, setTextNext] = useState(1)
20
+  const [recommendContent, setRecommendContent] = useState([])
21
+  const city = useSelector(state => state.city)
22
+
23
+  const [loading, setLoading] = useState(false)
24
+  const [dicts, setDicts] = useState([])
25
+
26
+  const hideFrame = (e) => {
27
+    console.log('关闭', e);
28
+    closeModal()//关闭
29
+
30
+  }
31
+
32
+
33
+  useEffect(() => {
34
+    if (type !== ROLE_CODE.CUSTOMER && type !== ROLE_CODE.DRIFT && type !== ROLE_CODE.CONSULTANT) {
35
+      fetch({ url: API_GET_AGENT_BUILDINGS }).then((res) => {
36
+        setDicts(res || [])
37
+      })
38
+    } else {
39
+      fetch({ url: API_ITEMS_LIST, payload: { pageNumber: 1, pageSize: 1000, cityId: city.curCity.id } }).then((res) => {
40
+
41
+        setDicts(res.records)
42
+      })
43
+    }
44
+  }, [])
45
+
46
+  const [darkMode, setDarkMode] = useState('light')
47
+
48
+  useEffect(() => {
49
+    Taro.getSystemInfo({
50
+      success: function (res) {
51
+        console.log(res.theme)
52
+        setDarkMode(res.theme)
53
+
54
+      }
55
+    })
56
+
57
+  }, [darkMode])
58
+
59
+  const [conTent, setConTent] = useState()
60
+
61
+  const buildingConten = (e) => {
62
+    console.log(e, 'eeeeeeeeeeeeeeee');
63
+    setConTent(e.detail.value)
64
+
65
+
66
+
67
+
68
+  }
69
+
70
+  const buliClick = (e) => {
71
+    e.stopPropagation()
72
+
73
+    if (conTent === '' || conTent === null || conTent === undefined) {
74
+      Taro.showToast({
75
+        title: '未正确选择楼盘',
76
+        icon: 'error',
77
+        duration: 2000
78
+      })
79
+
80
+    } else {
81
+      onChange(conTent)
82
+      return dicts.map((item, inx) => {
83
+
84
+
85
+        if (item.buildingId === conTent) {
86
+
87
+
88
+          const findIndex = inx
89
+          const name = dicts[findIndex].buildingName
90
+          //  item.buildingName
91
+          setBuidName(name)
92
+          console.log(name);
93
+
94
+          closeModal()
95
+
96
+          console.log('选中', conTent);
97
+          // const newArr = dicts.filter(function (obj) {
98
+          //   return obj.buildingId == e.detail.value;
99
+          // });
100
+          // console.log(newArr);
101
+
102
+
103
+
104
+        }
105
+        return item
106
+
107
+      })
108
+
109
+
110
+    }
111
+
112
+  }
113
+
114
+
115
+  return (
116
+    flag && <view   >
117
+      <view className={wrapAnimate} style='background:rgba(0,0,0,0);'></view>
118
+      <view onClick={hideFrame} className={frameAnimate} catchMove>
119
+        <view className={darkMode == 'dark' ? 'frame-dark' : 'frame'}>
120
+          {/* 标题  */}
121
+          <view className={darkMode == 'dark' ? 'title-wrapper-dark' : 'title-wrapper'}>
122
+            <view>{frameTitle}</view>
123
+          </view>
124
+          {/* 内容 */}
125
+          <view style='overflow-x: hidden;'>
126
+            <View className='page-section'>
127
+              <View className='radio-list' >
128
+                <scroll-view
129
+                  scrollY
130
+                  style={{ height: '30vh', overflow: 'hidden' }}
131
+                  catchMove
132
+                >
133
+                  <RadioGroup className='radio-list__RadioGroup' onChange={buildingConten} onClick={e => e.stopPropagation()}>
134
+                    {dicts.map((item, i) => {
135
+                      return (
136
+                        <Label catchMove className='radio-list__label' for={i} key={i}>
137
+                          <view className={darkMode == 'dark' ? 'radio-list__text-dark' : 'radio-list__text'}>{item.buildingName}</view>
138
+
139
+                          <Radio catchMove className='radio-list__radio' value={item.buildingId} checked={item.buildingId === conTent ? true : false}></Radio>
140
+
141
+                        </Label>
142
+                      )
143
+                    })}
144
+                  </RadioGroup>
145
+                </scroll-view>
146
+              </View>
147
+            </View>
148
+
149
+            {/* <view className='bottom-text' onClick={handleTextNext}> */}
150
+            <view style={{ display: 'flex', margin: '2em auto' }}>
151
+              <Button className='checkBtn' onClick={() => closeModal()}  >取消</Button>
152
+              <Button className='okBtn' onClick={buliClick}> 确定</Button>
153
+            </view>
154
+
155
+          </view>
156
+        </view>
157
+      </view>
158
+    </view>
159
+
160
+  )
161
+}

+ 122
- 0
src/components/BottomMoadl/style.css Zobrazit soubor

@@ -0,0 +1,122 @@
1
+.wrapAnimate {
2
+  animation: wrapAnimate 0.2s ease forwards;
3
+}
4
+@keyframes wrapAnimate {
5
+  0% {
6
+  }
7
+  100% {
8
+    background: rgba(0, 0, 0, 0.35);
9
+  }
10
+}
11
+
12
+.frame-wrapper {
13
+  position: fixed;
14
+  height: 100vh;
15
+  width: 100vw;
16
+  z-index: 80;
17
+}
18
+.frame {
19
+  background: #fff;
20
+  position: absolute;
21
+
22
+  bottom: 0;
23
+  width: 100%;
24
+  padding: 2.9vw 2.9vw 0;
25
+  border-top-left-radius: 20px;
26
+  border-top-right-radius: 20px;
27
+  z-index: 85;
28
+  box-sizing: border-box;
29
+  align-items: center;
30
+  text-align: center;
31
+}
32
+.title-wrapper-dark {
33
+  color: white;
34
+  justify-content: space-between;
35
+  text-align: center;
36
+  height: 28px;
37
+  font-size: 35px;
38
+  font-weight: 700;
39
+  margin-bottom: 5.9vw;
40
+}
41
+.radio-list__text-dark {
42
+  width: 100%;
43
+  align-items: center;
44
+  color: white;
45
+}
46
+.frame-dark {
47
+  background: #2b2b2b;
48
+  /* background: #fff; */
49
+  position: absolute;
50
+  bottom: 0;
51
+  width: 100%;
52
+  padding: 2.9vw 2.9vw 0;
53
+  border-top-left-radius: 20px;
54
+  border-top-right-radius: 20px;
55
+  z-index: 85;
56
+  box-sizing: border-box;
57
+  align-items: center;
58
+  text-align: center;
59
+}
60
+.title-wrapper {
61
+  justify-content: space-between;
62
+  text-align: center;
63
+  height: 28px;
64
+  font-size: 35px;
65
+  font-weight: 700;
66
+  color: #202020;
67
+  margin-bottom: 5.9vw;
68
+  margin: 1.5em auto;
69
+}
70
+.title-wrapper > image {
71
+  width: 3.5vw;
72
+  height: 3.5vw;
73
+  padding: 0 5vw;
74
+  margin-right: -5vw;
75
+}
76
+
77
+.wrap {
78
+  position: fixed;
79
+  z-index: 1;
80
+  top: 0;
81
+  left: 0;
82
+  right: 0;
83
+  bottom: 0;
84
+}
85
+
86
+.checkBtn {
87
+  display: inline-block;
88
+  width: 35%;
89
+
90
+  background-color: white;
91
+  color: #57bd6a;
92
+  text-align: center;
93
+  height: 10vw;
94
+  font-size: 26px;
95
+  box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
96
+}
97
+
98
+.okBtn {
99
+  width: 35%;
100
+  background-color: #57bd6a;
101
+  color: white;
102
+  text-align: center;
103
+  height: 10vw;
104
+  font-size: 26px;
105
+}
106
+.radio-list__label {
107
+  display: flex;
108
+  align-items: center;
109
+}
110
+.radio-list__RadioGroup {
111
+}
112
+.radio-list__radio {
113
+  display: flex;
114
+
115
+  margin-top: 1em;
116
+  margin-bottom: 0.2em;
117
+}
118
+.radio-list__text {
119
+  width: 100%;
120
+  align-items: center;
121
+  color: #000;
122
+}

+ 5
- 2
src/components/Picker/index.jsx Zobrazit soubor

@@ -4,6 +4,7 @@ import './style.scss'
4 4
 
5 5
 export default (props) => {
6 6
   const { kv, value, onChange, dicts, placeholder, mode, ...leftProps } = props
7
+
7 8
   const [rangeKey, rangeVal] = kv || ['label', 'value']
8 9
 
9 10
   const [inx, setInx] = useState()
@@ -25,8 +26,9 @@ export default (props) => {
25 26
   useEffect(() => {
26 27
     if (dicts && dicts.length > 0) {
27 28
       if (value !== undefined && value !== null) {
28
-        for(let i = 0; i < dicts.length; i += 1) {
29
+        for (let i = 0; i < dicts.length; i += 1) {
29 30
           if (dicts[i][rangeVal] === value) {
31
+
30 32
             setInx(i)
31 33
             setText(dicts[i][rangeKey])
32 34
             break;
@@ -38,6 +40,7 @@ export default (props) => {
38 40
 
39 41
   useEffect(() => {
40 42
     if (mode && mode !== 'selector') {
43
+
41 44
       setText(value)
42 45
     }
43 46
   }, [mode, value])
@@ -49,7 +52,7 @@ export default (props) => {
49 52
       onChange={handleChange}
50 53
       value={inx}
51 54
       range={dicts}
52
-      mode={mode||'selector'}
55
+      mode={mode || 'selector'}
53 56
       {...leftProps}
54 57
     >
55 58
       <View>{text || placeholder || '请选择'}</View>

+ 1
- 1
src/pages/mine/addCustomer/components/BuildingPicker.jsx Zobrazit soubor

@@ -18,7 +18,7 @@ export default (props) => {
18 18
       })
19 19
     } else {
20 20
       fetch({ url: API_ITEMS_LIST, payload: { pageNumber: 1, pageSize: 1000, cityId: city.curCity.id } }).then((res) => {
21
-        setDicts(res.records || [])
21
+        setDicts(res.records)
22 22
       })
23 23
     }
24 24
   }, [])

+ 7
- 6
src/pages/mine/components/MyCollectForBuilding/index.jsx Zobrazit soubor

@@ -6,8 +6,8 @@ import { API_ITEMS_LIST } from '@/constants/api'
6 6
 import ProjectListItem from '@/components/ProjectListItem/index'
7 7
 import './index.scss'
8 8
 
9
-export default function MyCollectForBuilding () {
10
-  
9
+export default function MyCollectForBuilding() {
10
+
11 11
   const user = useSelector(state => state.user)
12 12
   const [PersonId, setPersonId] = useState(null)
13 13
   const [pageNumber, setPageNumber] = useState(1)
@@ -16,13 +16,14 @@ export default function MyCollectForBuilding () {
16 16
   const [IsPull, setPull] = useState(false)
17 17
 
18 18
   useEffect(() => {
19
-    if(user?.userInfo?.person?.personId) {
19
+    if (user?.userInfo?.person?.personId) {
20 20
       setPersonId(user.userInfo.person.personId)
21 21
     }
22 22
   }, [user])
23 23
 
24 24
   useEffect(() => {
25
-    if(PersonId) {
25
+
26
+    if (PersonId) {
26 27
       GetPageList()
27 28
     }
28 29
   }, [pageNumber, PersonId])
@@ -41,14 +42,14 @@ export default function MyCollectForBuilding () {
41 42
   }
42 43
 
43 44
   const PageLoadMore = () => { // 页面上拉加载更多
44
-    if(HasNextPage) {
45
+    if (HasNextPage) {
45 46
       setPageNumber(pageNumber + 1)
46 47
     }
47 48
   }
48 49
 
49 50
   useEffect(() => { // 下拉刷新触发
50 51
     if (IsPull) {
51
-      if(pageNumber === 1) {
52
+      if (pageNumber === 1) {
52 53
         GetPageList()
53 54
       } else {
54 55
         setPageNumber(1)

+ 10
- 0
theme.json Zobrazit soubor

@@ -0,0 +1,10 @@
1
+{
2
+  "light": {
3
+    "navBackgroundColor": "#ffffff",
4
+    "navTextStyle": "black"
5
+  },
6
+  "dark": {
7
+    "navBackgroundColor": "#000000",
8
+    "navTextStyle": "white"
9
+  }
10
+}