return {
  data: function() {
    return {
      state: {},
      /**列表页详情页切换开关 */
      listFalg: true,
      /**班级ID*/
      roomid:'',
      /**搜索关键字 */
      key: "",
      /**排序选择器选项 */
      sortList: [
        {
          value: "b.LastDate Desc",
          label: "按学习时间"
        },
        {
          value: "b.addDate Desc",
          label: "按更新时间"
        }
      ],
      /**作业tab切换*/
      studenttype: '-1',
      /**作业完成列表*/
      tableData:[],
      /**选择器默认值 */
      sort: "b.LastDate Desc",
      /**班级列表数据 */
      classList: [],
      /**详情数据 */
      /**作业列表 */
      homeworkList: [],
      /**课程列表 */
      courseList: [],
      coursefacelist: [],
      /**训练营列表 */
      trainList: [],
      /**问答列表 */
      askList: [],
      /**班级详情 */
      classInfo: {},
      /**当前选中项 */
      activeName: "first",
      activeCourse: 0,
      /**总页数 */
      pageCount: null,
      /**当前页 */
      currentPage: 1,
      /**公告详情显示开关 */
      noticeDialogVisible: false,
      /**公告详情 */
      noticeDetail: {},
      /**作业详情开关 */
      homeworkDialogVisible: false,
      /**作业详情 */
      homeworkDetail: {},
      /**当前页数 */
      p: 1,
      /**总条数 */
      recordcount:null,
      courseid:this.$route.params.id
    };
  },
  created:function(){
    var that = this;
    that.$store.ready(function(state) {
      that.state = state;
      that.getUserWork()
    });
  },
  activated: function() {
    var that = this;
    that.p = 1;
    that.getUserWork()
  },
  methods: {
    /**作业跳转*/
    clickwork(id,url){
      var that = this
      if(url == ""){
        that.$router.push({
          path: `/user/homework/?id=${id}`,
        })
      }else{
        that.openView(url)
      }
    },
    /**选择器的回调 */
    changeSelect: function() {
      this.getUserWork();
    },
    /**搜索框的回调 */
    changeInput: function() {
      this.getUserWork();
    },
    /**标签页点击回调 */
    handleClick: function(tab, event) {
      var that = this;
    },
    /**打开详情页并且请求详情页数据
     * @params item object 要打开的详情项
     */
    openDetail: function(item) {
      var that = this;
      that.listFalg = false;
      that.getUserClassDetail(item);
    },
    /**打开外链
     * @params
     */
    openView: function(url) {
      window.open(url);
    },
    /**获取学员作业*/
    getUserWork: function(p){
      p = p || 1;
      var that = this;
      that.p = p;
      var params = {
        costype:that.$route.query.costype,
        courseid: that.courseid,
        studenttype: that.studenttype,
        apptoken: that.state.appToken,
        key:that.key,
        pageindex:that.p,	  //	当前页码
        pagesize:8,	  //	当前条数
      }
      GetMyUserHomeWork(params).then(function(res){
        that.tableData = res.data
        that.recordcount = res.recordcount
        that.pageCount = res.pagecount
      })
    }
  }
};
