Your Name 3 年前
父节点
当前提交
1058a6365b
共有 5 个文件被更改,包括 39 次插入45 次删除
  1. 1
    1
      config/prod.js
  2. 1
    1
      project.config.json
  3. 20
    26
      src/components/Auth/AuthPage/index.jsx
  4. 1
    1
      src/layout/useAuth.js
  5. 16
    16
      src/routes.js

+ 1
- 1
config/prod.js 查看文件

10
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
13
-    Version: '"V0.0.28-20210808"'
13
+    Version: '"V0.0.30-20210808"'
14
   },
14
   },
15
   mini: {},
15
   mini: {},
16
   h5: {
16
   h5: {

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

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

+ 20
- 26
src/components/Auth/AuthPage/index.jsx 查看文件

9
 export default (props) => {
9
 export default (props) => {
10
 
10
 
11
   const [loading, setLoading] = useState(false)
11
   const [loading, setLoading] = useState(false)
12
-  const { updateUserInfo } = useAuth()
12
+  const { updatePhoneNumber } = useAuth()
13
   
13
   
14
-  const handleGetUserInfo = () => {
15
-    Taro.getUserProfile({
16
-      lang: 'zh_CN',
17
-      desc: '用于完成平台注册',
18
-      success: (res) => {
19
-        const { errMsg, ...data } = res || {}
20
-        if (errMsg === 'getUserProfile:ok') {
21
-          setLoading(true)
22
-          updateUserInfo(data).then(() => {
23
-            setLoading(false)
24
-          }).catch((err) => {
25
-            console.error(err)
26
-            setLoading(false)
27
-          })
28
-        } else {
29
-          console.error(errMsg);
30
-          Taro.showToast({
31
-            title: '授权头像失败',
32
-            icon: 'none',
33
-            duration: 2000
34
-          })
35
-        }
36
-      }
37
-    })
14
+  const handlePhoneNumber = (detail) => {
15
+    const { errMsg, ...data } = detail || {}
16
+    if (errMsg === 'getPhoneNumber:ok') {
17
+      setLoading(true)
18
+      updatePhoneNumber(data).then(() => {
19
+        setLoading(false)
20
+      }).catch((err) => {
21
+        console.error(err)
22
+        setLoading(false)
23
+      })
24
+    } else {
25
+      console.error(errMsg);
26
+      Taro.showToast({
27
+        title: '授权手机失败',
28
+        icon: 'none',
29
+        duration: 2000
30
+      })
31
+    }
38
   }
32
   }
39
 
33
 
40
   return (
34
   return (
43
         <Image mode='aspectFit' className='centerLabel' src={require('@/assets/logo.png')} />
37
         <Image mode='aspectFit' className='centerLabel' src={require('@/assets/logo.png')} />
44
       </View>
38
       </View>
45
       <View className='LoginBtn'>
39
       <View className='LoginBtn'>
46
-        <button loading={loading} onClick={handleGetUserInfo}>微信登录</button>
40
+        <button loading={loading} openType='getPhoneNumber' onGetPhoneNumber={handlePhoneNumber}>微信登录</button>
47
       </View>
41
       </View>
48
       <View className='flex-item'></View>
42
       <View className='flex-item'></View>
49
       <View className='Bottom'>
43
       <View className='Bottom'>

+ 1
- 1
src/layout/useAuth.js 查看文件

27
 
27
 
28
       // 如果需要授权头像
28
       // 如果需要授权头像
29
       if (page.auth.indexOf('page') > -1) {
29
       if (page.auth.indexOf('page') > -1) {
30
-        if (person.inited && (!person.avatarurl || person.avatarurl.indexOf('default_avatar') > -1)) {
30
+        if (person.inited && !person.phone) {
31
           setAuthPage(true)
31
           setAuthPage(true)
32
         } else {
32
         } else {
33
           setAuthPage(false)
33
           setAuthPage(false)

+ 16
- 16
src/routes.js 查看文件

171
     page: 'pages/index/activityList/index',
171
     page: 'pages/index/activityList/index',
172
     pkg: 'main',
172
     pkg: 'main',
173
     type: 'activity',
173
     type: 'activity',
174
-    auth: ['phone', 'avatar'],
174
+    // auth: ['phone', 'avatar'],
175
   },
175
   },
176
   {
176
   {
177
     name: '活动详情',
177
     name: '活动详情',
256
     page: 'pages/mine/myRecommendCode/index',
256
     page: 'pages/mine/myRecommendCode/index',
257
     pkg: 'main',
257
     pkg: 'main',
258
     type: 'mine',
258
     type: 'mine',
259
-    auth: ['phone'],
259
+    // auth: ['phone'],
260
   },
260
   },
261
   {
261
   {
262
     name: '房贷计算器',
262
     name: '房贷计算器',
276
     page: 'pages/mine/toBeManager/index',
276
     page: 'pages/mine/toBeManager/index',
277
     pkg: 'main',
277
     pkg: 'main',
278
     type: 'mine',
278
     type: 'mine',
279
-    auth: ['phone'],
279
+    // auth: ['phone'],
280
   },
280
   },
281
   {
281
   {
282
     name: '成为经纪人',
282
     name: '成为经纪人',
283
     page: 'pages/mine/toBeAgent/index',
283
     page: 'pages/mine/toBeAgent/index',
284
     pkg: 'main',
284
     pkg: 'main',
285
     type: 'mine',
285
     type: 'mine',
286
-    auth: ['phone'],
286
+    // auth: ['phone'],
287
   },
287
   },
288
   {
288
   {
289
     name: '我的分享',
289
     name: '我的分享',
296
     page: 'pages/mine/myCourse/index',
296
     page: 'pages/mine/myCourse/index',
297
     pkg: 'main',
297
     pkg: 'main',
298
     type: 'curriculum',
298
     type: 'curriculum',
299
-    auth: ['phone'],
299
+    // auth: ['phone'],
300
   },
300
   },
301
   {
301
   {
302
     name: '我的活动',
302
     name: '我的活动',
309
     page: 'pages/mine/myCustomer/index',
309
     page: 'pages/mine/myCustomer/index',
310
     pkg: 'main',
310
     pkg: 'main',
311
     type: 'mine',
311
     type: 'mine',
312
-    auth: ['phone'],
312
+    // auth: ['phone'],
313
   },
313
   },
314
   {
314
   {
315
     name: '客户详情',
315
     name: '客户详情',
316
     page: 'pages/mine/myCustomerDetail/index',
316
     page: 'pages/mine/myCustomerDetail/index',
317
     pkg: 'main',
317
     pkg: 'main',
318
     type: 'mine',
318
     type: 'mine',
319
-    auth: ['phone'],
319
+    // auth: ['phone'],
320
   },
320
   },
321
   {
321
   {
322
     name: '我的收藏',
322
     name: '我的收藏',
329
     page: 'pages/channel/partnerChannel/index',
329
     page: 'pages/channel/partnerChannel/index',
330
     pkg: 'subpackages',
330
     pkg: 'subpackages',
331
     type: 'mine',
331
     type: 'mine',
332
-    auth: ['phone'],
332
+    // auth: ['phone'],
333
   },
333
   },
334
   {
334
   {
335
     name: '添加客户',
335
     name: '添加客户',
336
     page: 'pages/mine/addCustomer/index',
336
     page: 'pages/mine/addCustomer/index',
337
     pkg: 'main',
337
     pkg: 'main',
338
     type: 'mine',
338
     type: 'mine',
339
-    auth: ['phone'],
339
+    // auth: ['phone'],
340
   },
340
   },
341
   {
341
   {
342
     name: '驻场管理',
342
     name: '驻场管理',
343
     page: 'pages/marketing/residentManager/index',
343
     page: 'pages/marketing/residentManager/index',
344
     pkg: 'subpackages',
344
     pkg: 'subpackages',
345
     type: 'mine',
345
     type: 'mine',
346
-    auth: ['phone'],
346
+    // auth: ['phone'],
347
   },
347
   },
348
   {
348
   {
349
     name: '确认到访',
349
     name: '确认到访',
350
     page: 'pages/marketing/sureVisit/index',
350
     page: 'pages/marketing/sureVisit/index',
351
     pkg: 'subpackages',
351
     pkg: 'subpackages',
352
     type: 'mine',
352
     type: 'mine',
353
-    auth: ['phone'],
353
+    // auth: ['phone'],
354
   },
354
   },
355
   {
355
   {
356
     name: '变更交易节点',
356
     name: '变更交易节点',
357
     page: 'pages/marketing/changeVisit/index',
357
     page: 'pages/marketing/changeVisit/index',
358
     pkg: 'subpackages',
358
     pkg: 'subpackages',
359
     type: 'mine',
359
     type: 'mine',
360
-    auth: ['phone'],
360
+    // auth: ['phone'],
361
   },
361
   },
362
   {
362
   {
363
     name: '盘客工具',
363
     name: '盘客工具',
364
     page: 'pages/consultant/statCustomer/index',
364
     page: 'pages/consultant/statCustomer/index',
365
     pkg: 'subpackages',
365
     pkg: 'subpackages',
366
     type: 'mine',
366
     type: 'mine',
367
-    auth: ['phone'],
367
+    // auth: ['phone'],
368
   },
368
   },
369
   {
369
   {
370
     name: '客户信息',
370
     name: '客户信息',
371
     page: 'pages/mine/customerDetail/index',
371
     page: 'pages/mine/customerDetail/index',
372
     pkg: 'main',
372
     pkg: 'main',
373
     type: 'mine',
373
     type: 'mine',
374
-    auth: ['phone'],
374
+    // auth: ['phone'],
375
   },
375
   },
376
   {
376
   {
377
     name: '客户分析',
377
     name: '客户分析',
378
     page: 'pages/consultant/customerAnalyse/index',
378
     page: 'pages/consultant/customerAnalyse/index',
379
     pkg: 'subpackages',
379
     pkg: 'subpackages',
380
     type: 'mine',
380
     type: 'mine',
381
-    auth: ['phone'],
381
+    // auth: ['phone'],
382
   },
382
   },
383
   {
383
   {
384
     name: '个人主页',
384
     name: '个人主页',
385
     page: 'pages/consultant/myHomepage/index',
385
     page: 'pages/consultant/myHomepage/index',
386
     pkg: 'subpackages',
386
     pkg: 'subpackages',
387
     type: 'mine',
387
     type: 'mine',
388
-    auth: ['phone'],
388
+    // auth: ['phone'],
389
   },
389
   },
390
   {
390
   {
391
     name: '意见反馈',
391
     name: '意见反馈',