return {
  data: function() {
    return {
      loaded:false,
      detail:{},
      label:'',
    }
  },
  watch: {
    '$route.query':{
        handler(query){
          var that = this
          that.loaded = false
          that.intData()
        },
        deep:true
    },
  },
  methods: {
    open:function(name){
      switch(name){
        case 'UserCourseDetailAsk':
          this.$router.push({
            path:'/user/course/'+this.$route.params.id+'/ask',
            query:{
              costype:this.$route.query.costype,
              classid:this.detail.classid
            }
          })
          break
        case 'homework':
          this.$router.push({
            path:'/user/course/'+this.$route.params.id+'/homework',
            query:{
              costype:this.$route.query.costype
            }
          })
          break
        default:
          this.$router.push({
            name:name,
            query:{
              costype:this.$route.query.costype
            }
          })
      }
      
    },
    unopen:function(){
      KS_Utils.popup.msg('暂未开放下载，敬请期待~');
    },
    formatNumber: function (n) {
      n = n.toString()
      return n[1] ? n : '0' + n
    },
    formatTime: function (date) {
      if(typeof date === 'string'){
          date = date.replace(/\-/g,'/');
      }
      date = new Date(date)
      var year = date.getFullYear()
      var month = date.getMonth() + 1
      var day = date.getDate()
      var hour = date.getHours()
      var minute = date.getMinutes()
      var second = date.getSeconds()

      return {
        timestamp: date.getTime(),
        year: year,
        month: this.formatNumber(month),
        day: this.formatNumber(day),
        hour: this.formatNumber(hour),
        minute: this.formatNumber(minute),
        second: this.formatNumber(second)
      }
    },
    intData:function(){
      var that = this;
      if(that.$route.query.costype=='0'){
        that.label = '面授'
      }else if(that.$route.query.costype=='1'){
        that.label = '点播'
      }else if(that.$route.query.costype=='2'){
        that.label = '组合'
      }else if(that.$route.query.costype=='3'){
        that.label = '专栏'
      }else if(that.$route.query.costype=='5'){
        that.label = '直播'
      }else if(that.$route.query.costype=='6'){
        that.label = '活动'
      }else if(that.$route.query.costype=='7'){
        that.label = '训练营'
      }else if(that.$route.query.costype=='8'){
        that.label = '班级'
      }
      this.$store.ready(function(state) {
        if(that.$route.query.costype=='3'){
          GetUserSpecialDetail({
            courseid:that.$route.params.id,
            apptoken:state.appToken
          }).then(function(res) {
            if(res.result){
              that.detail = res.data.special_info
            }else{
              that.detail = {}
            }
            that.loaded = true
          })
        }else if(that.$route.query.costype=='7'){
          GetTrainCampView({
            trainid:that.$route.params.id,
            apptoken:state.appToken
          }).then(function(res) {
            if(res.result){
              that.detail = res.data
            }else{
              that.detail = {}
            }
            that.loaded = true
          })
        }else if(that.$route.query.costype=='8'){
          GetClassDetile({
            roomid:that.$route.params.id
          }).then(function(res) {
            if(res.result){
              that.detail = res.data[0]
            }else{
              that.detail = {}
            }
            that.loaded = true
          })
        }else if(that.$route.query.costype=='0'){
          getCourseCatalog({
            courseType:'face',
            courseid:that.$route.params.id,
            schoolid:0
          },state.apiDomain).then(function(res) {

            if(res.code!=-1){
              if(res.courseinfo){
                that.detail = res.courseinfo
              }
            }else{
              that.detail={}
            }
            that.loaded = true
          });
        }else{
          getCourseCatalog({
            courseid:that.$route.params.id,
            schoolid:0
          },state.apiDomain).then(function(res) {

            if(res.code!=-1){
              if(res.courseinfo){
                that.detail = res.courseinfo
              }
            }else{
              that.detail={}
            }
            
            that.loaded = true
          });
        }
        
      });
    }
  },
  mounted: function() {
    var that = this;
    var _courseid = that.$route.params.id;
    
    that.intData()
    
  }
};
