Authored by 王水玲

有货有赚复制粘贴功能

... ... @@ -30,7 +30,7 @@
{{/if}}
</div>
{{/socialMediaList}}
<p class="other">如果您有其他渠道,可以添加我们的服务号“有货有赚”反馈,也可以了解您的申请状态</p>
<p class="other">如果您有其他渠道,可以添加我们的服务号“有货有赚”反馈,也可以了解您的申请状态<em class="added">点击添加</em></p>
</div>
<div class="agreement-section">
<div class="agreement">
... ...
... ... @@ -58,6 +58,7 @@
"body-parser": "^1.18.0",
"cheerio": "^0.22.0",
"client-sessions": "^0.8.0",
"clipboard": "^2.0.1",
"compression": "^1.7.2",
"connect-multiparty": "^2.0.0",
"connect-redis": "^3.3.3",
... ...
... ... @@ -6,6 +6,7 @@ import dialog from 'js/plugin/dialog';
import fillInHbs from 'hbs/activity/have-gain/fill-in.hbs';
import yoho from 'js/yoho-app';
import parse from 'yoho-qs/parse';
import Clipboard from 'clipboard';
class HaveGainApplyPage extends Page {
constructor() {
... ... @@ -26,6 +27,43 @@ class HaveGainApplyPage extends Page {
}
init() {
let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') !== -1;
let clipboard = new Clipboard('.added', {
text: function() {
return '有货有赚';
}
});
new Clipboard('.apply-btn', {
text: function() {
return '有货有赚';
}
});
clipboard.on('success', function(e) {
let hasFooter = {
leftBtnText: '取消',
rightBtnText: '去添加'
};
if (isWeixin) {
hasFooter = {
centerBtnText: '确认'
};
}
dialog.showDialog({
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
hasClass: 'dialog-text-apply',
hasFooter: hasFooter
}, function() {
window.location.href = 'weixin://';
});
e.clearSelection();
});
this.bindEvents();
}
... ... @@ -146,28 +184,6 @@ class HaveGainApplyPage extends Page {
});
}
tapAdded() {
let that = this;
if (window.yohoInterface) {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
}
dialog.showDialog({
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
hasClass: 'dialog-text-apply',
hasFooter: {
leftBtnText: '取消',
rightBtnText: '去添加'
}
}, function() {
that.awakeWeixin();
});
}
awakeWeixin() {
window.location.href = 'weixin://';
}
tapAgreement(event) {
let $event = $(event.target);
... ... @@ -232,10 +248,6 @@ class HaveGainApplyPage extends Page {
return tip.show(res.message || '请稍后再试');
}
if (window.yohoInterface) {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
}
dialog.showDialog({
hasHeader: '申请成功',
hasClass: 'dialog-text-apply',
... ...
... ... @@ -2,7 +2,7 @@ import 'scss/activity/have-gain-verify.page.scss';
import Page from 'js/yoho-page';
import $ from 'yoho-jquery';
import dialog from 'js/plugin/dialog';
import yoho from 'js/yoho-app';
import Clipboard from 'clipboard';
class HaveGainVerifyPage extends Page {
constructor() {
... ... @@ -15,24 +15,35 @@ class HaveGainVerifyPage extends Page {
}
init() {
this.bindEvents();
}
bindEvents() {}
let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') !== -1;
let clipboard = new Clipboard('.add-btn', {
text: function() {
return '有货有赚';
}
});
tapAdded() {
if (window.yohoInterface) {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
}
dialog.showDialog({
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
hasClass: 'dialog-text-apply',
hasFooter: {
clipboard.on('success', function(e) {
let hasFooter = {
leftBtnText: '取消',
rightBtnText: '去添加'
};
if (isWeixin) {
hasFooter = {
centerBtnText: '确认'
};
}
}, function() {
window.location.href = 'weixin://';
dialog.showDialog({
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
hasClass: 'dialog-text-apply',
hasFooter: hasFooter
}, function() {
window.location.href = 'weixin://';
});
e.clearSelection();
});
}
}
... ...
... ... @@ -2078,6 +2078,14 @@ client-sessions@^0.8.0:
dependencies:
cookies "^0.7.0"
clipboard@^2.0.1:
version "2.0.1"
resolved "http://npm.yohops.com/clipboard/-/clipboard-2.0.1.tgz#a12481e1c13d8a50f5f036b0560fe5d16d74e46a"
dependencies:
good-listener "^1.2.2"
select "^1.1.2"
tiny-emitter "^2.0.0"
cliui@^2.1.0:
version "2.1.0"
resolved "http://npm.yohops.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
... ... @@ -3019,6 +3027,10 @@ delayed-stream@~1.0.0:
version "1.0.0"
resolved "http://npm.yohops.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
delegate@^3.1.2:
version "3.2.0"
resolved "http://npm.yohops.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166"
delegates@^1.0.0:
version "1.0.0"
resolved "http://npm.yohops.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
... ... @@ -4305,6 +4317,12 @@ gonzales-pe@4.2.3:
dependencies:
minimist "1.1.x"
good-listener@^1.2.2:
version "1.2.2"
resolved "http://npm.yohops.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50"
dependencies:
delegate "^3.1.2"
got@^6.7.1:
version "6.7.1"
resolved "http://npm.yohops.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0"
... ... @@ -8855,6 +8873,10 @@ select-hose@^2.0.0:
version "2.0.0"
resolved "http://npm.yohops.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca"
select@^1.1.2:
version "1.1.2"
resolved "http://npm.yohops.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"
selfsigned@^1.9.1:
version "1.10.3"
resolved "http://npm.yohops.com/selfsigned/-/selfsigned-1.10.3.tgz#d628ecf9e3735f84e8bafba936b3cf85bea43823"
... ... @@ -9782,6 +9804,10 @@ timsort@^0.3.0:
version "0.3.0"
resolved "http://npm.yohops.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"
tiny-emitter@^2.0.0:
version "2.0.2"
resolved "http://npm.yohops.com/tiny-emitter/-/tiny-emitter-2.0.2.tgz#82d27468aca5ade8e5fd1e6d22b57dd43ebdfb7c"
tmp@^0.0.33:
version "0.0.33"
resolved "http://npm.yohops.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
... ...