diff --git a/src/App.vue b/src/App.vue index 7c2f400..a94a29c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -70,19 +70,18 @@ const getGlobalI18n = computed(() => { return messages.value[locale.value]; }); -// 动态设置网站图标 -let link: any = document.querySelector("link[rel*='icon']") || document.createElement("link"); -link.type = "image/x-icon"; -link.rel = "shortcut icon"; -link.href = themeConfig.logoMini||logoMini; -document.getElementsByTagName("head")[0].appendChild(link); - // 设置初始化,防止刷新时恢复默认 onBeforeMount(() => { // 设置批量第三方 icon 图标 setIntroduction.cssCdn(); // 设置批量第三方 js setIntroduction.jsCdn(); + // 动态设置网站图标 + let link: any = document.querySelector("link[rel*='icon']") || document.createElement("link"); + link.type = "image/x-icon"; + link.rel = "shortcut icon"; + link.href = themeConfig.logoMini||logoMini; + document.getElementsByTagName("head")[0].appendChild(link); }); // 页面加载时 onMounted(() => { diff --git a/src/api/download/index.ts b/src/api/download/index.ts index 9eb29d9..80000b1 100644 --- a/src/api/download/index.ts +++ b/src/api/download/index.ts @@ -2,6 +2,18 @@ import axios from "axios"; import { ElMessage } from "element-plus"; const downloadPhoto = (imgSrc:any) => { + // 这个直接虚拟dom点击,不然会有跨域问题 + if(imgSrc.includes('guojunjie.oss-cn-hangzhou.aliyuncs.com')){ + const a = document.createElement('a'); + a.href = imgSrc; + a.download = '下载图片.'+ imgSrc.substr(imgSrc.lastIndexOf('.')+1) || 'jpg'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + ElMessage({message: '图片下载成功!',type: 'success',}); + return; + } + axios({ url: imgSrc, method: 'get', diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 0f2987e..2c648ff 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -2,7 +2,7 @@