修改商家logo没有更换的问题
parent
21289f5a92
commit
0c0c903529
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
//个人中心
|
||||
|
|
|
@ -1,14 +1,71 @@
|
|||
<template>
|
||||
<div>
|
||||
<Row class="header">
|
||||
<img src="../../assets/logo.png" class="logo" width="220px">
|
||||
<img :src="domainLogo" class="logo" width="220px" />
|
||||
</Row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBaseSite } from "@/api/common.js";
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
domainLogo: require("@/assets/logo.png"),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
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") + " - 运营后台";
|
||||
}
|
||||
}
|
||||
},
|
||||
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 + " - 运营后台";
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
<Button @click="onClickImg('buyerSideLogo')">选择图片</Button>
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem label="商家端Logo" prop="sellerSideLogo">
|
||||
<FormItem label="商家端Logo" prop="storeSideLogo">
|
||||
<div class="label-item-upload">
|
||||
<img v-if="formValidate.sellerSideLogo" class="img" :src="formValidate.sellerSideLogo" />
|
||||
<img v-if="formValidate.storeSideLogo" class="img" :src="formValidate.storeSideLogo" />
|
||||
<img v-else class="img" src="../../../../assets/emptyImg.png" alt="">
|
||||
<Button @click="onClickImg('sellerSideLogo')">选择图片</Button>
|
||||
<Button @click="onClickImg('storeSideLogo')">选择图片</Button>
|
||||
</div>
|
||||
</FormItem>
|
||||
|
||||
|
@ -72,7 +72,7 @@ export default {
|
|||
buyerSideLogo: "",
|
||||
domainLogo: "",
|
||||
icp: "",
|
||||
sellerSideLogo: "",
|
||||
storeSideLogo: "",
|
||||
siteName: "",
|
||||
staticPageAddress: "",
|
||||
staticPageWapAddress: "",
|
||||
|
|
|
@ -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`);
|
||||
}
|
||||
|
|
|
@ -6,22 +6,40 @@
|
|||
<div class="main">
|
||||
<div class="sidebar-menu-con menu-bar">
|
||||
<div class="logo-con">
|
||||
<img src="../assets/logo.png" key="max-logo" />
|
||||
<!-- <img src="../assets/logo.png" key="max-logo" /> -->
|
||||
<img :src="storeSideLogo" key="max-logo" />
|
||||
</div>
|
||||
<shrinkable-menu></shrinkable-menu>
|
||||
</div>
|
||||
<!-- 顶部标题栏主体 -->
|
||||
<div class="main-header-con">
|
||||
<div class="main-header">
|
||||
<div :class="{'header-avator-con':navType!=4, 'header-avator-con nav4':navType == 4}">
|
||||
<div
|
||||
:class="{
|
||||
'header-avator-con': navType != 4,
|
||||
'header-avator-con nav4': navType == 4,
|
||||
}"
|
||||
>
|
||||
<!-- 用户头像 -->
|
||||
<div class="user-dropdown-menu-con">
|
||||
<Row type="flex" justify="end" align="middle" class="user-dropdown-innercon">
|
||||
<Dropdown transfer trigger="hover" @on-click="handleClickUserDropdown">
|
||||
<Row
|
||||
type="flex"
|
||||
justify="end"
|
||||
align="middle"
|
||||
class="user-dropdown-innercon"
|
||||
>
|
||||
<Dropdown
|
||||
transfer
|
||||
trigger="hover"
|
||||
@on-click="handleClickUserDropdown"
|
||||
>
|
||||
<div class="dropList">
|
||||
<span class="main-user-name">{{ userInfo.storeName }}</span>
|
||||
<Icon type="md-arrow-dropdown" />
|
||||
<Avatar :src="userInfo.storeLogo" style="background: #fff;margin-left: 10px;"></Avatar>
|
||||
<Avatar
|
||||
:src="userInfo.storeLogo"
|
||||
style="background: #fff; margin-left: 10px"
|
||||
></Avatar>
|
||||
</div>
|
||||
<DropdownMenu slot="list">
|
||||
<DropdownItem name="changePass">修改密码</DropdownItem>
|
||||
|
@ -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;
|
||||
|
|
|
@ -1,14 +1,77 @@
|
|||
<template>
|
||||
<div>
|
||||
<Row class="header">
|
||||
<img class="logo" src="@/assets/logo.png" >
|
||||
<img class="logo" :src="storeSideLogo" />
|
||||
</Row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBaseSite } from "@/api/common.js";
|
||||
export default {
|
||||
name: "header",
|
||||
data(){
|
||||
return{
|
||||
storeSideLogo: require('@/assets/logo.png')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
if (
|
||||
!localStorage.getItem("sellersiteName") ||
|
||||
!localStorage.getItem("sellerlogoImg") ||
|
||||
!localStorage.getItem("seller_expiration_time")
|
||||
) {
|
||||
this.getSite();
|
||||
} else {
|
||||
// 如果缓存过期,则获取最新的信息
|
||||
if (new Date() > localStorage.getItem("seller_expiration_time")) {
|
||||
this.getSite();
|
||||
return;
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
getSite() {
|
||||
//获取基本站点信息
|
||||
getBaseSite().then((res) => {
|
||||
if (res.success && res.result.settingValue) {
|
||||
let data = JSON.parse(res.result.settingValue);
|
||||
// 过期时间
|
||||
var expirationTime = new Date().setHours(new Date().getHours() + 1);
|
||||
// 存放过期时间
|
||||
localStorage.setItem("seller_expiration_time", expirationTime);
|
||||
// 存放信息
|
||||
localStorage.setItem("sellersiteName", data.siteName);
|
||||
localStorage.setItem("sellerlogoImg", data.storeSideLogo);
|
||||
console.log(data,'datadadada')
|
||||
window.document.title = data.siteName;
|
||||
//动态获取icon
|
||||
let link =
|
||||
document.querySelector("link[rel*='icon']") ||
|
||||
document.createElement("link");
|
||||
link.type = "image/x-icon";
|
||||
link.href = data.storeSideLogo;
|
||||
link.rel = "shortcut icon";
|
||||
document.getElementsByTagName("head")[0].appendChild(link);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue