Authored by ccbikai

头像加载失败改成默认头像

@@ -3,5 +3,10 @@ @@ -3,5 +3,10 @@
3 * @author: bikai<kai.bi@yoho.cn> 3 * @author: bikai<kai.bi@yoho.cn>
4 * @date: 2015/11/12 4 * @date: 2015/11/12
5 */ 5 */
  6 +var $ = require('jquery');
6 7
7 -require('../product/recommend-for-you.js');  
  8 +require('../product/recommend-for-you.js');
  9 +
  10 +$('.user-avatar').on('error', function() {
  11 + $(this).attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
  12 +});
  1 +/**
  2 + * 个人信息
  3 + * @author: bikai<kai.bi@yoho.cn>
  4 + * @date: 2015/11/19
  5 + */
  6 +var $ = require('jquery');
  7 +
  8 +$('.user-avatar').on('error', function() {
  9 + $(this).attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
  10 +});
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="personal-details"> 2 <div class="personal-details">
3 <ul> 3 <ul>
4 - <li><span>头像</span><span><i class="head-portrait"><img src="{{ head_ico }}"></i></span></li> 4 + <li><span>头像</span><span><i class="head-portrait"><img class="user-avatar" src="{{ head_ico }}"></i></span></li>
5 <li><span>昵称</span><span>{{ username }}</span></li> 5 <li><span>昵称</span><span>{{ username }}</span></li>
6 <li><span>性别</span><span>{{ gender }}</span></li> 6 <li><span>性别</span><span>{{ gender }}</span></li>
7 <li><span>生日</span><span>{{ birthday }}</span></li> 7 <li><span>生日</span><span>{{ birthday }}</span></li>
@@ -247,4 +247,9 @@ @@ -247,4 +247,9 @@
247 <script> 247 <script>
248 seajs.use('js/me/my-guang'); 248 seajs.use('js/me/my-guang');
249 </script> 249 </script>
  250 +{{/if}}
  251 +{{#if personalDetailsPage}}
  252 +<script>
  253 + seajs.use('js/me/personal-details');
  254 +</script>
250 {{/if}} 255 {{/if}}
@@ -127,6 +127,7 @@ class HomeController extends AbstractAction @@ -127,6 +127,7 @@ class HomeController extends AbstractAction
127 // $uid = $this->getUid(); 127 // $uid = $this->getUid();
128 $uid = 967016; 128 $uid = 967016;
129 $data = \Index\UserModel::getUserProfileData($uid); 129 $data = \Index\UserModel::getUserProfileData($uid);
  130 + $data['personalDetailsPage'] = true;
130 $data['pageFooter'] = true; 131 $data['pageFooter'] = true;
131 $this->_view->display('personal-details', $data); 132 $this->_view->display('personal-details', $data);
132 } 133 }