Showing
1 changed file
with
11 additions
and
11 deletions
@@ -9,23 +9,16 @@ | @@ -9,23 +9,16 @@ | ||
9 | * @author: bikai<kai.bi@yoho.cn> | 9 | * @author: bikai<kai.bi@yoho.cn> |
10 | * @date: 2015/11/19 | 10 | * @date: 2015/11/19 |
11 | */ | 11 | */ |
12 | -let $ = require('yoho-jquery'); | 12 | +import $ from 'yoho-jquery'; |
13 | +import Page from 'yoho-page'; | ||
14 | +import tip from 'plugin/tip'; | ||
15 | + | ||
13 | let $userAvatar = $('.user-avatar'); | 16 | let $userAvatar = $('.user-avatar'); |
14 | let myImage = new Image(), | 17 | let myImage = new Image(), |
15 | avatar; | 18 | avatar; |
16 | 19 | ||
17 | require('common'); | 20 | require('common'); |
18 | 21 | ||
19 | -// 部分老用户没有头像,显示默认头像 | ||
20 | -avatar = $userAvatar.data('avatar'); | ||
21 | -myImage.src = avatar; | ||
22 | -myImage.onload = function() { | ||
23 | - $userAvatar.css('background-image', 'url(' + avatar + ')'); | ||
24 | -}; | ||
25 | - | ||
26 | -import Page from 'yoho-page'; | ||
27 | -import tip from 'plugin/tip'; | ||
28 | - | ||
29 | class PersonDetail extends Page { | 22 | class PersonDetail extends Page { |
30 | constructor() { | 23 | constructor() { |
31 | super(); | 24 | super(); |
@@ -41,6 +34,13 @@ class PersonDetail extends Page { | @@ -41,6 +34,13 @@ class PersonDetail extends Page { | ||
41 | 34 | ||
42 | init() { | 35 | init() { |
43 | this.bindEvents(); | 36 | this.bindEvents(); |
37 | + | ||
38 | + // 部分老用户没有头像,显示默认头像 | ||
39 | + avatar = $userAvatar.data('avatar'); | ||
40 | + myImage.src = avatar; | ||
41 | + myImage.onload = function() { | ||
42 | + $userAvatar.css('background-image', 'url(' + avatar + ')'); | ||
43 | + }; | ||
44 | } | 44 | } |
45 | 45 | ||
46 | bindEvents() { | 46 | bindEvents() { |
-
Please register or login to post a comment