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.
|
|
|
|
const app = getApp<IAppOption>();
|
|
|
|
|
|
|
|
|
|
// pages/story/a.ts
|
|
|
|
|
Component({
|
|
|
|
|
/**
|
|
|
|
|
* 组件的属性列表
|
|
|
|
|
*/
|
|
|
|
|
properties: {
|
|
|
|
|
detailId: {
|
|
|
|
|
type: String,
|
|
|
|
|
value: "0",
|
|
|
|
|
},
|
|
|
|
|
asideOut: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
value: false,
|
|
|
|
|
},
|
|
|
|
|
asideType: {
|
|
|
|
|
type: String,
|
|
|
|
|
value: "",
|
|
|
|
|
},
|
|
|
|
|
timeToast: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
value: false,
|
|
|
|
|
},
|
|
|
|
|
timeToastType: {
|
|
|
|
|
type: String,
|
|
|
|
|
value: "",
|
|
|
|
|
},
|
|
|
|
|
timeToastParams: {
|
|
|
|
|
type: Object,
|
|
|
|
|
value() {
|
|
|
|
|
return {};
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
observers: {
|
|
|
|
|
asideOut: function (asideOut) {
|
|
|
|
|
if (asideOut) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.countDown();
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
lifetimes: {
|
|
|
|
|
attached() {
|
|
|
|
|
let systemInfo = wx.getSystemInfoSync();
|
|
|
|
|
this.setData({
|
|
|
|
|
sliderTop: systemInfo.screenHeight - 250,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
detached() {
|
|
|
|
|
if (this.timer) clearInterval(this.timer);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
data: {
|
|
|
|
|
imageUrl: app.globalData.imageUrl,
|
|
|
|
|
Timestamp: app.globalData.Timestamp,
|
|
|
|
|
|
|
|
|
|
rewardScore: 0,
|
|
|
|
|
|
|
|
|
|
circleVal: 100,
|
|
|
|
|
centerVal: 9,
|
|
|
|
|
sliderTop: 450,
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
timer: null as any,
|
|
|
|
|
countDown() {
|
|
|
|
|
const that = this;
|
|
|
|
|
if (that.timer) return;
|
|
|
|
|
let circle = 100;
|
|
|
|
|
that.timer = setInterval(() => {
|
|
|
|
|
circle--;
|
|
|
|
|
that.setData({
|
|
|
|
|
circleVal: circle,
|
|
|
|
|
centerVal: Math.floor(circle / 10),
|
|
|
|
|
});
|
|
|
|
|
if (circle <= 0) {
|
|
|
|
|
clearInterval(that.timer);
|
|
|
|
|
this.handleAsideOut();
|
|
|
|
|
}
|
|
|
|
|
}, 100);
|
|
|
|
|
},
|
|
|
|
|
handleAsideOut() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: "POST",
|
|
|
|
|
url: "?r=zd/score/send-score",
|
|
|
|
|
data: {
|
|
|
|
|
Type: this.data.asideType,
|
|
|
|
|
Id: this.data.detailId,
|
|
|
|
|
},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
if (!Array.isArray(res)) {
|
|
|
|
|
this.setData({
|
|
|
|
|
rewardScore: res.rewardScore,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|