修复倒计时bug会被取消的bug
This commit is contained in:
parent
1a61a73237
commit
1545bf867f
@ -151,7 +151,6 @@
|
|||||||
</u-form-item>
|
</u-form-item>
|
||||||
</block>
|
</block>
|
||||||
</u--form>
|
</u--form>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -71,8 +71,14 @@
|
|||||||
this.id = options.id;
|
this.id = options.id;
|
||||||
this.initCompany();
|
this.initCompany();
|
||||||
this.initContractTypeList();
|
this.initContractTypeList();
|
||||||
|
let time = uni.getStorageSync('ctime' + this.id);
|
||||||
|
if(time>0&&(time - Date.now())/1000>0){
|
||||||
|
this.startTimer((time - Date.now())/1000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
if(this.timerCount>0) uni.setStorageSync('ctime'+this.id, this.timerCount*1000+Date.now());
|
||||||
},
|
},
|
||||||
onShow() {},
|
|
||||||
computed: {
|
computed: {
|
||||||
cTimerCount() {
|
cTimerCount() {
|
||||||
return this.timerCount;
|
return this.timerCount;
|
||||||
@ -129,14 +135,7 @@
|
|||||||
});
|
});
|
||||||
this.initCompany();
|
this.initCompany();
|
||||||
if (this.userInfo.contract.check_status == 3) {
|
if (this.userInfo.contract.check_status == 3) {
|
||||||
this.timerCount = 60;
|
this.startTimer();
|
||||||
this.timer = setInterval(() => {
|
|
||||||
this.timerCount--;
|
|
||||||
if (this.timerCount == 0) {
|
|
||||||
clearInterval(this.timer);
|
|
||||||
this.initCompany();
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
Toast('合同已发送');
|
Toast('合同已发送');
|
||||||
@ -149,14 +148,7 @@
|
|||||||
// 发送短信
|
// 发送短信
|
||||||
async getPostsms() {
|
async getPostsms() {
|
||||||
if (this.timerCount == 0) {
|
if (this.timerCount == 0) {
|
||||||
this.timerCount = 60;
|
this.startTimer();
|
||||||
this.timer = setInterval(() => {
|
|
||||||
this.timerCount--;
|
|
||||||
if (this.timerCount == 0) {
|
|
||||||
clearInterval(this.timer);
|
|
||||||
this.initCompany();
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
let res = await postsms({
|
let res = await postsms({
|
||||||
id: this.id
|
id: this.id
|
||||||
})
|
})
|
||||||
@ -164,6 +156,17 @@
|
|||||||
this.navTo('/subpkg/submit/submit');
|
this.navTo('/subpkg/submit/submit');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 定时器
|
||||||
|
startTimer(time=60){
|
||||||
|
this.timerCount = time.toFixed(0);
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.timerCount--;
|
||||||
|
if (this.timerCount <= 0) {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.loadUserDetail();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
navTo(url) {
|
navTo(url) {
|
||||||
url ?
|
url ?
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user