1.1.3 • Published 6 years ago
ux-feature-avatar v1.1.3
头像组件
支持特性
- 挂件
- 勋章
- 卡片
对接
提供两种对接方案:(推荐使用第二种,只需要在承载页加载我们的 公共节点( 前端公共配置 Node23)即可,每次不用升级直接 用到头像组件新特性)
一. 通过 npm 安装
npm install ux-feature-avatar --save
import AvatarCmp from 'ux-feature-avatar'
class AvatarDemo extends Component {
render() {
const avatar_config = {
"name": "啦啦啦",
"avatar": {
"hasAvatar":'true',
"img": '//cache.tms.beisen.cn/Image/101055/ec2102b9dc444140b78bff744420517a_l.jpeg',
"color": "#f0c75a"
},
"blessingType": 1,//祝福类型 1生日 2入职 3节日
enableFeatures: true,//是否开通送祝福
// simpleMode: false,//只显示头像
"medalurl": medalUrl,
enableJump:true,//是否支持跳转个人主页
"userId": 112984691,
"size": 80,
decorationType: 3,//挂件类型,为4文化标签,3系统勋章,2企业勋章,1祝福
// showHonorCard: false,
"udc": bless: { ext: { type: "bless", "from": "prfile-avatar", to: userid } },//祝福挂件打点标记
medal: { ext: { type: "medal", desc: "view-wall", from: "profile-avatar" } }//勋章挂件打点标记
}
}
return <div className="_avatar-wrap">
<AvatarCmp {...avatar_config} />
</div >
}
}
ReactDOM.render(< AvatarDemo/>, document.getElementById('app'))
二. 通过动态标签引入
//通过动态插入标签方式加载头像组件
export function loadAvatarCmp(id, callback) {
const featureAvatarVersion = window.__italent_common_cmps__ && window.__italent_common_cmps__.featureAvatar_version || '1.0.19'
if (!document.getElementById(id) || !window.AvatarCmp) {
const script = document.createElement('script');
script.type = "text/javascript"
script.id = id
if (script.readyState) {
script.onreadystatechange = function () {
if (script.readyState == 'loaded' || script.readyState == 'completed') {
script.onreadystatechange = null;
callback && callback()
}
}
} else {
script.onload = function () {
callback && callback()
}
}
script.src = `//stnew.beisen.com/ux/upaas/ux-feature-avatar/release/dist/main-${featureAvatarVersion}.min.js`;
document.body.appendChild(script)
} else {
callback && callback()
}
}
class AvatarDemo extends Component {
constructor(porps){
super(props)
this.state={
AvatarCmp:''
}
}
componentDidMount(){
loadAvatarCmp('__common_feature_avatar',()=>{
this.setState({
AvatarCmp:window.AvatarCmp
})
})
}
render() {
const avatar_config = {
"name": "啦啦啦",
"avatar": {
"hasAvatar":'true',
"img": '//cache.tms.beisen.cn/Image/101055/ec2102b9dc444140b78bff744420517a_l.jpeg',
"color": "#f0c75a"
},
"blessingType": 1,//祝福类型
enableFeatures: true,//是否开通送祝福
// simpleMode: false,//只显示头像
"medalurl": medalUrl,
"userId": 112984691,
"size": 80,
decorationType: 3,//挂件类型,为4文化标签,3系统勋章,2企业勋章,1祝福
// showHonorCard: false,
"udc": bless: { ext: { type: "bless", "from": "prfile-avatar", to: userid } },//祝福挂件打点标记
medal: { ext: { type: "medal", desc: "view-wall", from: "profile-avatar" } }//勋章挂件打点标记
}
}
const {AvatarCmp} =this.state;
return <div className="_avatar-wrap">
{AvatarCmp&&<AvatarCmp {...avatar_config} />}
</div >
}
}
ReactDOM.render(< AvatarDemo/>, document.getElementById('app'))
如需协助对接可以直接联系我 yinjikai@beisen.com
CHANGELOG
1.0.68
- 调用祝福㊗ ️ 时 追加参数,添加祝福类型
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.76
6 years ago
1.0.75
6 years ago
1.0.74
6 years ago
1.0.73
6 years ago
1.0.72
6 years ago
1.0.71
6 years ago
1.0.70
6 years ago
1.0.69
6 years ago
1.0.68
6 years ago
1.0.66
6 years ago
1.0.65
6 years ago
1.0.64
6 years ago
1.0.63
6 years ago
1.0.62
6 years ago
1.0.61
6 years ago
1.0.60
7 years ago
1.0.59
7 years ago
1.0.58
7 years ago
1.0.56
7 years ago
1.0.55
7 years ago
1.0.54
7 years ago
1.0.53
7 years ago
1.0.51
7 years ago
1.0.39
7 years ago
1.0.38
7 years ago
1.0.37
7 years ago
1.0.36
7 years ago
1.0.35
7 years ago
1.0.34
7 years ago
1.0.33
7 years ago
1.0.32
7 years ago
1.0.31
7 years ago
1.0.29
7 years ago
1.0.28
7 years ago
1.0.27
7 years ago
1.0.25
7 years ago
1.0.24
7 years ago
1.0.23
7 years ago
1.0.22
7 years ago
1.0.21
7 years ago
1.0.20
7 years ago
1.0.19
7 years ago
1.0.18
7 years ago
1.0.16
7 years ago
1.0.15
7 years ago
1.0.14
7 years ago
1.0.13
7 years ago