|
@@ -1,128 +1,138 @@
|
|
-
|
|
|
|
var prefix = 'jp-housekeep-manage-' + process.car.NODE_ENV + '_';
|
|
var prefix = 'jp-housekeep-manage-' + process.car.NODE_ENV + '_';
|
|
-
|
|
|
|
-var app = {
|
|
|
|
-
|
|
|
|
- getGzDate : (key) => {
|
|
|
|
- var tdate=new Date( ).toJSON().substr(0,10).replace("T"," ")
|
|
|
|
- var date= uni.getStorageSync( prefix + "is_gz_date")
|
|
|
|
-
|
|
|
|
- if(tdate==date){
|
|
|
|
- return false
|
|
|
|
- }else{
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- getUID:()=>{
|
|
|
|
- var obj=uni.getStorageSync(prefix + 'xpgj_wx_user_info')
|
|
|
|
- if(!obj){
|
|
|
|
- obj={}
|
|
|
|
- }
|
|
|
|
- if(obj.unionid&&!obj.unionId){
|
|
|
|
- obj.unionId=obj.unionid
|
|
|
|
- }
|
|
|
|
- return obj.unionId
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- setGzDate : () => uni.setStorageSync(prefix + "is_gz_date", new Date( ).toJSON().substr(0,10).replace("T"," ") ),
|
|
|
|
-
|
|
|
|
- getGunIdCharge :()=>{
|
|
|
|
-
|
|
|
|
- var date= uni.getStorageSync( prefix + "GunId_Date_charge")
|
|
|
|
- var now=new Date().getTime()
|
|
|
|
- if(date+5*60*1000>now){
|
|
|
|
- return uni.getStorageSync(prefix + "GunId_Date_Show_charge")
|
|
|
|
- }else{
|
|
|
|
- return "";
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- setGunIdCharge : ( value) => {
|
|
|
|
- uni.setStorageSync(prefix + "GunId_Date_Show_charge", value)
|
|
|
|
- uni.setStorageSync(prefix + "GunId_Date_charge", new Date().getTime())
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- getPrefix:()=> prefix,
|
|
|
|
- get : key => uni.getStorageSync(prefix + key),
|
|
|
|
-
|
|
|
|
- set : (key, value) => uni.setStorageSync(prefix + key, value),
|
|
|
|
- remove: key => uni.removeStorageSync(prefix + key),
|
|
|
|
- setConfig : (value) => uni.setStorageSync(prefix + '_config_$', value),
|
|
|
|
- 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;
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- setConfigMessage : (value) => uni.setStorageSync(prefix + '_config_tips_$', value),
|
|
|
|
- getConfigMessage : () => {
|
|
|
|
- var config = uni.getStorageSync(prefix + '_config_tips_$')
|
|
|
|
- if(!config){
|
|
|
|
- config=[]
|
|
|
|
- }
|
|
|
|
- return config;
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- logoff:()=>{
|
|
|
|
- uni.removeStorageSync(prefix + 'token_tdate')
|
|
|
|
- uni.removeStorageSync(prefix + 'token')
|
|
|
|
- uni.removeStorageSync(prefix + 'personInfo');
|
|
|
|
|
|
+
|
|
|
|
+var app = {
|
|
|
|
+
|
|
|
|
+ getGzDate: (key) => {
|
|
|
|
+ var tdate = new Date().toJSON().substr(0, 10).replace("T", " ")
|
|
|
|
+ var date = uni.getStorageSync(prefix + "is_gz_date")
|
|
|
|
+
|
|
|
|
+ if (tdate == date) {
|
|
|
|
+ return false
|
|
|
|
+ } else {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ getUID: () => {
|
|
|
|
+ var obj = uni.getStorageSync(prefix + 'xpgj_wx_user_info')
|
|
|
|
+ if (!obj) {
|
|
|
|
+ obj = {}
|
|
|
|
+ }
|
|
|
|
+ if (obj.unionid && !obj.unionId) {
|
|
|
|
+ obj.unionId = obj.unionid
|
|
|
|
+ }
|
|
|
|
+ return obj.unionId
|
|
|
|
+ },
|
|
|
|
+ getUnionPhone: () => {
|
|
|
|
+ var obj = uni.getStorageSync(prefix + 'xpgj_wx_user_info')
|
|
|
|
+ if (!obj) {
|
|
|
|
+ obj = {}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return obj.unionPhone
|
|
|
|
+ // if(!(process.env.NODE_ENV === "development") ){
|
|
|
|
+
|
|
|
|
+ // }else{
|
|
|
|
+ // return process.car.unionid
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
+ setGzDate: () => uni.setStorageSync(prefix + "is_gz_date", new Date().toJSON().substr(0, 10).replace("T", " ")),
|
|
|
|
+
|
|
|
|
+ getGunIdCharge: () => {
|
|
|
|
+
|
|
|
|
+ var date = uni.getStorageSync(prefix + "GunId_Date_charge")
|
|
|
|
+ var now = new Date().getTime()
|
|
|
|
+ if (date + 5 * 60 * 1000 > now) {
|
|
|
|
+ return uni.getStorageSync(prefix + "GunId_Date_Show_charge")
|
|
|
|
+ } else {
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ setGunIdCharge: (value) => {
|
|
|
|
+ uni.setStorageSync(prefix + "GunId_Date_Show_charge", value)
|
|
|
|
+ uni.setStorageSync(prefix + "GunId_Date_charge", new Date().getTime())
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ getPrefix: () => prefix,
|
|
|
|
+ get: key => uni.getStorageSync(prefix + key),
|
|
|
|
+
|
|
|
|
+ set: (key, value) => uni.setStorageSync(prefix + key, value),
|
|
|
|
+ remove: key => uni.removeStorageSync(prefix + key),
|
|
|
|
+ setConfig: (value) => uni.setStorageSync(prefix + '_config_$', value),
|
|
|
|
+ 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;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ setConfigMessage: (value) => uni.setStorageSync(prefix + '_config_tips_$', value),
|
|
|
|
+ getConfigMessage: () => {
|
|
|
|
+ var config = uni.getStorageSync(prefix + '_config_tips_$')
|
|
|
|
+ if (!config) {
|
|
|
|
+ config = []
|
|
|
|
+ }
|
|
|
|
+ return config;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ logoff: () => {
|
|
|
|
+ uni.removeStorageSync(prefix + 'token_tdate')
|
|
|
|
+ uni.removeStorageSync(prefix + 'token')
|
|
|
|
+ uni.removeStorageSync(prefix + 'personInfo');
|
|
uni.removeStorageSync(prefix + 'personInfoPlus');
|
|
uni.removeStorageSync(prefix + 'personInfoPlus');
|
|
- // uni.removeStorageSync(prefix + 'getElderModeClass');
|
|
|
|
- //uni.removeStorageSync(prefix+'wx_openId');
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- getPersonInfo : () => {
|
|
|
|
- return uni.getStorageSync(prefix + 'personInfo')
|
|
|
|
- },
|
|
|
|
- getPersonInfoPlus : () => {
|
|
|
|
- return uni.getStorageSync(prefix + 'personInfoPlus')
|
|
|
|
|
|
+ // uni.removeStorageSync(prefix + 'getElderModeClass');
|
|
|
|
+ //uni.removeStorageSync(prefix+'wx_openId');
|
|
|
|
+
|
|
},
|
|
},
|
|
- 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),
|
|
|
|
-
|
|
|
|
- getOpenIdALI : () => uni.getStorageSync(prefix + 'ali_openId'+process.car.VUE_APP_WXAPPID),
|
|
|
|
- setOpenIdALI : (value) => uni.setStorageSync(prefix + 'ali_openId'+process.car.VUE_APP_WXAPPID, value),
|
|
|
|
-
|
|
|
|
- getUserInfo : () => {
|
|
|
|
- return uni.getStorageSync(prefix + 'xpgj_wx_user_info')
|
|
|
|
|
|
+
|
|
|
|
+ getPersonInfo: () => {
|
|
|
|
+ return uni.getStorageSync(prefix + 'personInfo')
|
|
|
|
+ },
|
|
|
|
+ getPersonInfoPlus: () => {
|
|
|
|
+ return uni.getStorageSync(prefix + 'personInfoPlus')
|
|
},
|
|
},
|
|
|
|
+ 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) => uni.setStorageSync(prefix + 'personInfo', value),
|
|
|
|
- setPersonInfoPlus : (value) => uni.setStorageSync(prefix + 'personInfoPlus', value),
|
|
|
|
-
|
|
|
|
- setUserInfo : (value) => uni.setStorageSync(prefix + 'xpgj_wx_user_info', value),
|
|
|
|
-
|
|
|
|
- getToken : (options) => {
|
|
|
|
- //不同权限 ,不同token
|
|
|
|
-
|
|
|
|
- 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)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ,
|
|
|
|
- getGetElderModeClass : () => {
|
|
|
|
- return uni.getStorageSync(prefix + 'getElderModeClass')
|
|
|
|
|
|
+ getOpenIdALI: () => uni.getStorageSync(prefix + 'ali_openId' + process.car.VUE_APP_WXAPPID),
|
|
|
|
+ setOpenIdALI: (value) => uni.setStorageSync(prefix + 'ali_openId' + process.car.VUE_APP_WXAPPID, value),
|
|
|
|
+
|
|
|
|
+ getUserInfo: () => {
|
|
|
|
+ return uni.getStorageSync(prefix + 'xpgj_wx_user_info')
|
|
},
|
|
},
|
|
- setGetElderModeClass : (value) => uni.setStorageSync(prefix + 'getElderModeClass', value),
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ setPersonInfo: (value) => uni.setStorageSync(prefix + 'personInfo', value),
|
|
|
|
+ setPersonInfoPlus: (value) => uni.setStorageSync(prefix + 'personInfoPlus', value),
|
|
|
|
+
|
|
|
|
+ setUserInfo: (value) => uni.setStorageSync(prefix + 'xpgj_wx_user_info', value),
|
|
|
|
+
|
|
|
|
+ getToken: (options) => {
|
|
|
|
+ //不同权限 ,不同token
|
|
|
|
+
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ getGetElderModeClass: () => {
|
|
|
|
+ return uni.getStorageSync(prefix + 'getElderModeClass')
|
|
|
|
+ },
|
|
|
|
+ setGetElderModeClass: (value) => uni.setStorageSync(prefix + 'getElderModeClass', value),
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
-module.exports = app
|
|
|
|
|
|
+module.exports = app
|