// script.js
// 语言选择的内容
const languages = {
zh: {
title: "号码估价系统",
languageLabel: "选择语言:",
inputTypeLabel: "选择号码类型:",
inputNumberLabel: "请输入号码:",
getEstimateBtn: "获取估价",
mobileOption: "手机号",
wechatOption: "微信号",
carplateOption: "车牌号",
qqOption: "QQ号",
douyinOption: "抖音号",
kuaishouOption: "快手号",
shipinOption: "视频号",
resultTitle: "估价结果",
noInput: "请输入号码",
unknownType: "未知的号码类型",
estimates: {
mobile: {
values: ["1000元", "5000元", "10000元", "20000元"],
levels: ["普通", "中等", "优质", "极品"],
ratings: ["★☆☆☆☆", "★★☆☆☆", "★★★☆☆", "★★★★☆", "★★★★★"],
suggestions: ["非常抢手", "适合长期使用", "升值空间大", "值得投资"],
quotes: [
"该手机号在市场上非常受欢迎,未来有升值空间。",
"该手机号具有一定的市场价值,推荐长期使用。",
"这个手机号比较普通,但仍具备一定的市场潜力。",
"这个手机号稀有,推荐作为投资。",
]
},
// Similar data can be added for other types like wechat, qq, etc.
}
},
ug: {
title: "نۇمۇر باھاسى سىستېمىسى",
languageLabel: "تىلنى تاللاڭ:",
inputTypeLabel: "نۇمۇر تىپىنى تاللاڭ:",
inputNumberLabel: "نۇمۇرنى كىرگۈزۈڭ:",
getEstimateBtn: "باھانى ئالسىڭىز",
mobileOption: "تېلېفون نومۇرى",
wechatOption: "ۋېيچىڭ نومۇرى",
carplateOption: "ئاپتوموبىل نومۇرى",
qqOption: "QQ نومۇرى",
douyinOption: "دوۋين نومۇرى",
kuaishouOption: "كۇيشو نومۇرى",
shipinOption: "ۋىدىئو نومۇرى",
resultTitle: "باھا نىتىجىسى",
noInput: "نۇمۇرنى كىرگۈزۈڭ",
unknownType: "بېلىۋالغان نۇمۇر تىپى يوق",
estimates: {
mobile: {
values: ["1000 يۈەن", "5000 يۈەن", "10000 يۈەن", "20000 يۈەن"],
levels: ["ئادەتتىكى", "ئوتتۇرا", "يۇقىرى", "ئەڭ ياخشى"],
ratings: ["★☆☆☆☆", "★★☆☆☆", "★★★☆☆", "★★★★☆", "★★★★★"],
suggestions: ["كۆپ ئېھتىياجغا ئىگە", "ئۇزۇن مۇددەت ئىشلەش ئۈچۈن ماس", "ۋېتىن يۆنىلىشىگە ئىگە", "ئويغانىشقا يېتەڭ"],
quotes: [
"بۇ تېلېفون نومۇرى بازاردا چوڭ ئېھتىياجغا ئىگە، كەلگۈسىدە قىممىتى ئۆسىشى مۇمكىن.",
"بۇ تېلېفون نومۇرى بازارغا تەسىر كۆرسىتىدىغان بىر مەقدەردە بەسىمىگە ئىگە.",
"بۇ تېلېفون نومۇرى تۆۋەن، لېكىن ئالدىراشلىق بىلەن پۇل كىرگۈزۈش جەزىبىسى مەۋجۇت.",
"بۇ تېلېفون نومۇرى بىرنەچچە ئاي ياكى يىلدىن بىرى زىيادە بېكۇزۇپ كەلگەندە تەۋە.",
]
},
}
}
};
// 当前语言
let currentLanguage = 'zh';
// 更新页面内容为当前语言
function updateLanguage() {
document.getElementById("title").innerText = languages[currentLanguage].title;
document.getElementById("language-label").innerText = languages[currentLanguage].languageLabel;
document.getElementById("input-type-label").innerText = languages[currentLanguage].inputTypeLabel;
document.getElementById("input-number-label").innerText = languages[currentLanguage].inputNumberLabel;
document.getElementById("get-estimate-btn").innerText = languages[currentLanguage].getEstimateBtn;
// 更新每个号码类型选项
document.getElementById("mobile-option").innerText = languages[currentLanguage].mobileOption;
document.getElementById("wechat-option").innerText = languages[currentLanguage].wechatOption;
document.getElementById("carplate-option").innerText = languages[currentLanguage].carplateOption;
document.getElementById("qq-option").innerText = languages[currentLanguage].qqOption;
document.getElementById("douyin-option").innerText = languages[currentLanguage].douyinOption;
document.getElementById("kuaishou-option").innerText = languages[currentLanguage].kuaishouOption;
document.getElementById("shipin-option").innerText = languages[currentLanguage].shipinOption;
}
// 语言切换事件
function changeLanguage() {
currentLanguage = document.getElementById("language-select").value;
updateLanguage();
}
// 更新输入框的占位符
function updatePlaceholder() {
const inputType = document.getElementById("inputType").value;
const inputNumber = document.getElementById("inputNumber");
if (inputType === "mobile" || inputType === "qq") {
inputNumber.placeholder = languages[currentLanguage].noInput;
} else {
inputNumber.placeholder = "请输入完整号码";
}
}
// 获取估价信息
function getEstimate() {
const inputType = document.getElementById("inputType").value;
const inputNumber = document.getElementById("inputNumber").value;
const resultDiv = document.getElementById("result");
// 验证输入
if (!inputNumber) {
resultDiv.style.display = "none";
alert(languages[currentLanguage].noInput);
return;
}
// 获取估值数据
const estimate = languages[currentLanguage].estimates[inputType];
if (estimate) {
// 随机生成估值、等级、评星等
const value = estimate.values[Math.floor(Math.random() * estimate.values.length)];
const level = estimate.levels[Math.floor(Math.random() * estimate.levels.length)];
const rating = estimate.ratings[Math.floor(Math.random() * estimate.ratings.length)];
const suggestion = estimate.suggestions[Math.floor(Math.random() * estimate.suggestions.length)];
const quote = estimate.quotes[Math.floor(Math.random() * estimate.quotes.length)];
// 显示结果
resultDiv.innerHTML = `
<h3>${languages[currentLanguage].resultTitle}</h3>
<p>号码: ${inputNumber}</p >
<p>估价: ${value}</p >
<p>等级: ${level}</p >
<p>评星: ${rating}</p >
<p>推荐: ${suggestion}</p >
<p>评价语录: ${quote}</p >
`;
resultDiv.style.display = "block";
} else {
resultDiv.style.display = "none";
alert(languages[currentLanguage].unknownType);
}
}
暂无评论内容