Authored by 李靖

Merge branch 'feature/family' of git.yoho.cn:fe/yohobuywap-node into feature/family

@@ -5,9 +5,10 @@ const tideCommandModel = require('../models/tide-command'); @@ -5,9 +5,10 @@ const tideCommandModel = require('../models/tide-command');
5 5
6 exports.tideCommand = (req, res, next) => { 6 exports.tideCommand = (req, res, next) => {
7 let uid = req.user.uid, 7 let uid = req.user.uid,
8 - contentCode = '29958987ef0c0f830fad03d7e54f6061'; 8 + contentCode = '29958987ef0c0f830fad03d7e54f6061',
  9 + hideTips = req.query.hideTips === 'true' ? true : false;
9 10
10 - req.ctx(tideCommandModel).invitionData(uid, contentCode).then(result => { 11 + req.ctx(tideCommandModel).invitionData(uid, contentCode, hideTips).then(result => {
11 res.render('tide-command', { 12 res.render('tide-command', {
12 page: 'tide-command', 13 page: 'tide-command',
13 pageHeader: headerModel.setNav({ 14 pageHeader: headerModel.setNav({
@@ -388,7 +388,8 @@ class familyModel extends global.yoho.BaseModel { @@ -388,7 +388,8 @@ class familyModel extends global.yoho.BaseModel {
388 value: data.num, 388 value: data.num,
389 name: data.source, 389 name: data.source,
390 percent: parseInt(data.proportion, 10) * 100 + '%', 390 percent: parseInt(data.proportion, 10) * 100 + '%',
391 - color: data.colour 391 + color: data.colour,
  392 + plateType: data.type
392 }); 393 });
393 394
394 colorList.push(data.colour); 395 colorList.push(data.colour);
@@ -39,13 +39,14 @@ module.exports = class extends global.yoho.BaseModel { @@ -39,13 +39,14 @@ module.exports = class extends global.yoho.BaseModel {
39 }); 39 });
40 } 40 }
41 41
42 - invitionData(uid, contentCode) { 42 + invitionData(uid, contentCode, hideTips) {
43 return api.all([this.invitionText(uid), this.resources(contentCode)]).then((result) => { 43 return api.all([this.invitionText(uid), this.resources(contentCode)]).then((result) => {
44 let finaData = {}; 44 let finaData = {};
45 45
46 finaData = Object.assign(finaData, result[0]); 46 finaData = Object.assign(finaData, result[0]);
47 finaData.imgSrc = _.get(result[1], 'data[0].src', ''); 47 finaData.imgSrc = _.get(result[1], 'data[0].src', '');
48 finaData.resourcesUrl = _.get(result[1], 'data[0].url', ''); 48 finaData.resourcesUrl = _.get(result[1], 'data[0].url', '');
  49 + finaData.hideTips = hideTips;
49 50
50 return finaData; 51 return finaData;
51 }); 52 });
@@ -7,5 +7,8 @@ @@ -7,5 +7,8 @@
7 <input id="upload-img" type="file" /> 7 <input id="upload-img" type="file" />
8 </span> 8 </span>
9 </div> 9 </div>
  10 + {{#if isWechat}}
  11 + <div class="submit">提交</div>
  12 + {{/if}}
10 </div> 13 </div>
11 </div> 14 </div>
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 <span class="world-number">15</span> 9 <span class="world-number">15</span>
10 10
11 - <div class="introduce"> 11 + <div class="introduce{{#if hideTips}} hide{{/if}}">
12 <div class="rules"> 12 <div class="rules">
13 {{#if mytrendWordPageDesc}} 13 {{#if mytrendWordPageDesc}}
14 <span class="title">玩转潮流口令,超值福利等你拿</span> 14 <span class="title">玩转潮流口令,超值福利等你拿</span>
@@ -53,54 +53,60 @@ lazyLoad(); @@ -53,54 +53,60 @@ lazyLoad();
53 53
54 headerNavHammer = new Hammer(document.getElementById('yoho-header')); 54 headerNavHammer = new Hammer(document.getElementById('yoho-header'));
55 55
56 -headerNavHammer.on('tap', function(e) { 56 +function submit() {
57 let suggestText = $('#suggest-textarea').val(), 57 let suggestText = $('#suggest-textarea').val(),
58 textReg = /\S+/; 58 textReg = /\S+/;
59 59
  60 + if (!textReg.test(suggestText)) {
  61 + diaLog.showDialog({
  62 + autoHide: true,
  63 + dialogText: '意见不能为空'
  64 + });
60 65
61 - if ($(e.target).hasClass('nav-btn')) { 66 + return;
  67 + }
62 68
63 - if (!textReg.test(suggestText)) { 69 + $.ajax({
  70 + method: 'post',
  71 + url: '/home/savesuggest',
  72 + data: {
  73 + content: suggestText,
  74 + image: imgStr
  75 + }
  76 + }).then(function(data) {
  77 + if (data.code === 200) {
64 diaLog.showDialog({ 78 diaLog.showDialog({
65 autoHide: true, 79 autoHide: true,
66 - dialogText: '意见不能为空' 80 + dialogText: '提交成功'
67 }); 81 });
68 -  
69 - return;  
70 - }  
71 -  
72 - $.ajax({  
73 - method: 'post',  
74 - url: '/home/savesuggest',  
75 - data: {  
76 - content: suggestText,  
77 - image: imgStr  
78 - }  
79 - }).then(function(data) {  
80 - if (data.code === 200) {  
81 - diaLog.showDialog({  
82 - autoHide: true,  
83 - dialogText: '提交成功'  
84 - });  
85 - setTimeout(function() {  
86 - location.pathname = 'home/suggest';  
87 - }, 2000);  
88 - } else {  
89 - diaLog.showDialog({  
90 - autoHide: true,  
91 - dialogText: '提交失败~'  
92 - });  
93 - }  
94 - }).fail(function() {  
95 - 82 + setTimeout(function() {
  83 + location.pathname = 'home/suggest';
  84 + }, 2000);
  85 + } else {
96 diaLog.showDialog({ 86 diaLog.showDialog({
97 autoHide: true, 87 autoHide: true,
98 - dialogText: '网络错误~' 88 + dialogText: '提交失败~'
99 }); 89 });
  90 + }
  91 + }).fail(function() {
  92 +
  93 + diaLog.showDialog({
  94 + autoHide: true,
  95 + dialogText: '网络错误~'
100 }); 96 });
  97 + });
  98 +}
  99 +
  100 +headerNavHammer.on('tap', function(e) {
  101 + if ($(e.target).hasClass('nav-btn')) {
  102 + submit();
101 } 103 }
102 }); 104 });
103 105
  106 +$('.submit').on('click', function() {
  107 + submit();
  108 +});
  109 +
104 if (document.getElementById('img-form') !== null) { 110 if (document.getElementById('img-form') !== null) {
105 formHammer = new Hammer(document.getElementById('img-form')); 111 formHammer = new Hammer(document.getElementById('img-form'));
106 112
1 require('home/tide-command.page.css'); 1 require('home/tide-command.page.css');
2 2
3 let tip = require('plugin/tip'); 3 let tip = require('plugin/tip');
4 -let qs = require('yoho-qs');  
5 let trendWord; 4 let trendWord;
6 5
7 $('.tide-command-page').css('min-height', function() { 6 $('.tide-command-page').css('min-height', function() {
@@ -46,8 +45,4 @@ $('.save').click(function() { @@ -46,8 +45,4 @@ $('.save').click(function() {
46 45
47 (function() { 46 (function() {
48 $('.world-number').html(15 - $('.command-textarea').val().length); 47 $('.world-number').html(15 - $('.command-textarea').val().length);
49 -  
50 - if (qs.hideTips && qs.hideTips === 'true') {  
51 - $('.introduce').hide();  
52 - }  
53 }()); 48 }());
@@ -176,6 +176,18 @@ @@ -176,6 +176,18 @@
176 outline: none; 176 outline: none;
177 resize: none; 177 resize: none;
178 } 178 }
  179 +
  180 + .submit {
  181 + width: 350px;
  182 + height: 70px;
  183 + margin: 0 auto;
  184 + background: #000;
  185 + color: #fff;
  186 + text-align: center;
  187 + line-height: 70px;
  188 + margin-top: 180px;
  189 + border-radius: 10px;
  190 + }
179 } 191 }
180 192
181 .img-form { 193 .img-form {
@@ -150,10 +150,10 @@ @@ -150,10 +150,10 @@
150 .code-set { 150 .code-set {
151 background-image: resolve("home/index/code-set.png"); 151 background-image: resolve("home/index/code-set.png");
152 background-repeat: no-repeat; 152 background-repeat: no-repeat;
153 - background-size: 100%; 153 + background-size: 100% 90%;
154 display: inline-block; 154 display: inline-block;
155 width: 40px; 155 width: 40px;
156 - height: 40px; 156 + height: 44px;
157 margin-left: 5px; 157 margin-left: 5px;
158 } 158 }
159 159
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 .coffee { 83 .coffee {
84 .code-copy { 84 .code-copy {
85 top: -684px; 85 top: -684px;
86 - left: 356px; 86 + left: 364px;
87 } 87 }
88 } 88 }
89 89