多租户商城-商户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

71 lines
1.8 KiB

const ShopIdKey = 'cereShopId'
const ProjectKey = 'project'
export function setShopId(shopId) {
return sessionStorage.setItem(ShopIdKey, shopId)
}
export function getShopId() {
var fullUrl = window.location.search;
if (fullUrl.indexOf("?") != -1) {
fullUrl = fullUrl.substring(1);
var paramStrs = fullUrl.split("&");
for(let i=0;i<paramStrs.length;i++){
const newStrs = paramStrs[i].split("=");
if(newStrs[0] === ShopIdKey){
return newStrs[1];
}
}
}
return localStorage.getItem(ShopIdKey)
}
export function initShopId() {
var fullUrl = window.location.search;
var cereShopId = '0';
if (fullUrl.indexOf("?") != -1) {
fullUrl = fullUrl.substring(1);
var paramStrs = fullUrl.split("&");
for(let i=0;i<paramStrs.length;i++){
const newStrs = paramStrs[i].split("=");
if(newStrs[0] === ShopIdKey){
cereShopId = newStrs[1];
break;
}
}
}
sessionStorage.setItem(ShopIdKey, cereShopId)
}
export function getProject() {
var fullUrl = window.location.search;
if (fullUrl.indexOf("?") != -1) {
fullUrl = fullUrl.substring(1);
var paramStrs = fullUrl.split("&");
for(let i=0;i<paramStrs.length;i++){
const newStrs = paramStrs[i].split("=");
if(newStrs[0] === ProjectKey){
return newStrs[1];
}
}
}
return localStorage.getItem(ProjectKey)
}
export function initProject() {
var fullUrl = window.location.search;
var cereShopId = '0';
if (fullUrl.indexOf("?") != -1) {
fullUrl = fullUrl.substring(1);
var paramStrs = fullUrl.split("&");
for(let i=0;i<paramStrs.length;i++){
const newStrs = paramStrs[i].split("=");
if(newStrs[0] === ProjectKey){
cereShopId = newStrs[1];
break;
}
}
}
sessionStorage.setItem(ProjectKey, cereShopId)
}