|  | @@ -0,0 +1,224 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +  <div class="template">
 | 
	
		
			
				|  |  | +    <!-- 查询条件 -->
 | 
	
		
			
				|  |  | +    <div class="template-search">
 | 
	
		
			
				|  |  | +      <div>
 | 
	
		
			
				|  |  | +        <el-input
 | 
	
		
			
				|  |  | +          v-model="name"
 | 
	
		
			
				|  |  | +          class="search-name"
 | 
	
		
			
				|  |  | +          prefix-icon="el-icon-search"
 | 
	
		
			
				|  |  | +          @change="queryCourseList"
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +          <el-button slot="append" @click="queryCourseList">搜索</el-button>
 | 
	
		
			
				|  |  | +        </el-input>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +      <div>
 | 
	
		
			
				|  |  | +        <el-select v-model="release_status">
 | 
	
		
			
				|  |  | +          <el-option
 | 
	
		
			
				|  |  | +            v-for="item in releaseStatusList"
 | 
	
		
			
				|  |  | +            :key="item.value"
 | 
	
		
			
				|  |  | +            :label="item.name"
 | 
	
		
			
				|  |  | +            :value="item.value"
 | 
	
		
			
				|  |  | +          />
 | 
	
		
			
				|  |  | +        </el-select>
 | 
	
		
			
				|  |  | +        <el-button class="query-button" type="primary" @click="queryCourseList">查询</el-button>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +    <!-- 模板列表 -->
 | 
	
		
			
				|  |  | +    <div class="template-container">
 | 
	
		
			
				|  |  | +      <div class="template-container-title">
 | 
	
		
			
				|  |  | +        <span>模板库</span>
 | 
	
		
			
				|  |  | +        <el-button class="create" @click="$router.push('/create_course?isTemplate=true')">
 | 
	
		
			
				|  |  | +          <div><svg-icon icon-class="create" /><span>创建模板</span></div>
 | 
	
		
			
				|  |  | +        </el-button>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +      <div class="template-container-list">
 | 
	
		
			
				|  |  | +        <el-table :data="courseList">
 | 
	
		
			
				|  |  | +          <el-table-column prop="name" label="课程名称" width="320" />
 | 
	
		
			
				|  |  | +          <el-table-column label="课程周期" width="210">
 | 
	
		
			
				|  |  | +            <template slot-scope="{ row }">
 | 
	
		
			
				|  |  | +              <i class="el-icon-date" /> {{ row.begin_date }} - {{ row.end_date }}
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column label="已发布">
 | 
	
		
			
				|  |  | +            <template slot-scope="{ row }">
 | 
	
		
			
				|  |  | +              {{ row.is_release === 'true' ? '√' : '' }}
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column fixed="right" width="80">
 | 
	
		
			
				|  |  | +            <template slot-scope="{ row }">
 | 
	
		
			
				|  |  | +              <el-dropdown trigger="click">
 | 
	
		
			
				|  |  | +                <span class="el-dropdown-link">
 | 
	
		
			
				|  |  | +                  <svg-icon icon-class="more" />
 | 
	
		
			
				|  |  | +                </span>
 | 
	
		
			
				|  |  | +                <el-dropdown-menu slot="dropdown">
 | 
	
		
			
				|  |  | +                  <el-dropdown-item @click.native="edit(row.id)">
 | 
	
		
			
				|  |  | +                    <svg-icon icon-class="edit" /> 编辑
 | 
	
		
			
				|  |  | +                  </el-dropdown-item>
 | 
	
		
			
				|  |  | +                  <el-dropdown-item
 | 
	
		
			
				|  |  | +                    v-if="row.is_release === 'false'"
 | 
	
		
			
				|  |  | +                    @click.native="releaseCourse(row.id, true)"
 | 
	
		
			
				|  |  | +                  >
 | 
	
		
			
				|  |  | +                    <svg-icon icon-class="publish" /> 发布
 | 
	
		
			
				|  |  | +                  </el-dropdown-item>
 | 
	
		
			
				|  |  | +                  <el-dropdown-item v-else @click.native="releaseCourse(row.id, false)">
 | 
	
		
			
				|  |  | +                    <svg-icon icon-class="undo" /> 取消发布
 | 
	
		
			
				|  |  | +                  </el-dropdown-item>
 | 
	
		
			
				|  |  | +                </el-dropdown-menu>
 | 
	
		
			
				|  |  | +              </el-dropdown>
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +        </el-table>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +    <el-pagination
 | 
	
		
			
				|  |  | +      background
 | 
	
		
			
				|  |  | +      :page-sizes="[10, 20, 30, 40, 50]"
 | 
	
		
			
				|  |  | +      :page-size="page_capacity"
 | 
	
		
			
				|  |  | +      layout="prev, pager, next, total, sizes, jumper"
 | 
	
		
			
				|  |  | +      :total="total_count"
 | 
	
		
			
				|  |  | +      :current-page="cur_page"
 | 
	
		
			
				|  |  | +      @prev-click="changePage"
 | 
	
		
			
				|  |  | +      @next-click="changePage"
 | 
	
		
			
				|  |  | +      @current-change="changePage"
 | 
	
		
			
				|  |  | +      @size-change="changePageSize"
 | 
	
		
			
				|  |  | +    />
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +import { PageQueryCourseList } from '@/api/table';
 | 
	
		
			
				|  |  | +import { ReleaseCourse } from '@/api/course';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +export default {
 | 
	
		
			
				|  |  | +  data() {
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      // 查询条件
 | 
	
		
			
				|  |  | +      name: '',
 | 
	
		
			
				|  |  | +      page_capacity: 10,
 | 
	
		
			
				|  |  | +      cur_page: 0,
 | 
	
		
			
				|  |  | +      total_count: 0,
 | 
	
		
			
				|  |  | +      release_status: -1,
 | 
	
		
			
				|  |  | +      releaseStatusList: [
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +          name: '全部',
 | 
	
		
			
				|  |  | +          value: -1
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +          name: '已发布',
 | 
	
		
			
				|  |  | +          value: 1
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +          name: '未发布',
 | 
	
		
			
				|  |  | +          value: 0
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      ],
 | 
	
		
			
				|  |  | +      // 课程列表
 | 
	
		
			
				|  |  | +      courseList: []
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  created() {
 | 
	
		
			
				|  |  | +    this.queryCourseList();
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  methods: {
 | 
	
		
			
				|  |  | +    changePage(newPage) {
 | 
	
		
			
				|  |  | +      this.cur_page = newPage;
 | 
	
		
			
				|  |  | +      this.queryCourseList();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    changePageSize(pageSize) {
 | 
	
		
			
				|  |  | +      this.page_capacity = pageSize;
 | 
	
		
			
				|  |  | +      this.queryCourseList();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    queryCourseList() {
 | 
	
		
			
				|  |  | +      const queryCriteria = {
 | 
	
		
			
				|  |  | +        is_template: true,
 | 
	
		
			
				|  |  | +        name: this.name,
 | 
	
		
			
				|  |  | +        page_capacity: this.page_capacity,
 | 
	
		
			
				|  |  | +        cur_page: this.cur_page,
 | 
	
		
			
				|  |  | +        release_status: this.release_status
 | 
	
		
			
				|  |  | +      };
 | 
	
		
			
				|  |  | +      PageQueryCourseList(queryCriteria).then(({ course_list, total_count }) => {
 | 
	
		
			
				|  |  | +        this.courseList = course_list;
 | 
	
		
			
				|  |  | +        this.total_count = total_count;
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    edit(id) {
 | 
	
		
			
				|  |  | +      this.$router.push(`/create_course_step_table/course_info?id=${id}&isTemplate=true`);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    releaseCourse(course_id, is_release) {
 | 
	
		
			
				|  |  | +      ReleaseCourse({ course_id, is_release }).then(() => {
 | 
	
		
			
				|  |  | +        this.queryCourseList();
 | 
	
		
			
				|  |  | +        this.$message.success(`${is_release ? '' : '取消'}发布课程成功`);
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style lang="scss">
 | 
	
		
			
				|  |  | +@import '~@/styles/mixin.scss';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.template {
 | 
	
		
			
				|  |  | +  @include pagination;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  &-search {
 | 
	
		
			
				|  |  | +    display: flex;
 | 
	
		
			
				|  |  | +    justify-content: space-between;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    .search-name {
 | 
	
		
			
				|  |  | +      width: 528px;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    .query-button {
 | 
	
		
			
				|  |  | +      width: 114px;
 | 
	
		
			
				|  |  | +      margin-left: 12px;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  &-container {
 | 
	
		
			
				|  |  | +    width: 100%;
 | 
	
		
			
				|  |  | +    min-height: calc(100vh - 325px);
 | 
	
		
			
				|  |  | +    margin-top: 16px;
 | 
	
		
			
				|  |  | +    background-color: #fff;
 | 
	
		
			
				|  |  | +    border-radius: 8px;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    &-title {
 | 
	
		
			
				|  |  | +      display: flex;
 | 
	
		
			
				|  |  | +      justify-content: space-between;
 | 
	
		
			
				|  |  | +      align-items: center;
 | 
	
		
			
				|  |  | +      font-size: 20px;
 | 
	
		
			
				|  |  | +      font-weight: bold;
 | 
	
		
			
				|  |  | +      padding: 32px;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      .create {
 | 
	
		
			
				|  |  | +        width: 138px;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        div {
 | 
	
		
			
				|  |  | +          display: flex;
 | 
	
		
			
				|  |  | +          justify-content: space-around;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    &-list {
 | 
	
		
			
				|  |  | +      @include list;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      margin-top: 0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      .el-dropdown {
 | 
	
		
			
				|  |  | +        cursor: pointer;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        .svg-icon {
 | 
	
		
			
				|  |  | +          font-size: 19px;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</style>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style scoped>
 | 
	
		
			
				|  |  | +.el-dropdown-menu .svg-icon {
 | 
	
		
			
				|  |  | +  margin-right: 8px;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</style>
 |