99 lines
2.3 KiB
JavaScript
99 lines
2.3 KiB
JavaScript
var app = getApp();
|
||
Component({
|
||
properties: {
|
||
params: {
|
||
type: null
|
||
},
|
||
host :{
|
||
type: null
|
||
}
|
||
},
|
||
data: {
|
||
signdata: {},
|
||
tapnow:true
|
||
}, // 私有数据,可用于模板渲染
|
||
|
||
lifetimes: {
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
attached() {
|
||
},
|
||
moved() {},
|
||
detached() {},
|
||
},
|
||
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
attached() {
|
||
|
||
}, // 此处attached的声明会被lifetimes字段中的声明覆盖
|
||
ready() {
|
||
this.setData({
|
||
signdata: this.data.params
|
||
});
|
||
},
|
||
|
||
pageLifetimes: {
|
||
// 组件所在页面的生命周期函数
|
||
show() {},
|
||
hide() {},
|
||
resize() {},
|
||
},
|
||
|
||
methods: {
|
||
signnow() {
|
||
let that = this;
|
||
if(!that.data.tapnow){
|
||
console.log('点击限制!!!');
|
||
return;
|
||
}
|
||
that.setData({
|
||
tapnow : false
|
||
});
|
||
let urlStr = app.getNetAddresss("plugin.sign.Frontend.Modules.Sign.Controllers.sign.sign");
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function(resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
let signdata = that.data.signdata;
|
||
signdata.text = `已${signdata.sign_name}`;
|
||
let numDate = Number(
|
||
signdata.button_hint.replace(/[^0-9]/gi, "")
|
||
);
|
||
signdata.button_hint = numDate + 1 + "天";
|
||
that.setData({
|
||
signdata: signdata
|
||
});
|
||
//下面这个是h5链接,无法跳装
|
||
// let reslink = res.data.success_url;
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 1500,
|
||
success: function() {
|
||
setTimeout(function() {
|
||
//要延时执行的代码
|
||
}, 1500); //延迟时间
|
||
},
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
setTimeout(function() {
|
||
that.setData({
|
||
tapnow : true
|
||
});
|
||
}, 1500); //延迟时间
|
||
|
||
}
|
||
},
|
||
fail: function(res) {
|
||
console.log(res.msg);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
});
|