user.js
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Taro from '@tarojs/taro';
import {login as LoginModel} from '../models';
export default {
getYHStorageSync(key, fromPage) {
// 本地缓存
try {
return Taro.getStorageSync(key);
} catch (e) {
Taro.reportAnalytics('get_storage_error', {
key: key,
error: e.message,
error_code: e.code,
from_page: fromPage,
});
return null;
}
},
// 根据unionId上传微信头像昵称.
sendWeChatUserDataWithUnionId(unionId, nickName, userAvatarUrl) {
if (!unionId || !nickName || !userAvatarUrl || userAvatarUrl == "images/mine_default_head.png") return;
LoginModel.addUnionUpdUser({
unionId: unionId,
headIco: userAvatarUrl,
nickname: nickName
});
},
// 根据uid上传微信头像昵称
sendWeChatUserData(uid, nickName, userAvatarUrl) {
if (!uid || !nickName || !userAvatarUrl || userAvatarUrl == "images/mine_default_head.png") return;
LoginModel.addUpdUser({
uid: uid,
headIco: userAvatarUrl,
nickname: nickName
});
}
}