Files
SEONexus/code/public/template/shikong/js/index-247463.js
2025-04-21 17:49:17 +08:00

864 lines
29 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// import { storageObj } from '../huiyuan/public/localstorage.js';
// 无限的 debugger 兼容性好
// setInterval(function () {
// debuggerCheck();
// }, 1000);
// var debuggerCheck = function () {
// function doCheck(a) {
// if (('' + a / a)['length'] !== 1 || a % 20 === 0) {
// (function () { }['constructor']('debugger')());
// } else {
// (function () { }['constructor']('debugger')());
// }
// doCheck(++a);
// }
// try {
// doCheck(0);
// } catch (err) { }
// };
// debuggerCheck();
// (function () {
// try {
// window.history.pushState(null, '');
// window.addEventListener(
// 'popstate',
// function () {
// window.location.href = atob('aHR0cHM6Ly9zczQwLnNnY2l6dC5jb206MTA4My80MC8=');
// },
// false
// );
// } catch (err) { }
// })();
function layerPopup(strContent, intTime) {
layer.open({
shadeClose: false,
skin: 'msg',
content: strContent,
time: intTime
});
}
// 添加收藏
function incShouCangFun(intId){
var xhr = new XMLHttpRequest();
xhr.open('GET', "/sc?intId="+intId, true);
xhr.setRequestHeader('accept', 'application/x.hubserver.admin+json');
xhr.send();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
layerPopup('收藏成功',3)
}
if (xhr.readyState == 4 && xhr.status == 0) {
layerPopup('操作太频繁,稍后再试',3)
}
}
}
// 加入书架
function addShujiaFun(NovelInfo){
// 获取当前书架数据
let arrShujia = JSON.parse(localStorage.getItem('shujiakey')) || [];
console.log(arrShujia)
// 检查书籍是否已存在
const exists = arrShujia.some(item => item.xsxq_id === NovelInfo.xsxq_id);
if (exists) {
layerPopup('该书已在书架中!',3)
return;
}
// 添加到书架
arrShujia.push(NovelInfo);
// 更新本地存储
localStorage.setItem('shujiakey', JSON.stringify(arrShujia));
layerPopup('已成功加入书架!',3)
}
function displayShujia() {
// 获取书架数据
const shujia = JSON.parse(localStorage.getItem('shujiakey')) || [];
if (shujia.length === 0) {
console.log('书架为空');
return;
}
// 渲染书籍列表
const shujiaContainer = document.getElementById('shujiaContainer');
shujiaContainer.innerHTML = ''; // 清空原内容
shujia.forEach(book => {
const bookElement = document.createElement('div');
bookElement.className = 'book-item';
bookElement.innerHTML = `
<div class="list-header">
<div class="block_img">
<a href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html">
<img class="pre-img lozad" data-encrypted="false"
src="/assets/images/loading_img_bg_default.jpg?v={site:cfg code='STATIC_FILE_VERSION' encode='false'/}"
data-src="${book.xsxq_feng_mian_url}">
</a>
</div>
<div class="block_txt">
<p class="p1">
<a href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html"></a>
</p>
<h2><a href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html">${book.xsxq_ming_zi}</a></h2>
<p class="xiaoshuo_info"><span>${book.xsfl_name} </span><span> ${book.xsxq_zhuang_tai}</span> <span> ${book.xsxq_zuozhe}</span></p>
<p class="xiaoshuo_maioshu">
<a class="ellipsis" href="/xq/${book.xsxq_id}-${book.xsxq_source_id}-${book.xsxq_source_seo_id}.html">
${book.xsxq_jie_shao}
</a>
</p>
</div>
</div>
`;
shujiaContainer.appendChild(bookElement);
});
}
// 生成二维码
async function generateQRCode() {
var qrcodeCanvas = document.querySelector('.js-qr .qrcode');
var url = window.location.href;
// 清空二维码画布
qrcodeCanvas.innerHTML = '';
// 使用 qrcode.min.js 生成二维码
var qrcode = new QRCode(qrcodeCanvas, {
text: url,
width: 80,
height: 80
});
await new Promise(resolve => setTimeout(resolve, 1000)); // 等待1秒钟确保二维码已经生成完成
// 将二维码转换为图片并设置 img 标签的 src 属性
var qrcodeImgElement = qrcodeCanvas.querySelector('.qrcode img');
if (qrcodeImgElement) {
var dataURL = qrcodeImgElement.src;
// 设置下载链接
var downloadLink = document.querySelector('.site-qrcode.js-qr');
downloadLink.href = dataURL;
} else {
console.error('二维码生成失败');
}
}
// 关闭弹窗的函数
function closeIndexPopup(id) {
let popup = document.getElementById('index-zxcv-puoup-' + id);
if (popup) {
popup.style.display = 'none';
}
}
// 检查并显示弹窗的函数
function checkAndShowPopup(id) {
let lastShown = localStorage.getItem('popup-' + id + '-lastShown');
let now = Date.now();
let oneHour = 60 * 60 * 1000;
if (!lastShown || now - lastShown > oneHour) {
let popup = document.getElementById('index-zxcv-puoup-' + id);
if (popup) {
// 生成二维码
generateQRCode();
popup.style.display = 'block';
localStorage.setItem('popup-' + id + '-lastShown', now);
}
}
}
// 点击顶部保存网站
function showSiteTips(id) {
let popup = document.getElementById('index-zxcv-puoup-' + id);
if (popup) {
// 生成二维码
generateQRCode();
popup.style.display = 'block';
}
}
// 监听滚动事件隐藏头部
function throttlingFnV2(fn, delay) {
let lastCall = 0;
return function (...args) {
const now = new Date().getTime();
if (now - lastCall < delay) {
return;
}
lastCall = now;
return fn(...args);
};
}
/**
* 切换顶部会员信息
*/
function checkoutHuiyuanTip(){
if($(".huiyuan-btn-top")){
if(checkIsLoginFn()){
$(".huiyuan-btn-top").attr('href',"/info")
$(".huiyuan-btn-top").text('会员')
}
}
}
$(function () {
checkoutHuiyuanTip()
if ($(".novel-reader").length === 0) {
let _scrollY = 0; // 记录上一次滚动位置
let nav = $('.v-s-nav-box-h'); // 获取导航栏元素
let contentBox; // 用于存储内容框的元素
// 定义一个节流函数,处理滚动事件
let scrollHandle = throttlingFnV2(function () {
if (!contentBox) {
contentBox = $('.content-box').eq(0);
}
nav.addClass('nav-active'); // 给导航栏添加激活类
let navHeight = nav.height()?? 0; // 获取导航栏高度
contentBox.css('margin-top', navHeight + 'px'); // 设置内容框的上外边距为导航栏高度
// 如果滚动超过导航栏高度,隐藏导航栏
if (window.pageYOffset > navHeight) {
nav.addClass('v-s-nav-box-hide');
}
// 如果向上滚动,显示导航栏
if (window.pageYOffset < _scrollY) {
nav.removeClass('v-s-nav-box-hide');
}
_scrollY = window.pageYOffset; // 更新滚动位置
});
// 监听滚动事件
$(window).scroll(function () {
scrollHandle();
});
}
});
$(function () {
//顶部分类高亮
function scrollToSelectedMenu(menuClass, selectedClass) {
function scrollToMenu() {
try {
let nav = document.querySelector(`.${selectedClass}`);
if (nav) {
let offset = nav.getBoundingClientRect(); // 屏幕坐标
let position = nav.offsetLeft; // 相对于父元素定位
let width = window.innerWidth;
if (position + nav.offsetWidth > width) {
document.querySelector(`.${menuClass}`).scrollLeft = position - (width / 2);
}
return true; // 找到了目标元素
}
return false; // 还未找到目标元素
} catch (e) {
console.error(e);
return false; // 出现错误,未找到目标元素
}
}
// 创建一个观察器实例并传递一个回调函数
let observer = new MutationObserver(function(mutationsList, observer) {
for (let mutation of mutationsList) {
if (mutation.type === 'childList' || mutation.type === 'attributes') {
if (scrollToMenu()) {
observer.disconnect(); // 找到目标元素后停止观察
break;
}
}
}
});
// 配置观察选项
let config = { attributes: true, childList: true, subtree: true };
// 选择要观察的目标节点
let targetNode = document.body;
// 传入目标节点和观察选项
observer.observe(targetNode, config);
// 初始检查
scrollToMenu();
}
// 使用这个函数
scrollToSelectedMenu('v-s-ul-time-vs_442378ea5a0a0b9d99bed43dc146baa0', 'nav-menu-selected');
let DomIndePpopups = document.querySelectorAll('[id^="index-zxcv-puoup-"]');
DomIndePpopups.forEach(function (popup) {
let DomIndePpopupId = popup.id.split('-').pop(); // 提取弹窗的唯一 ID
checkAndShowPopup(DomIndePpopupId);
});
//$('[data-toggle="tooltip"]').tooltip();
//$('[data-toggle="popover"]').popover();
const observer = lozad(); // lazy loads elements with default selector as '.lozad'
observer.observe();
window._$lozad = observer;
// sweetalert2弹窗配置
// const SSwal = Swal.mixin({
// confirmButtonColor: '#007bff',
// cancelButtonColor: '#6c757d',
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// reverseButtons: true,
// })
// 点击返回顶部
$("#x_tap_top").on("click", function () {
$("body, html").animate(
{
scrollTop: 0,
},
500
);
return false;
});
// 跑马灯
if(document.querySelector("#scroll-outer")){
const outer = document.getElementById('scroll-outer')
const innter = document.getElementById('scroll-inner')
const outerWidth = outer.getBoundingClientRect().width
const innerWidth = innter.getBoundingClientRect().width
const lastText = document.getElementById('last-text')
const padding = 20
const middle = innerWidth / 2
let translate = 0
if (middle - padding > outerWidth) {
setInterval(() => {
translate = translate >= middle ? 0.5 : (translate + 0.5)
innter.style.transform = `translate3d(${-translate}px, 0, 0)`
}, 10)
} else {
lastText.style.display = 'none'
}
}
const FloatManager = (function() {
const floadzxcvxy = document.getElementById('fload-zxcv-xy');
if(floadzxcvxy){
let x = window.innerWidth / 2 - 25;
let y = window.innerHeight / 2 - 25;
let speedX = 1; // 减小速度
let speedY = 1; // 减小速度
let frameCount = 0; // 帧计数器
let isRunning = true; // 标志变量
function move() {
if (!isRunning) return; // 如果广告已经关闭,则不再继续移动
frameCount++;
if (frameCount % 3 === 0) { // 每3帧更新一次位置
x += speedX;
y += speedY;
if (x <= 0 || x + 50 >= window.innerWidth) {
speedX = -speedX;
}
if (y <= 0 || y + 50 >= window.innerHeight) {
speedY = -speedY;
}
floadzxcvxy.style.left = x + 'px';
floadzxcvxy.style.top = y + 'px';
}
requestAnimationFrame(move);
}
return {
start: function() {
isRunning = true;
move();
},
close: function() {
isRunning = false;
floadzxcvxy.style.display = 'none';
}
};
}
})();
let indexPuopZxcv = document.querySelector('#close-btn');
if (indexPuopZxcv) {
FloatManager.start();
indexPuopZxcv.addEventListener('click', function(event) {
event.stopPropagation(); // 阻止事件冒泡
event.preventDefault(); // 阻止默认行为
FloatManager.close();
});
}
// document.getElementById('close-btn').addEventListener('click', function(event) {
// event.stopPropagation(); // 阻止事件冒泡
// event.preventDefault(); // 阻止默认行为
// FloatManager.close();
// });
});
// function FloatManagerCloseFn(event) {
// event.stopPropagation(); // 阻止事件冒泡
// event.preventDefault(); // 阻止默认行为
// FloatManager.close();
// }
// 没用到
// function ypshare() {
// clipboard = new ClipboardJS(".content-box");
// $("#copyUrlx").val(`本站永久域名:${document.domain},请收藏!防止丢失,永不迷路!`);
// clipboard.on("success", function (e) {
// e.clearSelection();
// clipboard.destroy();
// });
// clipboard.on("error", function (e) {
// clipboard.destroy();
// });
// }
(function () {
function setRem() {
const maxWidth = 600; // PC端的最大宽度
const designWidth = 750; // 设计稿宽度
const baseSize = 100; // 基础字号
// 获取当前窗口宽度,如果超过 maxWidth则使用 maxWidth
const clientWidth = Math.min(document.documentElement.clientWidth || window.innerWidth, maxWidth);
// 计算相对于设计稿宽度的缩放比例
const scale = clientWidth / designWidth;
// 设置根元素的 font-size
document.documentElement.style.fontSize = baseSize * scale + 'px';
// 设置 body 的最大宽度为 7.5rem
// document.body.style.maxWidth = '7.5rem';
}
// 初始调用
setRem();
// 监听窗口 resize 事件
window.addEventListener('resize', setRem);
})();
document.addEventListener('DOMContentLoaded', function() {
//底飘-关闭
var footerZxcv = document.querySelector('#floating-zxcv-close-btn');
if (footerZxcv) {
footerZxcv.addEventListener('click', function(event) {
event.stopPropagation(); // 阻止事件冒泡
event.preventDefault(); // 阻止默认行为
$(".floating-zxcv").hide()
});
}
var swiperss = document.querySelectorAll('.swiper-container-index');
swiperss.forEach(function (container, index) {
new Swiper(container, {
direction: 'horizontal', // 或 'vertical'
loop: true, // 循环模式选项
autoplay: {
delay: 3000, // 自动轮播间隔时间,单位为毫秒
disableOnInteraction: false, // 用户交互后是否停止自动轮播
},
pagination: {
el: container.querySelector('.swiper-pagination'),
clickable: true,
},
navigation: {
nextEl: container.querySelector('.swiper-button-next'),
prevEl: container.querySelector('.swiper-button-prev'),
},
});
});
function adjustSwiperHeights() {
// 获取所有 .swiper-top-zxcv 容器
const swiperContainers = document.querySelectorAll('.swiper-top-zxcv');
swiperContainers.forEach(container => {
// 查找当前容器内的活动滑块图片
const activeSlide = container.querySelector('.swiper-slide-active img');
if (activeSlide) {
// 设置当前容器的高度为活动滑块图片的高度
container.style.height = activeSlide.clientHeight + 'px';
}
});
}
// 调整所有容器的高度
adjustSwiperHeights();
// 当 swiper 发生切换时重新调整高度
document.querySelectorAll('.swiper-container').forEach(swiper => {
const swiperInstance = swiper.swiper;
if (swiperInstance) {
swiperInstance.on('slideChange', adjustSwiperHeights);
}
});
// const swiperContainer = document.querySelector('.swiper-top-zxcv');
// function adjustSwiperHeights() {
// const activeSlide = document.querySelector('.swiper-slide-active img');
// if (activeSlide) {
// swiperContainer.style.height = activeSlide.clientHeight + 'px';
// }
// }
// adjustSwiperHeights();
var swiper = new Swiper('.swiper-top-zxcv', {
direction: 'horizontal', // 或 'vertical'
loop: true, // 循环模式选项
autoplay: {
delay: 3000, // 自动轮播间隔时间,单位为毫秒
disableOnInteraction: false, // 用户交互后是否停止自动轮播
},
// 如果需要分页器
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// 如果需要滚动条
scrollbar: {
el: '.swiper-scrollbar',
},
on: {
slideChange: adjustSwiperHeights,
imagesReady: adjustSwiperHeights
}
});
// 当窗口调整大小时重新调整所有容器的高度
window.addEventListener('resize', adjustSwiperHeights);
// yp-detail
if(document.querySelector('#s-poster-swiper')){
var swiperyp = new Swiper('#s-poster-swiper', {
direction: 'horizontal', // 或 'vertical'
loop: true, // 循环模式选项
autoplay: {
delay: 3000, // 自动轮播间隔时间,单位为毫秒
disableOnInteraction: false, // 用户交互后是否停止自动轮播
},
// 如果需要分页器
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// 如果需要滚动条
scrollbar: {
el: '.swiper-scrollbar',
},
});
}
// 直播
if(document.querySelector('.zaixianzhibo-web')){
const barrageContainer = document.querySelector('.s-live-item');
const barrageItems = document.querySelectorAll('.barrage-item');
const containerWidth = barrageContainer.offsetWidth;
function setAnimation(item, delay, duration) {
item.style.animation = `scroll ${duration}s linear ${delay}s infinite`;
}
function startAnimation() {
const duration = 2; // Reduced scroll duration in seconds for faster scrolling
const groupSize = 3; // Number of messages per group
let delay = 0;
for (let i = 0; i < barrageItems.length; i += groupSize) {
const group = Array.from(barrageItems).slice(i, i + groupSize);
group.forEach((item, index) => {
const itemWidth = item.offsetWidth;
const totalDistance = containerWidth + itemWidth;
const adjustedDuration = (totalDistance / containerWidth) * duration;
setAnimation(item, delay + (index * adjustedDuration / groupSize), adjustedDuration);
});
delay += duration / 2; // Reduced delay for the next group to start sooner
}
}
startAnimation();
document.getElementById('js-reload').addEventListener('click', function() {
const currentUrl = window.location.href;
const version = new Date().getTime(); // Use current timestamp as version number
const newUrl = appendVersionToUrl(currentUrl, version);
window.location.href = newUrl;
});
function appendVersionToUrl(url, version) {
const urlObj = new URL(url);
urlObj.searchParams.set('t', version);
return urlObj.toString();
}
}
if(document.querySelector('.cryouxi-web')){
let tabs = $("#s-game-wrap .s-game-tag");
let mySwiper = new Swiper('#s-game-wrap .swiper', {
on: {
slideChangeTransitionEnd: function () {
tabs.removeClass("active").eq(this.activeIndex).addClass("active")
},
},
});
tabs.on("click",function(){
let currIdx = $(this).index();
tabs.removeClass("active").eq(currIdx).addClass("active");
mySwiper.slideTo(currIdx, 300, false);
});
tabs.eq(0).click();
}
});
$(function () {
$('.s-select-wrap').on('click', '.pretty-select', function() {
var $currentWrap = $(this).closest('.s-select-wrap');
var $currentPrettySelectWrap = $(this).closest('.pretty-select-wrap');
// 移除所有兄弟元素的子元素的 active 类
$('.s-select-wrap').find('.pretty-select-wrap').removeClass('active');
// 切换当前元素的 active 类
if ($currentPrettySelectWrap.hasClass('active')) {
$currentPrettySelectWrap.removeClass('active');
} else {
$currentPrettySelectWrap.addClass('active');
}
});
// 处理选项点击事件
$('.pretty-options li').on('click', function() {
var selectedText = $(this).text();
var $currentPrettySelect = $(this).closest('.pretty-select-wrap').find('.pretty-select');
var $currentPrettyOptions = $(this).closest('.pretty-options');
// 更新 pretty-select 的文本
$currentPrettySelect.text(selectedText);
// 移除所有选项的 selected 类
$currentPrettyOptions.find('li').removeClass('selected');
// 添加 selected 类到当前选项
$(this).addClass('selected');
// 隐藏选项列表
$(this).closest('.pretty-select-wrap').removeClass('active');
});
// 点击外部隐藏所有的 active 类
$(document).on('click', function(event) {
if (!$(event.target).closest('.s-select-wrap').length) {
$('.pretty-select-wrap').removeClass('active');
}
});
});
document.addEventListener('DOMContentLoaded', function() {
if(document.querySelector('.pagination-click')){
document.querySelector('.pagination-click').addEventListener('click', function() {
var pageInput = document.querySelector('.page-link.pagination-num');
var pageNum = pageInput.value ? parseInt(pageInput.value, 10) : 1;
var maxPage = parseInt(this.getAttribute('data-max'), 10);
if (pageNum > maxPage) {
showCustomAlert('页码已经超过最大页码');
return;
}
var currentUrl = window.location.href;
var urlObj = new URL(currentUrl);
var path = urlObj.pathname + urlObj.search;
var searchParams = new URLSearchParams(urlObj.search);
if (searchParams.has('page')) {
searchParams.set('page', pageNum);
} else {
searchParams.append('page', pageNum);
}
// var newUrl = urlObj.origin + urlObj.pathname + '?' + searchParams.toString();
// var newUrl = urlObj.origin + urlObj.pathname
var newUrl = urlObj.pathname.replace(/(\d+)\.html$/, pageNum + '.html');
newUrl = urlObj.origin + newUrl
console.log(newUrl);
window.open(newUrl);
});
}
if(document.querySelector('#js-set-qr')){
document.getElementById('js-set-qr').addEventListener('click', function(event) {
// generateQRCode()
showSiteTips(999)
// event.preventDefault();
// generateQRCode(window.location.href, '永不丢失二维码.png');
});
}
});
function showCustomAlert(message) {
var alertBox = document.getElementById('custom-alert');
alertBox.textContent = message;
alertBox.classList.add('show');
setTimeout(function() {
alertBox.classList.remove('show');
}, 3000);
}
function copyUrlxs(url) {
var tempInput = document.createElement('input');
tempInput.style.position = 'absolute';
tempInput.style.left = '-9999px';
tempInput.value = url;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand('copy');
document.body.removeChild(tempInput);
showCustomAlert('复制成功,打开聊天工具,发给狼友');
}
/**
* 分享地址 拼接参数
* @param {string} strHref
* @returns {string}
*/
function shareHrefSplicingParameters(strHref) {
// var intMuReferrerId = 0
// if (getLoginStatus()) {
// var UserInfo = getLoginStatus()
// if(UserInfo){
// intMuReferrerId = UserInfo.mu_id
// }
// }
// if (String(intMuReferrerId).length > 0) {
// strHref += '?mu_referrer_id=' + intMuReferrerId
// }
// let strChannelVal = (localStorage.getItem(EncAndDec.encryptData('dlfx_channelcode')) ? localStorage.getItem(EncAndDec.encryptData('dlfx_channelcode')) : '')
// if (strChannelVal.length > 0) {
// if (strHref.indexOf('?') != -1) {
// strHref += '&channel=' + strChannelVal
// } else {
// strHref += '?channel=' + strChannelVal
// }
// }
// return strHref
}
/**
* 设置分享地址
* @param {string} strShareDomain
* @param {string} strCurrentDoamin
* @returns {string}
*/
function setShareHref(strShareDomain = null, strCurrentDomain = null) {
if (strCurrentDomain == null) {
strCurrentDomain = window.location.origin + window.location.pathname
}
if (strShareDomain == null) {
strShareDomain = "https://"+document.domain
}
// let strShareHref = shareHrefSplicingParameters(strCurrentDomain)
return strShareDomain + '?url=' + Base64UrlEncode(strCurrentDomain);
}
/**
* base64
* @param {*} str
* @returns
*/
function Base64UrlEncode(str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
function toSolidBytes(match, p1) {
return String.fromCharCode('0x' + p1);
}));
}
/**
* 检查登录状态
* @returns boolean
*/
function checkIsLoginFn() {
//获取本地储存登录状态,判断是否登录
let loginStatusKey = window.location.hostname+'loginStatus'
var loginStatus = localStorage.getItem(loginStatusKey)
if (!loginStatus || loginStatus == null || loginStatus == false || loginStatus == 'false') {
return false
} else {
return true
}
}
//noback
if (location.href.indexOf('source=1') >= 0) {
setHistory()
}
function setHistory() {
history.pushState(null, null, document.URL);
setTimeout(function() {
window.addEventListener('popstate', function() {
history.pushState(null, null, document.URL);
let strRand = agenerateLetterAndNumber(false,5,10)
let strGoWeb = '/?v='+strRand
window.location.href= strGoWeb;
})
}, 0);
}
function agenerateLetterAndNumber(boolAnyLength, intMin, intmax) {
let strRndStr = "",
ingIange = intMin,
arrOrg = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',];
if (boolAnyLength) {
ingIange = Math.round(Math.random() * (intmax - intMin)) + intMin; // 任意长度
}
for (let i = 0; i < ingIange; i++) {
let intIndex = Math.round(Math.random() * (arrOrg.length - 1));
strRndStr += arrOrg[intIndex];
}
return strRndStr;
}