mall_client/zyhs3_uniapp/TIM/profile.js

28 lines
1.0 KiB
JavaScript

export const _updateProFile = function () {
const userInfo = uni.getStorageSync('userinfo');
const nickName = uni.getStorageSync('nickName')
const headerImg = uni.getStorageSync('headerImg')
let promise = uni.$TUIKit.updateMyProfile({
nick: nickName || userInfo.nickName,
avatar: headerImg || userInfo.headerImg,
});
promise.then(function(imResponse) {
console.warn('用户资料更新成功', imResponse); // 更新资料失败的相关信息
}).catch(function(imError) {
console.warn('updateMyProfile error:', imError); // 更新资料失败的相关信息
});
}
export const _updateGroupProfile = function (groupID, path, custom, groupUserList) {
let data = {groupID};
if(path) data['avatar'] = path;
if(custom || groupUserList) {
data['groupCustomField'] = [];
if(custom) data['groupCustomField'].push({key: 'custom', value: custom});
if(groupUserList) data['groupCustomField'].push({key: 'groupUserList', value: groupUserList});
}
console.warn(data)
return uni.$TUIKit.updateGroupProfile(data).then(res => {
console.warn(res)
});
}