Compare commits

3 Commits

4 changed files with 31 additions and 2 deletions

View File

@@ -9,6 +9,11 @@
"id": 2,
"title": "AiDA X SFT AI Fashion Award 2024",
"imgUrl": "/image/events/Fashion-Award-2024.png"
},
{
"id": 3,
"title": "AiDA Global Design Awards 2026",
"imgUrl": "/image/events/award-poster.gif"
}
],
"eventsItem": [

View File

@@ -9,6 +9,11 @@
"id": 2,
"title": "AiDA X SFT AI时尚设计比赛2024",
"imgUrl": "/image/events/Fashion-Award-2024.png"
},
{
"id": 3,
"title": "AiDA全球设计奖 2026",
"imgUrl": "/image/events/award-poster-zh.gif"
}
],
"eventsItem": [

View File

@@ -32,6 +32,7 @@ import { Https } from "@/tool/https";
import { useRouter,useRoute } from 'vue-router'
import { useStore } from "vuex";
import { useI18n } from 'vue-i18n'
import { isValidUrl } from '@/tool/util';
export default defineComponent({
components:{
},
@@ -70,7 +71,13 @@ export default defineComponent({
accountMessage.isNoData = true
})
}
let setRead = (item:any)=>{
let setRead = (item: any) => {
const content = item.content.content
console.log('111', isValidUrl(content));
if (isValidUrl(content)) {
window.open(content, '_blank');
}
prop.setReadStatus(item).then((rv:any)=>{
item.isRead = 1
}).catch((err:any)=>{

View File

@@ -672,6 +672,17 @@ function sketchToMask(sketchImage) {
img.src = sketchImage;
});
}
function isValidUrl(string) {
try {
const url = new URL(string)
// 通常我们只需要 http 或 https 协议
return url.protocol === "http:" || url.protocol === "https:"
} catch (err) {
return false
}
}
export {
isEmail,
getUploadUrl,
@@ -695,5 +706,6 @@ export {
calculateGradientCoordinate,
segmentImage,
UrlToFile,
sketchToMask
sketchToMask,
isValidUrl
}