소스 검색

iPhone头像授权

Baozhangchao 3 년 전
부모
커밋
0eae5949f4

+ 3
- 2
config/dev.js 파일 보기

@@ -4,8 +4,9 @@ module.exports = {
4 4
   },
5 5
   defineConstants: {
6 6
     // HOST: '"https://xlk.njyz.tech"',
7
-    HOST: '"https://www.newhousehold.cn"',
8
-    // HOST: '"http://127.0.0.1:8567"',
7
+    // HOST: '"https://www.newhousehold.cn"',
8
+    HOST: '"http://192.168.89.147:8081"',
9
+
9 10
     WSS_HOST: '"wss://www.newhousehold.cn"',
10 11
     // WSS_HOST: '"wss://xlk.njyz.tech"',
11 12
     OSS_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',

+ 2
- 2
config/prod.js 파일 보기

@@ -3,9 +3,9 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"https://www.newhousehold.cn"', //正式
6
+    // HOST: '"http://192.168.89.147:8081"', //正式
7 7
     WSS_HOST: '"wss://www.newhousehold.cn"',
8
-    // HOST: '"https://xlk.njyz.tech"', //正式
8
+    HOST: '"https://xlk.njyz.tech"',
9 9
     // WSS_HOST: '"wss://xlk.njyz.tech"',
10 10
     OSS_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
11 11
     OSS_FAST_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',

+ 1
- 1
project.config.json 파일 보기

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

+ 3
- 0
src/app.config.js 파일 보기

@@ -45,6 +45,9 @@ export default {
45 45
   permission: {
46 46
     "scope.userLocation": {
47 47
       desc: "你的位置信息将用于显示当前区域信息"
48
+    },
49
+    "scope.userInfo": {
50
+      desc: "你的信息将用于页面展示"
48 51
     }
49 52
   },
50 53
 }

+ 2
- 1
src/components/Auth/AuthAvatar.jsx 파일 보기

@@ -13,7 +13,8 @@ export default (props) => {
13 13
 
14 14
   const handleUserProfile = (detail) => {
15 15
     const { errMsg, ...data } = detail || {}
16
-    if (errMsg === 'getUserProfile:ok') {
16
+
17
+    if (errMsg === 'getUserProfile:ok' || errMsg === 'getUserInfo:ok') {
17 18
       setLoading(true)
18 19
       updateUserInfo(data).then(() => {
19 20
         setLoading(false)

+ 9
- 3
src/components/Auth/AuthBox.jsx 파일 보기

@@ -7,12 +7,17 @@ export default (props) => {
7 7
   const { loading, title, openType, onGetUserInfo, onGetPhoneNumber, onCancel = (x => x) } = props
8 8
 
9 9
   const handleGetUserInfo = () => {
10
-    Taro.getUserProfile({
11
-      lang: 'zh_CN',
10
+    const getUserInfo = Taro.canIUse('getUserProfile') ? Taro.getUserProfile : Taro.getUserInfo
11
+    getUserInfo({
12 12
       desc: '用于完善个人资料',
13
+      lang: 'zh_CN',
13 14
       success: (res) => {
15
+        console.log('授权成功', res);
14 16
         onGetUserInfo(res)
15
-      }
17
+      },
18
+      fali: (res) => {
19
+        console.log('授权错误', res);
20
+      },
16 21
     })
17 22
   }
18 23
 
@@ -36,6 +41,7 @@ export default (props) => {
36 41
             <Button
37 42
               className='auth-btn'
38 43
               type='default'
44
+              openType='getUserInfo'
39 45
               onClick={handleGetUserInfo}
40 46
               loading={loading}
41 47
             >确定</Button>

+ 1
- 1
src/components/Auth/AuthPage/index.jsx 파일 보기

@@ -15,7 +15,7 @@ export default (props) => {
15 15
 
16 16
   const [loading, setLoading] = useState(false)
17 17
   const { updatePhoneNumber } = useAuth(consultant, router, page)
18
-  
18
+
19 19
   const handlePhoneNumber = (e) => {
20 20
     const { errMsg, ...data } = e?.detail || {}
21 21
     // debugger

+ 2
- 2
src/components/Auth/AuthPhone.jsx 파일 보기

@@ -11,8 +11,8 @@ export default (props) => {
11 11
     router,
12 12
     page,
13 13
     onCancel = (x => x),
14
-    onSuccess = () => {},
15
-    onError = () => {},
14
+    onSuccess = () => { },
15
+    onError = () => { },
16 16
   } = props;
17 17
 
18 18
   const [loading, setLoading] = useState(false)

+ 5
- 5
src/layout/index.js 파일 보기

@@ -57,7 +57,7 @@ export default (ChildComponent) => (props) => {
57 57
   useEffect(() => {
58 58
     if (isSinglePage) return;
59 59
 
60
-    reportCustomer(person, consultant, false).catch(() => {})
60
+    reportCustomer(person, consultant, false).catch(() => { })
61 61
   }, [person, consultant, isSinglePage])
62 62
 
63 63
   // 请求埋点设置
@@ -67,7 +67,7 @@ export default (ChildComponent) => (props) => {
67 67
     if (id) {
68 68
       setShareContent({})
69 69
     }
70
-  } ,[id, page.type, isSinglePage])
70
+  }, [id, page.type, isSinglePage])
71 71
 
72 72
   // 埋点数据
73 73
   useEffect(() => {
@@ -91,13 +91,13 @@ export default (ChildComponent) => (props) => {
91 91
 
92 92
   useEffect(() => {
93 93
     setLoading((!person || !person.personId) || (scene && !qrInited))
94
-  // eslint-disable-next-line react-hooks/exhaustive-deps
94
+    // eslint-disable-next-line react-hooks/exhaustive-deps
95 95
   }, [person, scene, qrInited])
96 96
 
97 97
   return (
98 98
     <>
99 99
       {/* 菊花转 */}
100
-      <Overlay visible={loading} style={{background: '#fff'}}>
100
+      <Overlay visible={loading} style={{ background: '#fff' }}>
101 101
         <Loading />
102 102
       </Overlay>
103 103
 
@@ -116,7 +116,7 @@ export default (ChildComponent) => (props) => {
116 116
       </Overlay>
117 117
 
118 118
       {/* 授权头像-全屏 */}
119
-      { authPage && !isSinglePage && <AuthPage consultant={consultant} router={router} page={page} /> }
119
+      {authPage && !isSinglePage && <AuthPage consultant={consultant} router={router} page={page} />}
120 120
 
121 121
       {/* 显示分享朋友圈 */}
122 122
       <ShareToCircle visible={shareTimelineVisible && !isSinglePage} onClose={() => setShareTimelineVisible(false)} />