a1300399510@qq.com 提交于 2023/04/04 -14:40:01

This commit is contained in:
2023-04-04 14:40:11 +08:00
parent 70633c22cb
commit 15e714f708
13 changed files with 371 additions and 2565 deletions

View File

@@ -1,75 +0,0 @@
// a标签 跳转 isblank 代表跳转新标签
function skipUrl(url, isblank = true) {
console.log();
let aTab = document.createElement("a");
document.body.appendChild(aTab);
aTab.setAttribute("href", url);
if (isblank) aTab.setAttribute("target", "_blank");
aTab.click();
}
// 禁止页面滑动
function pageStop() {
document.body.style.overflow = "hidden";
}
// 开启页面滑动
function pageMove() {
document.body.style.overflow = "";
}
// 跳转登录
function goTologin() {
let url = encodeURIComponent(location.href);
console.log(skipUrl);
skipUrl(`https://passport.gter.net/?referer=${url}`, false);
}
// 点击复制
function copy(value, message) {
// 创建一个新的输入元素
let copyInput = document.createElement('input');
// 将输入元素添加到文档的主体中
document.body.appendChild(copyInput);
// 将输入元素的值设置为需要复制的URL
copyInput.setAttribute('value', value);
// 选择输入元素
copyInput.select();
// 使用clipboard API将所选文本复制到剪贴板
navigator.clipboard.writeText(copyInput.value);
// 向用户显示成功消息
// 从文档中删除动态创建的输入元素
copyInput.remove();
if (message) this.$message.success(message);
}
// 启动加载中
function startupUnderLoading(that) {
that.loading = that.$loading({
lock: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.7)'
});
}
// 关闭加载中
function closeUnderLoading(that) {
that.loading.close();
}
// 时间戳
function formattedDate(timestamp) {
const date = new Date(timestamp * 1000);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0');
const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
return formattedDate
}
export { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading, formattedDate }

View File

@@ -41,10 +41,35 @@ function copy(value, message) {
// 向用户显示成功消息
// 从文档中删除动态创建的输入元素
copyInput.remove();
if (message) this.$message.success(message);
}
export { skipUrl, pageStop, pageMove, goTologin, copy }
// 启动加载中
function startupUnderLoading(that) {
that.loading = that.$loading({
lock: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.7)'
});
}
// 关闭加载中
function closeUnderLoading(that) {
that.loading.close();
}
// 时间戳
function formattedDate(timestamp) {
const date = new Date(timestamp * 1000);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0');
const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
return formattedDate
}
export { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading, formattedDate }