|
|
|
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(){
|
|
|
|
|
|
|
|
let {status} = this.data;
|
|
|
|
this.triggerEvent("refresh",{target:"body", status})
|
|
|
|
},
|
|
|
|
onTapButton({target:{dataset:{current}}}){
|
|
|
|
|
|
|
|
let {status} =this.data;
|
|
|
|
this.triggerEvent("refresh",{target:"button",current, status})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|