鍍金池/ 問答/HTML/ 慕課網(wǎng)Es6彩票課程中遇到 Uncaught (in promise) 錯誤

慕課網(wǎng)Es6彩票課程中遇到 Uncaught (in promise) 錯誤

在學(xué)習(xí)慕課網(wǎng)《Es6彩票實(shí)戰(zhàn)項(xiàng)目》課程中,遇到了Uncaught (in promise) 錯誤

圖片描述

錯誤指向 this.getState().then...這一句,而且,get/state 報(bào)404

interface.js
/**
   * 獲取當(dāng)前狀態(tài)
   * @param  {string} issue [當(dāng)前期號]
   * @return {[type]}       [description]
   */
  getState(issue){
    let self = this;
    return new Promise((resolve, reject) => {
      $.ajax({
        url:'/get/state',
        data:{
          issue:issue
        },
        dataType:'json',
        success:function(res){
          resolve.call(self,res);
        },
        error:function(err){
          reject.call(err);
        }
      })
    })
  }
}
lottery.js
/**
   * [updateState 狀態(tài)更新]
   * @return {[type]} [description]
   */
  updateState(){
    let self=this;
    this.getState().then(function(res){
      self.issue=res.issue;
      self.end_time=res.end_time;
      self.state=res.state;
      $(self.issue_el).text(res.issue);
      self.countdown(res.end_time,function(time){
        $(self.countdown_el).html(time)
      },function(){
        setTimeout(function () {
          self.updateState();
          self.getOmit(self.issue).then(function(res){

          });
          self.getOpenCode(self.issue).then(function(res){

          });
        }, 500);
      })
    })
  }

請哪位知道什么原因的指點(diǎn)下,謝謝。

回答
編輯回答
茍活

已解決,代碼沒寫全導(dǎo)致的。

2017年10月10日 20:48