You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

const app = getApp();
const config = global.config;
const imgUrl = config.imgDir+"blank_info_bg.png";
const scenes = {
imgUrl,
401:{
message:"请先登录哦",
buttons:["点击登录"]
}
}
Component({
properties: {
status:{
type:Number,
observer:function(res){
this.refresh()
}
},
config:Object,
bg:{
type:String,
value:"#00b0f0"
},
position:{
type:String,
value:"fixed"
}
},
data: {
},
methods: {
refresh(){
let {config, status} = this.data;
var {message="", buttons=[], imgUrl=""} = scenes;
if(scenes[status])
var {message=message, buttons=buttons, imgUrl=imgUrl} = scenes[status];
if(config[status])
var {message=message, buttons=buttons, imgUrl=imgUrl} = config[status];
this.setData({message, buttons, imgUrl});
},
onTapBody(){
console.log("tapbody")
let {status} = this.data;
this.triggerEvent("refresh",{target:"body", status})
},
onTapButton({target:{dataset:{current}}}){
console.log("tapButton")
let {status} =this.data;
this.triggerEvent("refresh",{target:"button",current, status})
}
}
})