From 0c0c903529d0c6ae9aa33657666b41e2483dee1f Mon Sep 17 00:00:00 2001 From: mhhhh Date: Wed, 1 Jun 2022 10:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=AE=B6logo?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=8D=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer/src/App.vue | 14 ++-- manager/src/views/Main.vue | 54 +++------------ manager/src/views/main-components/header.vue | 61 ++++++++++++++++- .../setting-manage/setting/BASE_SETTING.vue | 8 +-- seller/src/api/common.js | 6 ++ seller/src/views/Main.vue | 39 +++++++++-- seller/src/views/main-components/header.vue | 65 ++++++++++++++++++- 7 files changed, 184 insertions(+), 63 deletions(-) diff --git a/buyer/src/App.vue b/buyer/src/App.vue index ae17ac3a..7647f50a 100644 --- a/buyer/src/App.vue +++ b/buyer/src/App.vue @@ -14,19 +14,19 @@ export default { }, methods:{ init(){ - if(!localStorage.getItem("siteName")||!localStorage.getItem("logoImg")||!localStorage.getItem("sitelogo_expiration_time")) { + if(!storage.getItem("siteName")||!storage.getItem("logoImg")||!storage.getItem("sitelogo_expiration_time")) { this.getSite(); }else{ // 如果缓存过期,则获取最新的信息 - if (new Date() > localStorage.getItem("sitelogo_expiration_time")) { + if (new Date() > storage.getItem("sitelogo_expiration_time")) { this.getSite(); return; }else{ - window.document.title = localStorage.getItem("siteName"); + window.document.title = storage.getItem("siteName"); //动态获取icon let link =document.querySelector("link[rel*='icon']") ||document.createElement("link"); link.type = "image/x-icon"; - link.href = localStorage.getItem("logoImg"); + link.href = storage.getItem("logoImg"); link.rel = "shortcut icon"; document.getElementsByTagName("head")[0].appendChild(link); } @@ -41,10 +41,10 @@ export default { // 过期时间 var expirationTime = new Date().setHours(new Date().getHours() + 1); // 存放过期时间 - localStorage.setItem("sitelogo_expiration_time", expirationTime); + storage.setItem("sitelogo_expiration_time", expirationTime); // 存放信息 - localStorage.setItem('siteName', data.siteName); - localStorage.setItem('logoImg', data.buyerSideLogo); + storage.setItem('siteName', data.siteName); + storage.setItem('logoImg', data.buyerSideLogo); window.document.title = data.siteName; //动态获取icon diff --git a/manager/src/views/Main.vue b/manager/src/views/Main.vue index 1b79239d..7f6cdeeb 100644 --- a/manager/src/views/Main.vue +++ b/manager/src/views/Main.vue @@ -129,28 +129,15 @@ export default { if (currWidth <= 1200) { this.sliceNum = 2; } - - if(!localStorage.getItem("icon")||!localStorage.getItem("title")||!localStorage.getItem("icontitle_expiration_time")) { - this.getSite(); - }else{ - // 如果缓存过期,则获取最新的信息 - if (new Date() > localStorage.getItem("icontitle_expiration_time")) { - this.getSite(); - return; - }else{ - this.domainLogo = localStorage.getItem("icon"); - let link = - document.querySelector("link[rel*='icon']") || - document.createElement("link"); - link.type = "image/x-icon"; - link.href = localStorage.getItem("icon"); - link.rel = "shortcut icon"; - document.getElementsByTagName("head")[0].appendChild(link); - window.document.title = localStorage.getItem("title") + " - 运营后台"; - - } - } - + this.domainLogo = localStorage.getItem("icon"); + let link = + document.querySelector("link[rel*='icon']") || + document.createElement("link"); + link.type = "image/x-icon"; + link.href = localStorage.getItem("icon"); + link.rel = "shortcut icon"; + document.getElementsByTagName("head")[0].appendChild(link); + window.document.title = localStorage.getItem("title") + " - 运营后台"; // 读取未读消息数 getNoticePage({}).then((res) => { if (res.success) { @@ -160,28 +147,7 @@ export default { } }); }, - getSite(){ - //获取domainLogo - getBaseSite().then((res) => { - const { domainLogo, siteName } = JSON.parse(res.result.settingValue); - this.domainLogo = domainLogo; - // 过期时间 - var expirationTime = new Date().setHours(new Date().getHours() + 1); - // 存放过期时间 - localStorage.setItem("icontitle_expiration_time", expirationTime); - // 存放信息 - localStorage.setItem('icon', domainLogo); - localStorage.setItem('title', siteName); - let link = - document.querySelector("link[rel*='icon']") || - document.createElement("link"); - link.type = "image/x-icon"; - link.href = domainLogo; - link.rel = "shortcut icon"; - document.getElementsByTagName("head")[0].appendChild(link); - window.document.title = siteName + " - 运营后台"; - }) - }, + //用户头像下方抽屉点击 handleClickUserDropdown(name) { //个人中心 diff --git a/manager/src/views/main-components/header.vue b/manager/src/views/main-components/header.vue index f59d7559..86d4c85c 100644 --- a/manager/src/views/main-components/header.vue +++ b/manager/src/views/main-components/header.vue @@ -1,14 +1,71 @@ diff --git a/manager/src/views/sys/setting-manage/setting/BASE_SETTING.vue b/manager/src/views/sys/setting-manage/setting/BASE_SETTING.vue index 08811844..13d099f2 100644 --- a/manager/src/views/sys/setting-manage/setting/BASE_SETTING.vue +++ b/manager/src/views/sys/setting-manage/setting/BASE_SETTING.vue @@ -25,11 +25,11 @@ - +
- + - +
@@ -72,7 +72,7 @@ export default { buyerSideLogo: "", domainLogo: "", icp: "", - sellerSideLogo: "", + storeSideLogo: "", siteName: "", staticPageAddress: "", staticPageWapAddress: "", diff --git a/seller/src/api/common.js b/seller/src/api/common.js index f0022aa6..da6e0c46 100644 --- a/seller/src/api/common.js +++ b/seller/src/api/common.js @@ -16,3 +16,9 @@ export const getRegion = (params) => { export function getIMDetail () { return getRequest(`${commonUrl}/common/common/IM`); } + + +//获取图片logo +export function getBaseSite () { + return getRequest(`${commonUrl}/common/common/site`); +} diff --git a/seller/src/views/Main.vue b/seller/src/views/Main.vue index 70b06bae..df273bc0 100644 --- a/seller/src/views/Main.vue +++ b/seller/src/views/Main.vue @@ -6,22 +6,40 @@
-
+
- - + +
{{ userInfo.storeName }} - +
修改密码 @@ -71,6 +89,7 @@ export default { sliceNum: 5, // 展示nav数量 userInfo: {}, // 用户信息 navType: 1, // nav类型 + storeSideLogo: "", //logo图片 }; }, computed: { @@ -98,6 +117,16 @@ export default { if (pathArr.length >= 2) { this.$store.commit("addOpenSubmenu", pathArr[1].name); } + this.storeSideLogo = localStorage.getItem("sellerlogoImg"); + window.document.title = localStorage.getItem("sellersiteName"); + //动态获取icon + let link = + document.querySelector("link[rel*='icon']") || + document.createElement("link"); + link.type = "image/x-icon"; + link.href = localStorage.getItem("sellerlogoImg"); + link.rel = "shortcut icon"; + document.getElementsByTagName("head")[0].appendChild(link); let userInfo = JSON.parse(Cookies.get("userInfoSeller")); this.userInfo = userInfo; diff --git a/seller/src/views/main-components/header.vue b/seller/src/views/main-components/header.vue index 8776d669..d64239c9 100644 --- a/seller/src/views/main-components/header.vue +++ b/seller/src/views/main-components/header.vue @@ -1,14 +1,77 @@