mixin.js 971 B

12345678910111213141516171819202122232425262728293031323334
  1. var prefix = 'jp_charging_' + process.car.NODE_ENV + '_';
  2. var app = {
  3. getPrefix:()=> prefix,
  4. get : key => uni.getStorageSync(prefix + key),
  5. set : (key, value) => uni.setStorageSync(prefix + key, value),
  6. remove: key => uni.removeStorageSync(prefix + key),
  7. getPersonInfo : () => {
  8. return uni.getStorageSync(prefix + 'personInfo')
  9. },
  10. signOut:()=> uni.removeStorageSync(prefix + 'personInfo'),
  11. getOpenId : () => uni.getStorageSync(prefix + 'wx_openId'),
  12. setOpenId : (value) => uni.setStorageSync(prefix + 'wx_openId', value),
  13. setPersonInfo : (value) => uni.setStorageSync(prefix + 'personInfo', value),
  14. getToken : () => uni.getStorageSync(prefix + 'token'),
  15. setToken : (value) => {
  16. uni.setStorageSync(prefix + 'token', value)
  17. if(value){
  18. var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,15).replace("T"," ")
  19. uni.setStorageSync(prefix + 'token_tdate', tdate)
  20. }
  21. }
  22. ,
  23. }
  24. module.exports = app