|
@@ -1,14 +1,15 @@
|
1
|
1
|
import React from 'react';
|
|
2
|
+import Taro from '@tarojs/taro';
|
2
|
3
|
import { View, Image, Button } from '@tarojs/components';
|
3
|
4
|
import { ActionSheet, Cell } from '@antmjs/vantui';
|
4
|
5
|
import { ROLES, ROLE_CITIZEN } from '@/utils/user';
|
5
|
6
|
import logo from '@/assets/image/logo.png';
|
6
|
7
|
import Icon from '@/assets/icons/avatar.png';
|
7
|
|
-import { useModel } from '@/store';
|
8
|
8
|
import style from './head.module.less';
|
9
|
9
|
|
10
|
10
|
export default (props) => {
|
11
|
|
- const { user, person, duty, onDutyChange } = props;
|
|
11
|
+ const { userModel } = props;
|
|
12
|
+ const { user, person, duty, updateDuty, authProfile } = userModel || {};
|
12
|
13
|
const { dutyList = [] } = user || {};
|
13
|
14
|
const role = ROLES[duty || ROLE_CITIZEN];
|
14
|
15
|
|
|
@@ -31,14 +32,17 @@ export default (props) => {
|
31
|
32
|
}
|
32
|
33
|
|
33
|
34
|
const onSelect = (e) => {
|
34
|
|
- onDutyChange(e.detail.value)
|
|
35
|
+ updateDuty(e.detail.value)
|
35
|
36
|
}
|
36
|
37
|
|
37
|
|
- const { getAvatar } = useModel('user');
|
38
|
|
-
|
39
|
|
- const onChooseAvatar = (e) => {
|
40
|
|
- const code = e.detail.code;
|
41
|
|
- getAvatar(code).then(props.onSuccess);
|
|
38
|
+ const onGetUserProfile = () => {
|
|
39
|
+ // 新版本小程序已开始不支持获取头像, 昵称了
|
|
40
|
+ // Taro.getUserProfile({
|
|
41
|
+ // desc: '用于完善您的资料',
|
|
42
|
+ // success: res => {
|
|
43
|
+ // authProfile(res);
|
|
44
|
+ // }
|
|
45
|
+ // })
|
42
|
46
|
}
|
43
|
47
|
|
44
|
48
|
return (
|
|
@@ -61,8 +65,8 @@ export default (props) => {
|
61
|
65
|
/>
|
62
|
66
|
</View>
|
63
|
67
|
<View className={style.avatar}>
|
64
|
|
- <Button openType="chooseAvatar" onChooseAvatar={onChooseAvatar}>
|
65
|
|
- <Image src={avatar}></Image>
|
|
68
|
+ <Button onClick={onGetUserProfile}>
|
|
69
|
+ <Image mode="scaleToFill" src={avatar}></Image>
|
66
|
70
|
</Button>
|
67
|
71
|
</View>
|
68
|
72
|
</View>
|