var prefix = 'jp_charging_' + process.car.NODE_ENV + '_'; var app = { getPrefix:()=> prefix, get : key => uni.getStorageSync(prefix + key), set : (key, value) => uni.setStorageSync(prefix + key, value), remove: key => uni.removeStorageSync(prefix + key), getPersonInfoPlus : (jp_identity) => { if(jp_identity){ return uni.getStorageSync(prefix +jp_identity+ '_personInfoPlus') }else{ return uni.getStorageSync(prefix + 'personInfoPlus') } }, getPersonInfo : (jp_identity) => { if(jp_identity){ return uni.getStorageSync(prefix +jp_identity+ '_personInfo') }else{ return uni.getStorageSync(prefix + 'personInfo') } }, signOut:()=> uni.removeStorageSync(prefix + 'personInfo'), getOpenId : () => uni.getStorageSync(prefix + 'wx_openId'+process.car.VUE_APP_WXAPPID), setOpenId: (value) => uni.setStorageSync(prefix + 'wx_openId'+process.car.VUE_APP_WXAPPID, value), setPersonInfo : (value,jp_identity) =>{ if(jp_identity){ uni.setStorageSync(prefix + jp_identity+'_personInfo', value) }else{ uni.setStorageSync(prefix + 'personInfo', value) } }, setPersonInfoPlus : (value,jp_identity) =>{ if(jp_identity){ uni.setStorageSync(prefix + jp_identity+'_personInfoPlus', value) }else{ uni.setStorageSync(prefix + 'personInfoPlus', value) } }, getToken : (options) => { //不同权限 ,不同token if(options&&options.jp_identity){ return uni.getStorageSync(prefix+options.jp_identity+ '_token') }else{ return uni.getStorageSync(prefix + 'token') } }, setToken : (value,jp_identity) => { if(jp_identity){ uni.setStorageSync(prefix +jp_identity + '_token', value) if(value){ var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,15).replace("T"," ") uni.setStorageSync(prefix + jp_identity+'_token_tdate', tdate) } }else{ uni.setStorageSync(prefix + 'token', value) if(value){ var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,15).replace("T"," ") uni.setStorageSync(prefix + 'token_tdate', tdate) } } } , } module.exports = app