Authored by 李靖

头像功能

... ... @@ -9,23 +9,16 @@
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/19
*/
let $ = require('yoho-jquery');
import $ from 'yoho-jquery';
import Page from 'yoho-page';
import tip from 'plugin/tip';
let $userAvatar = $('.user-avatar');
let myImage = new Image(),
avatar;
require('common');
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
import Page from 'yoho-page';
import tip from 'plugin/tip';
class PersonDetail extends Page {
constructor() {
super();
... ... @@ -41,6 +34,13 @@ class PersonDetail extends Page {
init() {
this.bindEvents();
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
}
bindEvents() {
... ...