feat(Prices.vue): 添加URL有效性检查和格式化功能

This commit is contained in:
wood chen 2025-05-14 00:46:36 +08:00
parent 179fcc108f
commit 8f3b6e1f67

View File

@ -656,6 +656,26 @@ const billingTypeMap = {
const getStatus = (status) => statusMap[status] || status
const getBillingType = (type) => billingTypeMap[type] || type
// URL
const isValidUrl = (url) => {
try {
new URL(url)
return true
} catch {
return false
}
}
// URL便
const formatSourceUrl = (url) => {
try {
const urlObj = new URL(url)
return urlObj.hostname + (urlObj.pathname !== '/' ? urlObj.pathname : '')
} catch {
return url
}
}
//
const copyModelName = (modelName) => {
navigator.clipboard.writeText(modelName)