...
|
...
|
@@ -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,9 +27,54 @@ class HaveGainApplyPage extends Page { |
|
|
}
|
|
|
|
|
|
init() {
|
|
|
let that = this;
|
|
|
let clipboard = new Clipboard('.added', {
|
|
|
text: function() {
|
|
|
return '有货有赚';
|
|
|
}
|
|
|
});
|
|
|
|
|
|
new Clipboard('.apply-btn', {
|
|
|
text: function() {
|
|
|
return '有货有赚';
|
|
|
}
|
|
|
});
|
|
|
|
|
|
clipboard.on('success', function(e) {
|
|
|
that.copyDialog();
|
|
|
e.clearSelection();
|
|
|
});
|
|
|
|
|
|
clipboard.on('error', function() {
|
|
|
that.copyDialog();
|
|
|
});
|
|
|
|
|
|
this.bindEvents();
|
|
|
}
|
|
|
|
|
|
copyDialog() {
|
|
|
let ua = navigator.userAgent.toLowerCase();
|
|
|
let isWeixin = ua.indexOf('micromessenger') !== -1;
|
|
|
let hasFooter = {
|
|
|
leftBtnText: '取消',
|
|
|
rightBtnText: '去添加'
|
|
|
};
|
|
|
|
|
|
if (isWeixin) {
|
|
|
hasFooter = {
|
|
|
centerBtnText: '确认'
|
|
|
};
|
|
|
}
|
|
|
|
|
|
dialog.showDialog({
|
|
|
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
|
|
|
hasClass: 'dialog-text-apply',
|
|
|
hasFooter: hasFooter
|
|
|
}, function() {
|
|
|
window.location.href = 'weixin://';
|
|
|
});
|
|
|
}
|
|
|
|
|
|
bindEvents() {
|
|
|
let that = this;
|
|
|
|
...
|
...
|
@@ -146,28 +192,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 +256,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',
|
...
|
...
|
|