Your Name 3 年前
父节点
当前提交
e1bd1e753e
共有 7 个文件被更改,包括 90 次插入3 次删除
  1. 2
    2
      config/dev.js
  2. 1
    1
      project.config.json
  3. 6
    0
      src/layout/index.js
  4. 3
    0
      src/routes.js
  5. 42
    0
      src/utils/customer.js
  6. 2
    0
      src/utils/login.js
  7. 34
    0
      src/utils/qrcode.js

+ 2
- 2
config/dev.js 查看文件

3
     NODE_ENV: '"development"'
3
     NODE_ENV: '"development"'
4
   },
4
   },
5
   defineConstants: {
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
     WSS_HOST: '"wss://xlk.njyz.tech"',
8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',

+ 1
- 1
project.config.json 查看文件

2
 	"miniprogramRoot": "dist/",
2
 	"miniprogramRoot": "dist/",
3
 	"projectname": "miniapp",
3
 	"projectname": "miniapp",
4
 	"description": "",
4
 	"description": "",
5
-	"appid": "wxc96058d57e77f373",
5
+	"appid": "wxe44244d1a5ea3364",
6
 	"setting": {
6
 	"setting": {
7
 		"urlCheck": false,
7
 		"urlCheck": false,
8
 		"es6": false,
8
 		"es6": false,

+ 6
- 0
src/layout/index.js 查看文件

8
 import AuthPhone from '@/components/Auth/AuthPhone'
8
 import AuthPhone from '@/components/Auth/AuthPhone'
9
 import Spin from '@/components/Spin/Spin2'
9
 import Spin from '@/components/Spin/Spin2'
10
 import FixedConsultant from '@/components/FixedConsultant'
10
 import FixedConsultant from '@/components/FixedConsultant'
11
+import { report as reportCustomer } from '@/utils/customer'
11
 import { ROLE_CODE } from '@/constants/user'
12
 import { ROLE_CODE } from '@/constants/user'
12
 import useAuth from './useAuth'
13
 import useAuth from './useAuth'
13
 import { routes } from '../routes'
14
 import { routes } from '../routes'
31
   // 页面埋点
32
   // 页面埋点
32
   const [trackData, setTrackData] = useState({})
33
   const [trackData, setTrackData] = useState({})
33
 
34
 
35
+  // 报备客户
36
+  useEffect(() => {
37
+    reportCustomer(person, consultant, false).catch(() => {})
38
+  }, [person, consultant])
39
+
34
   // 请求埋点设置
40
   // 请求埋点设置
35
   useEffect(() => {
41
   useEffect(() => {
36
     if (id) {
42
     if (id) {

+ 3
- 0
src/routes.js 查看文件

44
     page: 'pages/chat/chatDetail/index',
44
     page: 'pages/chat/chatDetail/index',
45
     pkg: 'main',
45
     pkg: 'main',
46
     type: 'other',
46
     type: 'other',
47
+    auth: ['phone', 'avatar'],
47
   },
48
   },
48
 
49
 
49
   // /********************************
50
   // /********************************
131
     page: 'pages/index/buildingTakeLook/index',
132
     page: 'pages/index/buildingTakeLook/index',
132
     pkg: 'main',
133
     pkg: 'main',
133
     type: 'building',
134
     type: 'building',
135
+    auth: ['phone', 'avatar'],
134
   },
136
   },
135
   {
137
   {
136
     name: '项目动态',
138
     name: '项目动态',
173
     page: 'pages/index/activityDetail/index',
175
     page: 'pages/index/activityDetail/index',
174
     pkg: 'main',
176
     pkg: 'main',
175
     type: 'activity',
177
     type: 'activity',
178
+    auth: ['phone', 'avatar'],
176
   },
179
   },
177
   {
180
   {
178
     name: '特价房',
181
     name: '特价房',

+ 42
- 0
src/utils/customer.js 查看文件

1
+
2
+import { reportClient } from '@/services/report'
3
+
4
+/**
5
+ * 报备客户
6
+ * @param {*} userInfo 
7
+ * @param {*} consultant 
8
+ * @param {*} showToast 
9
+ */
10
+function report(person, consultant, showToast) {
11
+  if (!person || !(person.tel || person.phone)) {
12
+    return Promise.reject('用户手机号不存在');
13
+  }
14
+
15
+  if (!consultant || !consultant.id) {
16
+    return Promise.reject('置业顾问信息不存在');
17
+  }
18
+
19
+  if (consultant.id == person.personId) {
20
+    return Promise.resolve();
21
+  }
22
+
23
+  const realPhone = person.tel || person.phone
24
+  const payload = {
25
+    realtyConsultant: consultant.id, //报备人 置业顾问
26
+    phone: realPhone,
27
+    showToast,
28
+  }
29
+
30
+  return new Promise((resolve, reject) => {
31
+    reportClient(payload).then(res => {
32
+      resolve()
33
+    }).catch(err => {
34
+      console.error(err)
35
+      reject(err.message || err)
36
+    })
37
+  })
38
+}
39
+
40
+export {
41
+  report,
42
+}

+ 2
- 0
src/utils/login.js 查看文件

58
             })
58
             })
59
           }
59
           }
60
 
60
 
61
+          // 如果通过扫码进入
62
+
61
         }).catch(reject)
63
         }).catch(reject)
62
       }
64
       }
63
     })
65
     })

+ 34
- 0
src/utils/qrcode.js 查看文件

1
+
2
+import { getCodeScene  } from '@/services/common'
3
+import { parseQueryString } from './tools'
4
+
5
+/**
6
+ * 获取二维码参数
7
+ * 微信小程序  基础库 2.1.2 开始支持
8
+ * @param {*} scene 场景值
9
+ */
10
+export function getQrCodeParams(sceneID) {
11
+  if (!sceneID) {
12
+    console.error('未解析到二维码场景值')
13
+    return Promise.reject('未解析到二维码场景值')
14
+  }
15
+
16
+  console.log('解析到二维码场景 ID', sceneID)
17
+
18
+  return new Promise((resolve, reject) => {
19
+    getCodeScene(sceneID).then((res) => {
20
+      const data = typeof res === 'string' ? JSON.parse(res) : res
21
+      const params = parseQueryString(data.scene || '')
22
+
23
+      console.log('解析到二维码场景参数: ', params)
24
+
25
+      resolve({
26
+        ...params,
27
+        '__raw': data.scene,
28
+      })
29
+    }).catch(err => {
30
+      console.error('解析二维码场景参数失败', err)
31
+      reject('解析二维码场景参数失败')
32
+    })
33
+  })
34
+}