mirror of
https://github.com/woodchen-ink/aimodels-prices.git
synced 2025-07-18 13:41:59 +08:00
feat(Prices.vue): 添加URL有效性检查和格式化功能
This commit is contained in:
parent
179fcc108f
commit
8f3b6e1f67
@ -656,6 +656,26 @@ const billingTypeMap = {
|
|||||||
const getStatus = (status) => statusMap[status] || status
|
const getStatus = (status) => statusMap[status] || status
|
||||||
const getBillingType = (type) => billingTypeMap[type] || type
|
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) => {
|
const copyModelName = (modelName) => {
|
||||||
navigator.clipboard.writeText(modelName)
|
navigator.clipboard.writeText(modelName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user