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/buyer/src/config/index.js b/buyer/src/config/index.js index 8366633f..e3fd5c56 100644 --- a/buyer/src/config/index.js +++ b/buyer/src/config/index.js @@ -1,7 +1,7 @@ const Cookie = require('js-cookie') module.exports = { - title:Cookie.get('siteName'), //配置显示在浏览器标签的title、底部信息、部分信息展示的值 + title:Cookie.get('siteName') || 'lilishop', //配置显示在浏览器标签的title、底部信息、部分信息展示的值 icpCard: "", // icp证 company: { href: "https://pickmall.cn", diff --git a/buyer/src/vuex/store.js b/buyer/src/vuex/store.js index c97b6f06..e1e374bd 100644 --- a/buyer/src/vuex/store.js +++ b/buyer/src/vuex/store.js @@ -12,7 +12,7 @@ export default new Vuex.Store({ navList: [], // 首页快捷导航 cartNum: storage.getItem('cartNum') || 0, logoImg: storage.getItem('logoImg') || require('@/assets/images/logo2.png'), - siteName:storage.getItem('siteName')|| null, + siteName:storage.getItem('siteName')|| 'lilishop', hotWordsList: storage.getItem('hotWordsList'), category: JSON.parse(localStorage.getItem('category')) }, 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/goods/goods-info/goodsDetail.vue b/manager/src/views/goods/goods-info/goodsDetail.vue index 538c24f0..da21cc4b 100644 --- a/manager/src/views/goods/goods-info/goodsDetail.vue +++ b/manager/src/views/goods/goods-info/goodsDetail.vue @@ -6,7 +6,10 @@