Showing
8 changed files
with
99 additions
and
16 deletions
@@ -112,3 +112,12 @@ exports.inviteReg = (req, res) => { | @@ -112,3 +112,12 @@ exports.inviteReg = (req, res) => { | ||
112 | page: 'invite-reg' | 112 | page: 'invite-reg' |
113 | }); | 113 | }); |
114 | }; | 114 | }; |
115 | + | ||
116 | +exports.setTrendWorld = (req, res, next) => { | ||
117 | + let uid = req.user.uid; | ||
118 | + let trendWord = req.query.trendWord; | ||
119 | + | ||
120 | + req.ctx(expandModel).setTrendWorld(uid, trendWord).then(result => { | ||
121 | + res.json(result); | ||
122 | + }).catch(next); | ||
123 | +}; |
@@ -91,4 +91,18 @@ module.exports = class extends global.yoho.BaseModel { | @@ -91,4 +91,18 @@ module.exports = class extends global.yoho.BaseModel { | ||
91 | } | 91 | } |
92 | }); | 92 | }); |
93 | } | 93 | } |
94 | + | ||
95 | + /** | ||
96 | + * 设置我的潮流口令 | ||
97 | + */ | ||
98 | + setTrendWorld(uid, trendWord) { | ||
99 | + return api.get('', { | ||
100 | + method: 'app.trendword.update', | ||
101 | + uid: uid, | ||
102 | + trendWord: trendWord | ||
103 | + }).then((result) => { | ||
104 | + | ||
105 | + return result; | ||
106 | + }); | ||
107 | + } | ||
94 | }; | 108 | }; |
@@ -268,5 +268,6 @@ router.get('/reward-list', expand.rewardList); // 拓展新客 æˆ‘çš„å¥–åŠ±åˆ—è¡ | @@ -268,5 +268,6 @@ router.get('/reward-list', expand.rewardList); // 拓展新客 æˆ‘çš„å¥–åŠ±åˆ—è¡ | ||
268 | router.get('/reward-detail', auth, expand.rewardDetail); // 拓展新客 我的奖励详情页 | 268 | router.get('/reward-detail', auth, expand.rewardDetail); // 拓展新客 我的奖励详情页 |
269 | router.get('/friend-invite', expand.friendInvite); // 拓展新客 好友邀请页 | 269 | router.get('/friend-invite', expand.friendInvite); // 拓展新客 好友邀请页 |
270 | router.get('/invite-reg', expand.inviteReg); // 注册成功 | 270 | router.get('/invite-reg', expand.inviteReg); // 注册成功 |
271 | +router.get('/set-trend-world', expand.setTrendWorld); // 注册成功 | ||
271 | 272 | ||
272 | module.exports = router; | 273 | module.exports = router; |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -// const mRoot = '../models'; | ||
4 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 3 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
5 | -// const tideCommandModel = require(`${mRoot}/tideCommandModel`); | 4 | +const tideCommandModel = require('../models/tide-command'); |
6 | 5 | ||
7 | -exports.tideCommand = (req, res) => { | ||
8 | - res.render('tide-command', { | ||
9 | - page: 'tide-command', | ||
10 | - pageHeader: headerModel.setNav({ | ||
11 | - navTitle: '我的潮流口令', | ||
12 | - navBtn: false, | ||
13 | - save: true | ||
14 | - }), | ||
15 | - title: '我的潮流口令', | ||
16 | - width750: true, | ||
17 | - localCss: true | ||
18 | - }); | 6 | +exports.tideCommand = (req, res, next) => { |
7 | + let uid = req.user.uid; | ||
8 | + | ||
9 | + req.ctx(tideCommandModel).invitionData(uid).then(result => { | ||
10 | + res.render('tide-command', { | ||
11 | + page: 'tide-command', | ||
12 | + pageHeader: headerModel.setNav({ | ||
13 | + navTitle: '我的潮流口令', | ||
14 | + navBtn: false, | ||
15 | + save: true | ||
16 | + }), | ||
17 | + title: '我的潮流口令', | ||
18 | + width750: true, | ||
19 | + localCss: true, | ||
20 | + invitionDta: result | ||
21 | + }); | ||
22 | + }).catch(next); | ||
19 | }; | 23 | }; |
1 | +const api = global.yoho.API; | ||
2 | + | ||
3 | +module.exports = class extends global.yoho.BaseModel { | ||
4 | + constructor(ctx) { | ||
5 | + super(ctx); | ||
6 | + } | ||
7 | + | ||
8 | + invitionData(uid) { | ||
9 | + return api.get('', { | ||
10 | + method: 'app.invitecode.my', | ||
11 | + uid: uid | ||
12 | + }, { | ||
13 | + code: 200 | ||
14 | + }).then((result) => { | ||
15 | + | ||
16 | + if (result && result.code === 200 && result.data) { | ||
17 | + | ||
18 | + return result.data; | ||
19 | + } else { | ||
20 | + return {}; | ||
21 | + } | ||
22 | + }); | ||
23 | + } | ||
24 | +}; |
1 | <div class="tide-command-page yoho-page"> | 1 | <div class="tide-command-page yoho-page"> |
2 | - <textarea name="" class="command-textarea" placeholder="请设置您的潮流口令"></textarea> | 2 | + {{# invitionDta}} |
3 | + <textarea name="" class="command-textarea" placeholder="请设置您的潮流口令">{{#if trendWorld}}{{trendWorld}}{{/if}} | ||
4 | + </textarea> | ||
5 | + {{#if trendWorld}} | ||
3 | <span class="close">×</span> | 6 | <span class="close">×</span> |
7 | + {{/if}} | ||
4 | <div class="rules"> | 8 | <div class="rules"> |
5 | <span>您的潮流口令需要是15位以内的字符,使用潮流口令标榜自己的个性与独一无二。</span> | 9 | <span>您的潮流口令需要是15位以内的字符,使用潮流口令标榜自己的个性与独一无二。</span> |
6 | </div> | 10 | </div> |
11 | + {{/ invitionDta}} | ||
7 | </div> | 12 | </div> |
1 | require('home/tide-command.page.css'); | 1 | require('home/tide-command.page.css'); |
2 | 2 | ||
3 | +let tip = require('plugin/tip'); | ||
4 | +let trendWord; | ||
5 | + | ||
3 | $('.tide-command-page').css('min-height', function() { | 6 | $('.tide-command-page').css('min-height', function() { |
4 | return $(window).height(); | 7 | return $(window).height(); |
5 | }); | 8 | }); |
9 | + | ||
10 | +$('.close').click(function() { | ||
11 | + $('.command-textarea').val(''); | ||
12 | +}); | ||
13 | + | ||
14 | +$('.save').click(function() { | ||
15 | + trendWord = $('.command-textarea').val(); | ||
16 | + | ||
17 | + if (!trendWord) { | ||
18 | + tip.show('请输入潮流口令'); | ||
19 | + } | ||
20 | + | ||
21 | + $.ajax({ | ||
22 | + type: 'GET', | ||
23 | + url: '/activity/set-trend-world', | ||
24 | + data: { | ||
25 | + trendWord: trendWord | ||
26 | + }, | ||
27 | + success: function(result) { | ||
28 | + tip.show(result.message); | ||
29 | + } | ||
30 | + }); | ||
31 | +}); |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | width: 100%; | 9 | width: 100%; |
10 | font-size: 28px; | 10 | font-size: 28px; |
11 | line-height: 94px; | 11 | line-height: 94px; |
12 | - color: #b0b0b0; | 12 | + color: #000; |
13 | border: none; | 13 | border: none; |
14 | resize: none; | 14 | resize: none; |
15 | background-color: #fff; | 15 | background-color: #fff; |
-
Please register or login to post a comment