1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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),
- 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;
- },
- logoff:()=>{
- uni.removeStorageSync(prefix + 'token_tdate')
- uni.removeStorageSync(prefix + 'token')
- uni.removeStorageSync(prefix + 'personInfo');
- uni.removeStorageSync(prefix + 'personInfoPlus');
- //uni.removeStorageSync(prefix+'wx_openId');
-
- },
- setConfig : (value) => uni.setStorageSync(prefix + '_config_$', value),
-
- getPersonInfo : () => {
- return uni.getStorageSync(prefix + 'personInfo')
- },
- signOut:()=> uni.removeStorageSync(prefix + 'personInfo'),
- getOpenId : () => uni.getStorageSync(prefix + 'wx_openId'),
-
- getUserInfo : () => {
- return uni.getStorageSync(prefix + 'xpgj_wx_user_info')
- },
- setOpenId : (value) => uni.setStorageSync(prefix + 'wx_openId', value),
- setPersonInfo : (value) => uni.setStorageSync(prefix + 'personInfo', value),
-
- setUserInfo : (value) => uni.setStorageSync(prefix + 'xpgj_wx_user_info', 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) => {
- 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
|