|
@@ -83,7 +83,6 @@
|
|
|
<img class="sure-text" src="../static/img/changePhoneActivity/sure-text.png" />
|
|
|
</div>
|
|
|
</div>
|
|
|
- <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="inviteCopy" disabled="true" value="">
|
|
|
</div>
|
|
|
<script>
|
|
|
toastr.options.positionClass = 'toast-center-center';
|
|
@@ -190,19 +189,15 @@
|
|
|
//复制
|
|
|
function copyUrl(){
|
|
|
stopManyClick(() => {
|
|
|
- //加载数据
|
|
|
- var href = window.location.href;
|
|
|
- var copyBefore = JSON.stringify(href);
|
|
|
- var copyUrl = copyBefore.split('"');
|
|
|
- console.log(copyUrl[1])
|
|
|
- $('#inviteCopy').val(copyUrl[1]);
|
|
|
- var input = document.getElementById("inviteCopy");
|
|
|
- // 选中文本
|
|
|
- input.select();
|
|
|
- // 执行浏览器复制命令
|
|
|
- document.execCommand("copy");
|
|
|
+ var oInput = document.createElement('input'); //创建一个input
|
|
|
+ oInput.setAttribute("readonly", "readonly");//设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
|
|
|
+ oInput.value = window.location.href;
|
|
|
+ document.body.appendChild(oInput);//将input插入到body
|
|
|
+ oInput.select(); // 选择对象
|
|
|
+ document.execCommand("Copy"); // 执行浏览器复制命令
|
|
|
toastr.error('复制当前网址成功!');
|
|
|
- $('#inviteCopy').blur();
|
|
|
+ oInput.style.display='none'; // 将input隐藏
|
|
|
+ oInput.remove(); // 将input销毁
|
|
|
})
|
|
|
}
|
|
|
//点击选择框
|