2021-05-13 11:03:32 +08:00
|
|
|
let isDev = process.env.NODE_ENV === "development";
|
|
|
|
|
|
|
|
const UUID = isDev ? "uuid_key_dev" : "uuid_key";
|
|
|
|
const HAS_LOGIN = isDev ? "has_login_key_dev" : "has_login_key";
|
|
|
|
const ACCESS_TOKEN = isDev ? "access_token_key_dev" : "access_token_key";
|
|
|
|
const REFRESH_TOKEN = isDev ? "refresh_token_key_dev" : "refresh_token_key";
|
|
|
|
const USER_INFO = isDev ? "user_info_obj_dev" : "user_info_obj";
|
|
|
|
const FACE_LOGIN = isDev ? "face_login_dev" : "face_login";
|
|
|
|
const FINGER_LOGIN = isDev ? "finger_login_dev" : "finger_login";
|
|
|
|
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
|
2022-02-10 18:57:17 +08:00
|
|
|
const AFTERSALE_DATA = isDev ? "aftersale_data_dev" : "aftersale_data";
|
2021-05-13 11:03:32 +08:00
|
|
|
export default {
|
2023-01-13 07:35:51 +08:00
|
|
|
//写入自动发券
|
|
|
|
setAutoCp(val){
|
|
|
|
uni.setStorageSync('autoCp', val)
|
|
|
|
},
|
|
|
|
//获取自动发券时间
|
|
|
|
getAutoCp(){
|
|
|
|
return uni.getStorageSync('autoCp');
|
|
|
|
},
|
2021-07-30 16:29:05 +08:00
|
|
|
// 写入热门搜索时间戳
|
|
|
|
setHotWords(val) {
|
|
|
|
uni.setStorageSync("hotWords", val);
|
|
|
|
},
|
|
|
|
// 获取热门搜索时间戳
|
|
|
|
getHotWords() {
|
|
|
|
return uni.getStorageSync(`hotWords`);
|
|
|
|
},
|
2022-04-24 22:41:00 +08:00
|
|
|
//写入 展示还是不展示
|
|
|
|
setShow(val) {
|
|
|
|
uni.setStorageSync("show", val);
|
|
|
|
},
|
|
|
|
getShow() {
|
|
|
|
if (uni.getStorageSync(`show`) === "" || uni.getStorageSync(`show`) === undefined) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return uni.getStorageSync(`show`);
|
|
|
|
},
|
2021-05-13 11:03:32 +08:00
|
|
|
// 获取face id登录
|
|
|
|
getFaceLogin() {
|
|
|
|
return uni.getStorageSync(FACE_LOGIN);
|
|
|
|
},
|
|
|
|
// 写入face id
|
|
|
|
setFaceLogin(val) {
|
|
|
|
uni.setStorageSync(FACE_LOGIN, val);
|
|
|
|
},
|
|
|
|
// 获取指纹登录
|
|
|
|
getFingerLogin() {
|
|
|
|
return uni.getStorageSync(FINGER_LOGIN);
|
|
|
|
},
|
|
|
|
// 写入指纹登录
|
|
|
|
setFingerLogin(val) {
|
|
|
|
uni.setStorageSync(FINGER_LOGIN, val);
|
|
|
|
},
|
|
|
|
// 写入用户信息
|
|
|
|
setUserInfo(val) {
|
|
|
|
uni.setStorageSync(USER_INFO, val);
|
|
|
|
},
|
|
|
|
// 获取用户信息
|
|
|
|
getUserInfo() {
|
|
|
|
return uni.getStorageSync(USER_INFO);
|
|
|
|
},
|
2022-12-27 14:17:00 +08:00
|
|
|
setTalkToUser(val){
|
|
|
|
uni.setStorageSync("TALK_TO_USER", val);
|
|
|
|
},
|
|
|
|
getTalkToUser(){
|
|
|
|
return uni.getStorageSync("TALK_TO_USER");
|
|
|
|
},
|
2021-05-13 11:03:32 +08:00
|
|
|
// 写入uuid
|
|
|
|
setUuid(val) {
|
|
|
|
uni.setStorageSync(UUID, val);
|
|
|
|
},
|
|
|
|
// 获取uuid
|
|
|
|
getUuid() {
|
|
|
|
return uni.getStorageSync(UUID);
|
|
|
|
},
|
|
|
|
// 写入登录
|
|
|
|
setHasLogin(val) {
|
|
|
|
uni.setStorageSync(HAS_LOGIN, val);
|
|
|
|
},
|
|
|
|
// 获取是否登录
|
|
|
|
getHasLogin() {
|
|
|
|
return uni.getStorageSync(HAS_LOGIN);
|
|
|
|
},
|
|
|
|
// 删除uuid
|
|
|
|
removeUuid() {
|
|
|
|
uni.removeStorageSync(UUID);
|
|
|
|
},
|
|
|
|
// 写入accessToken
|
|
|
|
setAccessToken(val) {
|
|
|
|
uni.setStorageSync(ACCESS_TOKEN, val);
|
|
|
|
},
|
|
|
|
// 获取accessToken
|
|
|
|
getAccessToken() {
|
|
|
|
return uni.getStorageSync(ACCESS_TOKEN);
|
|
|
|
},
|
|
|
|
// 后退购物车
|
|
|
|
setCartBackbtn(val) {
|
|
|
|
uni.setStorageSync(CART_BACKBTN, val);
|
|
|
|
},
|
|
|
|
|
|
|
|
// 删除token
|
|
|
|
removeAccessToken() {
|
|
|
|
uni.removeStorageSync(ACCESS_TOKEN);
|
|
|
|
},
|
|
|
|
// 写入刷新token
|
|
|
|
setRefreshToken(val) {
|
|
|
|
uni.setStorageSync(REFRESH_TOKEN, val);
|
|
|
|
},
|
|
|
|
// 获取刷新token
|
|
|
|
getRefreshToken() {
|
|
|
|
return uni.getStorageSync(REFRESH_TOKEN);
|
|
|
|
},
|
|
|
|
// 删除token
|
|
|
|
removeRefreshToken() {
|
|
|
|
uni.removeStorageSync(REFRESH_TOKEN);
|
|
|
|
},
|
2022-03-10 17:15:59 +08:00
|
|
|
|
2022-02-10 18:57:17 +08:00
|
|
|
setAfterSaleData(val) {
|
|
|
|
uni.setStorageSync(AFTERSALE_DATA, val);
|
|
|
|
},
|
2022-03-10 17:15:59 +08:00
|
|
|
|
2022-02-10 18:57:17 +08:00
|
|
|
getAfterSaleData() {
|
|
|
|
return uni.getStorageSync(AFTERSALE_DATA);
|
|
|
|
},
|
|
|
|
// 删除token
|
|
|
|
removeAfterSaleData() {
|
|
|
|
uni.removeStorageSync(AFTERSALE_DATA);
|
|
|
|
},
|
2022-12-27 18:01:41 +08:00
|
|
|
// 是否发送商品连接记录
|
|
|
|
setImGoodsLink(val) {
|
|
|
|
uni.setStorageSync('imGoodId', val);
|
|
|
|
},
|
|
|
|
getImGoodsLink() {
|
|
|
|
return uni.getStorageSync('imGoodId');
|
|
|
|
},
|
2021-05-13 11:03:32 +08:00
|
|
|
};
|