function useTestData(num) { const tableEle = document.getElementById("table") for (let i = 0; i < num; i++) { const trEle = document.createElement("tr") const basic_tool_type = getRandomBasicToolType() const basic_tool_id = getRandomBasicToolId(basic_tool_type) const platform_name = getRandomPlatformName() const danger_level = getRandomNumberWithRange(0, 2).toString() const user_name = getRandomUserName() const user_password = getRandomUserPasswd() const remark = getRandomRemark() trEle.innerHTML = ` ${basic_tool_type} ${basic_tool_id} ${platform_name} ${danger_level} ${user_name} ${user_password} ${remark} ` switch (danger_level) { case "1": trEle.style.backgroundColor = "rgba(226, 208, 43, 0.5)" break; case "2": trEle.style.backgroundColor = "rgba(226, 43, 43, 0.5)" default: break; } tableEle.appendChild(trEle) } } function getRandomBasicToolType() { const list = [ "phone_number", "email", ] return list[getRandomNumberWithRange(0, list.length - 1)] } function getRandomBasicToolId(type) { switch (type) { case "phone_number": const phoneList = [ "12345678901", "09876543211" ] return phoneList[getRandomNumberWithRange(0, phoneList.length - 1)] case "email": const emailList = [ "abc@qq.com", "XiaoMing@163.com", "XiaoAi@163.com" ] return emailList[getRandomNumberWithRange(0, emailList.length - 1)] } } function getRandomPlatformName() { const list = [ "微信", "qq", "微博", "网易游戏", "腾讯游戏", "小米账号", "华为账号", "vivo账号", "国家政务服务平台", "国家反炸app", "王者荣耀", "和平精英", "蛋仔派对", "京东", "天猫", "淘宝", "企业微信", "豆包ai", "deepseek", "chatgpt", "网易邮箱", "qq邮箱", "高德地图", "百度地图", "支付宝", "boss直聘", "酷狗音乐", "网易音乐", "qq音乐", "汽水音乐", "抖音", "快手", "小红书" ] return list[getRandomNumberWithRange(0, list.length - 1)] } function getRandomUserName() { const list = [ "小艾", "小爱", "小明", "小红", "小蓝", "小绿" ] return list[getRandomNumberWithRange(0, list.length - 1)] } function getRandomUserPasswd() { const list = [ "admin", "1234", "12345678", "10293847", "" ] return list[getRandomNumberWithRange(0, list.length - 1)] } function getRandomRemark() { const list = [ "无法注销", "正在注销中", "不常用", "绑定了身份证", "将会在2000年1月1日自动注销", "" ] return list[getRandomNumberWithRange(0, list.length - 1)] } function getRandomNumberWithRange(startIndex, endIndex) { endIndex++ return Math.floor(Math.random() * (endIndex - startIndex) + startIndex) }