|
|
|
// components/tips/add-to-lite.js
|
|
|
|
import util from '../../utils/util'
|
|
|
|
const cache_key='ADD-TO-LINE'
|
|
|
|
Component({
|
|
|
|
/**
|
|
|
|
* 组件的属性列表
|
|
|
|
*/
|
|
|
|
properties: {
|
|
|
|
bgColor:{
|
|
|
|
type:String,
|
|
|
|
value:'#C8B16D',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
hidden:true,
|
|
|
|
statusBarHeightFull:0,
|
|
|
|
},
|
|
|
|
attached(){
|
|
|
|
let ca=util.cache(cache_key);
|
|
|
|
if(ca){
|
|
|
|
this.hide();
|
|
|
|
}else{
|
|
|
|
this.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 组件的方法列表
|
|
|
|
*/
|
|
|
|
methods: {
|
|
|
|
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;
|
|
|
|
}else{
|
|
|
|
pt = systemInfo.statusBarHeight;
|
|
|
|
h = 48;
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
hidden:false,
|
|
|
|
statusBarHeightFull:pt+h,
|
|
|
|
})
|
|
|
|
if(!this.timeInterval){
|
|
|
|
this.timeIntervalNum=0;
|
|
|
|
this.timeInterval=setInterval(()=>{
|
|
|
|
this.hasClose();
|
|
|
|
},1000)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
hasClose(){
|
|
|
|
if(this.timeIntervalNum>=10){
|
|
|
|
this.hide();
|
|
|
|
clearInterval(this.timeInterval);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.timeIntervalNum++;
|
|
|
|
},
|
|
|
|
hide(){
|
|
|
|
this.triggerEvent("hide");
|
|
|
|
util.cache(cache_key,cache_key);
|
|
|
|
this.setData({
|
|
|
|
hidden:true,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}) |
...
|
...
|
|