|
@@ -20,7 +20,11 @@ Page({
|
|
|
|
|
|
isstop:false,
|
|
isstop:false,
|
|
|
|
|
|
- title:''
|
|
+ title:'',
|
|
|
|
+
|
|
|
|
+ percentage: '',
|
|
|
|
+ timer: null,
|
|
|
|
+ startTime: 0,
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
@@ -172,4 +176,55 @@ Page({
|
|
})
|
|
})
|
|
console.log(this.data.isstop);
|
|
console.log(this.data.isstop);
|
|
},
|
|
},
|
|
|
|
+ startIncrease() {
|
|
|
|
+
|
|
|
|
+ this.setData({
|
|
|
|
+ startTime: Date.now(),
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (this.data.timer) {
|
|
|
|
+ clearInterval(this.data.timer);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.setData({
|
|
|
|
+ timer: setInterval(() => {
|
|
|
|
+ const currentTime = Date.now();
|
|
|
|
+ const elapsedTime = currentTime - this.data.startTime;
|
|
|
|
+ const percentage = Math.min((elapsedTime / 4000) * 100, 100);
|
|
|
|
+
|
|
|
|
+ this.setData({
|
|
|
|
+ percentage: `conic-gradient(from 0deg, #015EEA ${percentage}%, white 0%)`,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (percentage >= 100) {
|
|
|
|
+ clearInterval(this.data.timer);
|
|
|
|
+ this.setData({
|
|
|
|
+ timer: null,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }, 40),
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ stopIncrease() {
|
|
|
|
+
|
|
|
|
+ if (this.data.timer) {
|
|
|
|
+ clearInterval(this.data.timer);
|
|
|
|
+ this.setData({
|
|
|
|
+ timer: null,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const elapsedTime = Date.now() - this.data.startTime;
|
|
|
|
+ if (elapsedTime < 4000) {
|
|
|
|
+ this.setData({
|
|
|
|
+ percentage: '',
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
})
|
|
})
|