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');
exports.tideCommand = (req, res, next) => {
let uid = req.user.uid,
contentCode = '29958987ef0c0f830fad03d7e54f6061';
contentCode = '29958987ef0c0f830fad03d7e54f6061',
hideTips = req.query.hideTips === 'true' ? true : false;
req.ctx(tideCommandModel).invitionData(uid, contentCode).then(result => {
req.ctx(tideCommandModel).invitionData(uid, contentCode, hideTips).then(result => {
res.render('tide-command', {
page: 'tide-command',
pageHeader: headerModel.setNav({
... ...
... ... @@ -388,7 +388,8 @@ class familyModel extends global.yoho.BaseModel {
value: data.num,
name: data.source,
percent: parseInt(data.proportion, 10) * 100 + '%',
color: data.colour
color: data.colour,
plateType: data.type
});
colorList.push(data.colour);
... ...
... ... @@ -39,13 +39,14 @@ module.exports = class extends global.yoho.BaseModel {
});
}
invitionData(uid, contentCode) {
invitionData(uid, contentCode, hideTips) {
return api.all([this.invitionText(uid), this.resources(contentCode)]).then((result) => {
let finaData = {};
finaData = Object.assign(finaData, result[0]);
finaData.imgSrc = _.get(result[1], 'data[0].src', '');
finaData.resourcesUrl = _.get(result[1], 'data[0].url', '');
finaData.hideTips = hideTips;
return finaData;
});
... ...
... ... @@ -7,5 +7,8 @@
<input id="upload-img" type="file" />
</span>
</div>
{{#if isWechat}}
<div class="submit">提交</div>
{{/if}}
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -8,7 +8,7 @@
<span class="world-number">15</span>
<div class="introduce">
<div class="introduce{{#if hideTips}} hide{{/if}}">
<div class="rules">
{{#if mytrendWordPageDesc}}
<span class="title">玩转潮流口令,超值福利等你拿</span>
... ...
... ... @@ -53,54 +53,60 @@ lazyLoad();
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function(e) {
function submit() {
let suggestText = $('#suggest-textarea').val(),
textReg = /\S+/;
if (!textReg.test(suggestText)) {
diaLog.showDialog({
autoHide: true,
dialogText: '意见不能为空'
});
if ($(e.target).hasClass('nav-btn')) {
return;
}
if (!textReg.test(suggestText)) {
$.ajax({
method: 'post',
url: '/home/savesuggest',
data: {
content: suggestText,
image: imgStr
}
}).then(function(data) {
if (data.code === 200) {
diaLog.showDialog({
autoHide: true,
dialogText: '意见不能为空'
dialogText: '提交成功'
});
return;
}
$.ajax({
method: 'post',
url: '/home/savesuggest',
data: {
content: suggestText,
image: imgStr
}
}).then(function(data) {
if (data.code === 200) {
diaLog.showDialog({
autoHide: true,
dialogText: '提交成功'
});
setTimeout(function() {
location.pathname = 'home/suggest';
}, 2000);
} else {
diaLog.showDialog({
autoHide: true,
dialogText: '提交失败~'
});
}
}).fail(function() {
setTimeout(function() {
location.pathname = 'home/suggest';
}, 2000);
} else {
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
dialogText: '提交失败~'
});
}
}).fail(function() {
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
}
headerNavHammer.on('tap', function(e) {
if ($(e.target).hasClass('nav-btn')) {
submit();
}
});
$('.submit').on('click', function() {
submit();
});
if (document.getElementById('img-form') !== null) {
formHammer = new Hammer(document.getElementById('img-form'));
... ...
require('home/tide-command.page.css');
let tip = require('plugin/tip');
let qs = require('yoho-qs');
let trendWord;
$('.tide-command-page').css('min-height', function() {
... ... @@ -46,8 +45,4 @@ $('.save').click(function() {
(function() {
$('.world-number').html(15 - $('.command-textarea').val().length);
if (qs.hideTips && qs.hideTips === 'true') {
$('.introduce').hide();
}
}());
... ...
... ... @@ -176,6 +176,18 @@
outline: none;
resize: none;
}
.submit {
width: 350px;
height: 70px;
margin: 0 auto;
background: #000;
color: #fff;
text-align: center;
line-height: 70px;
margin-top: 180px;
border-radius: 10px;
}
}
.img-form {
... ...
... ... @@ -150,10 +150,10 @@
.code-set {
background-image: resolve("home/index/code-set.png");
background-repeat: no-repeat;
background-size: 100%;
background-size: 100% 90%;
display: inline-block;
width: 40px;
height: 40px;
height: 44px;
margin-left: 5px;
}
... ...
... ... @@ -83,7 +83,7 @@
.coffee {
.code-copy {
top: -684px;
left: 356px;
left: 364px;
}
}
... ...