Authored by 陈峰

Merge branch 'gray' into 'master'

Gray



See merge request !1485
const _ = require('lodash');
const haveGainModel = require('../models/have-gain');
const headerModel = require('../../../doraemon/models/header');
... ... @@ -70,7 +71,21 @@ class HaveGain {
let checkUrl = result.data && result.data.checkUrl || '';
if (checkUrl.indexOf('activity/have-gain/apply') === -1) {
return res.redirect(checkUrl);
// 302无法触发app识别、所以前端跳转
return res.render('have-gain/apply', {
module: 'activity',
page: 'have-gain-apply',
needJump: true,
jumpUrl: checkUrl,
width750: true,
localCss: true,
title: '有货有赚',
pageHeader: !req.yoho.isApp && headerModel.setNav({
navTitle: '有货有赚',
navBtn: false
}),
});
}
return res.render('have-gain/apply', {
... ... @@ -134,6 +149,10 @@ class HaveGain {
body.socialMediaList = JSON.parse(body.socialMediaList || '[]', true);
if (req.yoho.isMiniApp) {
uid.appVersion = _.get(global, 'yoho.config.appVersion');
}
return req.ctx(haveGainModel).submitApply(Object.assign({uid}, body)).then(result => {
return res.json(result);
}).catch(next);
... ...
... ... @@ -13,13 +13,13 @@ module.exports = class extends global.yoho.BaseModel {
this.invitecode(params),
this.checkApply(params)
]).then(res => {
let share = (_.get(res[0], 'data.context', '')).match(/(\d+)/g);
let share = (_.get(res[0], 'data.context', '')).match(/\>(\d+)</g);
let gainList = [
{
url: _.get(res[0], 'data.url', ''),
img: '//img11.static.yhbimg.com/yhb-img01/2018/07/09/10/010d4f185b1a155449966ef12d3ed41490.jpg?imageView2/{mode}/w/{width}/h/{height}', // eslint-disable-line
totalUser: _.get(share, '[0]', 0),
totalCouponNum: _.get(share, '[1]', 0),
totalUser: parseInt(_.get(share, '[0]', 0).replace('>', '').replace('<', ''), 10),
totalCouponNum: parseInt(_.get(share, '[1]', 0).replace('>', '').replace('<', ''), 10),
isShow: true
}, {
url: _.get(res[1], 'data.checkUrl', ''),
... ... @@ -64,7 +64,7 @@ module.exports = class extends global.yoho.BaseModel {
if (checkStatus === 1) { // 审核中
checkUrl = helpers.urlFormat('/activity/have-gain/verify', {});
} else if (checkStatus === 2) { // 审核成功
checkUrl = '//m.yohobuy.com?title=有货有赚&openby:yohobuy={"action":"go.minealliance","params":{"title":"有货有赚"}}'; // eslint-disable-line
checkUrl = helpers.urlFormat('') + '?title=有货有赚&openby:yohobuy={"action":"go.minealliance","params":{"type": "myAlliance", "title":"有货有赚"}}' // eslint-disable-line
} else if (checkStatus === 3) { // 申请拒绝
checkUrl = helpers.urlFormat('/activity/have-gain/fail', {});
}
... ...
<div class="have-gain-apply">
<div class="have-gain-apply" data-jump="{{needJump}}" data-url="{{jumpUrl}}">
{{#unless needJump}}
<div class="section">
<div class="apply-title">基本信息</div>
<ul class="section-ul">
... ... @@ -37,4 +38,5 @@
</div>
<div class="apply-btn disable">申请开通</div>
</div>
{{/unless}}
</div>
... ...
... ... @@ -2,7 +2,7 @@
{{#gainList}}
<div class="have-gain-item">
<div class="item-img">
<img src="{{image img 690 430}}" />
<a href="{{url}}"><img src="{{image img 690 430}}" /></a>
</div>
<div class="item-footer">
{{#if isShow}}
... ...
... ... @@ -244,6 +244,8 @@ module.exports = class extends global.yoho.BaseModel {
});
}
/**
* 获取非红人店铺的店铺装修数据
* @param {int} shopId 店铺id
... ...
{
"name": "yohobuywap-node",
"version": "6.6.22",
"version": "6.6.23",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -12,6 +12,7 @@ class HaveGainApplyPage extends Page {
this.selector = {
isFlag: false,
$apply: $('.have-gain-apply'),
$nameInput: $('.section .name'),
$mobileInput: $('.section .mobile'),
$fillIn: $('.party-icon-item .fill-in'),
... ... @@ -29,6 +30,7 @@ class HaveGainApplyPage extends Page {
bindEvents() {
let that = this;
this.jumpVerify();
this.selector.$nameInput.on('input', this.changeBtnStatus.bind(this));
this.selector.$mobileInput.on('input', this.changeBtnStatus.bind(this));
this.selector.$fillIn.on('click', that.tapFillIn);
... ... @@ -37,6 +39,27 @@ class HaveGainApplyPage extends Page {
this.selector.$applyBtn.on('click', this.apply.bind(this));
}
jumpVerify() {
let jump = this.selector.$apply.data('jump');
let jumpUrl = this.selector.$apply.data('url');
if (jump) {
if (yoho.isApp && jumpUrl.indexOf('go.minealliance') > -1) {
$('body').append('<a id="jump-url" href="javascript:;" style="display: none;"></a>');
$('#jump-url').attr('href', jumpUrl);
setTimeout(() => {
if (window.yohoInterface) {
yoho.invokeMethod('go.back');
}
$('#jump-url')[0].click();
}, 500);
} else {
window.location.href = jumpUrl;
}
}
}
changeBtnStatus() {
let errStatus = 0;
let name = $.trim(this.selector.$nameInput.val());
... ... @@ -104,7 +127,9 @@ class HaveGainApplyPage extends Page {
tapAdded() {
let that = this;
yoho.invokeMethod('go.copy', {text: '有货有赚'});
if (window.yohoInterface) {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
}
dialog.showDialog({
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
hasClass: 'dialog-text-apply',
... ... @@ -171,7 +196,7 @@ class HaveGainApplyPage extends Page {
return this.ajax({
type: 'post',
url: '/activity/have-gain/submitApply',
url: `/activity/have-gain/submitApply${window.location.search}`,
data: {
name: $.trim(this.selector.$nameInput.val()),
mobile: $.trim(this.selector.$mobileInput.val()),
... ... @@ -184,7 +209,10 @@ class HaveGainApplyPage extends Page {
return tip.show(res.message || '请稍后再试');
}
yoho.invokeMethod('go.copy', {text: '有货有赚'});
if (window.yohoInterface) {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
}
dialog.showDialog({
hasHeader: '申请成功',
hasClass: 'dialog-text-apply',
... ...
... ... @@ -23,7 +23,9 @@ class HaveGainVerifyPage extends Page {
}
tapAdded() {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
if (window.yohoInterface) {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
}
dialog.showDialog({
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
hasClass: 'dialog-text-apply',
... ...
body {
background-color: #f0f0f0;
}
.have-gain-index {
background-color: #f0f0f0;
... ...
... ... @@ -2148,6 +2148,15 @@ cosmiconfig@^2.1.0, cosmiconfig@^2.1.1:
parse-json "^2.2.0"
require-from-string "^1.1.0"
cosmiconfig@^4.0.0:
version "4.0.0"
resolved "http://npm.yohops.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc"
dependencies:
is-directory "^0.3.1"
js-yaml "^3.9.0"
parse-json "^4.0.0"
require-from-string "^2.0.1"
cosmiconfig@^5.0.0, cosmiconfig@^5.0.2:
version "5.0.5"
resolved "http://npm.yohops.com/cosmiconfig/-/cosmiconfig-5.0.5.tgz#a809e3c2306891ce17ab70359dc8bdf661fe2cd0"
... ... @@ -4150,6 +4159,18 @@ ignore@^3.3.3, ignore@^3.3.5:
version "3.3.8"
resolved "http://npm.yohops.com/ignore/-/ignore-3.3.8.tgz#3f8e9c35d38708a3a7e0e9abb6c73e7ee7707b2b"
import-cwd@^2.0.0:
version "2.1.0"
resolved "http://npm.yohops.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9"
dependencies:
import-from "^2.1.0"
import-from@^2.1.0:
version "2.1.0"
resolved "http://npm.yohops.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1"
dependencies:
resolve-from "^3.0.0"
import-lazy@^2.1.0:
version "2.1.0"
resolved "http://npm.yohops.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
... ... @@ -6695,7 +6716,7 @@ postcss-less@^2.0.0:
dependencies:
postcss "^5.2.16"
postcss-load-config@^1.1.0, postcss-load-config@^1.2.0:
postcss-load-config@^1.1.0:
version "1.2.0"
resolved "http://npm.yohops.com/postcss-load-config/-/postcss-load-config-1.2.0.tgz#539e9afc9ddc8620121ebf9d8c3673e0ce50d28a"
dependencies:
... ... @@ -6704,6 +6725,13 @@ postcss-load-config@^1.1.0, postcss-load-config@^1.2.0:
postcss-load-options "^1.2.0"
postcss-load-plugins "^2.3.0"
postcss-load-config@^2.0.0:
version "2.0.0"
resolved "http://npm.yohops.com/postcss-load-config/-/postcss-load-config-2.0.0.tgz#f1312ddbf5912cd747177083c5ef7a19d62ee484"
dependencies:
cosmiconfig "^4.0.0"
import-cwd "^2.0.0"
postcss-load-options@^1.2.0:
version "1.2.0"
resolved "http://npm.yohops.com/postcss-load-options/-/postcss-load-options-1.2.0.tgz#b098b1559ddac2df04bc0bb375f99a5cfe2b6d8c"
... ... @@ -6718,13 +6746,13 @@ postcss-load-plugins@^2.3.0:
cosmiconfig "^2.1.1"
object-assign "^4.1.0"
postcss-loader@^2.1.4:
version "2.1.5"
resolved "http://npm.yohops.com/postcss-loader/-/postcss-loader-2.1.5.tgz#3c6336ee641c8f95138172533ae461a83595e788"
postcss-loader@^2.1.6:
version "2.1.6"
resolved "http://npm.yohops.com/postcss-loader/-/postcss-loader-2.1.6.tgz#1d7dd7b17c6ba234b9bed5af13e0bea40a42d740"
dependencies:
loader-utils "^1.1.0"
postcss "^6.0.0"
postcss-load-config "^1.2.0"
postcss-load-config "^2.0.0"
schema-utils "^0.4.0"
postcss-markdown@^0.28.0:
... ... @@ -7752,6 +7780,10 @@ require-from-string@^1.1.0:
version "1.2.1"
resolved "http://npm.yohops.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418"
require-from-string@^2.0.1:
version "2.0.2"
resolved "http://npm.yohops.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
require-main-filename@^1.0.1:
version "1.0.1"
resolved "http://npm.yohops.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
... ...