Showing
5 changed files
with
92 additions
and
42 deletions
@@ -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,6 +27,43 @@ class HaveGainApplyPage extends Page { | @@ -26,6 +27,43 @@ class HaveGainApplyPage extends Page { | ||
26 | } | 27 | } |
27 | 28 | ||
28 | init() { | 29 | init() { |
30 | + let ua = navigator.userAgent.toLowerCase(); | ||
31 | + let isWeixin = ua.indexOf('micromessenger') !== -1; | ||
32 | + let clipboard = new Clipboard('.added', { | ||
33 | + text: function() { | ||
34 | + return '有货有赚'; | ||
35 | + } | ||
36 | + }); | ||
37 | + | ||
38 | + new Clipboard('.apply-btn', { | ||
39 | + text: function() { | ||
40 | + return '有货有赚'; | ||
41 | + } | ||
42 | + }); | ||
43 | + | ||
44 | + clipboard.on('success', function(e) { | ||
45 | + let hasFooter = { | ||
46 | + leftBtnText: '取消', | ||
47 | + rightBtnText: '去添加' | ||
48 | + }; | ||
49 | + | ||
50 | + if (isWeixin) { | ||
51 | + hasFooter = { | ||
52 | + centerBtnText: '确认' | ||
53 | + }; | ||
54 | + } | ||
55 | + | ||
56 | + dialog.showDialog({ | ||
57 | + dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加', | ||
58 | + hasClass: 'dialog-text-apply', | ||
59 | + hasFooter: hasFooter | ||
60 | + }, function() { | ||
61 | + window.location.href = 'weixin://'; | ||
62 | + }); | ||
63 | + | ||
64 | + e.clearSelection(); | ||
65 | + }); | ||
66 | + | ||
29 | this.bindEvents(); | 67 | this.bindEvents(); |
30 | } | 68 | } |
31 | 69 | ||
@@ -146,28 +184,6 @@ class HaveGainApplyPage extends Page { | @@ -146,28 +184,6 @@ class HaveGainApplyPage extends Page { | ||
146 | }); | 184 | }); |
147 | } | 185 | } |
148 | 186 | ||
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) { | 187 | tapAgreement(event) { |
172 | let $event = $(event.target); | 188 | let $event = $(event.target); |
173 | 189 | ||
@@ -232,10 +248,6 @@ class HaveGainApplyPage extends Page { | @@ -232,10 +248,6 @@ class HaveGainApplyPage extends Page { | ||
232 | return tip.show(res.message || '请稍后再试'); | 248 | return tip.show(res.message || '请稍后再试'); |
233 | } | 249 | } |
234 | 250 | ||
235 | - if (window.yohoInterface) { | ||
236 | - yoho.invokeMethod('go.copy', {text: '有货有赚'}); | ||
237 | - } | ||
238 | - | ||
239 | dialog.showDialog({ | 251 | dialog.showDialog({ |
240 | hasHeader: '申请成功', | 252 | hasHeader: '申请成功', |
241 | hasClass: 'dialog-text-apply', | 253 | 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,24 +15,35 @@ class HaveGainVerifyPage extends Page { | @@ -15,24 +15,35 @@ class HaveGainVerifyPage extends Page { | ||
15 | } | 15 | } |
16 | 16 | ||
17 | init() { | 17 | init() { |
18 | - this.bindEvents(); | ||
19 | - } | ||
20 | - | ||
21 | - bindEvents() {} | 18 | + let ua = navigator.userAgent.toLowerCase(); |
19 | + let isWeixin = ua.indexOf('micromessenger') !== -1; | ||
20 | + let clipboard = new Clipboard('.add-btn', { | ||
21 | + text: function() { | ||
22 | + return '有货有赚'; | ||
23 | + } | ||
24 | + }); | ||
22 | 25 | ||
23 | - tapAdded() { | ||
24 | - if (window.yohoInterface) { | ||
25 | - yoho.invokeMethod('go.copy', {text: '有货有赚'}); | ||
26 | - } | ||
27 | - dialog.showDialog({ | ||
28 | - dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加', | ||
29 | - hasClass: 'dialog-text-apply', | ||
30 | - hasFooter: { | 26 | + clipboard.on('success', function(e) { |
27 | + let hasFooter = { | ||
31 | leftBtnText: '取消', | 28 | leftBtnText: '取消', |
32 | rightBtnText: '去添加' | 29 | rightBtnText: '去添加' |
30 | + }; | ||
31 | + | ||
32 | + if (isWeixin) { | ||
33 | + hasFooter = { | ||
34 | + centerBtnText: '确认' | ||
35 | + }; | ||
33 | } | 36 | } |
34 | - }, function() { | ||
35 | - window.location.href = 'weixin://'; | 37 | + |
38 | + dialog.showDialog({ | ||
39 | + dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加', | ||
40 | + hasClass: 'dialog-text-apply', | ||
41 | + hasFooter: hasFooter | ||
42 | + }, function() { | ||
43 | + window.location.href = 'weixin://'; | ||
44 | + }); | ||
45 | + | ||
46 | + e.clearSelection(); | ||
36 | }); | 47 | }); |
37 | } | 48 | } |
38 | } | 49 | } |
@@ -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" |
-
Please register or login to post a comment