Authored by 陈峰

Merge branch 'hotfix/haveGain' into 'release/9.19'

Hotfix/have gain

有货有赚 复制粘贴

See merge request !1547
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 {{/if}} 30 {{/if}}
31 </div> 31 </div>
32 {{/socialMediaList}} 32 {{/socialMediaList}}
33 - <p class="other">如果您有其他渠道,可以添加我们的服务号“有货有赚”反馈,也可以了解您的申请状态</p> 33 + <p class="other">如果您有其他渠道,可以添加我们的服务号“有货有赚”反馈,也可以了解您的申请状态<em class="added">点击添加</em></p>
34 </div> 34 </div>
35 <div class="agreement-section"> 35 <div class="agreement-section">
36 <div class="agreement"> 36 <div class="agreement">
@@ -58,6 +58,7 @@ @@ -58,6 +58,7 @@
58 "body-parser": "^1.18.0", 58 "body-parser": "^1.18.0",
59 "cheerio": "^0.22.0", 59 "cheerio": "^0.22.0",
60 "client-sessions": "^0.8.0", 60 "client-sessions": "^0.8.0",
  61 + "clipboard": "^2.0.1",
61 "compression": "^1.7.2", 62 "compression": "^1.7.2",
62 "connect-multiparty": "^2.0.0", 63 "connect-multiparty": "^2.0.0",
63 "connect-redis": "^3.3.3", 64 "connect-redis": "^3.3.3",
@@ -6,6 +6,7 @@ import dialog from 'js/plugin/dialog'; @@ -6,6 +6,7 @@ import dialog from 'js/plugin/dialog';
6 import fillInHbs from 'hbs/activity/have-gain/fill-in.hbs'; 6 import fillInHbs from 'hbs/activity/have-gain/fill-in.hbs';
7 import yoho from 'js/yoho-app'; 7 import yoho from 'js/yoho-app';
8 import parse from 'yoho-qs/parse'; 8 import parse from 'yoho-qs/parse';
  9 +import Clipboard from 'clipboard';
9 10
10 class HaveGainApplyPage extends Page { 11 class HaveGainApplyPage extends Page {
11 constructor() { 12 constructor() {
@@ -26,9 +27,54 @@ class HaveGainApplyPage extends Page { @@ -26,9 +27,54 @@ class HaveGainApplyPage extends Page {
26 } 27 }
27 28
28 init() { 29 init() {
  30 + let that = this;
  31 + let clipboard = new Clipboard('.added', {
  32 + text: function() {
  33 + return '有货有赚';
  34 + }
  35 + });
  36 +
  37 + new Clipboard('.apply-btn', {
  38 + text: function() {
  39 + return '有货有赚';
  40 + }
  41 + });
  42 +
  43 + clipboard.on('success', function(e) {
  44 + that.copyDialog();
  45 + e.clearSelection();
  46 + });
  47 +
  48 + clipboard.on('error', function() {
  49 + that.copyDialog();
  50 + });
  51 +
29 this.bindEvents(); 52 this.bindEvents();
30 } 53 }
31 54
  55 + copyDialog() {
  56 + let ua = navigator.userAgent.toLowerCase();
  57 + let isWeixin = ua.indexOf('micromessenger') !== -1;
  58 + let hasFooter = {
  59 + leftBtnText: '取消',
  60 + rightBtnText: '去添加'
  61 + };
  62 +
  63 + if (isWeixin) {
  64 + hasFooter = {
  65 + centerBtnText: '确认'
  66 + };
  67 + }
  68 +
  69 + dialog.showDialog({
  70 + dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
  71 + hasClass: 'dialog-text-apply',
  72 + hasFooter: hasFooter
  73 + }, function() {
  74 + window.location.href = 'weixin://';
  75 + });
  76 + }
  77 +
32 bindEvents() { 78 bindEvents() {
33 let that = this; 79 let that = this;
34 80
@@ -146,28 +192,6 @@ class HaveGainApplyPage extends Page { @@ -146,28 +192,6 @@ class HaveGainApplyPage extends Page {
146 }); 192 });
147 } 193 }
148 194
149 - tapAdded() {  
150 - let that = this;  
151 -  
152 - if (window.yohoInterface) {  
153 - yoho.invokeMethod('go.copy', {text: '有货有赚'});  
154 - }  
155 - dialog.showDialog({  
156 - dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',  
157 - hasClass: 'dialog-text-apply',  
158 - hasFooter: {  
159 - leftBtnText: '取消',  
160 - rightBtnText: '去添加'  
161 - }  
162 - }, function() {  
163 - that.awakeWeixin();  
164 - });  
165 - }  
166 -  
167 - awakeWeixin() {  
168 - window.location.href = 'weixin://';  
169 - }  
170 -  
171 tapAgreement(event) { 195 tapAgreement(event) {
172 let $event = $(event.target); 196 let $event = $(event.target);
173 197
@@ -232,10 +256,6 @@ class HaveGainApplyPage extends Page { @@ -232,10 +256,6 @@ class HaveGainApplyPage extends Page {
232 return tip.show(res.message || '请稍后再试'); 256 return tip.show(res.message || '请稍后再试');
233 } 257 }
234 258
235 - if (window.yohoInterface) {  
236 - yoho.invokeMethod('go.copy', {text: '有货有赚'});  
237 - }  
238 -  
239 dialog.showDialog({ 259 dialog.showDialog({
240 hasHeader: '申请成功', 260 hasHeader: '申请成功',
241 hasClass: 'dialog-text-apply', 261 hasClass: 'dialog-text-apply',
@@ -2,7 +2,7 @@ import 'scss/activity/have-gain-verify.page.scss'; @@ -2,7 +2,7 @@ import 'scss/activity/have-gain-verify.page.scss';
2 import Page from 'js/yoho-page'; 2 import Page from 'js/yoho-page';
3 import $ from 'yoho-jquery'; 3 import $ from 'yoho-jquery';
4 import dialog from 'js/plugin/dialog'; 4 import dialog from 'js/plugin/dialog';
5 -import yoho from 'js/yoho-app'; 5 +import Clipboard from 'clipboard';
6 6
7 class HaveGainVerifyPage extends Page { 7 class HaveGainVerifyPage extends Page {
8 constructor() { 8 constructor() {
@@ -15,22 +15,41 @@ class HaveGainVerifyPage extends Page { @@ -15,22 +15,41 @@ class HaveGainVerifyPage extends Page {
15 } 15 }
16 16
17 init() { 17 init() {
18 - this.bindEvents(); 18 + let that = this;
  19 + let clipboard = new Clipboard('.add-btn', {
  20 + text: function() {
  21 + return '有货有赚';
  22 + }
  23 + });
  24 +
  25 + clipboard.on('success', function(e) {
  26 + that.copyDialog();
  27 + e.clearSelection();
  28 + });
  29 +
  30 + clipboard.on('error', function() {
  31 + that.copyDialog();
  32 + });
19 } 33 }
20 34
21 - bindEvents() {} 35 + copyDialog() {
  36 + let ua = navigator.userAgent.toLowerCase();
  37 + let isWeixin = ua.indexOf('micromessenger') !== -1;
  38 + let hasFooter = {
  39 + leftBtnText: '取消',
  40 + rightBtnText: '去添加'
  41 + };
22 42
23 - tapAdded() {  
24 - if (window.yohoInterface) {  
25 - yoho.invokeMethod('go.copy', {text: '有货有赚'}); 43 + if (isWeixin) {
  44 + hasFooter = {
  45 + centerBtnText: '确认'
  46 + };
26 } 47 }
  48 +
27 dialog.showDialog({ 49 dialog.showDialog({
28 dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加', 50 dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
29 hasClass: 'dialog-text-apply', 51 hasClass: 'dialog-text-apply',
30 - hasFooter: {  
31 - leftBtnText: '取消',  
32 - rightBtnText: '去添加'  
33 - } 52 + hasFooter: hasFooter
34 }, function() { 53 }, function() {
35 window.location.href = 'weixin://'; 54 window.location.href = 'weixin://';
36 }); 55 });
@@ -2078,6 +2078,14 @@ client-sessions@^0.8.0: @@ -2078,6 +2078,14 @@ client-sessions@^0.8.0:
2078 dependencies: 2078 dependencies:
2079 cookies "^0.7.0" 2079 cookies "^0.7.0"
2080 2080
  2081 +clipboard@^2.0.1:
  2082 + version "2.0.1"
  2083 + resolved "http://npm.yohops.com/clipboard/-/clipboard-2.0.1.tgz#a12481e1c13d8a50f5f036b0560fe5d16d74e46a"
  2084 + dependencies:
  2085 + good-listener "^1.2.2"
  2086 + select "^1.1.2"
  2087 + tiny-emitter "^2.0.0"
  2088 +
2081 cliui@^2.1.0: 2089 cliui@^2.1.0:
2082 version "2.1.0" 2090 version "2.1.0"
2083 resolved "http://npm.yohops.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" 2091 resolved "http://npm.yohops.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
@@ -3019,6 +3027,10 @@ delayed-stream@~1.0.0: @@ -3019,6 +3027,10 @@ delayed-stream@~1.0.0:
3019 version "1.0.0" 3027 version "1.0.0"
3020 resolved "http://npm.yohops.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" 3028 resolved "http://npm.yohops.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
3021 3029
  3030 +delegate@^3.1.2:
  3031 + version "3.2.0"
  3032 + resolved "http://npm.yohops.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166"
  3033 +
3022 delegates@^1.0.0: 3034 delegates@^1.0.0:
3023 version "1.0.0" 3035 version "1.0.0"
3024 resolved "http://npm.yohops.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" 3036 resolved "http://npm.yohops.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
@@ -4305,6 +4317,12 @@ gonzales-pe@4.2.3: @@ -4305,6 +4317,12 @@ gonzales-pe@4.2.3:
4305 dependencies: 4317 dependencies:
4306 minimist "1.1.x" 4318 minimist "1.1.x"
4307 4319
  4320 +good-listener@^1.2.2:
  4321 + version "1.2.2"
  4322 + resolved "http://npm.yohops.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50"
  4323 + dependencies:
  4324 + delegate "^3.1.2"
  4325 +
4308 got@^6.7.1: 4326 got@^6.7.1:
4309 version "6.7.1" 4327 version "6.7.1"
4310 resolved "http://npm.yohops.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" 4328 resolved "http://npm.yohops.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0"
@@ -8855,6 +8873,10 @@ select-hose@^2.0.0: @@ -8855,6 +8873,10 @@ select-hose@^2.0.0:
8855 version "2.0.0" 8873 version "2.0.0"
8856 resolved "http://npm.yohops.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" 8874 resolved "http://npm.yohops.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca"
8857 8875
  8876 +select@^1.1.2:
  8877 + version "1.1.2"
  8878 + resolved "http://npm.yohops.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"
  8879 +
8858 selfsigned@^1.9.1: 8880 selfsigned@^1.9.1:
8859 version "1.10.3" 8881 version "1.10.3"
8860 resolved "http://npm.yohops.com/selfsigned/-/selfsigned-1.10.3.tgz#d628ecf9e3735f84e8bafba936b3cf85bea43823" 8882 resolved "http://npm.yohops.com/selfsigned/-/selfsigned-1.10.3.tgz#d628ecf9e3735f84e8bafba936b3cf85bea43823"
@@ -9782,6 +9804,10 @@ timsort@^0.3.0: @@ -9782,6 +9804,10 @@ timsort@^0.3.0:
9782 version "0.3.0" 9804 version "0.3.0"
9783 resolved "http://npm.yohops.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" 9805 resolved "http://npm.yohops.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"
9784 9806
  9807 +tiny-emitter@^2.0.0:
  9808 + version "2.0.2"
  9809 + resolved "http://npm.yohops.com/tiny-emitter/-/tiny-emitter-2.0.2.tgz#82d27468aca5ade8e5fd1e6d22b57dd43ebdfb7c"
  9810 +
9785 tmp@^0.0.33: 9811 tmp@^0.0.33:
9786 version "0.0.33" 9812 version "0.0.33"
9787 resolved "http://npm.yohops.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" 9813 resolved "http://npm.yohops.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"