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