Baozhangchao 3 年 前
コミット
fb00821453

+ 1
- 0
project.config.json ファイルの表示

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

+ 8
- 1
src/app.config.js ファイルの表示

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

+ 161
- 0
src/components/BottomMoadl/index.jsx ファイルの表示

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 ファイルの表示

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 ファイルの表示

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

+ 1
- 1
src/pages/mine/addCustomer/components/BuildingPicker.jsx ファイルの表示

18
       })
18
       })
19
     } else {
19
     } else {
20
       fetch({ url: API_ITEMS_LIST, payload: { pageNumber: 1, pageSize: 1000, cityId: city.curCity.id } }).then((res) => {
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 ファイルの表示

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

+ 10
- 0
theme.json ファイルの表示

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