Authored by 王水玲

有货有赚 复制粘贴

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