mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-18 08:33:49 +08:00
修改
1.修改价格显示问题 2.分化用户数据和添加cookit等静态方法
This commit is contained in:
38
rc-busness/plugins/until/until.js
Normal file
38
rc-busness/plugins/until/until.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
这个是存放静态公共方法
|
||||
*/
|
||||
|
||||
/**
|
||||
* 设置cookie的值
|
||||
* @param {String} key cookie的键
|
||||
* @param {String} val cookie的值
|
||||
* @param {String} exdays 过期时间默认的话是7天
|
||||
*/
|
||||
const setCookie = (key,val,exdays = 7)=>{
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime()+(exdays*24*60*60*1000));
|
||||
var expires = "expires="+d.toGMTString();
|
||||
document.cookie = key + "=" + val + "; " + expires;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取cookie的值
|
||||
* @param {String} key cookie的键
|
||||
*/
|
||||
const getCookie = (key)=>{
|
||||
var name = key + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0; i<ca.length; i++){
|
||||
var c = ca[i].trim();
|
||||
if(c.indexOf(name)==0) return c.substring(name.length,c.length);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export {
|
||||
setCookie,
|
||||
getCookie,
|
||||
}
|
||||
Reference in New Issue
Block a user