Authored by 王水玲

Merge branch 'develop' into feature/activity

@@ -15,25 +15,25 @@ @@ -15,25 +15,25 @@
15 <ul class="two-dim clearfix"> 15 <ul class="two-dim clearfix">
16 <li class="left"> 16 <li class="left">
17 {{#if devEnv}} 17 {{#if devEnv}}
18 - <img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-app.png"> 18 + <img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-app.png">
19 {{^}} 19 {{^}}
20 - <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png"> 20 + <img class="dim-img lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/qr-app.png">
21 {{/if}} 21 {{/if}}
22 <p>YOHO!有货</p> 22 <p>YOHO!有货</p>
23 </li> 23 </li>
24 <li class="left"> 24 <li class="left">
25 {{#if devEnv}} 25 {{#if devEnv}}
26 - <img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-weixin.png"> 26 + <img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-weixin.png">
27 {{^}} 27 {{^}}
28 - <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png"> 28 + <img class="dim-img lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/qr-app.png">
29 {{/if}} 29 {{/if}}
30 <p>微信</p> 30 <p>微信</p>
31 </li> 31 </li>
32 <li class="left"> 32 <li class="left">
33 {{#if devEnv}} 33 {{#if devEnv}}
34 - <img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-weibo.png"> 34 + <img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-weibo.png">
35 {{^}} 35 {{^}}
36 - <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png"> 36 + <img class="dim-img lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/qr-app.png">
37 {{/if}} 37 {{/if}}
38 <p>微博</p> 38 <p>微博</p>
39 </li> 39 </li>
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 </div> 41 </div>
42 </div> 42 </div>
43 <p class="item-nav center"> 43 <p class="item-nav center">
44 - <span class="iconfont cur" key="0">&#xe619;</span> 44 + <span class="iconfont cur" key="0">&#xe606;</span>
45 </p> 45 </p>
46 </dd> 46 </dd>
47 <dd> 47 <dd>
@@ -121,9 +121,9 @@ @@ -121,9 +121,9 @@
121 </ul> 121 </ul>
122 </div> 122 </div>
123 <p id="feed-back-page" class="item-nav center"> 123 <p id="feed-back-page" class="item-nav center">
124 - <span class="iconfont cur">&#xe619;</span>  
125 - <span class="iconfont ">&#xe619;</span>  
126 - <span class="iconfont ">&#xe619;</span> 124 + <span class="iconfont cur">&#xe606;</span>
  125 + <span class="iconfont ">&#xe606;</span>
  126 + <span class="iconfont ">&#xe606;</span>
127 </p> 127 </p>
128 </dd> 128 </dd>
129 <dd class="last"> 129 <dd class="last">
@@ -139,27 +139,27 @@ @@ -139,27 +139,27 @@
139 <li> 139 <li>
140 <a href="http://www.yohomars.com/" target="_blank"> 140 <a href="http://www.yohomars.com/" target="_blank">
141 {{#if devEnv}} 141 {{#if devEnv}}
142 - <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/mars.png"> 142 + <img class="lazy" data-original="http://localhost:3000/img/layout/mars.png">
143 {{^}} 143 {{^}}
144 - <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/mars.png"> 144 + <img class="lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/mars.png">
145 {{/if}} 145 {{/if}}
146 </a> 146 </a>
147 </li> 147 </li>
148 <li> 148 <li>
149 <a href="http://app.yohoshow.com/" target="_blank"> 149 <a href="http://app.yohoshow.com/" target="_blank">
150 {{#if devEnv}} 150 {{#if devEnv}}
151 - <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/show.png"> 151 + <img class="lazy" data-original="http://localhost:3000/img/layout/show.png">
152 {{^}} 152 {{^}}
153 - <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/show.png"> 153 + <img class="lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/show.png">
154 {{/if}} 154 {{/if}}
155 </a> 155 </a>
156 </li> 156 </li>
157 <li> 157 <li>
158 <a href="http://www.yoho.cn/product#yoho" target="_blank"> 158 <a href="http://www.yoho.cn/product#yoho" target="_blank">
159 {{#if devEnv}} 159 {{#if devEnv}}
160 - <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/yoho.png"> 160 + <img class="lazy" data-original="http://localhost:3000/img/layout/yoho.png">
161 {{^}} 161 {{^}}
162 - <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/yoho.png"> 162 + <img class="lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/yoho.png">
163 {{/if}} 163 {{/if}}
164 </a> 164 </a>
165 </li> 165 </li>
@@ -167,7 +167,7 @@ @@ -167,7 +167,7 @@
167 </div> 167 </div>
168 </div> 168 </div>
169 <p class="item-nav center"> 169 <p class="item-nav center">
170 - <span class="iconfont cur">&#xe619;</span> 170 + <span class="iconfont cur">&#xe606;</span>
171 </p> 171 </p>
172 </dd> 172 </dd>
173 </dl> 173 </dl>
1 {{# headerData}} 1 {{# headerData}}
2 - <div class="yoho-header {{headType}}"> 2 + <div class="yoho-header {{headtype}}">
3 <div class="tool-wrapper clearfix"> 3 <div class="tool-wrapper clearfix">
4 <div class="center-content"> 4 <div class="center-content">
5 <div class="yoho-group-map left"> 5 <div class="yoho-group-map left">
@@ -84,8 +84,10 @@ @@ -84,8 +84,10 @@
84 </form> 84 </form>
85 </div> 85 </div>
86 <div class="go-cart"> 86 <div class="go-cart">
87 - <span class="iconfont ">&#xe600;</span>  
88 - <span class="goods-num-tip">0</span> 87 + <a href="http://www.yohobuy.com/shopping/cart">
  88 + <span class="iconfont ">&#xe600;</span>
  89 + <span class="goods-num-tip">0</span>
  90 + </a>
89 <div class="mini-cart-wrapper"> 91 <div class="mini-cart-wrapper">
90 <div class="loading-cart"> 92 <div class="loading-cart">
91 <h3>加载中,请稍后</h3> 93 <h3>加载中,请稍后</h3>
No preview for this file type
@@ -2,11 +2,11 @@ @@ -2,11 +2,11 @@
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3 <svg xmlns="http://www.w3.org/2000/svg"> 3 <svg xmlns="http://www.w3.org/2000/svg">
4 <metadata> 4 <metadata>
5 -Created by FontForge 20120731 at Tue May 3 14:50:34 2016 5 +Created by FontForge 20120731 at Wed May 11 14:40:20 2016
6 By admin 6 By admin
7 </metadata> 7 </metadata>
8 <defs> 8 <defs>
9 -<font id="iconfont" horiz-adv-x="1048" > 9 +<font id="iconfont" horiz-adv-x="1024" >
10 <font-face 10 <font-face
11 font-family="iconfont" 11 font-family="iconfont"
12 font-weight="500" 12 font-weight="500"
@@ -19,7 +19,7 @@ Created by FontForge 20120731 at Tue May 3 14:50:34 2016 @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Tue May 3 14:50:34 2016
19 bbox="0 -212 1158 896" 19 bbox="0 -212 1158 896"
20 underline-thickness="50" 20 underline-thickness="50"
21 underline-position="-100" 21 underline-position="-100"
22 - unicode-range="U+0078-E604" 22 + unicode-range="U+0078-E606"
23 /> 23 />
24 <missing-glyph horiz-adv-x="374" 24 <missing-glyph horiz-adv-x="374"
25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> 25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
@@ -33,13 +33,13 @@ d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> @@ -33,13 +33,13 @@ d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
33 d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5 33 d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
34 t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5 34 t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
35 t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" /> 35 t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
36 - <glyph glyph-name="uniE600" unicode="&#xe600;" 36 + <glyph glyph-name="uniE600" unicode="&#xe600;" horiz-adv-x="1048"
37 d="M832 -126.5q0 -35.5 -25 -60.5t-60.5 -25t-60.5 25t-25 60.5t25 60.5t60.5 25t60.5 -25t25 -60.5zM533 -126.5q0 -35.5 -25 -60.5t-60 -25t-60 25t-25 60.5t25 60.5t60 25t60 -25t25 -60.5zM277 620l-35 159q-3 14 -15 23.5t-27 9.5h-147q-22 0 -37.5 -15.5t-15.5 -37.5 37 d="M832 -126.5q0 -35.5 -25 -60.5t-60.5 -25t-60.5 25t-25 60.5t25 60.5t60.5 25t60.5 -25t25 -60.5zM533 -126.5q0 -35.5 -25 -60.5t-60 -25t-60 25t-25 60.5t25 60.5t60 25t60 -25t25 -60.5zM277 620l-35 159q-3 14 -15 23.5t-27 9.5h-147q-22 0 -37.5 -15.5t-15.5 -37.5
38 t15.5 -38t37.5 -16h54l157 -627q6 -25 25.5 -40t44.5 -15h527q25 0 44.5 15t25.5 40l113 452q9 34 -13 62t-57 28h-697z" /> 38 t15.5 -38t37.5 -16h54l157 -627q6 -25 25.5 -40t44.5 -15h527q25 0 44.5 15t25.5 40l113 452q9 34 -13 62t-57 28h-697z" />
39 - <glyph glyph-name="uniE601" unicode="&#xe601;" horiz-adv-x="1024" 39 + <glyph glyph-name="uniE601" unicode="&#xe601;"
40 d="M505 337l2 -2q2 -1 3.5 -1t3.5 1l430 364q2 2 1 5.5t-5 3.5h-435h-424q-4 0 -5 -3.5t1 -5.5zM72 669q-3 2 -6 0.5t-3 -4.5v-584q0 -4 3.5 -5t5.5 1l288 346zM953 669.5q-3 1.5 -5 -0.5l-288 -246l287 -346q3 -2 6 -1t3 5v584q0 3 -3 4.5zM641 406l-131 -111l-5 5 40 d="M505 337l2 -2q2 -1 3.5 -1t3.5 1l430 364q2 2 1 5.5t-5 3.5h-435h-424q-4 0 -5 -3.5t1 -5.5zM72 669q-3 2 -6 0.5t-3 -4.5v-584q0 -4 3.5 -5t5.5 1l288 346zM953 669.5q-3 1.5 -5 -0.5l-288 -246l287 -346q3 -2 6 -1t3 5v584q0 3 -3 4.5zM641 406l-131 -111l-5 5
41 l-125 103l-275 -328q-2 -3 -1 -6t5 -3h396h407q4 0 5 3t-1 6z" /> 41 l-125 103l-275 -328q-2 -3 -1 -6t5 -3h396h407q4 0 5 3t-1 6z" />
42 - <glyph glyph-name="uniE602" unicode="&#xe602;" 42 + <glyph glyph-name="uniE602" unicode="&#xe602;" horiz-adv-x="1048"
43 d="M297.5 528q-20.5 0 -35 -14.5t-14.5 -35t14.5 -35.5t35 -15t35.5 15t15 35.5t-15 35t-35.5 14.5zM381 251q0 96 84 164t202 68t202 -68t84 -163.5t-84 -163.5t-202 -68t-202 68t-84 163zM286 251q0 -17 2 -35v1q-88 42 -140.5 114t-52.5 157t51.5 157t139.5 114t192 42 43 d="M297.5 528q-20.5 0 -35 -14.5t-14.5 -35t14.5 -35.5t35 -15t35.5 15t15 35.5t-15 35t-35.5 14.5zM381 251q0 96 84 164t202 68t202 -68t84 -163.5t-84 -163.5t-202 -68t-202 68t-84 163zM286 251q0 -17 2 -35v1q-88 42 -140.5 114t-52.5 157t51.5 157t139.5 114t192 42
44 q142 0 249.5 -76.5t128.5 -189.5q-88 43 -189 43q-104 0 -191.5 -43.5t-138.5 -119t-51 -164.5zM953 36q95 93 95 215t-94 214q2 20 2 23q0 111 -64 205t-174.5 148.5t-240 54.5t-239.5 -54.5t-174 -148.5t-64 -205q0 -78 33 -148.5t93 -125.5l-77 -123q-8 -12 -6.5 -26 44 q142 0 249.5 -76.5t128.5 -189.5q-88 43 -189 43q-104 0 -191.5 -43.5t-138.5 -119t-51 -164.5zM953 36q95 93 95 215t-94 214q2 20 2 23q0 111 -64 205t-174.5 148.5t-240 54.5t-239.5 -54.5t-174 -148.5t-64 -205q0 -78 33 -148.5t93 -125.5l-77 -123q-8 -12 -6.5 -26
45 t10.5 -25q13 -15 32 -15q9 0 18 4l180 80q4 2 7 4q20 -7 39 -12q48 -80 138.5 -128t199.5 -48q75 0 145 25q1 -1 2 -1l140 -62q8 -4 17 -4q20 0 32 15q10 10 11 24t-7 26zM527 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11z 45 t10.5 -25q13 -15 32 -15q9 0 18 4l180 80q4 2 7 4q20 -7 39 -12q48 -80 138.5 -128t199.5 -48q75 0 145 25q1 -1 2 -1l140 -62q8 -4 17 -4q20 0 32 15q10 10 11 24t-7 26zM527 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11z
@@ -47,8 +47,12 @@ M667 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11 @@ -47,8 +47,12 @@ M667 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11
47 <glyph glyph-name="uniE603" unicode="&#xe603;" horiz-adv-x="1158" 47 <glyph glyph-name="uniE603" unicode="&#xe603;" horiz-adv-x="1158"
48 d="M1069 181h-245v378h132l113 -169v-209zM1158 417l-155 231h-268v-467h-45v508q0 20 -14 34t-34 14h-63l-67 -89h89v-467h-512v467h45l22 89h-108q-20 0 -34 -14t-14 -34v-549q0 -20 14 -34t34 -14h139q-33 -37 -33 -87q0 -53 37.5 -91t91 -38t91.5 38t38 91q0 50 -34 87 48 d="M1069 181h-245v378h132l113 -169v-209zM1158 417l-155 231h-268v-467h-45v508q0 20 -14 34t-34 14h-63l-67 -89h89v-467h-512v467h45l22 89h-108q-20 0 -34 -14t-14 -34v-549q0 -20 14 -34t34 -14h139q-33 -37 -33 -87q0 -53 37.5 -91t91 -38t91.5 38t38 91q0 50 -34 87
49 h264h191q-34 -37 -34 -87q0 -53 38 -91t91.5 -38t91 38t37.5 91q0 50 -33 87h134v325zM326 668q-89 -153 -94 -296v-12h129v12q0 43 17 112q17 68 39 116q27 61 67.5 118t62.5 79l4 3v96h-390l-2 -114h245q-33 -40 -78 -114z" /> 49 h264h191q-34 -37 -34 -87q0 -53 38 -91t91.5 -38t91 38t37.5 91q0 50 -33 87h134v325zM326 668q-89 -153 -94 -296v-12h129v12q0 43 17 112q17 68 39 116q27 61 67.5 118t62.5 79l4 3v96h-390l-2 -114h245q-33 -40 -78 -114z" />
50 - <glyph glyph-name="uniE604" unicode="&#xe604;" horiz-adv-x="1024" 50 + <glyph glyph-name="uniE604" unicode="&#xe604;"
51 d="M875 126l-363 -164l-363 164v610q247 75 363 75t363 -75v-610zM930 808q-34 11 -84.5 26t-159.5 38.5t-174 23.5t-174 -23.5t-159.5 -38.5t-84.5 -26q-14 -4 -22 -15.5t-8 -25.5v-669q0 -27 25 -39l405 -183q9 -3 18 -3t18 3l405 183q25 12 25 39v669q0 14 -8 25.5 51 d="M875 126l-363 -164l-363 164v610q247 75 363 75t363 -75v-610zM930 808q-34 11 -84.5 26t-159.5 38.5t-174 23.5t-174 -23.5t-159.5 -38.5t-84.5 -26q-14 -4 -22 -15.5t-8 -25.5v-669q0 -27 25 -39l405 -183q9 -3 18 -3t18 3l405 183q25 12 25 39v669q0 14 -8 25.5
52 t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" /> 52 t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" />
  53 + <glyph glyph-name="uniE605" unicode="&#xe605;"
  54 +d="M903 577l-68 69l-388 -388l-231 230l-68 -68l299 -298l65 65z" />
  55 + <glyph glyph-name="uniE606" unicode="&#xe606;"
  56 +d="M512 599q47 0 88 -18t72 -49t49 -72t18 -89q0 -46 -18 -87t-49 -72t-72 -49t-88 -18t-88 18t-72 49t-49 72t-18 87q0 48 18 89t49 72t72 49t88 18v0zM512 599z" />
53 </font> 57 </font>
54 </defs></svg> 58 </defs></svg>
No preview for this file type
No preview for this file type
  1 +/**
  2 + * 页面公共逻辑和接口
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/11/23
  5 + */
  6 +var $ = require('yoho-jquery');
  7 +
  8 +var $body = $('body');
  9 +
  10 +function cookie(name) {
  11 + var re = new RegExp(name + '=([^;$]*)', 'i'),
  12 + matchPattern = '$1';
  13 +
  14 + return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
  15 +}
  16 +
  17 +function setCookie(name, value, options) {
  18 + var expires = '',
  19 + path,
  20 + domain,
  21 + secure,
  22 + date;
  23 +
  24 + if (typeof value !== 'undefined') {
  25 + options = options || {};
  26 + if (value === null) {
  27 + value = '';
  28 + options.expires = -1;
  29 + }
  30 +
  31 + if (options.expires &&
  32 + (typeof options.expires === 'number' || options.expires.toUTCString)) {
  33 + if (typeof options.expires === 'number') {
  34 + date = new Date();
  35 + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
  36 + } else {
  37 + date = options.expires;
  38 + }
  39 + expires = '; expires=' + date.toUTCString();
  40 + }
  41 + path = options.path ? '; path=' + options.path : '';
  42 + domain = options.domain ? '; domain=' + options.domain : '';
  43 + secure = options.secure ? '; secure' : '';
  44 + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
  45 + }
  46 +}
  47 +
  48 +function getUser() {
  49 + var c = cookie('_UID'),
  50 + user;
  51 +
  52 + if (typeof c === 'undefined') {
  53 + return 0;
  54 + }
  55 +
  56 + user = c.split('::');
  57 +
  58 + if (typeof user === 'undefined' || user.length < 4) {
  59 + return 0;
  60 + }
  61 +
  62 + return user;
  63 +}
  64 +
  65 +function getUid() {
  66 + var user = getUser();
  67 +
  68 + if (user === 0) {
  69 + return 0;
  70 + }
  71 +
  72 + return user[1];
  73 +}
  74 +
  75 +function getShoppingKey() {
  76 + var c = cookie('_g');
  77 +
  78 + if (typeof c === 'undefined') {
  79 + return '';
  80 + }
  81 +
  82 + return JSON.parse(c).k;
  83 +}
  84 +
  85 +// YAS统计代码
  86 +(function(w, d, s, j, f) {
  87 + var a = d.createElement(s);
  88 + var m = d.getElementsByTagName(s)[0];
  89 +
  90 + w.YohoAcquisitionObject = f;
  91 +
  92 + w[f] = function() {
  93 + w[f].p = arguments;
  94 + };
  95 +
  96 + a.async = 1;
  97 + a.src = j;
  98 + m.parentNode.insertBefore(a, m);
  99 +}(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js', '_yas'));
  100 +
  101 +(function() {
  102 + var uid = getUid();
  103 +
  104 + uid = uid === 0 ? '' : uid;
  105 +
  106 + window._ozuid = uid; // 暴露ozuid
  107 +
  108 + if (window._yas) {
  109 + window._yas(1 * new Date(), '1.0.14', 'yohobuy_web', uid, '', '');
  110 + }
  111 +}());
  112 +
  113 +// window.resize在width<1180时适配成990
  114 +$(window).on('resize', function() {
  115 + var w = $(this).width();
  116 +
  117 + // return top
  118 + if (w < 1360) {
  119 + $('.return-top').addClass('min');
  120 + } else {
  121 + $('.return-top').removeClass('min');
  122 + }
  123 +
  124 + // body
  125 + if (w < 1180) {
  126 + $body.addClass('min-screen');
  127 + } else {
  128 + $body.removeClass('min-screen');
  129 + }
  130 +}).trigger('resize');
  131 +
  132 +function queryString() {
  133 + var vars = {},
  134 + hash,
  135 + i,
  136 + search = window.location.search,
  137 + hashes = search ? decodeURIComponent(search).slice(1).split('&') : [];
  138 +
  139 + for (i = 0; i < hashes.length; i++) {
  140 + hash = hashes[i].split('=');
  141 + vars[hash[0]] = hash[1];
  142 + }
  143 + return vars;
  144 +}
  145 +
  146 +// 个人中心左侧栏头像加载失败后,显示默认头像
  147 +(function() {
  148 + $(window).load(function() {
  149 + var thumb = document.getElementById('user-thumb');
  150 + var img;
  151 +
  152 + if (!thumb) {
  153 + return;
  154 + }
  155 +
  156 + img = new Image();
  157 +
  158 + img.src = thumb.src;
  159 +
  160 + img.onerror = function() {
  161 + $(thumb).parent().append('<div class="default-user-thumb"></div>').end().remove();
  162 + };
  163 + });
  164 +}());
  165 +
  166 +window.cookie = cookie;
  167 +
  168 +window.setCookie = setCookie;
  169 +
  170 +window.getUser = getUser;
  171 +
  172 +window.getUid = getUid;
  173 +
  174 +window.getShoppingKey = getShoppingKey;
  175 +
  176 +window.queryString = queryString;
  177 +
  178 +require('./header');
  179 +require('./footer');
  1 +/**
  2 + * 尾部
  3 + * @author: wangqing<robin.wang@yoho.cn>
  4 + * @date: 2015/12/01
  5 + */
  6 +
  7 +var $ = require('yoho-jquery');
  8 +
  9 +var $returnTop = $('.return-top');
  10 +
  11 +/**
  12 + * 订阅
  13 + * @return {[type]} [description]
  14 + */
  15 +function actionSubscription() {
  16 + var $subscriberBox = $('#subscriber-box'),
  17 + $subscriberBtn = $('#subscriber-btn'),
  18 + emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/;
  19 +
  20 + var iconCode = {
  21 + mail: '&#xe601;',
  22 + tick: '&#xe605;'
  23 + };
  24 +
  25 + $subscriberBox.focus(function() {
  26 + $(this).val('').css('color', '');
  27 + $subscriberBtn.removeClass('done').html(iconCode.mail);
  28 + });
  29 +
  30 + $subscriberBtn.click(function() {
  31 + var email = $.trim($subscriberBox.val());
  32 +
  33 + if (email !== '' && emailReg.test(email)) {
  34 + try {
  35 + $.ajax({
  36 + url: 'http://new.yohobuy.com/common/emailsubscriber',
  37 + dataType: 'jsonp',
  38 + data: {
  39 + email: email,
  40 + tmp: Math.random(),
  41 + uid: window.getUid()
  42 + },
  43 + success: function(data) {
  44 + if (data.data.result === 1) {
  45 + $subscriberBox.val('已订阅到:' + email);
  46 + $subscriberBtn.addClass('done').html(iconCode.tick);
  47 + } else {
  48 + $subscriberBox.css('color', 'red');
  49 + }
  50 + }
  51 + });
  52 + } catch (e) {
  53 + console.log(e.message);
  54 + }
  55 + } else {
  56 + $subscriberBox.css('color', 'red');
  57 + }
  58 + });
  59 +}
  60 +
  61 +function actionhomeFootChange() {
  62 + var $vote = $('.vote'),
  63 + $feedBackPage = $('#feed-back-page'),
  64 + count = $vote.children('li').length;
  65 +
  66 + // 意见反馈
  67 + $feedBackPage.on('click', 'span', function() {
  68 + var $this = $(this);
  69 +
  70 + if ($this.hasClass('cur')) {
  71 + return;
  72 + }
  73 +
  74 + $this.siblings('.cur').removeClass('cur');
  75 + $this.addClass('cur');
  76 +
  77 + $vote.children().not('.hide').addClass('hide')
  78 + .end()
  79 + .eq($this.index()).removeClass('hide');
  80 + });
  81 +
  82 + $vote.on('click', '.feed-back-btn', function() {
  83 + var $this = $(this),
  84 + $li = $this.closest('li'),
  85 + index = $li.index(),
  86 + _solution = [];
  87 +
  88 + var _answer = $li.find('.feedback-answer').val(),
  89 + _feedback = $li.find('.feedback-id').val(),
  90 + _question = $li.find('.question-id').val();
  91 +
  92 + $li.find(':checked').each(function() {
  93 + _solution.push($(this).val());
  94 + });
  95 +
  96 + $.ajax({
  97 + url: 'http://new.yohobuy.com/common/suggestfeedback',
  98 + dataType: 'jsonp',
  99 + data: {
  100 + feedback_id: _feedback || 0,
  101 + question_id: _question || 0,
  102 + answer: _answer || '',
  103 + solution: _solution.join(',')
  104 + },
  105 + success: function(data) {
  106 + var next = index + 1;
  107 +
  108 + if (~~data.data.result === 1) {
  109 + if (index === count - 1) {
  110 + alert('感谢您的参与!'); // eslint-disable-line
  111 + return;
  112 + }
  113 +
  114 + $li.addClass('hide');
  115 +
  116 + $vote.children(':eq(' + (index + 1) + ')').removeClass('hide');
  117 + $feedBackPage.children('.cur').removeClass('cur');
  118 + $feedBackPage.children(':eq(' + next + ')').addClass('cur');
  119 + }
  120 + }
  121 + });
  122 + });
  123 +}
  124 +
  125 +function rePosReturn() {
  126 + if ($(window).height() > $(document).height()) {
  127 + $returnTop.addClass('hide');
  128 + }
  129 +
  130 + // 只在窗口高度大于文档高度的时候,隐藏返回顶部
  131 + // else {
  132 + // $returnTop.removeClass('hide');
  133 + // }
  134 +}
  135 +
  136 +// 返回顶部
  137 +$returnTop.click(function() {
  138 + $('html,body').animate({
  139 + scrollTop: 0
  140 + }, 500);
  141 +});
  142 +
  143 +$(window).scroll(function() {
  144 + if ($(window).scrollTop() === 0) {
  145 + $returnTop.addClass('hide');
  146 + } else {
  147 + $returnTop.removeClass('hide');
  148 + }
  149 +});
  150 +
  151 +// 如果初始是隐藏的,监听图片加载,重新确定return-top的高度
  152 +if ($returnTop.hasClass('hide')) {
  153 + $('img').load(rePosReturn);
  154 +}
  155 +
  156 +// 初始化
  157 +actionSubscription();
  158 +actionhomeFootChange();
  159 +
  160 +// 暴露给有可能通AJAX改变内容的页面去用
  161 +window.rePosReturnTop = rePosReturn;
@@ -3,10 +3,8 @@ @@ -3,10 +3,8 @@
3 * @author: yyq<yanqing.yang@yoho.cn> 3 * @author: yyq<yanqing.yang@yoho.cn>
4 * @date: 2016/5/9 4 * @date: 2016/5/9
5 */ 5 */
6 -/* eslint-disable */  
7 -var $ = require('yoho-jquery');  
8 - // handlebars = require('yoho.handlebars'),  
9 - // json2 = require('json2'); 6 +var $ = require('yoho-jquery'),
  7 + handlebars = require('yoho-handlebars');
10 8
11 var $tool = $('.tool-wrapper'), 9 var $tool = $('.tool-wrapper'),
12 $yohoGroup = $tool.find('.yoho-group'), 10 $yohoGroup = $tool.find('.yoho-group'),
@@ -21,29 +19,25 @@ var $head = $('.head-wrapper'), @@ -21,29 +19,25 @@ var $head = $('.head-wrapper'),
21 19
22 var $subNav = $('.sub-nav-list .contain-third'); 20 var $subNav = $('.sub-nav-list .contain-third');
23 21
24 -var apiDomain = $('#api-domain').val(), // 获取登陆状态的地址  
25 - apiBanner = 'http://new.yohobuy.com/common/getbanner',  
26 - thirdLineNum = 9, 22 +var thirdLineNum = 9,
27 delayer, 23 delayer,
28 centerFn, 24 centerFn,
29 loginFn, 25 loginFn,
30 cartFn; 26 cartFn;
31 27
32 -$('#api-domain').remove(); // 删除地址信息  
33 -  
34 // handlebars模板 28 // handlebars模板
35 -// centerFn = handlebars.compile($('#simple-account-info-tpl').html());  
36 -// loginFn = handlebars.compile($('#header-login-info-tpl').html());  
37 -// cartFn = handlebars.compile($('#mini-cart-tpl').html()); 29 +centerFn = handlebars.compile($('#simple-account-info-tpl').html());
  30 +loginFn = handlebars.compile($('#header-login-info-tpl').html());
  31 +cartFn = handlebars.compile($('#mini-cart-tpl').html());
38 32
39 // handlebars helper 33 // handlebars helper
40 -// handlebars.registerHelper('notzero', function(v1, options) {  
41 -// if (v1 !== '0') {  
42 -// return options.fn(this);  
43 -// } else {  
44 -// return options.inverse(this);  
45 -// }  
46 -// }); 34 +handlebars.registerHelper('notzero', function(v1, options) {
  35 + if (v1 !== '0') {
  36 + return options.fn(this);
  37 + } else {
  38 + return options.inverse(this);
  39 + }
  40 +});
47 41
48 // 格式化三级菜单 42 // 格式化三级菜单
49 function formatThirdMenu() { 43 function formatThirdMenu() {
@@ -91,7 +85,7 @@ function syncLoginInfo() { @@ -91,7 +85,7 @@ function syncLoginInfo() {
91 method: 'open.passport.get' 85 method: 'open.passport.get'
92 }; 86 };
93 87
94 - $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) { 88 + $.getJSON('http://www.yohobuy.com/common/passport/?callback=?', param, function(jsonData) {
95 if (jsonData && jsonData.data && jsonData.data.result !== -1) { 89 if (jsonData && jsonData.data && jsonData.data.result !== -1) {
96 updateLoginInfo(jsonData.data.data); 90 updateLoginInfo(jsonData.data.data);
97 } else { 91 } else {
@@ -110,7 +104,7 @@ function searchSuggest(key) { @@ -110,7 +104,7 @@ function searchSuggest(key) {
110 query: key 104 query: key
111 }; 105 };
112 106
113 - $.getJSON('http://search.yohobuy.com/api/suggest/?callback=?', param, function(jsonData) { 107 + $.getJSON('http://search.yohobuy.com/api/suggest?callback=?', param, function(jsonData) {
114 if (jsonData.code === 200) { 108 if (jsonData.code === 200) {
115 if (jsonData.data && jsonData.data.length) { 109 if (jsonData.data && jsonData.data.length) {
116 $searchSug.html(jsonData.data).show(); 110 $searchSug.html(jsonData.data).show();
@@ -123,72 +117,72 @@ function searchSuggest(key) { @@ -123,72 +117,72 @@ function searchSuggest(key) {
123 117
124 // 同步mini购物车数据 118 // 同步mini购物车数据
125 function syncCratInfo(strG) { 119 function syncCratInfo(strG) {
126 - // var info, total;  
127 - //  
128 - // if (strG) {  
129 - // window.setCookie('_g', strG, {  
130 - // path: '/',  
131 - // domain: '.yohobuy.com'  
132 - // });  
133 - // }  
134 - // if (window.cookie('_g')) {  
135 - // info = json2.parse(window.cookie('_g'));  
136 - // total = parseInt(info._nac) + parseInt(info._ac);  
137 - // total = total > 0 ? total : 0;  
138 - // $goCart.data({  
139 - // key: info._k,  
140 - // num: total  
141 - // });  
142 - // $goodsNum.text(total);  
143 - // } 120 + var info, total;
  121 +
  122 + if (strG) {
  123 + window.setCookie('_g', strG, {
  124 + path: '/',
  125 + domain: '.yohobuy.com'
  126 + });
  127 + }
  128 + if (window.cookie('_g')) {
  129 + info = $.parseJSON(window.cookie('_g'));
  130 + total = parseInt(info._nac, 10) + parseInt(info._ac, 10);
  131 + total = total > 0 ? total : 0;
  132 + $goCart.data({
  133 + key: info._k,
  134 + num: total
  135 + });
  136 + $goodsNum.text(total);
  137 + }
144 } 138 }
145 139
146 function loadCartDetail(key) { 140 function loadCartDetail(key) {
147 - // var param = {  
148 - // return_type: 'jsonp',  
149 - // method: 'open.Shoppingcart.getCartData',  
150 - // shopping_key: key  
151 - // };  
152 - //  
153 - // $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) {  
154 - // var totalGoods, data;  
155 - //  
156 - // if (jsonData.code === 200) {  
157 - // data = jsonData.data;  
158 - // totalGoods = $.merge(data.main_goods, data.advance_goods);  
159 - // totalGoods = $.merge(totalGoods, data.outlet_goods);  
160 - // totalGoods = $.merge(totalGoods, data.gift_goods);  
161 - // totalGoods = $.merge(totalGoods, data.need_pay_gifts);  
162 - // if (totalGoods && totalGoods.length) {  
163 - // data.totalGoods = totalGoods;  
164 - // $miniCart.html(cartFn({  
165 - // carData: data  
166 - // }));  
167 - // } else {  
168 - // $miniCart.html('<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>');  
169 - // }  
170 - // }  
171 - // }); 141 + var param = {
  142 + return_type: 'jsonp',
  143 + method: 'open.Shoppingcart.getCartData',
  144 + shopping_key: key
  145 + };
  146 +
  147 + $.getJSON('http://www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) {
  148 + var totalGoods, data;
  149 +
  150 + if (jsonData.code === 200) {
  151 + data = jsonData.data;
  152 + totalGoods = $.merge(data.main_goods, data.advance_goods);
  153 + totalGoods = $.merge(totalGoods, data.outlet_goods);
  154 + totalGoods = $.merge(totalGoods, data.gift_goods);
  155 + totalGoods = $.merge(totalGoods, data.need_pay_gifts);
  156 + if (totalGoods && totalGoods.length) {
  157 + data.totalGoods = totalGoods;
  158 + $miniCart.html(cartFn({
  159 + carData: data
  160 + }));
  161 + } else {
  162 + $miniCart.html('<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>');
  163 + }
  164 + }
  165 + });
172 } 166 }
173 167
174 function delCartGoods(data, callback) { 168 function delCartGoods(data, callback) {
175 - // var param = {  
176 - // return_type: 'jsonp',  
177 - // method: 'open.Shoppingcart.delone',  
178 - // shopping_key: data.key,  
179 - // id: data.id,  
180 - // isreduce: data.isreduce  
181 - // };  
182 - //  
183 - // $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) {  
184 - // var strG = '';  
185 - //  
186 - // if (jsonData.code === 200) {  
187 - // callback();  
188 - // strG = '{"_k":"' + data.key + '","_nac":' + jsonData.data.total_goods_num + ',"_ac":0,"_r":0}';  
189 - // syncCratInfo(strG);  
190 - // }  
191 - // }); 169 + var param = {
  170 + return_type: 'jsonp',
  171 + method: 'open.Shoppingcart.delone',
  172 + shopping_key: data.key,
  173 + id: data.id,
  174 + isreduce: data.isreduce
  175 + };
  176 +
  177 + $.getJSON('http://www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) {
  178 + var strG = '';
  179 +
  180 + if (jsonData.code === 200) {
  181 + strG = '{"_k":"' + data.key + '","_nac":' + jsonData.data.total_goods_num + ',"_ac":0,"_r":0}';
  182 + syncCratInfo(strG);
  183 + return callback();
  184 + }
  185 + });
192 } 186 }
193 187
194 syncLoginInfo(); 188 syncLoginInfo();
@@ -240,9 +234,10 @@ $searchForm.on('keyup', '.search-key', function(e) { @@ -240,9 +234,10 @@ $searchForm.on('keyup', '.search-key', function(e) {
240 $(this).val(val); 234 $(this).val(val);
241 searchSuggest(val); 235 searchSuggest(val);
242 } 236 }
243 -  
244 - // http://search.yohobuy.com/api/suggest  
245 - // searchSuggest 237 +}).on('blur', '.search-key', function() {
  238 + setTimeout(function() {
  239 + $searchSug.hide();
  240 + }, 200);
246 }); 241 });
247 242
248 $goCart.hover(function() { 243 $goCart.hover(function() {
@@ -265,7 +260,7 @@ $goCart.hover(function() { @@ -265,7 +260,7 @@ $goCart.hover(function() {
265 $goCart.removeClass('on-hover'); 260 $goCart.removeClass('on-hover');
266 }); 261 });
267 262
268 -$goCart.on('click', '.cart-goods-del', function(e) { 263 +$goCart.on('click', '.cart-goods-del', function() {
269 var $dom = $(this), 264 var $dom = $(this),
270 data = $dom.data(), 265 data = $dom.data(),
271 callback; 266 callback;
@@ -297,14 +292,14 @@ $subNav.on({ @@ -297,14 +292,14 @@ $subNav.on({
297 param.width = 174; 292 param.width = 174;
298 param.height = 155; 293 param.height = 155;
299 param._ = new Date(); 294 param._ = new Date();
300 - // $.getJSON(apiBanner + '/?callback=?', param, function(JsonData) {  
301 - // if (JsonData.code === 200) {  
302 - // $show.addClass('show');  
303 - // $show.find('img').attr('src', JsonData.data.src);  
304 - // $show.find('a').attr('href', JsonData.data.url);  
305 - // $show.find('.title').text(JsonData.data.title);  
306 - // }  
307 - // }); 295 + $.getJSON('http://new.yohobuy.com/common/getbanner?callback=?', param, function(JsonData) {
  296 + if (JsonData.code === 200) {
  297 + $show.addClass('show');
  298 + $show.find('img').attr('src', JsonData.data.src);
  299 + $show.find('a').attr('href', JsonData.data.url);
  300 + $show.find('.title').text(JsonData.data.title);
  301 + }
  302 + });
308 }, 303 },
309 mouseleave: function() { 304 mouseleave: function() {
310 var $thirdNav = $(this).children('.third-nav-wrapper'); 305 var $thirdNav = $(this).children('.third-nav-wrapper');
@@ -315,6 +310,3 @@ $subNav.on({ @@ -315,6 +310,3 @@ $subNav.on({
315 $thirdNav.hide(); 310 $thirdNav.hide();
316 } 311 }
317 }); 312 });
318 -  
319 -  
320 -/* eslint-ensable */  
1 -require('../header'); 1 +require('../common');
@@ -387,4 +387,4 @@ @@ -387,4 +387,4 @@
387 .footer-help li { 387 .footer-help li {
388 width: 150px; 388 width: 150px;
389 } 389 }
390 -} 390 +}
@@ -48,6 +48,7 @@ @@ -48,6 +48,7 @@
48 span { 48 span {
49 display: inline-block; 49 display: inline-block;
50 vertical-align: middle; 50 vertical-align: middle;
  51 + line-height: 30px;
51 } 52 }
52 53
53 .hi { 54 .hi {
@@ -343,7 +344,7 @@ @@ -343,7 +344,7 @@
343 border: none; 344 border: none;
344 background: #fff; 345 background: #fff;
345 box-sizing: border-box; 346 box-sizing: border-box;
346 - padding: 7px 0 7px 10px; 347 + padding: 7px 0 9px 10px;
347 } 348 }
348 349
349 .search-btn { 350 .search-btn {
@@ -415,7 +416,7 @@ @@ -415,7 +416,7 @@
415 top: 30px; 416 top: 30px;
416 right: -14px; 417 right: -14px;
417 width: 378px; 418 width: 378px;
418 - background: #f8f8f8 reslove('layout/empty_car.png') no-repeat 106px 132px; 419 + background: #f8f8f8 resolve('layout/empty_car.png') no-repeat 106px 132px;
419 z-index: 1000; 420 z-index: 1000;
420 display: none; 421 display: none;
421 422