Authored by zhangxiaoru

分享样式

@@ -151,6 +151,9 @@ app.use((req, res, next) => { @@ -151,6 +151,9 @@ app.use((req, res, next) => {
151 next(); 151 next();
152 }); 152 });
153 153
  154 +// 添加请求上下文
  155 +app.use(global.yoho.httpCtx());
  156 +
154 // dispatcher 157 // dispatcher
155 try { 158 try {
156 const user = require('./doraemon/middleware/user'); 159 const user = require('./doraemon/middleware/user');
  1 +'use strict';
  2 +
  3 +// const shareBuyModel = require('../models/share-buy'),
  4 + // headerModel = require('../../../doraemon/models/header');
  5 +
  6 +exports.index = (req, res) => {
  7 + // let uid = req.user.uid;
  8 +
  9 + // req.ctx(shareBuyModel).shareIndex(uid).then(data => {
  10 + res.render('share-buy/share-buy', {
  11 + localCss: true,
  12 + width750: true,
  13 + title: '分享购'
  14 + });
  15 +
  16 + // }).catch(next);
  17 +};
  18 +
  19 +exports.detail = (req, res) => {
  20 + // let uid = req.user.uid;
  21 +
  22 + res.render('share-buy/share-detail', {
  23 + localCss: true,
  24 + width750: true,
  25 + title: '分享购',
  26 + page: 'share-buy'
  27 + });
  28 +};
  1 +// const config = global.yoho.config;
  2 +
  3 +// module.exports = class extends global.yoho.BaseModel {
  4 +
  5 +// shareIndex(uid) {
  6 +
  7 +// let data = {
  8 +// content_code: 'ec9eb72eae121fcd6c1b7d1de75caff1'
  9 +// }
  10 +
  11 +// let options = {
  12 +// url: 'operations/api/v5/resource/get',
  13 +// data: data,
  14 +// param: {
  15 +// cache: true,
  16 +// code: 200
  17 +// },
  18 +// api: global.yoho.ServiceAPI
  19 +// };
  20 +
  21 +// return this.get(options).then(result => {
  22 +// return result;
  23 +// });
  24 +// };
  25 +// };
@@ -43,6 +43,8 @@ const appDownloads = require(`${cRoot}/app-downloads`); @@ -43,6 +43,8 @@ const appDownloads = require(`${cRoot}/app-downloads`);
43 const redbag = require(`${cRoot}/redbag`); 43 const redbag = require(`${cRoot}/redbag`);
44 const annualAccount = require(`${cRoot}/annual-account`); 44 const annualAccount = require(`${cRoot}/annual-account`);
45 45
  46 +const shareBuy = require(`${cRoot}/share-buy`);
  47 +
46 // routers 48 // routers
47 49
48 router.get('/demo', demo.index); 50 router.get('/demo', demo.index);
@@ -238,4 +240,7 @@ router.get('/app-downloads', appDownloads.index); @@ -238,4 +240,7 @@ router.get('/app-downloads', appDownloads.index);
238 240
239 router.get('/couponSend', couponFloor.couponSend); // 获取优惠券 241 router.get('/couponSend', couponFloor.couponSend); // 获取优惠券
240 242
  243 +router.get('/share-buy', shareBuy.index); // 分享购首页
  244 +router.get('/share-buy/detail', shareBuy.detail); // 分享购详情页
  245 +
241 module.exports = router; 246 module.exports = router;
  1 +<div class="share-buy-page yoho-page">
  2 + <div class="share-title"></div>
  3 +
  4 + <div class="coupon-list">
  5 + <div class="coupon-group">
  6 + <div class="coupon-left">
  7 + <p class="coupon-money">
  8 + <i class="iconfont"></i>
  9 + <span class="money">50</span>
  10 + </p>
  11 + <p class="coupon-type">现金券</p>
  12 + </div>
  13 + <div class="coupon-right">
  14 + <span>立即参与</span>
  15 + <p class="coupon-mold">品牌卷</p>
  16 + <p class="coupon-limit">全场通用</p>
  17 + </div>
  18 + </div>
  19 + <div class="coupon-group">
  20 + <div class="coupon-left">
  21 + <p class="coupon-money">
  22 + <i class="iconfont"></i>
  23 + <span class="money">50</span>
  24 + </p>
  25 + <p class="coupon-type">现金券</p>
  26 + </div>
  27 + <div class="coupon-right">
  28 + <span>立即参与</span>
  29 + <p class="coupon-mold">品牌卷</p>
  30 + <p class="coupon-limit">全场通用</p>
  31 + </div>
  32 + </div>
  33 + </div>
  34 +
  35 + <div class="news-flash">
  36 + <span class="news-title">返利快讯</span>
  37 + <ul class="news">
  38 + <li>1234545</li>
  39 + <li>qweee</li>
  40 + <li>是的是的</li>
  41 + </ul>
  42 + </div>
  43 +
  44 + <div class="tab">
  45 + <a>我的返利收益</a>
  46 + <a>分享购攻略</a>
  47 + </div>
  48 +
  49 +</div>
  1 +<div class="share-buy-page yoho-page">
  2 + <div class="share-title"></div>
  3 +
  4 + <div class="coupon-list">
  5 + <div class="coupon-group">
  6 + <div class="coupon-left">
  7 + <p class="coupon-money">
  8 + <i class="iconfont"></i>
  9 + <span class="money">50</span>
  10 + </p>
  11 + <p class="coupon-type">现金券</p>
  12 + </div>
  13 + <div class="coupon-right">
  14 + <span>立即参与</span>
  15 + <p class="coupon-mold">品牌卷</p>
  16 + <p class="coupon-limit">全场通用</p>
  17 + </div>
  18 + </div>
  19 + <div class="coupon-group">
  20 + <div class="coupon-left">
  21 + <p class="coupon-money">
  22 + <i class="iconfont"></i>
  23 + <span class="money">50</span>
  24 + </p>
  25 + <p class="coupon-type">现金券</p>
  26 + </div>
  27 + <div class="coupon-right">
  28 + <span>立即参与</span>
  29 + <p class="coupon-mold">品牌卷</p>
  30 + <p class="coupon-limit">全场通用</p>
  31 + </div>
  32 + </div>
  33 + </div>
  34 +
  35 + <div class="news-flash">
  36 + <span class="news-title">返利快讯</span>
  37 + <ul class="news">
  38 + <li>1234545</li>
  39 + <li>qweee</li>
  40 + <li>是的是的</li>
  41 + </ul>
  42 + </div>
  43 +
  44 + <div class="tab">
  45 + <a>我的返利收益</a>
  46 + <a>分享购攻略</a>
  47 + </div>
  48 +
  49 +</div>
  50 +
  51 +{{!-- <div>{{message}}1111</div>
  52 +<div class="activity-time" data-time-s="">
  53 + <span></span>
  54 + <span></span>天
  55 + <span></span>
  56 + <span></span>小时
  57 + <span></span>
  58 + <span></span>分钟
  59 + <span></span>
  60 + <span></span>秒
  61 +</div>
  62 +<div class="gonggao">
  63 + <ul class="gun">
  64 + <li>1234545</li>
  65 + <li>qweee</li>
  66 + <li>是的是的</li>
  67 + </ul>
  68 +</div> --}}
  69 +
  1 +<div class="share-detail-page">
  2 + <div class="coupon-detail">
  3 + <div class="countdown">
  4 + <div class="title">距离活动时间还剩:</div>
  5 + <div class="activity-time">
  6 + <span></span>
  7 + <span></span>
  8 + <span></span>
  9 + <span></span>小时
  10 + <span></span>
  11 + <span></span>分钟
  12 + <span></span>
  13 + <span></span>
  14 + </div>
  15 + </div>
  16 +
  17 + <div class="coupon-info">
  18 + <div class="info-top">
  19 + <div class="coupon-money">
  20 + <i class="iconfont"></i>
  21 + <span>50</span>
  22 + </div>
  23 + <span class="coupon-code">fhewlfhwefh</span>
  24 + <span class="copy">复制</span>
  25 + <p class="share-way">(券码可直接分享给好友)
  26 + <span class="coupon-type">现金券<span>
  27 + </p>
  28 + </div>
  29 + <div class="info-bottom">
  30 + <span class="share-coupon">全场通用</span>
  31 + <span class="coupon-tip">特列商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。</span>
  32 + <span class="validity">有效期</span>
  33 + </div>
  34 +
  35 + <p class="use-way">
  36 + 使用方法:<br>
  37 + 复制以上优惠券码,在有货APP优惠券列表页兑换券码或结
  38 + 算时优惠券栏输入扣减; <br>
  39 + 券码一个账户仅可使用1次。
  40 + </p>
  41 + </div>
  42 + </div>
  43 +</div>
@@ -14,8 +14,12 @@ const domains = { @@ -14,8 +14,12 @@ const domains = {
14 liveApi: 'http://testapi.live.yohops.com:9999/', 14 liveApi: 'http://testapi.live.yohops.com:9999/',
15 singleApi: 'http://api-test3.yohops.com:9999/', 15 singleApi: 'http://api-test3.yohops.com:9999/',
16 16
17 - api: 'http://api-test3.yohops.com:9999/',  
18 - service: 'http://service-test3.yohops.com:9999/', 17 + // api: 'http://api-test3.yohops.com:9999/',
  18 + // service: 'http://service-test3.yohops.com:9999/',
  19 +
  20 + api: 'http://api.yoho.cn/',
  21 + service: 'http://service.yoho.cn/',
  22 +
19 global: 'http://api-global.yohobuy.com', 23 global: 'http://api-global.yohobuy.com',
20 store: 'http://192.168.102.210:8080/portal-gateway/', 24 store: 'http://192.168.102.210:8080/portal-gateway/',
21 25
  1 +'use strict';
  2 +
  3 +let $ = require('yoho-jquery');
  4 +
  5 + // tip = require('plugin/tip');
  6 +
  7 +let $activityTime = $('.activity-time'),
  8 + endTime = $activityTime ? $activityTime.data('time-s') : '';
  9 +
  10 +let params = {
  11 + anHour: 3600, // 1小时=?秒
  12 + aMinute: 60, // 1分钟=?秒
  13 + aSecond: 1, // 1秒=?秒
  14 + timeDom: $activityTime, // 时间对象数组
  15 + endTime: [endTime] // 时间差数组
  16 +};
  17 +
  18 +require('activity/share-buy.page.css');
  19 +
  20 +if ($('.share-buy-page').height() < $(window).height()) {
  21 + $('.share-buy-page').height($(window).height());
  22 +}
  23 +
  24 +function division(time) {
  25 + time = time > 10 ? time + '' : '0' + time;
  26 +
  27 + let timeArr = time.split('');
  28 +
  29 + return timeArr;
  30 +}
  31 +
  32 +// 倒计时
  33 +function getRTime(conf) {
  34 + let d = 0,
  35 + h = 0,
  36 + m = 0,
  37 + s = 0;
  38 +
  39 + conf.timeDom.each(function(key, item) {
  40 + conf.endTime[key] = conf.endTime[key] - conf.aSecond;
  41 +
  42 + if (conf.endTime[key] > conf.aSecond) {
  43 + d = Math.floor(conf.endTime[key] / conf.anHour / 24);
  44 + h = Math.floor(conf.endTime[key] / conf.anHour % 24);
  45 + m = Math.floor(conf.endTime[key] / conf.aMinute % 60);
  46 + s = Math.floor(conf.endTime[key] / conf.aSecond % 60);
  47 +
  48 + // showTime += d > 0 ? d + '天' : '';
  49 + // showTime += h > 0 ? h + '小时' : '';
  50 + // showTime += m + '分钟';
  51 + // showTime += s > 0 ? s + '秒' : '';
  52 +
  53 + // if (showTime.length !== '') {
  54 + // showTime = '剩' + showTime;
  55 + // }
  56 +
  57 + // console.log(m, division(m));
  58 +
  59 + $(item).find('span').eq(0).html(division(d)[0]);
  60 + $(item).find('span').eq(1).html(division(d)[1]);
  61 + $(item).find('span').eq(2).html(division(h)[0]);
  62 + $(item).find('span').eq(3).html(division(h)[1]);
  63 + $(item).find('span').eq(4).html(division(m)[0]);
  64 + $(item).find('span').eq(5).html(division(m)[1]);
  65 + $(item).find('span').eq(6).html(division(s)[0]);
  66 + $(item).find('span').eq(7).html(division(s)[1]);
  67 +
  68 + $(item).fadeIn();
  69 + } else {
  70 + $(item).hide();
  71 + }
  72 + });
  73 +}
  74 +
  75 +function startCountDown(p) {
  76 + $.extend(params, p || {});
  77 + setInterval(function() {
  78 + getRTime(params);
  79 + }, 1000);
  80 +}
  81 +
  82 +$.ajax({
  83 + type: 'GET',
  84 + url: '/product/sale/discount/getTime',
  85 + data: {
  86 + id: 3919
  87 + },
  88 + success: function(data) {
  89 + if (data) {
  90 +
  91 + startCountDown({
  92 + endTime: [data]
  93 + });
  94 + }
  95 + }
  96 +});
  97 +
  98 +function Marquee() {
  99 + $('.news').animate({
  100 + marginTop: '-' + $('.news').find('li:first').height() + 'px'
  101 + }, 1000, function() {
  102 + $(this).css({ marginTop: '0px' }).find('li:first').appendTo(this);
  103 + });
  104 +}
  105 +
  106 +if ($('.news').find('li').length > 1) {
  107 +
  108 + setInterval(Marquee, 2000);
  109 +}
  1 +.share-buy-page {
  2 + width: 100%;
  3 + height: 100%;
  4 + background-image: resolve("activity/share-buy/back.png");
  5 + background-size: 100%;
  6 + padding-top: 110px;
  7 +
  8 + .share-title {
  9 + background-image: resolve("activity/share-buy/body.png");
  10 + width: 580px;
  11 + height: 197px;
  12 + background-size: 100%;
  13 + margin: auto;
  14 + }
  15 +
  16 + .coupon-list {
  17 + background-color: #d0021b;
  18 + margin: 115px 30px 0;
  19 + padding: 30px 0;
  20 + }
  21 +
  22 + .coupon-group {
  23 + margin: 0 20px 30px;
  24 + background-image: resolve("activity/share-buy/coupon.png");
  25 + background-size: 100%;
  26 + width: 651px;
  27 + height: 190px;
  28 + padding-top: 25px;
  29 +
  30 + .coupon-left {
  31 + float: left;
  32 + width: 180px;
  33 + text-align: center;
  34 +
  35 + .coupon-money {
  36 + color: #d0021b;
  37 + font-size: 34px;
  38 + }
  39 +
  40 + .money {
  41 + font-size: 70px;
  42 + font-family: DINCond;
  43 + }
  44 +
  45 + .coupon-type {
  46 + font-size: 24px;
  47 + color: #b0b0b0;
  48 + }
  49 + }
  50 +
  51 + .coupon-right {
  52 + width: 470px;
  53 + float: left;
  54 + padding-left: 36px;
  55 +
  56 + .coupon-mold {
  57 + font-size: 30px;
  58 + line-height: 96px;
  59 + font-weight: 700;
  60 + font-family: PingFang;
  61 + }
  62 +
  63 + .coupon-limit {
  64 + font-size: 22px;
  65 + color: #b0b0b0;
  66 + line-height: 40px;
  67 + }
  68 +
  69 + span {
  70 + float: right;
  71 + margin: 45px 35px 0 0;
  72 + display: block;
  73 + width: 130px;
  74 + height: 50px;
  75 + line-height: 50px;
  76 + font-size: 28px;
  77 + color: #fff;
  78 + background-color: #d0021b;
  79 + text-align: center;
  80 + }
  81 + }
  82 +
  83 + &:last-child {
  84 + margin-bottom: 0;
  85 + }
  86 + }
  87 +
  88 + .news-flash {
  89 + height: 70px;
  90 + overflow: hidden;
  91 + text-align: center;
  92 + color: #fff;
  93 + margin: 30px;
  94 +
  95 + .news-title {
  96 + display: block;
  97 + float: left;
  98 + width: 150px;
  99 + height: 70px;
  100 + background-color: #d0021b;
  101 + color: #fff;
  102 + font-size: 30px;
  103 + line-height: 70px;
  104 + }
  105 +
  106 + .news {
  107 + background-color: #222;
  108 +
  109 + li {
  110 + height: 70px;
  111 + width: 100%;
  112 + font-size: 24px;
  113 + line-height: 70px;
  114 + }
  115 + }
  116 + }
  117 +
  118 + .tab {
  119 + width: 100%;
  120 + height: 125px;
  121 + background-color: #d0021b;
  122 + position: fixed;
  123 + bottom: 0;
  124 + z-index: 10;
  125 +
  126 + a {
  127 + width: 50%;
  128 + height: 125px;
  129 + line-height: 125px;
  130 + text-align: center;
  131 + display: block;
  132 + float: left;
  133 + color: #fff;
  134 + font-size: 34px;
  135 + }
  136 + }
  137 +}
  138 +
  139 +.share-detail-page {
  140 + .coupon-detail {
  141 + margin: 30px;
  142 + background-color: #d0021b;
  143 + }
  144 +
  145 + .countdown {
  146 + color: #fff;
  147 + text-align: center;
  148 + margin: 5px 0 40px;
  149 +
  150 + .title {
  151 + height: 70px;
  152 + line-height: 70px;
  153 + }
  154 +
  155 + .activity-time {
  156 + font-size: 22px;
  157 +
  158 + span {
  159 + display: inline-block;
  160 + width: 35px;
  161 + height: 45px;
  162 + font-size: 32px;
  163 + background-color: #bb0218;
  164 + }
  165 + }
  166 + }
  167 +
  168 + .coupon-info {
  169 + background-image: resolve("activity/share-buy/coupon-detail.png");
  170 + background-size: 100%;
  171 + background-repeat: no-repeat;
  172 + padding: 50px 20px 0;
  173 +
  174 + .info-top {
  175 + padding: 0 30px;
  176 + }
  177 +
  178 + .coupon-money {
  179 + float: right;
  180 + font-size: 28px;
  181 + height: 56px;
  182 +
  183 + .iconfont {
  184 + vertical-align: top;
  185 + }
  186 +
  187 + span {
  188 + position: relative;
  189 + top: -17px;
  190 + font-size: 70px;
  191 + }
  192 + }
  193 +
  194 + .coupon-code {
  195 + display: inline-block;
  196 + font-size: 28px;
  197 + }
  198 +
  199 + .copy {
  200 + display: inline-block;
  201 + width: 90px;
  202 + height: 40px;
  203 + background-color: #444;
  204 + color: #fff;
  205 + font-size: 24px;
  206 + line-height: 40px;
  207 + text-align: center;
  208 + border-radius: 5px;
  209 + }
  210 +
  211 + .share-way {
  212 + width: 100%;
  213 + color: #b0b0b0;
  214 + font-size: 24px;
  215 + display: inline-block;
  216 +
  217 + .coupon-type {
  218 + float: right;
  219 + }
  220 + }
  221 +
  222 + .info-bottom {
  223 + color: #b0b0b0;
  224 + font-size: 24px;
  225 + padding: 40px 30px 0;
  226 +
  227 + span {
  228 + display: inline-block;
  229 + }
  230 +
  231 + .validity {
  232 + height: 42px;
  233 + line-height: 42px;
  234 + }
  235 + }
  236 +
  237 + .use-way {
  238 + margin-top: 45px;
  239 + padding-bottom: 20px;
  240 + font-size: 24px;
  241 + color: #fff;
  242 + }
  243 + }
  244 +}
  1 +@import "share-buy/share-detail";