personal-details.page.js
481 Bytes
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/8/22
* Time: 18:05
*/
/**
* 个人信息
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/19
*/
var $ = require('yoho-jquery');
var $userAvatar = $('.user-avatar');
var myImage = new Image(),
avatar;
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};