信达小程序
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.

104 lines
2.0 KiB

const app = getApp<IAppOption>()
10 months ago
// pages/story/a.ts
Component({
/**
*
*/
properties: {
detailId: {
type: String,
value: '0',
10 months ago
},
asideOut: {
type: Boolean,
value: false,
},
asideType: {
type: String,
value: '',
10 months ago
},
timeToast: {
type: Boolean,
value: false,
},
timeToastType: {
type: String,
value: '',
10 months ago
},
timeToastParams: {
type: Object,
value() {
return {}
10 months ago
},
},
},
observers: {
asideOut(asideOut) {
10 months ago
if (asideOut) {
setTimeout(() => {
this.countDown()
}, 1000)
10 months ago
}
},
},
lifetimes: {
attached() {
const systemInfo = wx.getSystemInfoSync()
10 months ago
this.setData({
sliderTop: systemInfo.screenHeight - 250,
})
10 months ago
},
detached() {
if (this.timer)
clearInterval(this.timer)
10 months ago
},
},
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
10 months ago
that.timer = setInterval(() => {
circle--
10 months ago
that.setData({
circleVal: circle,
centerVal: Math.floor(circle / 10),
})
10 months ago
if (circle <= 0) {
clearInterval(that.timer)
this.handleAsideOut()
10 months ago
}
}, 100)
10 months ago
},
handleAsideOut() {
wx.ajax({
method: 'POST',
url: '?r=xd/score/send-score',
10 months ago
data: {
Type: this.data.asideType,
Id: this.data.detailId,
},
}).then((res) => {
if (!Array.isArray(res)) {
this.setData({
rewardScore: res.rewardScore,
})
10 months ago
}
})
10 months ago
},
},
})