Authored by 郝肖肖

'会员等级-进度条'

@@ -24,10 +24,10 @@ module.exports = class extends global.yoho.BaseModel { @@ -24,10 +24,10 @@ module.exports = class extends global.yoho.BaseModel {
24 vip.level = parseInt(data.current_vip_level, 10) || 0; 24 vip.level = parseInt(data.current_vip_level, 10) || 0;
25 vip.current_total_growth = parseInt(data.current_total_growth, 10) || 0; 25 vip.current_total_growth = parseInt(data.current_total_growth, 10) || 0;
26 vip.grades = [ 26 vip.grades = [
27 - {name: '普通会员', val: 0, percent: 0},  
28 - {name: '银卡会员', val: 800, percent: 11.4},  
29 - {name: '金卡会员', val: 3000, percent: 42.9},  
30 - {name: '白金会员', val: 7000, percent: 100} 27 + {name: '普通会员', val: 0},
  28 + {name: '银卡会员', val: 800},
  29 + {name: '金卡会员', val: 3000},
  30 + {name: '白金会员', val: 7000}
31 ]; 31 ];
32 32
33 if (vip.grades[vip.level + 1]) { 33 if (vip.grades[vip.level + 1]) {
@@ -35,6 +35,9 @@ module.exports = class extends global.yoho.BaseModel { @@ -35,6 +35,9 @@ module.exports = class extends global.yoho.BaseModel {
35 vip.need_total_growth = vip.need_total_growth > 0 ? vip.need_total_growth : 0; 35 vip.need_total_growth = vip.need_total_growth > 0 ? vip.need_total_growth : 0;
36 } 36 }
37 37
  38 + vip.current_total_percent = ((vip.current_total_growth / vip.grades[3].val) * 100).toFixed(2);
  39 + vip.current_total_percent = vip.current_total_percent > 100 ? 100 : vip.current_total_percent;
  40 +
38 return vip; 41 return vip;
39 }); 42 });
40 } 43 }
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <span class="name">拉拉</span> 11 <span class="name">拉拉</span>
12 <span class="vip-img{{level}}"></span> 12 <span class="vip-img{{level}}"></span>
13 <span class="info"> 13 <span class="info">
14 - 我的成长值:<span class="adolesce-val">{{current_total_growth}}</span>&nbsp;&nbsp; 14 + 我的成长值:<span class="adolesce-val" data-percent={{current_total_percent}}>{{current_total_growth}}</span>&nbsp;&nbsp;
15 {{#if need_total_growth}} 15 {{#if need_total_growth}}
16 下次升级还需:<span class="adolesce-val">{{need_total_growth}}</span> 16 下次升级还需:<span class="adolesce-val">{{need_total_growth}}</span>
17 {{/if}} 17 {{/if}}
@@ -2,3 +2,7 @@ @@ -2,3 +2,7 @@
2 * Created by DELL on 2017.2.10. 2 * Created by DELL on 2017.2.10.
3 */ 3 */
4 require('../common'); 4 require('../common');
  5 +
  6 +let percentVal = $('.adolesce-val').data('percent');
  7 +
  8 +$('head').append('<style>.vip-me-page .vip-level .user .progress::before{width:' + percentVal + '%}</style>');
@@ -99,7 +99,7 @@ @@ -99,7 +99,7 @@
99 99
100 &:before { 100 &:before {
101 content: ""; 101 content: "";
102 - width: 85%; 102 + width: 0;
103 height: 2px; 103 height: 2px;
104 position: relative; 104 position: relative;
105 background-color: #000; 105 background-color: #000;
@@ -141,6 +141,18 @@ @@ -141,6 +141,18 @@
141 .p-footer p { 141 .p-footer p {
142 margin-top: 3px; 142 margin-top: 3px;
143 } 143 }
  144 +
  145 + &:first-child {
  146 + width: 11.4%;
  147 + }
  148 +
  149 + &:first-child + li {
  150 + width: 31.4%;
  151 + }
  152 +
  153 + &:first-child + li + li {
  154 + width: 57.1%;
  155 + }
144 } 156 }
145 } 157 }
146 } 158 }