12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- var prefix = 'jp_xqjy_' + 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),
- getConfig : () => {
- var config = uni.getStorageSync(prefix + '_config_$')
- var configure={}
- if(config){
- for(var i in config){
- var con=config[i];
- configure[con.key]=con.value
- }
- }
- return configure;
- },
- setConfig : (value) => uni.setStorageSync(prefix + '_config_$', value),
-
- getPersonInfoPlus : () => {
- return uni.getStorageSync(prefix + 'personInfoPlus')
- },
- getPersonInfo : () => {
- return uni.getStorageSync(prefix + 'personInfo')
- },
- logoff:()=>{
- uni.removeStorageSync(prefix + 'token_tdate')
- uni.removeStorageSync(prefix + 'token')
- uni.removeStorageSync(prefix + 'personInfo');
- uni.removeStorageSync(prefix + 'personInfoPlus');
- //uni.removeStorageSync(prefix+'wx_openId');
-
- },
- signOut:()=> uni.removeStorageSync(prefix + 'personInfo'),
- getOpenId : () => uni.getStorageSync(prefix + 'wx_openId'),
- setOpenId : (value) => uni.setStorageSync(prefix + 'wx_openId', value),
- setPersonInfo : (value) => uni.setStorageSync(prefix + 'personInfo', value),
- setPersonInfoPlus : (value) => uni.setStorageSync(prefix + 'personInfoPlus', value),
-
- getToken : () => uni.getStorageSync(prefix + 'token'),
- setToken : (value) => {
- 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
|