|
@@ -527,47 +527,76 @@
|
|
|
let timer,
|
|
|
isFlag = true;
|
|
|
function showShearPlate() {
|
|
|
- stopManyClick(() => {
|
|
|
- $('.box-shear-plate').empty();
|
|
|
- $.ajax({
|
|
|
- url: baseUrl + '/api/public/v5/shear/content',
|
|
|
- headers: {
|
|
|
- Authorization: token,
|
|
|
- },
|
|
|
- type: 'get',
|
|
|
- dataType: 'json',
|
|
|
- success: function (res) {
|
|
|
- if (res.status === 0) {
|
|
|
- if (res.data.length) {
|
|
|
- cutList = array_unique(res.data);
|
|
|
- var str =
|
|
|
- '<div class="title">剪贴板<div onclick="handleClear()" class="btn-clear">清空</div></div><div class="slide-wrapper-content">';
|
|
|
- cutList.forEach(function (item) {
|
|
|
- str +=
|
|
|
- "<div class='slide-wrapper'><div class='slide-scroll animate-slide-start'><div class='slide-content'><div onclick='handleCopy(\"" +
|
|
|
- item.content +
|
|
|
- '")\'>' +
|
|
|
- item.content +
|
|
|
- "</div></div><div class='slide-content-button'><button onclick='handleDelete(" +
|
|
|
- item.id +
|
|
|
- ")'>删除</button></div></div></div>";
|
|
|
- });
|
|
|
- str += '</div>';
|
|
|
- $('.box-shear-plate').append(str);
|
|
|
+ stopManyClick(function () {
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ if (window.navigator.clipboard) {
|
|
|
+ window.navigator.clipboard
|
|
|
+ .readText()
|
|
|
+ .then(
|
|
|
+ function (content) {
|
|
|
+ return $.ajax({
|
|
|
+ url: baseUrl + '/api/public/v5/shear/content',
|
|
|
+ type: 'post',
|
|
|
+ dataType: 'json',
|
|
|
+ data: JSON.stringify({
|
|
|
+ content: content,
|
|
|
+ }),
|
|
|
+ headers: {
|
|
|
+ 'content-Type': 'application/json',
|
|
|
+ Authorization: token,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ function (err) {
|
|
|
+ $.toast('读取剪贴板失败', 'text');
|
|
|
+ },
|
|
|
+ )
|
|
|
+ .finally(resolve);
|
|
|
+ } else {
|
|
|
+ resolve();
|
|
|
+ }
|
|
|
+ }).then(function () {
|
|
|
+ $('.box-shear-plate').empty();
|
|
|
+ return $.ajax({
|
|
|
+ url: baseUrl + '/api/public/v5/shear/content',
|
|
|
+ headers: {
|
|
|
+ Authorization: token,
|
|
|
+ },
|
|
|
+ type: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.status === 0) {
|
|
|
+ if (res.data.length) {
|
|
|
+ cutList = array_unique(res.data);
|
|
|
+ var str =
|
|
|
+ '<div class="title">剪贴板<div onclick="handleClear()" class="btn-clear">清空</div></div><div class="slide-wrapper-content">';
|
|
|
+ cutList.forEach(function (item) {
|
|
|
+ str +=
|
|
|
+ "<div class='slide-wrapper'><div class='slide-scroll animate-slide-start'><div class='slide-content'><div onclick='handleCopy(\"" +
|
|
|
+ item.content +
|
|
|
+ '")\'>' +
|
|
|
+ item.content +
|
|
|
+ "</div></div><div class='slide-content-button'><button onclick='handleDelete(" +
|
|
|
+ item.id +
|
|
|
+ ")'>删除</button></div></div></div>";
|
|
|
+ });
|
|
|
+ str += '</div>';
|
|
|
+ $('.box-shear-plate').append(str);
|
|
|
+ } else {
|
|
|
+ $('.box-shear-plate').append(
|
|
|
+ '<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>',
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $('.mask').show();
|
|
|
+ initSlider();
|
|
|
} else {
|
|
|
$('.box-shear-plate').append(
|
|
|
'<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>',
|
|
|
);
|
|
|
+ $('.mask').show();
|
|
|
}
|
|
|
- $('.mask').show();
|
|
|
- initSlider();
|
|
|
- } else {
|
|
|
- $('.box-shear-plate').append(
|
|
|
- '<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>',
|
|
|
- );
|
|
|
- $('.mask').show();
|
|
|
- }
|
|
|
- },
|
|
|
+ },
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
}
|