页面显示接口数据时间呈现倒计时:

76 阅读1分钟
read(row) {
          // 附件名称
          this.open = true;
          console.log("row", row.coursewareid);
          console.log(row);
          // row的id和status
          this.id = row.id;
          this.status = row.status;
          // if (row.imagename == null || row.imagename == "") {
          //   console.log(222);
          //   // return;
          // } else {
          //   this.annexName = row.imagename.replace(',undefined','');
          // }
          // if (row.imageurl == null || row.imageurl == "") {
          //   return;
          // } else {
          //   this.annexUrl = this.baseUrl + row.imageurl.substring(1);
          // }

  // 附件路径
  // (this.annexUrl = this.baseUrl + row.imageurl.substring(1)),
  // 根据课件id找课件,有可能有附件
  getCourseware(row.coursewareid).then(response => {
    this.coursewareform = response.data;
    console.log("this.coursewareform ", this.coursewareform);
    this.title = "课件内容";
    const TIME_COUNT = response.data.readtime;
    // 如果完成状态是:否
    if (row.status == 0) {
      if (TIME_COUNT < 10) {
        this.minute = "0" + TIME_COUNT;
      } else {
        this.minute = TIME_COUNT + "";
      }
      this.second = "00";
      this.timer = setInterval(() => {
        if (this.second == "00" && parseInt(this.minute) > 0) {
          this.minute = parseInt(this.minute) - 1 + "";
          if (this.minute < 10) {
            this.minute = "0" + this.minute;
          } else {
            this.minute = this.minute + "";
          }
          this.second = 59 + "";
        } else {
          if (parseInt(this.second) > 0) {
            this.second = parseInt(this.second) - 1 + "";
            if (this.second < 10) {
              this.second = "0" + this.second;
            } else {
              this.second = this.second + "";
            }
          }
        }
        if (this.second == "00" && this.minute == "00") {
          //完成
          changeTrainingtaskUser(row.id).then(res => {});

          this.showClose = true;
        }
      }, 1000);
    } else {
      this.timeShow = false;
      this.showClose = true;
    }
  });
},

    // 阅读结束按钮
closReda() {
  // 当完成状态为否的时候 改变状态
  if (this.status == 0) {
    this.status = 1;
  }
  console.log(this.id, "2");
  console.log(this.status, "1是");
  changeTrainingtaskUser(this.id).then(res => {
    console.log(res);
  });

  this.open = false;
  this.getList();
},