diff --git a/app/view/domain/record.html b/app/view/domain/record.html index 9aa82b3..ee5c5de 100644 --- a/app/view/domain/record.html +++ b/app/view/domain/record.html @@ -276,7 +276,7 @@ $(document).ready(function(){ var domain = value; if(domain === "@") domain = "{$domainName}"; else domain = value + ".{$domainName}"; - return value + ' '; + return value + ''; } }, { @@ -293,13 +293,17 @@ $(document).ready(function(){ title: '线路类型' }, { - field: 'Value', - title: '记录值', - formatter: function(value, row, index) { - if(row.Type == 'MX') return value + ' | '+row.MX; - return value; - } - }, + field: 'Value', + title: '记录值', + formatter: function(value, row, index) { + var display = value; + if(row.Type == 'MX') display = value + ' | ' + row.MX; + var copyId = 'copy-value-' + row.RecordId; + // 只允许安全字符,避免引号问题 + var safeValue = (value+'').replace(/'/g, "'").replace(/\\/g, "\\\\"); + return ''+display+''; + } + }, { field: 'TTL', title: 'TTL' @@ -725,5 +729,28 @@ function advanceSearch(){ $("#searchbox1").slideDown(); } } +function copyToClipboard(text, selector) { + var tempInput = document.createElement('input'); + tempInput.style.position = 'absolute'; + tempInput.style.left = '-9999px'; + tempInput.value = text; + document.body.appendChild(tempInput); + tempInput.select(); + document.execCommand('copy'); + document.body.removeChild(tempInput); + if(selector){ + var icon = document.querySelector(selector + ' + a i'); + if(icon){ + var oldClass = icon.className; + icon.className = 'fa fa-check'; + setTimeout(function(){ icon.className = oldClass; }, 1000); + } + } + if(typeof layer !== 'undefined' && layer.msg){ + layer.msg('已复制到剪贴板'); + }else{ + alert('已复制到剪贴板'); + } +} {/block} \ No newline at end of file