Przeglądaj źródła

Merge branch 'master' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table

zengyicheng 2 lat temu
rodzic
commit
22c3096dd8

+ 177 - 0
src/components/pages/components/courseProblem.vue

@@ -0,0 +1,177 @@
+<template>
+  <div>
+    <div class="cp_title">
+      <span>{{this.problemCourse.title}}</span>
+    </div>
+    <div style="margin-top:10px">
+      <el-table
+        v-loading="Loading"
+        ref="table"
+        :data="Data"
+        border
+        :height="500"
+        :fit="true"
+        style="width: 100%"
+        :row-class-name="tableRowClassName"
+        :header-cell-style="{ background: 'rgb(238,238,238)' }"
+      >
+        <el-table-column prop="courseName" label="课程" min-width="20" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="classname" label="章节" min-width="20" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="name" label="姓名" min-width="20" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="time" label="时间" min-width="20"></el-table-column>
+        <el-table-column label="操作" min-width="10">
+          <template slot-scope="scope">
+            <el-button type="primary" size="small" @click="checkProblem(scope.row)">查看</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="margin-top:10px">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :page-size="10"
+          :total="Total"
+          @current-change="handleCurrentChange"
+        ></el-pagination>
+      </div>
+    </div>
+    <el-dialog
+      title="查看提问详情"
+      :visible.sync="dialogVisible"
+      :append-to-body="true"
+      width="500px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
+      <div>
+        <div class="a_addBox">
+          <ProblemDetail :problem="problem"></ProblemDetail>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">关 闭</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import ProblemDetail from "./problemDetail";
+export default {
+  components: {
+    ProblemDetail,
+  },
+  props: ["problemCourse"],
+  data() {
+    return {
+      Course: this.problemCourse,
+      chapters: [],
+      Loading: false,
+      Data: [],
+      Total: 0,
+      page: 1,
+      courseId: "",
+      dialogVisible: false,
+      problem: {},
+    };
+  },
+  methods: {
+    getData() {
+      this.Loading = true;
+      let params = {
+        cid: this.courseId,
+        page: this.page,
+      };
+      this.ajax
+        .get(this.$store.state.api + "getProblem", params)
+        .then((res) => {
+          this.Loading = false;
+          this.Total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          let _array = res.data[0];
+          let _chapters = this.chapters;
+          _array.forEach((item) => {
+            _chapters.forEach((chapter) => {
+              if (item.chapterid == chapter.id) {
+                item.classname = chapter.name;
+              }
+            });
+          });
+          this.Data = res.data[0];
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    tableRowClassName({ row, rowIndex }) {
+      if ((rowIndex + 1) % 2 === 0) {
+        return "even_row";
+      } else {
+        return "";
+      }
+    },
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getData();
+      console.log(`当前页: ${val}`);
+    },
+    handleClose(done) {
+      done();
+    },
+    checkProblem(res) {
+      this.problem = res;
+      this.dialogVisible = true;
+    },
+  },
+  watch: {
+    // 使用监听的方式,监听数据的变化
+    problemCourse(val) {
+      this.Course = val;
+      var _chapters = JSON.parse(val.chapters);
+      this.chapters = [];
+      this.courseId = val.courseId;
+      _chapters.forEach((element) => {
+        this.chapters.push({
+          name: element.dyName,
+          id: element.chapterInfo[0].chapterid,
+        });
+      });
+      this.page = 1;
+      this.getData();
+    },
+  },
+  mounted() {
+    console.log(JSON.parse(this.problemCourse.chapters));
+    var _chapters = JSON.parse(this.problemCourse.chapters);
+    _chapters.forEach((element) => {
+      this.chapters.push({
+        name: element.dyName,
+        id: element.chapterInfo[0].chapterid,
+      });
+    });
+    this.courseId = this.problemCourse.courseId;
+    this.getData();
+  },
+};
+</script>
+
+<style scoped>
+.cp_title {
+  font-size: 24px;
+}
+.dialog_diy >>> .el-dialog__header {
+  background: #3d67bc !important;
+  padding: 15px 20px;
+}
+.dialog_diy >>> .el-dialog__title {
+  color: #fff;
+}
+.dialog_diy >>> .el-dialog__headerbtn {
+  top: 19px;
+}
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
+  color: #fff;
+}
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
+  color: #fff;
+}
+</style>

+ 41 - 0
src/components/pages/components/problemDetail.vue

@@ -0,0 +1,41 @@
+<template>
+  <div>
+    <div class="pd_title">
+      <span>{{problem.courseName}}</span>
+    </div>
+    <div class="pd_stitle">
+      <span>{{problem.classname}}</span>
+    </div>
+    <div class="pd_text">
+      <span>{{problem.text}}</span>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  props: ["problem"],
+  data() {
+    return {};
+  },
+};
+</script>
+
+<style scoped>
+.pd_title {
+  font-size: 24px;
+}
+
+.pd_stitle {
+  font-size: 22px;
+  margin-top: 10px;
+}
+
+.pd_text {
+  font-size: 16px;
+  margin-top: 10px;
+  height: 400px;
+  overflow: auto;
+
+}
+</style>

+ 701 - 698
src/components/pages/course.vue

@@ -1,90 +1,72 @@
 <template>
-	<div class="pb_content" style="height: auto">
-		<div class="pb_head top">
-			<span>项目管理</span>
-			<div class="student_button">
-				<el-button
-					type="primary"
-					class="bgColor"
-					@click="goTo('/course/addCourse?userid=' + userid + '&oid=' + oid)"
-					>添加项目</el-button
-				>
-			</div>
-		</div>
-		<div class="pb_content_body" style="height: 100%">
-			<div class="student_head">
-				<div class="choose">
-					<div class="student_search">
-						<span>课程筛选</span>
-						<el-select v-model="groupA" @change="search">
-							<el-option value="0" label="我的课程"></el-option>
-							<el-option value="1" label="他人课程"></el-option>
-						</el-select>
-					</div>
-					<div
-						class="all_choose"
-						v-for="(item, index) in CourseType[0]"
-						:key="index"
-					>
-						<span>{{ item.name }}</span>
-						<el-select
-							v-model="courseTypeId[item.id]"
-							placeholder="请选择"
-							@change="getTypeName"
-						>
-							<el-option label="全部" value="1">全部</el-option>
-							<el-option
-								v-for="item1 in CourseTypeJson[item.id]"
-								:key="item1.id"
-								:label="item1.name"
-								:value="item1.id"
-							>
-							</el-option>
-						</el-select>
-					</div>
-					<div @click="clear" class="clear">重置</div>
-				</div>
+  <div class="pb_content" style="height: auto">
+    <div class="pb_head top">
+      <span>项目管理</span>
+      <div class="student_button">
+        <el-button
+          type="primary"
+          class="bgColor"
+          @click="goTo('/course/addCourse?userid=' + userid + '&oid=' + oid)"
+        >添加项目</el-button>
+      </div>
+    </div>
+    <div class="pb_content_body" style="height: 100%">
+      <div class="student_head">
+        <div class="choose">
+          <div class="student_search">
+            <span>课程筛选</span>
+            <el-select v-model="groupA" @change="search">
+              <el-option value="0" label="我的课程"></el-option>
+              <el-option value="1" label="他人课程"></el-option>
+            </el-select>
+          </div>
+          <div class="all_choose" v-for="(item, index) in CourseType[0]" :key="index">
+            <span>{{ item.name }}</span>
+            <el-select v-model="courseTypeId[item.id]" placeholder="请选择" @change="getTypeName">
+              <el-option label="全部" value="1">全部</el-option>
+              <el-option
+                v-for="item1 in CourseTypeJson[item.id]"
+                :key="item1.id"
+                :label="item1.name"
+                :value="item1.id"
+              ></el-option>
+            </el-select>
+          </div>
+          <div @click="clear" class="clear">重置</div>
+        </div>
 
-				<div class="student_right">
-					<div class="head_left">
-						<el-input
-							v-model="courseName"
-							class="student_input"
-							placeholder="请输入课程名称"
-						></el-input>
-						<el-button class="course_button" @click="searchCourse"
-							>查询</el-button
-						>
-					</div>
-				</div>
-			</div>
-			<div class="student_table">
-				<div class="course_box">
-					<div class="out_box" v-for="(item, index) in course" :key="index">
-						<div class="tup">
-							<img
-								:src="
+        <div class="student_right">
+          <div class="head_left">
+            <el-input v-model="courseName" class="student_input" placeholder="请输入课程名称"></el-input>
+            <el-button class="course_button" @click="searchCourse">查询</el-button>
+          </div>
+        </div>
+      </div>
+      <div class="student_table">
+        <div class="course_box">
+          <div class="out_box" v-for="(item, index) in course" :key="index">
+            <div class="tup">
+              <img
+                :src="
 									item.cover != null && item.cover != ''
 										? JSON.parse(item.cover).length > 0
 											? JSON.parse(item.cover)[0].url
 											: mr
 										: mr
 								"
-								alt=""
-							/>
-						</div>
-						<div class="bottom_box">
-							<div>{{ item.title }}</div>
-							<div class="kc_t" v-if="groupA == '1'">
-								创建老师:{{ item.uname }}
-							</div>
-							<div class="kc_time">{{ item.time }}</div>
-						</div>
-						<div class="three_bottom">
-							<div @click="jump(item.courseId)">开始教学</div>
-							<div
-								v-if="groupA == '0'"
-								@click="
+                alt
+              />
+            </div>
+            <div class="bottom_box">
+              <div>{{ item.title }}</div>
+              <div class="kc_t" v-if="groupA == '1'">创建老师:{{ item.uname }}</div>
+              <div class="kc_time">{{ item.time }}</div>
+            </div>
+            <div class="three_bottom">
+              <div @click="jump(item.courseId)">开始教学</div>
+              <div
+                v-if="groupA == '0'"
+                @click="
 									goTo(
 										'/course/addCourse?cid=' +
 											item.courseId +
@@ -94,11 +76,9 @@
 											oid
 									)
 								"
-							>
-								修改
-							</div>
-							<div
-								@click="
+              >修改</div>
+              <div
+                @click="
 									goTo(
 										'/worksDetail?cid=' +
 											item.courseId +
@@ -108,641 +88,664 @@
 											oid
 									)
 								"
-							>
-								作业
-							</div>
-							<div @click="deleteCourse(item.courseId)">删除</div>
-						</div>
-					</div>
-					<div class="course_empty" v-if="course.length == 0">暂无数据</div>
-				</div>
-			</div>
-		</div>
-		<div class="student_page">
-			<el-pagination
-				background
-				layout="prev, pager, next"
-				:page-size="10"
-				:total="total"
-				v-if="page"
-				style="padding-bottom: 20px"
-				@current-change="handleCurrentChange"
-			>
-			</el-pagination>
-		</div>
-		<el-dialog :visible.sync="dialogVisible1" size="tiny">
-			<img width="100%" :src="dialogImageUrl" alt="" />
-		</el-dialog>
-	</div>
+              >作业</div>
+              <div @click="checkProblem(item)">提问</div>
+              <div @click="deleteCourse(item.courseId)">删除</div>
+            </div>
+          </div>
+          <div class="course_empty" v-if="course.length == 0">暂无数据</div>
+        </div>
+      </div>
+    </div>
+    <div class="student_page">
+      <el-pagination
+        background
+        layout="prev, pager, next"
+        :page-size="10"
+        :total="total"
+        v-if="page && course.length"
+        style="padding-bottom: 20px"
+        @current-change="handleCurrentChange"
+      ></el-pagination>
+    </div>
+    <el-dialog :visible.sync="dialogVisible1" size="tiny">
+      <img width="100%" :src="dialogImageUrl" alt />
+    </el-dialog>
+    <el-dialog
+      title="查看提问"
+      :visible.sync="dialogVisible"
+      :append-to-body="true"
+      width="750px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
+      <div>
+        <div class="a_addBox">
+			<CourseProblem :problemCourse="problemCourse"></CourseProblem>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">关 闭</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-	import "../../common/aws-sdk-2.235.1.min";
-	import EditorBar from "../../components/tools/wangEnduit";
-	export default {
-		components: { EditorBar },
-		data() {
-			return {
-				itemCount: 1,
-				courseTitle: "",
-				courseText: "",
-				courseTime: "",
-				isLoading: false,
-				fileList: [],
-				fileList1: [],
-				homeworkList: [{ name: "" }],
-				formLabelWidth: "100px",
-				dialogVisible: false,
-				dialogVisible1: false,
-				dialogImageUrl: "",
-				group: "",
-				userid: this.$route.query.userid,
-				oid: this.$route.query.oid,
-				Juri: "",
-				groupList: [],
-				JuriList: [],
-				page: 1,
-				total: 0,
-				tableData: [],
-				now: "",
-				courseDetail: {},
-				addCourse: {},
-				groupA: "0",
-				classX: "",
-				course: [],
-				courseName: "",
-				mr: require("../../assets/icon/kc1.png"),
-				CourseType: [],
-				CourseTypeJson: {},
-				courseTypeId: {},
-				courseTypeSon: [],
-				isChoose: 0,
-			};
-		},
-		methods: {
-			change(val) {
-				console.log(val);
-			},
-			addHomeworkBox() {
-				this.homeworkList.push({ name: "" });
-				this.itemCount++;
-			},
-			reduceHomeworkBox() {
-				var a = this.homeworkList;
-				a.splice(a.length - 1);
-				this.itemCount--;
-			},
-			goTo(path) {
-				this.$router.push(path);
-			},
-			tableRowClassName({ row, rowIndex }) {
-				if ((rowIndex + 1) % 2 === 0) {
-					return "even_row";
-				} else {
-					return "";
-				}
-			},
-			jump(cid) {
-				// window.open(
-				//   "//pbl.cocorobo.cn/pbl-student-table/dist/#/courseDetail?courseId=" +
-				//     cid +
-				//     "&userid=" +
-				//     this.userid
-				// );
-				window.parent.postMessage({ cid: cid, type: "1" }, "*");
-			},
-			handle_remove(file, fileList) {
-				var _tmp = this.fileList;
-				for (var i = 0, len = _tmp.length; i < len; i++) {
-					if (_tmp[i].uid == file.uid) {
-						_tmp.splice(i, 1);
-						break;
-					}
-					this.fileList = _tmp;
-				}
-			},
-			handle_remove1(file, fileList) {
-				var _tmp = this.fileList1;
-				for (var i = 0, len = _tmp.length; i < len; i++) {
-					if (_tmp[i].uid == file.uid) {
-						_tmp.splice(i, 1);
-						break;
-					}
-					this.fileList1 = _tmp;
-				}
-			},
-			handleCurrentChange(val) {
-				// console.log(`当前页: ${val}`);
-				this.page = val;
-				this.getCourse();
-			},
-			init() {},
-			handleClose(done) {
-				done();
-			},
-			handleRemove(file, fileList) {
-				console.log(file, fileList);
-			},
-			handlePictureCardPreview(file) {
-				this.dialogImageUrl = file.url;
-				this.dialogVisible1 = true;
-			},
-			onExceed() {
-				this.$message.error("课程海报仅支持上传一张,请删除后再进行上传");
-			},
-			//uuid生成
-			guid() {
-				return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
-					/[xy]/g,
-					function (c) {
-						var r = (Math.random() * 16) | 0,
-							v = c == "x" ? r : (r & 0x3) | 0x8;
-						return v.toString(16);
-					}
-				);
-			},
-			time() {
-				if (!this.now) {
-					this.now = new Date().getTime();
-					return true;
-				} else {
-					let time = new Date().getTime();
-					if (time - this.now > 3000) {
-						this.now = time;
-						return true;
-					} else {
-						return false;
-					}
-				}
-			},
-			searchCourse() {
-				this.page = 1;
-				this.getCourse();
-			},
-			clear() {
-				for (var i = 0; i < this.CourseType[0].length; i++) {
-					this.courseTypeId[this.CourseType[0][i].id] = "";
-				}
-				this.getCourse();
-			},
-			getCourse() {
-				const loading = this.openLoading(
-					document.querySelector(".student_table")
-				);
-				var typeE = [];
-				var typea, typeb, typec, typed;
-				if (this.isChoose == 1) {
-					for (var i = 0; i < this.CourseType[0].length; i++) {
-						if (this.courseTypeId[this.CourseType[0][i].id] == "1") {
-							typeE.push(this.CourseType[0][i].id);
-						} else if (this.courseTypeId[this.CourseType[0][i].id] != "") {
-							if (this.CourseType[0][i].name == "年级") {
-								typea = this.courseTypeId[this.CourseType[0][i].id];
-							} else if (this.CourseType[0][i].name == "专栏") {
-								typeb = this.courseTypeId[this.CourseType[0][i].id];
-							} else if (this.CourseType[0][i].name == "新技能") {
-								typec = this.courseTypeId[this.CourseType[0][i].id];
-							} else if (this.CourseType[0][i].name == "学科") {
-								typed = this.courseTypeId[this.CourseType[0][i].id];
-							}
-							this.courseTypeSon.push(
-								this.courseTypeId[this.CourseType[0][i].id]
-							);
-						}
-					}
-				}
-				this.isLoading = true;
-				let params = {
-					type: this.groupA,
-					uid: this.userid,
-					oid: this.oid,
-					typea: typea != undefined ? typea : "",
-					typeb: typeb != undefined ? typeb : "",
-					typec: typec != undefined ? typec : "",
-					typed: typed != undefined ? typed : "",
-					typeE: typeE.join(","),
-					cu: "",
-					cn: this.courseName,
-					page: this.page,
-				};
-				this.ajax
-					.get(this.$store.state.api + "selectCourseNew", params)
-					.then((res) => {
-						loading.close();
-						this.isLoading = false;
-						this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
-						this.course = res.data[0];
-					})
-					.catch((err) => {
-						console.error(err);
-					});
-			},
-			getTypeName() {
-				this.$forceUpdate();
-				this.page = 1;
-				this.isChoose = 1;
-				this.getCourse();
-			},
-			// searchCourse() {
-			//   this.isLoading = true;
-			//   let params = {
-			//     cu: "",
-			//     cn: this.courseName,
-			//     page: this.page,
-			//   };
-			//   this.ajax
-			//     .get(this.$store.state.api + "searchCourse", params)
-			//     .then((res) => {
-			//       this.isLoading = false;
-			//       this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
-			//       this.course = res.data[0];
-			//     })
-			//     .catch((err) => {
-			//       this.isLoading = false;
-			//       console.error(err);
-			//     });
-			// },
-			deleteCourse(cid) {
-				const loading = this.openLoading(
-					document.querySelector(".student_table")
-				);
-				this.isLoading = true;
-				let params = {
-					cid: cid,
-				};
-				this.ajax
-					.get(this.$store.state.api + "deleteCourse", params)
-					.then((res) => {
-						loading.close();
-						this.isLoading = false;
-						this.$message.success("删除成功");
-						this.getCourse();
-					})
-					.catch((err) => {
-						console.error(err);
-					});
-			},
-			selectType() {
-				this.ajax
-					.get(this.$store.state.api + "selectType")
-					.then((res) => {
-						this.CourseType = res.data;
-						for (var i = 0; i < res.data[0].length; i++) {
-							if (!this.cid) {
-								this.courseTypeId[res.data[0][i].id] = "";
-							}
-							for (var j = 0; j < res.data[1].length; j++) {
-								if (res.data[0][i].id == res.data[1][j].pid) {
-									if (!this.CourseTypeJson[res.data[0][i].id]) {
-										this.CourseTypeJson[res.data[0][i].id] = [];
-									}
-									this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
-								}
-							}
-						}
-					})
-					.catch((err) => {
-						console.error(err);
-					});
-			},
-			search() {
-				this.page = 1;
-				this.getCourse();
-			},
-		},
-		created() {
-			this.page = 1;
-			this.selectType();
-			this.getCourse();
-		},
-	};
+import "../../common/aws-sdk-2.235.1.min";
+import EditorBar from "../../components/tools/wangEnduit";
+import CourseProblem from "./components/courseProblem";
+export default {
+  components: { EditorBar,CourseProblem },
+  data() {
+    return {
+      itemCount: 1,
+      courseTitle: "",
+      courseText: "",
+      courseTime: "",
+      isLoading: false,
+      fileList: [],
+      fileList1: [],
+      homeworkList: [{ name: "" }],
+      formLabelWidth: "100px",
+      dialogVisible: false,
+      dialogVisible1: false,
+      dialogImageUrl: "",
+      group: "",
+      userid: this.$route.query.userid,
+      oid: this.$route.query.oid,
+      Juri: "",
+      groupList: [],
+      JuriList: [],
+      page: 1,
+      total: 0,
+      tableData: [],
+      now: "",
+      courseDetail: {},
+      addCourse: {},
+      groupA: "0",
+      classX: "",
+      course: [],
+      courseName: "",
+      mr: require("../../assets/icon/kc1.png"),
+      CourseType: [],
+      CourseTypeJson: {},
+      courseTypeId: {},
+      courseTypeSon: [],
+      isChoose: 0,
+      problemCourse: null, //查看提问的课程
+    };
+  },
+  methods: {
+    change(val) {
+      console.log(val);
+    },
+    addHomeworkBox() {
+      this.homeworkList.push({ name: "" });
+      this.itemCount++;
+    },
+    reduceHomeworkBox() {
+      var a = this.homeworkList;
+      a.splice(a.length - 1);
+      this.itemCount--;
+    },
+    goTo(path) {
+      this.$router.push(path);
+    },
+    tableRowClassName({ row, rowIndex }) {
+      if ((rowIndex + 1) % 2 === 0) {
+        return "even_row";
+      } else {
+        return "";
+      }
+    },
+    jump(cid) {
+      // window.open(
+      //   "//pbl.cocorobo.cn/pbl-student-table/dist/#/courseDetail?courseId=" +
+      //     cid +
+      //     "&userid=" +
+      //     this.userid
+      // );
+      window.parent.postMessage({ cid: cid, type: "1" }, "*");
+    },
+    handle_remove(file, fileList) {
+      var _tmp = this.fileList;
+      for (var i = 0, len = _tmp.length; i < len; i++) {
+        if (_tmp[i].uid == file.uid) {
+          _tmp.splice(i, 1);
+          break;
+        }
+        this.fileList = _tmp;
+      }
+    },
+    handle_remove1(file, fileList) {
+      var _tmp = this.fileList1;
+      for (var i = 0, len = _tmp.length; i < len; i++) {
+        if (_tmp[i].uid == file.uid) {
+          _tmp.splice(i, 1);
+          break;
+        }
+        this.fileList1 = _tmp;
+      }
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.page = val;
+      this.getCourse();
+    },
+    init() {},
+    handleClose(done) {
+      done();
+    },
+    handleRemove(file, fileList) {
+      console.log(file, fileList);
+    },
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible1 = true;
+    },
+    onExceed() {
+      this.$message.error("课程海报仅支持上传一张,请删除后再进行上传");
+    },
+    //uuid生成
+    guid() {
+      return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (
+        c
+      ) {
+        var r = (Math.random() * 16) | 0,
+          v = c == "x" ? r : (r & 0x3) | 0x8;
+        return v.toString(16);
+      });
+    },
+    time() {
+      if (!this.now) {
+        this.now = new Date().getTime();
+        return true;
+      } else {
+        let time = new Date().getTime();
+        if (time - this.now > 3000) {
+          this.now = time;
+          return true;
+        } else {
+          return false;
+        }
+      }
+    },
+    searchCourse() {
+      this.page = 1;
+      this.getCourse();
+    },
+    clear() {
+      for (var i = 0; i < this.CourseType[0].length; i++) {
+        this.courseTypeId[this.CourseType[0][i].id] = "";
+      }
+      this.getCourse();
+    },
+    getCourse() {
+      const loading = this.openLoading(
+        document.querySelector(".student_table")
+      );
+      var typeE = [];
+      var typea, typeb, typec, typed;
+      if (this.isChoose == 1) {
+        for (var i = 0; i < this.CourseType[0].length; i++) {
+          if (this.courseTypeId[this.CourseType[0][i].id] == "1") {
+            typeE.push(this.CourseType[0][i].id);
+          } else if (this.courseTypeId[this.CourseType[0][i].id] != "") {
+            if (this.CourseType[0][i].name == "年级") {
+              typea = this.courseTypeId[this.CourseType[0][i].id];
+            } else if (this.CourseType[0][i].name == "专栏") {
+              typeb = this.courseTypeId[this.CourseType[0][i].id];
+            } else if (this.CourseType[0][i].name == "新技能") {
+              typec = this.courseTypeId[this.CourseType[0][i].id];
+            } else if (this.CourseType[0][i].name == "学科") {
+              typed = this.courseTypeId[this.CourseType[0][i].id];
+            }
+            this.courseTypeSon.push(
+              this.courseTypeId[this.CourseType[0][i].id]
+            );
+          }
+        }
+      }
+      this.isLoading = true;
+      let params = {
+        type: this.groupA,
+        uid: this.userid,
+        oid: this.oid,
+        typea: typea != undefined ? typea : "",
+        typeb: typeb != undefined ? typeb : "",
+        typec: typec != undefined ? typec : "",
+        typed: typed != undefined ? typed : "",
+        typeE: typeE.join(","),
+        cu: "",
+        cn: this.courseName,
+        page: this.page,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectCourseNew", params)
+        .then((res) => {
+          loading.close();
+          this.isLoading = false;
+          this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.course = res.data[0];
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    getTypeName() {
+      this.$forceUpdate();
+      this.page = 1;
+      this.isChoose = 1;
+      this.getCourse();
+    },
+    // searchCourse() {
+    //   this.isLoading = true;
+    //   let params = {
+    //     cu: "",
+    //     cn: this.courseName,
+    //     page: this.page,
+    //   };
+    //   this.ajax
+    //     .get(this.$store.state.api + "searchCourse", params)
+    //     .then((res) => {
+    //       this.isLoading = false;
+    //       this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+    //       this.course = res.data[0];
+    //     })
+    //     .catch((err) => {
+    //       this.isLoading = false;
+    //       console.error(err);
+    //     });
+    // },
+    deleteCourse(cid) {
+      const loading = this.openLoading(
+        document.querySelector(".student_table")
+      );
+      this.isLoading = true;
+      let params = {
+        cid: cid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "deleteCourse", params)
+        .then((res) => {
+          loading.close();
+          this.isLoading = false;
+          this.$message.success("删除成功");
+          this.getCourse();
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    selectType() {
+      this.ajax
+        .get(this.$store.state.api + "selectType")
+        .then((res) => {
+          this.CourseType = res.data;
+          for (var i = 0; i < res.data[0].length; i++) {
+            if (!this.cid) {
+              this.courseTypeId[res.data[0][i].id] = "";
+            }
+            for (var j = 0; j < res.data[1].length; j++) {
+              if (res.data[0][i].id == res.data[1][j].pid) {
+                if (!this.CourseTypeJson[res.data[0][i].id]) {
+                  this.CourseTypeJson[res.data[0][i].id] = [];
+                }
+                this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
+              }
+            }
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    search() {
+      this.page = 1;
+      this.getCourse();
+    },
+    checkProblem(res) {
+      this.problemCourse = res;
+	  this.dialogVisible = true;
+    },
+  },
+  created() {
+    this.page = 1;
+    this.selectType();
+    this.getCourse();
+  },
+};
 </script>
 
 <style scoped>
-	.dialog_diy >>> .el-dialog__header {
-		background: #3d67bc !important;
-		padding: 15px 20px;
-	}
-	.dialog_diy >>> .el-dialog__title {
-		color: #fff;
-	}
-	.dialog_diy >>> .el-dialog__headerbtn {
-		top: 19px;
-	}
-	.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
-		color: #fff;
-	}
-	.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
-		color: #fff;
-	}
-	.student_head >>> .el-button--primary {
-		background-color: #2268bc;
-	}
+.dialog_diy >>> .el-dialog__header {
+  background: #3d67bc !important;
+  padding: 15px 20px;
+}
+.dialog_diy >>> .el-dialog__title {
+  color: #fff;
+}
+.dialog_diy >>> .el-dialog__headerbtn {
+  top: 19px;
+}
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
+  color: #fff;
+}
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
+  color: #fff;
+}
+.student_head >>> .el-button--primary {
+  background-color: #2268bc;
+}
 
-	.xls_button {
-		font-size: 14px;
-		cursor: pointer;
-		text-decoration: underline;
-		color: rgb(34, 104, 188);
-	}
-	.student_head {
-		display: flex;
-		justify-content: space-between;
-		align-items: baseline;
-		flex-direction: row;
-		flex-wrap: nowrap;
-	}
+.xls_button {
+  font-size: 14px;
+  cursor: pointer;
+  text-decoration: underline;
+  color: rgb(34, 104, 188);
+}
+.student_head {
+  display: flex;
+  justify-content: space-between;
+  align-items: baseline;
+  flex-direction: row;
+  flex-wrap: nowrap;
+}
 
-	.top {
-		display: flex;
-		justify-content: space-between;
-	}
+.top {
+  display: flex;
+  justify-content: space-between;
+}
 
-	.bgColor {
-		background: #466b99;
-	}
+.bgColor {
+  background: #466b99;
+}
 
-	.student_search {
-		display: flex;
-		align-items: center;
-		width: calc(100% / 3);
-	}
-	.student_search span {
-		margin: 0 10px 0 0;
-		width: 65px;
-	}
-	.student_button {
-		display: flex;
-		overflow: hidden;
-		height: 40px;
-	}
-	.upload-demo {
-		display: flex;
-		flex-direction: column;
-		align-items: end;
-		/* position: relative; */
-		width: 100px;
-		overflow: hidden;
-	}
-	.student_table {
-		margin: 10px 0;
-		height: 100%;
-		overflow: auto;
-	}
+.student_search {
+  display: flex;
+  align-items: center;
+  width: calc(100% / 3);
+}
+.student_search span {
+  margin: 0 10px 0 0;
+  width: 65px;
+}
+.student_button {
+  display: flex;
+  overflow: hidden;
+  height: 40px;
+}
+.upload-demo {
+  display: flex;
+  flex-direction: column;
+  align-items: end;
+  /* position: relative; */
+  width: 100px;
+  overflow: hidden;
+}
+.student_table {
+  margin: 10px 0;
+  height: 100%;
+  overflow: auto;
+}
 
-	.student_empty {
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
+.student_empty {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
 
-	.el-table >>> .even_row {
-		background-color: #f1f1f1;
-	}
+.el-table >>> .even_row {
+  background-color: #f1f1f1;
+}
 
-	.time {
-		font-size: 13px;
-		color: #999;
-	}
+.time {
+  font-size: 13px;
+  color: #999;
+}
 
-	.course_button {
-		padding: 10px 20px;
-	}
-	.course_button_box {
-		display: flex;
-		margin-top: 5px;
-		justify-content: space-between;
-	}
-	.course_rate {
-		margin-top: 5px;
-	}
-	.course_view {
-		display: flex;
-		align-items: center;
-		margin: 5px 0 0 0;
-	}
-	.course_view i {
-		background-image: url("../../assets/liulan.png");
-		width: 25px;
-		height: 25px;
-		background-size: 100% 100%;
-		/* margin-top: 1px; */
-		line-height: 25px;
-		vertical-align: text-top;
-		background-repeat: no-repeat;
-	}
-	.image {
-		width: 100%;
-		height: 150px;
-		display: block;
-	}
-	.course_box {
-		display: flex;
-		flex-wrap: wrap;
-		height: 100%;
-	}
-	.student_page {
-		width: 95%;
-		margin: 0 auto;
-	}
-	.course_create_box {
-		font-size: 18px;
-	}
-	.course_name {
-		margin-top: 10px;
-	}
-	.course_name span {
-		margin-bottom: 10px;
-		display: block;
-	}
-	.homework_box {
-		display: flex;
-		align-items: center;
-		flex-wrap: wrap;
-	}
-	.course_homework {
-		width: 130px;
-		display: flex;
-		justify-content: center;
-		flex-direction: column;
-		align-items: center;
-		margin: 0 10px 10px 0;
-	}
-	.course_type {
-		margin-top: 10px;
-		display: flex;
-	}
-	.course_type1 span {
-		margin-bottom: 10px;
-		display: block;
-	}
-	.course_type2 {
-		margin-left: 20px;
-	}
-	.course_type2 span {
-		margin-bottom: 10px;
-		display: block;
-	}
-	.course_empty {
-		color: rgb(110, 110, 110);
-		width: 100%;
-		height: 100%;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-	.el_cards >>> .el-card__body {
-		height: 100%;
-	}
-	.courseBtnBox {
-		display: flex;
-		flex-direction: column;
-		justify-content: space-between;
-		height: calc(100% - 170px);
-		padding: 10px;
-	}
+.course_button {
+  padding: 10px 20px;
+}
+.course_button_box {
+  display: flex;
+  margin-top: 5px;
+  justify-content: space-between;
+}
+.course_rate {
+  margin-top: 5px;
+}
+.course_view {
+  display: flex;
+  align-items: center;
+  margin: 5px 0 0 0;
+}
+.course_view i {
+  background-image: url("../../assets/liulan.png");
+  width: 25px;
+  height: 25px;
+  background-size: 100% 100%;
+  /* margin-top: 1px; */
+  line-height: 25px;
+  vertical-align: text-top;
+  background-repeat: no-repeat;
+}
+.image {
+  width: 100%;
+  height: 150px;
+  display: block;
+}
+.course_box {
+  display: flex;
+  flex-wrap: wrap;
+  height: 100%;
+  min-height: 530px;
+}
+.student_page {
+  width: 95%;
+  margin: 0 auto;
+}
+.course_create_box {
+  font-size: 18px;
+}
+.course_name {
+  margin-top: 10px;
+}
+.course_name span {
+  margin-bottom: 10px;
+  display: block;
+}
+.homework_box {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+}
+.course_homework {
+  width: 130px;
+  display: flex;
+  justify-content: center;
+  flex-direction: column;
+  align-items: center;
+  margin: 0 10px 10px 0;
+}
+.course_type {
+  margin-top: 10px;
+  display: flex;
+}
+.course_type1 span {
+  margin-bottom: 10px;
+  display: block;
+}
+.course_type2 {
+  margin-left: 20px;
+}
+.course_type2 span {
+  margin-bottom: 10px;
+  display: block;
+}
+.course_empty {
+  color: rgb(110, 110, 110);
+  width: 100%;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.el_cards >>> .el-card__body {
+  height: 100%;
+}
+.courseBtnBox {
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+  height: calc(100% - 170px);
+  padding: 10px;
+}
 
-	.wordUpload {
-		display: flex;
-	}
+.wordUpload {
+  display: flex;
+}
 
-	.wordUpload > .buttonUp {
-		margin-right: 5px;
-	}
+.wordUpload > .buttonUp {
+  margin-right: 5px;
+}
 
-	.out_box {
-		display: flex;
-		flex-direction: column;
-		flex-wrap: nowrap;
-		width: 250px;
-		background: #fff;
-		margin-left: 25px;
-		border: 1px solid #ccc;
-		height: fit-content;
-		box-sizing: border-box;
-		border-radius: 0px 0px 5px 5px;
-		overflow: hidden;
-		margin-bottom: 15px;
-	}
+.out_box {
+  display: flex;
+  flex-direction: column;
+  flex-wrap: nowrap;
+  width: 250px;
+  background: #fff;
+  margin-left: 25px;
+  border: 1px solid #ccc;
+  height: fit-content;
+  box-sizing: border-box;
+  border-radius: 0px 0px 5px 5px;
+  overflow: hidden;
+  margin-bottom: 15px;
+}
 
-	.bottom_box {
-		display: flex;
-		padding: 10px 0 10px 10px;
-		flex-direction: column;
-		box-sizing: border-box;
-	}
-	.bottom_box > div:nth-child(1) {
-		width: 230px;
-		overflow: hidden;
-		text-overflow: ellipsis;
-		white-space: nowrap;
-	}
+.bottom_box {
+  display: flex;
+  padding: 10px 0 10px 10px;
+  flex-direction: column;
+  box-sizing: border-box;
+}
+.bottom_box > div:nth-child(1) {
+  width: 230px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
 
-	.tup {
-		width: 100%;
-		height: 141.06px;
-		margin: 0 auto;
-	}
+.tup {
+  width: 100%;
+  height: 141.06px;
+  margin: 0 auto;
+}
 
-	.tup > img {
-		width: 100%;
-		height: 100%;
-	}
+.tup > img {
+  width: 100%;
+  height: 100%;
+}
 
-	.kc_time {
-		margin-top: 8px;
-		font-size: 14px;
-		color: #999;
-	}
-	.kc_t {
-		margin-top: 5px;
-	}
+.kc_time {
+  margin-top: 8px;
+  font-size: 14px;
+  color: #999;
+}
+.kc_t {
+  margin-top: 5px;
+}
+
+.three_bottom {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+  height: 40px;
+  align-items: center;
+  background: #f5f4f4;
+  font-size: 14px;
+}
+.three_bottom > div {
+  cursor: pointer;
+}
+
+.three_bottom > div:hover {
+  color: #79a2ff;
+}
+.head_left {
+  display: flex;
+}
+.student_input >>> .el-input__inner {
+  height: 40px;
+  width: 190px;
+  font-size: 13px;
+  padding: 0 10px;
+}
+.course_button {
+  color: #fff;
+  background: #2268bc;
+  width: 75px;
+  height: 40px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 40px;
+}
+.all_choose {
+  margin: 15px 0 10px;
+  height: 20%;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  width: calc(100% / 3);
+}
+.all_choose > span {
+  width: 50px;
+  display: block;
+}
+.choose {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  align-content: space-between;
+  height: 100%;
+  justify-content: flex-start;
+  width: 60%;
+  min-width: 868px;
+  align-items: center;
+}
+.choose > div:nth-child(2) {
+  margin-left: 1%;
+  width: 32.33333%;
+}
+.choose > div:nth-child(4) {
+  margin-right: 1%;
+  width: 32.33333%;
+}
+.choose > div:nth-child(5) {
+  margin-left: 1%;
+}
+.choose > div:nth-child(4) > span {
+  width: 74px !important;
+  min-width: 74px;
+}
+.choose > div:nth-child(4) >>> .el-select {
+  width: 217.5px;
+  min-width: 215.06px;
+}
+.clear {
+  width: 70px;
+  height: 35px;
+  background: #2268bc;
+  color: #fff;
+  text-align: center;
+  border-radius: 5px;
+  line-height: 35px;
+  cursor: pointer;
+  margin-left: 20px;
+}
 
-	.three_bottom {
-		display: flex;
-		flex-direction: row;
-		justify-content: space-around;
-		height: 40px;
-		align-items: center;
-		background: #f5f4f4;
-		font-size: 14px;
-	}
-	.three_bottom > div {
-		cursor: pointer;
-	}
 
-	.three_bottom > div:hover {
-		color: #79a2ff;
-	}
-	.head_left {
-		display: flex;
-	}
-	.student_input >>> .el-input__inner {
-		height: 40px;
-		width: 190px;
-		font-size: 13px;
-		padding: 0 10px;
-	}
-	.course_button {
-		color: #fff;
-		background: #2268bc;
-		width: 75px;
-		height: 40px;
-		padding: 0 !important;
-		font-size: 12px;
-		line-height: 40px;
-	}
-	.all_choose {
-		margin: 15px 0 10px;
-		height: 20%;
-		display: flex;
-		flex-direction: row;
-		align-items: center;
-		width: calc(100% / 3);
-	}
-	.all_choose > span {
-		width: 50px;
-		display: block;
-	}
-	.choose {
-		display: flex;
-		flex-direction: row;
-		flex-wrap: wrap;
-		align-content: space-between;
-		height: 100%;
-		justify-content: flex-start;
-		width: 60%;
-		min-width: 868px;
-		align-items: center;
-	}
-	.choose > div:nth-child(2) {
-		margin-left: 1%;
-		width: 32.33333%;
-	}
-	.choose > div:nth-child(4) {
-		margin-right: 1%;
-		width: 32.33333%;
-	}
-	.choose > div:nth-child(5) {
-		margin-left: 1%;
-	}
-	.choose > div:nth-child(4) > span {
-		width: 74px !important;
-		min-width: 74px;
-	}
-	.choose > div:nth-child(4) >>> .el-select {
-		width: 217.5px;
-		min-width: 215.06px;
-	}
-	.clear {
-		width: 70px;
-		height: 35px;
-		background: #2268bc;
-		color: #fff;
-		text-align: center;
-		border-radius: 5px;
-		line-height: 35px;
-		cursor: pointer;
-		margin-left: 20px;
-	}
 </style>