Authored by lijing

市场推广

@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 6
7 var express = require('express'), 7 var express = require('express'),
8 path = require('path'), 8 path = require('path'),
9 - hbs = require('express-handlebars'); 9 + hbs = require('express-handlebars'),
  10 + helpers = require(path.join(global.utils, 'helpers'));
10 11
11 var app = express(); 12 var app = express();
12 13
@@ -23,7 +24,7 @@ app.engine('.hbs', hbs({ @@ -23,7 +24,7 @@ app.engine('.hbs', hbs({
23 defaultLayout: 'layout', 24 defaultLayout: 'layout',
24 layoutsDir: doraemon, 25 layoutsDir: doraemon,
25 partialsDir: ['./views/partial', `${doraemon}/partial`], 26 partialsDir: ['./views/partial', `${doraemon}/partial`],
26 - helpers: global.yoho.helpers 27 + helpers: Object.assign({}, global.yoho.helpers, helpers)
27 })); 28 }));
28 29
29 // router 30 // router
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 </div> 18 </div>
19 {{# floorAdListTitle}} 19 {{# floorAdListTitle}}
20 <div class="floor-top"> 20 <div class="floor-top">
21 - <img src="../img/activity/market/floor-top-1.jpg" /> 21 + <img src="{{imgSrc '/img/activity/market/floor-top-1.jpg'}}" />
22 </div> 22 </div>
23 {{/ floorAdListTitle}} 23 {{/ floorAdListTitle}}
24 <ul class="floor-ul"> 24 <ul class="floor-ul">
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </ul> 33 </ul>
34 {{# newsList}} 34 {{# newsList}}
35 <div class="floor-top"> 35 <div class="floor-top">
36 - <img src="../img/activity/market/floor-top-2.jpg" /> 36 + <img src="{{imgSrc '/img/activity/market/floor-top-2.jpg'}}" />
37 </div> 37 </div>
38 <div class="floor-c"> 38 <div class="floor-c">
39 <a href="{{url}}"> 39 <a href="{{url}}">
@@ -13,6 +13,7 @@ module.exports = { @@ -13,6 +13,7 @@ module.exports = {
13 app: 'h5', 13 app: 'h5',
14 port: 6001, 14 port: 6001,
15 siteUrl: '//m.yohobuy.com', 15 siteUrl: '//m.yohobuy.com',
  16 + assetUrl: '//localhost:5001',
16 domains: { 17 domains: {
17 // api: 'http://devapi.yoho.cn:58078/', 18 // api: 'http://devapi.yoho.cn:58078/',
18 // service: 'http://devservice.yoho.cn:58077/' 19 // service: 'http://devservice.yoho.cn:58077/'
@@ -88,6 +89,7 @@ module.exports = { @@ -88,6 +89,7 @@ module.exports = {
88 if (isProduction) { 89 if (isProduction) {
89 Object.assign(module.exports, { 90 Object.assign(module.exports, {
90 appName: 'm.yohobuy.com', 91 appName: 'm.yohobuy.com',
  92 + assetUrl: '//cdn.yoho.cn/m-yohobuy-node/assets',
91 domains: { 93 domains: {
92 api: 'http://api.yoho.yohoops.org/', 94 api: 'http://api.yoho.yohoops.org/',
93 service: 'http://service.yoho.yohoops.org/', 95 service: 'http://service.yoho.yohoops.org/',
@@ -117,6 +119,7 @@ if (isProduction) { @@ -117,6 +119,7 @@ if (isProduction) {
117 } else if (isTest) { 119 } else if (isTest) {
118 Object.assign(module.exports, { 120 Object.assign(module.exports, {
119 appName: 'm.yohobuy.com for test', 121 appName: 'm.yohobuy.com for test',
  122 + assetUrl: '//cdn.yoho.cn/m-yohobuy-node/assets',
120 domains: { 123 domains: {
121 api: 'http://api-test3.yohops.com:9999/', 124 api: 'http://api-test3.yohops.com:9999/',
122 service: 'http://service-test3.yohops.com:9999/', 125 service: 'http://service-test3.yohops.com:9999/',
  1 +const url = require('url');
  2 +const config = require('../config/common');
  3 +const assetUrl = config.assetUrl;
  4 +
  5 +module.exports = {
  6 + imgSrc: function(imgSrc) {
  7 + return url.resolve(assetUrl, imgSrc);
  8 + }
  9 +};