Browse Source

Merge branch 'main' of http://git.ycjcjy.com/marketing/miniapp into main

Your Name 3 years ago
parent
commit
ac50f5b9e3

+ 2
- 2
config/dev.js View File

@@ -3,8 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"https://xlk.njyz.tech"',
7
-    HOST: '"http://127.0.0.1:8081"',
6
+    HOST: '"https://xlk.njyz.tech"',
7
+    // HOST: '"http://127.0.0.1:8081"',
8 8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9 9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10 10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',

+ 12
- 6
src/pages/mine/index.jsx View File

@@ -6,8 +6,9 @@ import Taro from '@tarojs/taro'
6 6
 import '@/assets/css/iconfont.css'
7 7
 import { fetch } from '@/utils/request'
8 8
 import { API_PUT_REGISTERCONSULTANT } from '@/constants/api'
9
-import login from '@/utils/login'
10 9
 import { getImgURL } from '@/utils/image'
10
+import { UPDATE_USER_INFO } from '@/constants/user'
11
+import store from '@/store'
11 12
 import './index.scss'
12 13
 import NeedLogin from './components/NeedLogin'
13 14
 import MineMenuList from './tabData'
@@ -22,17 +23,18 @@ export default withLayout(() => {
22 23
   const [IsPull, setPull] = useState(false)
23 24
   const [ShowLogin, setShowLogin] = useState(false)
24 25
   const [PullTimer, setPullTimer] = useState(null)
26
+  const { dispatch } = store
25 27
 
26 28
   useEffect(() => {
27 29
     setShowLogin(false)
28
-    if(user?.userInfo?.person?.personId) {
30
+    if (user?.userInfo?.person?.personId) {
29 31
       const person = user.userInfo.person
30 32
       setUserRole(person.personType === 'customer' || person.personType === 'drift' ? 1 : person.personType === 'estate agent' ? 2 : person.personType === 'Realty Consultant' ? 3 : 4)
31 33
     }
32 34
   }, [user])
33 35
 
34 36
   useEffect(() => {
35
-    if(UserRole !== null) {
37
+    if (UserRole !== null) {
36 38
       setMenuList(UserRole === 1 ? MineMenuList.User : UserRole === 2 ? MineMenuList.Broker : UserRole === 3 ? MineMenuList.Adviser : MineMenuList.Resident)
37 39
     }
38 40
   }, [UserRole])
@@ -52,13 +54,17 @@ export default withLayout(() => {
52 54
 
53 55
   const MenuClick = (router) => {
54 56
     return () => {
55
-      if(router === 'propertyConsultant') {
57
+      if (router === 'propertyConsultant') {
56 58
         fetch({ url: API_PUT_REGISTERCONSULTANT, method: 'put' }).then(() => {
57 59
           Taro.showToast({
58 60
             title: '匹配成功',
59
-            icon: 'none'
61
+            icon: 'none',
62
+            duration: 2000
60 63
           })
61
-          login({path: '', scene: ''})
64
+          dispatch({ type: UPDATE_USER_INFO, payload: { personType: 'Realty Consultant' } })
65
+          setTimeout(() => {
66
+            Taro.navigateBack({ delta: 1 })
67
+          }, 2000)
62 68
         }).catch(() => {
63 69
           Taro.showToast({
64 70
             title: '匹配失败,请联系相关管理人员',

+ 1
- 1
src/pages/mine/tabData.js View File

@@ -16,7 +16,7 @@ const MineMenuList = {
16 16
     [
17 17
       { name: '成为驻场管理', icon: require('../../assets/mine-icon8.png'), router: '/pages/mine/toBeManager/index' },
18 18
       { name: '成为置业顾问', icon: require('../../assets/mine-icon4.png'), router: 'propertyConsultant' },
19
-      { name: '成为专业经纪人', icon: require('../../assets/mine-icon2.png'), router: null }
19
+      { name: '成为专业经纪人', icon: require('../../assets/mine-icon2.png'), router: '/pages/mine/toBeAgent/index' }
20 20
     ]
21 21
   ],
22 22
   Broker: [ // 经纪人

+ 3
- 0
src/pages/mine/toBeAgent/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '成为经纪人'
3
+}

+ 56
- 0
src/pages/mine/toBeAgent/index.jsx View File

@@ -0,0 +1,56 @@
1
+import { useState } from 'react'
2
+import Taro from '@tarojs/taro'
3
+import withLayout from '@/layout'
4
+import { ScrollView, Input } from '@tarojs/components'
5
+import { fetch } from '@/utils/request'
6
+import { API_REGISTER_AGENT } from '@/constants/api'
7
+import { UPDATE_USER_INFO } from '@/constants/user'
8
+import store from '@/store'
9
+import './index.scss'
10
+
11
+export default withLayout(() => {
12
+
13
+  const [Code, setCode] = useState('')
14
+  const { dispatch } = store
15
+
16
+  const ToSubmit = () => {
17
+    if (Code !== '') {
18
+      fetch({ url: `${API_REGISTER_AGENT}?channelCode=${Code}`, method: 'put' }).then(() => {
19
+        Taro.showToast({ title: '绑定成功', icon: 'none', duration: 2000 })
20
+        dispatch({ type: UPDATE_USER_INFO, payload: { personType: 'estate agent' } })
21
+        setTimeout(() => {
22
+          Taro.navigateBack({ delta: 1 })
23
+        }, 2000)
24
+      })
25
+    } else {
26
+      Taro.showToast({
27
+        title: '请输入渠道验证码',
28
+        icon: 'none'
29
+      })
30
+    }
31
+  }
32
+
33
+  const CodeChange = (e) => {
34
+    setCode(e.detail.value)
35
+  }
36
+
37
+  return (
38
+    <view className='Page toBeAgent'>
39
+
40
+      <ScrollView scroll-y>
41
+        <view className='PageContent'>
42
+
43
+          <view className='Input'>
44
+            <Input placeholder='请输入渠道验证码 (必填)' onInput={CodeChange}></Input>
45
+          </view>
46
+
47
+          <view className='Btn'>
48
+            <text onClick={ToSubmit}>提交</text>
49
+          </view>
50
+
51
+        </view>
52
+      </ScrollView>
53
+
54
+    </view>
55
+  )
56
+})

+ 44
- 0
src/pages/mine/toBeAgent/index.scss View File

@@ -0,0 +1,44 @@
1
+.Page.toBeAgent {
2
+  background: #fff;
3
+  height: 100vh;
4
+  width: 100%;
5
+  > scroll-view {
6
+    width: 100%;
7
+    height: 100%;
8
+    .PageContent {
9
+      position: relative;
10
+      overflow: hidden;
11
+      min-height: 100vh;
12
+      >.Input {
13
+        padding: 0 30px;
14
+        position: relative;
15
+        overflow: hidden;
16
+        margin-top: 30px;
17
+        >input {
18
+          display: block;
19
+          font-size: 28px;
20
+          line-height: 80px;
21
+          height: 80px;
22
+          text-indent: 20px;
23
+          border: 2px solid rgba(0, 0, 0, 0.08);
24
+          border-radius: 8px;
25
+        }
26
+      }
27
+      >.Btn {
28
+        padding: 40px;
29
+        position: relative;
30
+        overflow: hidden;
31
+        > text {
32
+          display: block;
33
+          text-align: center;
34
+          font-size: 32px;
35
+          line-height: 92px;
36
+          background: #193c83;
37
+          color: #fff;
38
+          font-weight: bold;
39
+          border-radius: 92px;
40
+        }
41
+      }
42
+    }
43
+  }
44
+}

+ 10
- 6
src/pages/mine/toBeManager/index.jsx View File

@@ -4,19 +4,23 @@ import withLayout from '@/layout'
4 4
 import { ScrollView, Input } from '@tarojs/components'
5 5
 import { fetch } from '@/utils/request'
6 6
 import { API_TOBE_MANAGER } from '@/constants/api'
7
+import { UPDATE_USER_INFO } from '@/constants/user'
8
+import store from '@/store'
7 9
 import './index.scss'
8 10
 
9 11
 export default withLayout(() => {
10
-
12
+  
11 13
   const [Code, setCode] = useState('')
14
+  const { dispatch } = store
12 15
 
13 16
   const ToSubmit = () => {
14 17
     if (Code !== '') {
15
-      fetch({ url: API_TOBE_MANAGER, method: 'post', payload: { marketingCode: Code } }).then((res) => {
16
-        Taro.showToast({
17
-          title: '绑定成功',
18
-          icon: 'none'
19
-        })
18
+      fetch({ url: API_TOBE_MANAGER, method: 'post', payload: { marketingCode: Code } }).then(() => {
19
+        Taro.showToast({ title: '绑定成功', icon: 'none', duration: 2000 })
20
+        dispatch({ type: UPDATE_USER_INFO, payload: { personType: 'marketing' } })
21
+        setTimeout(() => {
22
+          Taro.navigateBack({ delta: 1 })
23
+        }, 2000)
20 24
       })
21 25
     } else {
22 26
       Taro.showToast({

+ 6
- 0
src/routes.js View File

@@ -265,6 +265,12 @@ const routes = [
265 265
     pkg: 'main',
266 266
     type: 'mine',
267 267
   },
268
+  {
269
+    name: '成为经纪人',
270
+    page: 'pages/mine/toBeAgent/index',
271
+    pkg: 'main',
272
+    type: 'mine',
273
+  },
268 274
   {
269 275
     name: '推荐客户',
270 276
     page: 'pages/mine/recommendUser/index',