Showing
7 changed files
with
66 additions
and
42 deletions
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | <div class="account-name" data-type="{{type}}"> | 17 | <div class="account-name" data-type="{{type}}"> |
18 | {{#if account}} | 18 | {{#if account}} |
19 | 账号:<em>{{account}}</em> | 19 | 账号:<em>{{account}}</em> |
20 | - 粉丝:<em>{{fans}}</em> | 20 | + 粉丝:<em data-fans="{{fans}}">{{fans}}</em> |
21 | {{/if}} | 21 | {{/if}} |
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
1 | <div class="dialog-fill-content"> | 1 | <div class="dialog-fill-content"> |
2 | <div class="fill-item">账号:<input type="text" class="account" placeholder="请输入账号昵称" value="{{account}}" /></div> | 2 | <div class="fill-item">账号:<input type="text" class="account" placeholder="请输入账号昵称" value="{{account}}" /></div> |
3 | - <div class="fill-item">粉丝数:<input type="text" class="fans" placeholder="请输入粉丝数量" value="{{fans}}" /></div> | 3 | + <div class="fill-item">粉丝数:<input type="text" class="fans" placeholder="请输入粉丝数量" |
4 | + onkeyup="value=value.replace(/[^\d]/g,'')" value="{{fans}}" maxlength="9" /></div> | ||
4 | </div> | 5 | </div> |
@@ -75,14 +75,19 @@ class HaveGainApplyPage extends Page { | @@ -75,14 +75,19 @@ class HaveGainApplyPage extends Page { | ||
75 | hasClass: 'dialog-fill-in', | 75 | hasClass: 'dialog-fill-in', |
76 | dialogText: fillInHbs({ | 76 | dialogText: fillInHbs({ |
77 | account: $accountName.find('em').eq(0).text() || '', | 77 | account: $accountName.find('em').eq(0).text() || '', |
78 | - fans: $accountName.find('em').eq(1).text() || '' | 78 | + fans: $accountName.find('em').eq(1).data('fans') || '' |
79 | }), | 79 | }), |
80 | hasFooter: { | 80 | hasFooter: { |
81 | leftBtnText: '取消', | 81 | leftBtnText: '取消', |
82 | rightBtnText: '去添加' | 82 | rightBtnText: '去添加' |
83 | } | 83 | } |
84 | }, function() { | 84 | }, function() { |
85 | - $accountName.html(`账号:<em>${$('.dialog-fill-in .account').val()}</em> 粉丝:<em>${$('.dialog-fill-in .fans').val()}</em>`); // eslint-disable-line | 85 | + let fans = $('.dialog-fill-in .fans').val() || 0; |
86 | + let fansFix = Math.round((fans / 10000) * 100) / 100; // 保留二个小数 | ||
87 | + | ||
88 | + fansFix = fansFix >= 10 ? fansFix + '万' : fans; | ||
89 | + | ||
90 | + $accountName.html(`账号:<em>${$('.dialog-fill-in .account').val()}</em> 粉丝:<em data-fans="${fans}">${fansFix}</em>`); // eslint-disable-line | ||
86 | dialog.hideDialog(); | 91 | dialog.hideDialog(); |
87 | $event.text('已填写').addClass('disable'); | 92 | $event.text('已填写').addClass('disable'); |
88 | }); | 93 | }); |
@@ -136,7 +141,7 @@ class HaveGainApplyPage extends Page { | @@ -136,7 +141,7 @@ class HaveGainApplyPage extends Page { | ||
136 | socialMediaList.push({ | 141 | socialMediaList.push({ |
137 | type: $accountName.data('type'), | 142 | type: $accountName.data('type'), |
138 | account: $accountName.find('em').eq(0).text() || '', | 143 | account: $accountName.find('em').eq(0).text() || '', |
139 | - fans: $accountName.find('em').eq(1).text() || '' | 144 | + fans: $accountName.find('em').eq(1).data('fans') || '' |
140 | }); | 145 | }); |
141 | }); | 146 | }); |
142 | 147 | ||
@@ -157,7 +162,7 @@ class HaveGainApplyPage extends Page { | @@ -157,7 +162,7 @@ class HaveGainApplyPage extends Page { | ||
157 | }).then(res => { | 162 | }).then(res => { |
158 | this.selector.isFlag = false; | 163 | this.selector.isFlag = false; |
159 | 164 | ||
160 | - if (res.code !== 200) { | 165 | + if ([200, 613].indexOf(res.code) === -1) { |
161 | return tip.show(res.message || '请稍后再试'); | 166 | return tip.show(res.message || '请稍后再试'); |
162 | } | 167 | } |
163 | 168 |
1 | import 'activity/have-gain-verify.page.css'; | 1 | import 'activity/have-gain-verify.page.css'; |
2 | import Page from 'yoho-page'; | 2 | import Page from 'yoho-page'; |
3 | import $ from 'yoho-jquery'; | 3 | import $ from 'yoho-jquery'; |
4 | -import tip from 'plugin/tip'; | 4 | +import dialog from 'plugin/dialog'; |
5 | +import yoho from 'yoho-app'; | ||
5 | 6 | ||
6 | class HaveGainVerifyPage extends Page { | 7 | class HaveGainVerifyPage extends Page { |
7 | constructor() { | 8 | constructor() { |
8 | super(); | 9 | super(); |
9 | 10 | ||
10 | - this.view = { | ||
11 | - header: $('.user-defined-header') | 11 | + this.selector = { |
12 | + $addBtn: $('.esp-go .add-btn') | ||
12 | }; | 13 | }; |
14 | + this.init(); | ||
13 | } | 15 | } |
14 | 16 | ||
15 | - apply() { | ||
16 | - return this.ajax({ | ||
17 | - url: '/activity/grade/graph' | ||
18 | - }).then(res => { | ||
19 | - if (res.code !== 200) { | ||
20 | - return tip.show(res.message); | 17 | + init() { |
18 | + this.bindEvents(); | ||
19 | + } | ||
20 | + | ||
21 | + bindEvents() { | ||
22 | + this.selector.$addBtn.on('click', this.tapAdded.bind(this)); | ||
23 | + } | ||
24 | + | ||
25 | + tapAdded() { | ||
26 | + yoho.invokeMethod('go.copy', {text: '有货有赚'}); | ||
27 | + dialog.showDialog({ | ||
28 | + dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加', | ||
29 | + hasClass: 'dialog-fill-in', | ||
30 | + hasFooter: { | ||
31 | + leftBtnText: '取消', | ||
32 | + rightBtnText: '去添加' | ||
21 | } | 33 | } |
34 | + }, function() { | ||
35 | + window.location.href = 'weixin://'; | ||
22 | }); | 36 | }); |
23 | } | 37 | } |
24 | } | 38 | } |
public/scss/activity/_have-gain-dialog.css
0 → 100644
1 | +.dialog-wrapper .dialog-fill-in { | ||
2 | + background-color: #fff; | ||
3 | + | ||
4 | + .dialog-fill-content { | ||
5 | + padding: 0 10px; | ||
6 | + margin-top: -20px; | ||
7 | + | ||
8 | + .fill-item { | ||
9 | + font-family: PingFang-SC-Regular, sans-serif; | ||
10 | + font-size: 28px; | ||
11 | + color: #444; | ||
12 | + letter-spacing: -0.34px; | ||
13 | + display: flex; | ||
14 | + justify-content: space-between; | ||
15 | + align-items: center; | ||
16 | + margin-bottom: 20px; | ||
17 | + } | ||
18 | + | ||
19 | + input { | ||
20 | + width: 340px; | ||
21 | + height: 60px; | ||
22 | + line-height: 60px; | ||
23 | + border: 0.5px solid #eee; | ||
24 | + padding: 0 10px; | ||
25 | + } | ||
26 | + } | ||
27 | +} |
1 | +@import "have-gain-dialog"; | ||
2 | + | ||
1 | .have-gain-apply { | 3 | .have-gain-apply { |
2 | background-color: #f0f0f0; | 4 | background-color: #f0f0f0; |
3 | 5 | ||
@@ -139,30 +141,3 @@ | @@ -139,30 +141,3 @@ | ||
139 | } | 141 | } |
140 | } | 142 | } |
141 | 143 | ||
142 | -.dialog-wrapper .dialog-fill-in { | ||
143 | - background-color: #fff; | ||
144 | - | ||
145 | - .dialog-fill-content { | ||
146 | - padding: 0 10px; | ||
147 | - margin-top: -20px; | ||
148 | - | ||
149 | - .fill-item { | ||
150 | - font-family: PingFang-SC-Regular, sans-serif; | ||
151 | - font-size: 28px; | ||
152 | - color: #444; | ||
153 | - letter-spacing: -0.34px; | ||
154 | - display: flex; | ||
155 | - justify-content: space-between; | ||
156 | - align-items: center; | ||
157 | - margin-bottom: 20px; | ||
158 | - } | ||
159 | - | ||
160 | - input { | ||
161 | - width: 340px; | ||
162 | - height: 60px; | ||
163 | - line-height: 60px; | ||
164 | - border: 0.5px solid #eee; | ||
165 | - padding: 0 10px; | ||
166 | - } | ||
167 | - } | ||
168 | -} |
-
Please register or login to post a comment