|
|
|
// components/tips/add-to-lite.js
|
|
|
|
import util from '../../utils/util'
|
|
|
|
const cache_key='ADD-TO-LINE'
|
|
|
|
const cache_key='A2L-'
|
|
|
|
Component({
|
|
|
|
/**
|
|
|
|
* 组件的属性列表
|
|
...
|
...
|
@@ -9,7 +9,13 @@ Component({ |
|
|
|
bgColor:{
|
|
|
|
type:String,
|
|
|
|
value:'rgba(0,0,0,0.6)',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
key:String,
|
|
|
|
type:{
|
|
|
|
type:String,
|
|
|
|
value:'yellow',
|
|
|
|
},
|
|
|
|
hitStr:String,
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -20,11 +26,15 @@ Component({ |
|
|
|
statusBarHeightFull:0,
|
|
|
|
},
|
|
|
|
attached(){
|
|
|
|
let ca=util.cache(cache_key);
|
|
|
|
let cacheKey=cache_key+this.data.key
|
|
|
|
let ca=util.cache(cacheKey);
|
|
|
|
if(ca){
|
|
|
|
this.hide();
|
|
|
|
}else{
|
|
|
|
this.show();
|
|
|
|
let p=getCurrentPages()
|
|
|
|
if(p.length==1){
|
|
|
|
this.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
...
|
...
|
@@ -35,21 +45,28 @@ Component({ |
|
|
|
show(){
|
|
|
|
this.triggerEvent("show");
|
|
|
|
//导航栏自适应
|
|
|
|
let systemInfo = wx.getSystemInfoSync();
|
|
|
|
let reg = /ios/i;
|
|
|
|
let pt = 20;//导航状态栏上内边距
|
|
|
|
let h = 44;//导航状态栏高度
|
|
|
|
if(reg.test(systemInfo.system)){
|
|
|
|
pt = systemInfo.statusBarHeight;
|
|
|
|
h = 44;
|
|
|
|
if(this.data.type=='yellow'){
|
|
|
|
let systemInfo = wx.getSystemInfoSync();
|
|
|
|
let reg = /ios/i;
|
|
|
|
let pt = 20;//导航状态栏上内边距
|
|
|
|
let h = 44;//导航状态栏高度
|
|
|
|
if(reg.test(systemInfo.system)){
|
|
|
|
pt = systemInfo.statusBarHeight;
|
|
|
|
h = 44;
|
|
|
|
}else{
|
|
|
|
pt = systemInfo.statusBarHeight;
|
|
|
|
h = 48;
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
hidden:false,
|
|
|
|
statusBarHeightFull:(pt+h-5),
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
pt = systemInfo.statusBarHeight;
|
|
|
|
h = 48;
|
|
|
|
this.setData({
|
|
|
|
hidden:false,
|
|
|
|
statusBarHeightFull:0,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
hidden:false,
|
|
|
|
statusBarHeightFull:pt+h,
|
|
|
|
})
|
|
|
|
if(!this.timeInterval){
|
|
|
|
this.timeIntervalNum=0;
|
|
|
|
this.timeInterval=setInterval(()=>{
|
|
...
|
...
|
@@ -67,7 +84,8 @@ Component({ |
|
|
|
},
|
|
|
|
hide(){
|
|
|
|
this.triggerEvent("hide");
|
|
|
|
util.cache(cache_key,cache_key);
|
|
|
|
let cacheKey=cache_key+this.data.key
|
|
|
|
util.cache(cacheKey,cacheKey);
|
|
|
|
this.setData({
|
|
|
|
hidden:true,
|
|
|
|
})
|
...
|
...
|
|