分享链接复制功能改进

现在复制的链接自带访问密码
This commit is contained in:
Chenx221 2024-02-17 16:53:11 +08:00
parent 4c1bcf0da2
commit 95ef693881
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021

View File

@ -1,7 +1,8 @@
$(document).ready(function() { $(document).ready(function() {
$('#copy-link-button').click(function() { $('#copy-link-button').click(function() {
var shareId = $('table.detail-view tbody tr:first-child td').text(); var shareId = $('table.detail-view tbody tr:first-child td').text();
var shareLink = window.location.origin + '/index.php?r=share%2Faccess&share_id=' + shareId; var accessCode = $('table.detail-view tbody tr:nth-child(3) td').text(); // 获取访问密码
var shareLink = window.location.origin + '/index.php?r=share%2Faccess&share_id=' + shareId + '&access_code=' + accessCode; // 将访问密码添加到分享链接中
navigator.clipboard.writeText(shareLink).then(function() { navigator.clipboard.writeText(shareLink).then(function() {
alert('分享链接已复制到剪贴板'); alert('分享链接已复制到剪贴板');
}).catch(function(error) { }).catch(function(error) {