Browse Source

添加备课

11wqe1 1 week ago
parent
commit
df165ab376

+ 391 - 0
src/components/dialog/addClassDialog.vue

@@ -0,0 +1,391 @@
+<template>
+  <div class="addNewPP2">
+    <el-dialog
+      title="选择班级"
+      v-model="show"
+      width="800px"
+      height="80%"
+    >
+      <div class="check_classBox" v-loading="isLoading">
+        <div class="check_class_right">
+          <span>年级</span>
+          <div
+            class="check_class"
+            :class="{ activeX: gradeId == '' }"
+            @click="(gradeId = ''), getClass()"
+          >
+            全部年级
+          </div>
+          <el-tooltip
+            placement="top"
+            :content="item.name"
+            v-for="(item, index) in gradeList"
+            :key="index"
+          >
+            <div
+              class="check_class"
+              :class="{ activeX: gradeId == item.id }"
+              @click="(gradeId = item.id), getClass()"
+            >
+              {{ item.name }}
+            </div>
+          </el-tooltip>
+        </div>
+        <div class="check_class_left">
+          <div class="check_class_all_box">
+            <div class="check_class_left_title">班级</div>
+          </div>
+          <div class="classItem" @click="classItemClick(item)" :class="{classActiveItem:checkboxList2.map(i=>i.id).includes(item.id)}" v-for="item in grade2" :key="item.id">
+            <div class="ci_left">
+              <div>{{ item.name }}</div>
+              <span v-if="item.studentNum>=0">{{ item.studentNum }} 名学生</span>
+            </div>
+            <div class="ci_right">
+
+              <svg v-show="checkboxList2.map(i=>i.id).includes(item.id)" t="1756864121172" class="icon" viewBox="0 0 1098 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4441" width="200" height="200"><path d="M476.808045 0.000043C213.401753 0.106685-0.031993 213.68973 0 477.074693S213.551052 953.98938 476.94668 954.021373s476.957344-213.412417 477.085315-476.808045A477.010665 477.010665 0 0 0 476.808045 0.000043z m273.761252 353.369671L441.861388 661.853674a43.1901 43.1901 0 0 1-62.023117 0L202.214984 484.251715a43.864079 43.864079 0 1 1 62.033781-62.033782l147.21959 147.21959 277.89897-276.86454a43.861946 43.861946 0 1 1 62.023117 62.033781z m0 0" p-id="4442" fill="#4CAF51"></path></svg>
+            </div>
+          </div>
+          <div v-if="!grade2.length">暂无数据</div>
+        </div>
+      </div>
+      <template #footer>
+        <div class="b_bottom">
+					<div @click="close()">取消</div>
+          <div class="b_b_submit" @click="submit()">确定</div>
+				</div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+  import { ref } from 'vue';
+  import axios from 'axios';
+  import { userInfoStore } from '../../stores/counter';
+  import qs from 'qs';
+  const show = ref(false);
+  const gradeId = ref('');
+  const gradeList = ref([]);
+  const checkboxList2 = ref([]);
+  const grade2 = ref([]);
+  const userInfo = userInfoStore();
+  const emit = defineEmits(["success"]);
+  const classSearch = ref('');
+  const isLoading = ref(false);
+  // const courseDetail = ref({});
+  const props = defineProps({
+    courseDetail: {
+      type: Object,
+      default: () => {}
+    }
+  });
+  const open = (data) => {
+    console.log('data',data);
+        show.value = true;
+        checkboxList2.value = data.classList ? JSON.parse(JSON.stringify(data.classList)):[];
+        getClass();
+        selectGrage();
+  };
+  const close = () => {
+    show.value = false;
+    init();
+  };
+  const getClass = () => {
+    isLoading.value = true;
+    axios.get('https://pbl.cocorobo.cn/api/pbl/selectClassBySchoolSearch2?oid='+userInfo.user.organizeid+'&gid='+gradeId.value+'&cn='+classSearch.value)
+    .then(res => {
+      isLoading.value = false;
+      grade2.value = res.data[0];
+    })
+    .catch(err => {
+      isLoading.value = false;
+      console.error(err);
+    });
+  };
+  const selectGrage = () => {
+    axios.get('https://pbl.cocorobo.cn/api/pbl/selectGrageBySchool?oid='+userInfo.user.organizeid)
+    .then(res => {
+      gradeList.value = res.data[0];
+    })
+    .catch(err=>{
+        console.log(err);
+        // loading.value = false
+    })
+  };
+  // 添加与去除班级
+  const classItemClick = (item) => {
+    if(checkboxList2.value.map(i=>i.id).includes(item.id)){
+      checkboxList2.value = checkboxList2.value.filter(i => i.id != item.id);
+      } else {
+        checkboxList2.value.push(item);
+      }
+  };
+  const submit = () => {
+      let formData = qs.stringify([{
+        cid: props.courseDetail.courseId,
+        juri:checkboxList2.value.map(i=>i.id).join(',')
+      }]);
+      console.log('formData',formData);
+      // return
+      axios.post("https://pbl.cocorobo.cn/api/pbl/update_CourseJuriById",formData,{
+        headers: {
+          'Content-Type': 'application/x-www-form-urlencoded'
+        }
+      }).then(res=>{
+        if(res.data==1){
+          console.log('修改成功');
+          emit("success");
+          init();
+          close();
+        }
+      })
+      .catch(err=>{
+        console.log('err',err);
+      })
+  };
+  const init = () => {
+    gradeId.value = "";
+    classSearch.value = "";
+  };
+
+  defineExpose({
+    open,
+    close
+  });
+</script>
+
+<style scoped>
+.addNewPP2 >>> .el-dialog__body {
+  padding: 5px 0;
+}
+
+.addNewPP2 >>> .el-dialog {
+  margin-top: 5vh !important;
+  border-radius: 10px !important;
+}
+/* .addNewPP2 >>> .el-dialog__header {
+  padding: 0 !important;
+  margin: 0 !important;
+} */
+.check_classBox {
+  height: 400px;
+  display: flex;
+  border-top: 1.5px solid #e7ebf1;
+  border-bottom: 1.5px solid #e7ebf1;
+}
+
+.check_class_right {
+  width: 200px;
+  border-right: 1px solid #e7ebf1;
+  display: flex;
+  align-items: center;
+  flex-direction: column;
+  height: 100%;
+  overflow: auto;
+  padding: 15px 0;
+  box-sizing: border-box;
+  padding-top: 40px;
+  position: relative;
+}
+
+.check_class_right>span{
+  font-size: 14px;
+  text-align: left;
+  position: absolute;
+  left: 10px;
+  top: 10px;
+  font-weight: 700;
+}
+
+.check_class {
+  width: 85%;
+  border-radius: 5px;
+  height: 50px;
+  min-height: 30px;
+  padding: 0 20px;
+  box-sizing: border-box;
+  cursor: pointer;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+  background: #fff;
+  border: solid 1px #E2E9EE;
+}
+
+.check_class.activeX {
+  background: #E8F5E8;
+  color: #4CAF51;
+  font-weight: 700;
+  border-color: #4CAF51;
+}
+
+.check_class + .check_class {
+  margin-top: 15px;
+}
+
+.check_class_left {
+  background: #fafafa;
+  width: calc(100% - 130px);
+  padding: 15px;
+  box-sizing: border-box;
+  overflow: auto;
+}
+
+.check_class_all_box {
+  display: flex;
+  margin-bottom: 10px;
+}
+
+.all_check {
+  display: flex;
+  align-items: center;
+  padding: 2px 0 0;
+  margin-left: 10px;
+}
+
+.all_check >>> .el-checkbox__label {
+  line-height: 18px;
+}
+
+.check_class_left_title {
+  font-size: 14px;
+  font-weight: 700;
+}
+
+.check_class_item {
+  display: flex;
+  flex-wrap: wrap;
+  height: calc(100% - 45px);
+  overflow: auto;
+  justify-content: flex-start;
+  align-items: flex-start;
+  align-content: flex-start;
+}
+
+.class_item:first-child {
+  /* margin: 0 15px 15px 67px; */
+}
+.class_item {
+  margin: 0 15px 15px 0;
+}
+
+.class_item:hover >>> .el-checkbox__label {
+  color: #409eff;
+}
+
+.class_item >>> .el-checkbox__label {
+  color: #0e1e33;
+}
+
+.class_item:hover >>> .el-checkbox__inner {
+  border-color: #409eff;
+}
+
+.class_item >>> .el-checkbox,
+.class_item >>> .el-checkbox__input {
+  display: flex;
+  align-items: center;
+}
+
+.classItem{
+  width: 100%;
+  height: 70px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  background: #fff;
+  box-sizing: border-box;
+  border: solid 1px #E1E8ED;
+  border-radius: 10px;
+  margin-bottom: 15px;
+  padding-left: 30px;
+  position: relative;
+}
+
+.classItem::after{
+  content: "";
+  height: 100%;
+  width: 8px;
+  background: #E1E8ED;
+  position: absolute;
+  left: 0;
+  top: 0;
+  border-radius: 10px 0 0 10px;
+  cursor: pointer;
+}
+
+.ci_left{
+  width: calc(100% - 70px);
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+}
+
+.ci_left>div{
+  color: #000;
+  font-size: 16px;
+  margin-bottom: 4px;
+  font-weight: 700;
+}
+
+.ci_left>span{
+  font-size: 14px;
+  color: #8F8F8F;
+}
+
+.ci_right{
+  width: 70px;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+
+}
+
+.ci_right>svg{
+  width: 20px;
+  height: 20px;
+}
+
+.classActiveItem{
+  border: solid 1px #4CAF51;
+}
+
+.classActiveItem::after{
+  background: #4CAF51;
+}
+
+.b_bottom {
+	width: 100%;
+	height: 40px;
+	display: flex;
+	align-items: center;
+	justify-content: flex-end;
+	box-sizing: border-box;
+	padding: 0 20px;
+}
+
+.b_bottom>div{
+  padding: 10px 25px;
+  background: #fff;
+  color: #000;
+  border-radius: 4px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border: solid 1px #EEEEEE;
+  margin-left: 15px;
+  cursor: pointer;
+}
+
+.b_bottom>.b_b_submit{
+  background: #1A1A1A;
+  color: #D4D4D4;
+  border-color: #1A1A1A;
+}
+
+</style>

+ 296 - 0
src/components/dialog/selectTeachingClassDialog.vue

@@ -0,0 +1,296 @@
+<template>
+	<div class="opkDialogHeader">
+		<el-dialog v-model="show" :show-close="false">
+			<template #header>
+				<div class="b_head">
+					<span>添加班级</span>
+					<svg
+						@click="close()"
+						t="1748587270371"
+						class="icon"
+						viewBox="0 0 1024 1024"
+						version="1.1"
+						xmlns="http://www.w3.org/2000/svg"
+						p-id="5023"
+						width="200"
+						height="200"
+					>
+						<path
+							d="M0 0h1024v1024H0z"
+							fill="#FF0033"
+							fill-opacity="0"
+							p-id="5024"
+						></path>
+						<path
+							d="M240.448 168l2.346667 2.154667 289.92 289.941333 279.253333-279.253333a42.666667 42.666667 0 0 1 62.506667 58.026666l-2.133334 2.346667-279.296 279.210667 279.274667 279.253333a42.666667 42.666667 0 0 1-58.005333 62.528l-2.346667-2.176-279.253333-279.253333-289.92 289.962666a42.666667 42.666667 0 0 1-62.506667-58.005333l2.154667-2.346667 289.941333-289.962666-289.92-289.92a42.666667 42.666667 0 0 1 57.984-62.506667z"
+							fill="#fff"
+							p-id="5025"
+						></path>
+					</svg>
+				</div>
+			</template>
+			<div class="b_main" v-loading="loading">
+					<template v-for="item in classList">
+						<div
+							class="b_m_classItem"
+							:class="{ b_m_classItem_active: selectId == item.id }"
+							:key="item.id"
+							v-if="item.name"
+							@click="
+								selectId == item.id ? (selectId = '') : (selectId = item.id)
+							"
+						>
+							<div>{{ item.name }}</div>
+							<span v-if="item.studentNum >= 0"
+								>{{ item.studentNum }} 名学生
+							</span>
+						</div>
+					</template>
+
+					<div
+						class="b_m_classItem"
+						@click="editClass"
+					>
+						<div>
+							<span>+</span>
+							<svg
+								t="1756867649445"
+								class="icon"
+								viewBox="0 0 1024 1024"
+								version="1.1"
+								xmlns="http://www.w3.org/2000/svg"
+								p-id="10274"
+								width="200"
+								height="200"
+							>
+								<path
+									d="M417.664 921.6l317.184-824.32h-63.616L353.152 921.6z"
+									fill="#999999"
+									p-id="10275"
+								></path>
+							</svg>
+							<span>-</span>
+						</div>
+						<div>添加或修改班级</div>
+					</div>
+				</div>
+		</el-dialog>
+		
+	</div>
+	<addClassDialog
+			ref="addClassDialogRef"
+			:courseDetail="courseDetail"
+			@success="getCourseList"
+		/>
+</template>
+
+<script setup>
+import { ref } from "vue";
+import { userInfoStore } from "../../stores/counter";
+import addClassDialog from "./addClassDialog.vue";
+const emit = defineEmits(["success", "changeClassList"]);
+import axios from 'axios';
+
+const courseDetail = ref({});
+const loading = ref(false);
+const show = ref(false);
+const classList = ref([]);
+const selectId = ref("");
+const userInfo = userInfoStore();
+const addClassDialogRef = ref(null);
+
+const getClasslist = (options) => {
+	courseDetail.value = JSON.parse(JSON.stringify(options));
+	getCourseList();
+	loading.value = true;
+	show.value = true;
+};
+const getCourseList = () => {
+	axios.get('https://pbl.cocorobo.cn/api/pbl/selectCourseDetail2?courseId='+courseDetail.value.courseId)
+    .then(res => {
+        console.log(res);
+       
+        classList.value = res.data[3]        
+        loading.value = false
+    })
+    .catch(err=>{
+        console.log(err);
+        loading.value = false
+    })
+};
+
+ const close = () => {
+	show.value = false;
+ }
+const editClass = () => {
+	addClassDialogRef.value.open({ classList: classList.value });
+};
+
+defineExpose({
+	getClasslist,
+});
+
+</script>
+<style scoped>
+.opkDialogHeader >>> .el-dialog {
+	width: 900px !important;
+	border-radius: 8px;
+	padding: 0;
+	background-color: #fff;
+	overflow: hidden;
+	border-radius: 8px !important;
+}
+.opkDialogHeader >>> .el-dialog__body {
+	padding: 0 !important;
+	background: #fafafa !important;
+}
+.opkDialogHeader >>> .el-dialog__header {  /* 注意这里没有 :deep,因为是全局 */
+  /* background: #2575fc !important; */
+  padding: 0 !important;margin: 0 !important;
+}
+.box {
+	width: 900px;
+	height: auto;
+	background: #fafafa;
+	border-radius: 15px;
+	box-shadow:
+		0px 6px 30px 5px rgba(0, 0, 0, 0.05),
+		0px 16px 24px 2px rgba(0, 0, 0, 0.04),
+		0px 8px 10px -5px rgba(0, 0, 0, 0.08);
+}
+
+.b_head {
+	width: 100%;
+	height: 50px;
+	/* border-radius: 15px 15px 0 0; */
+	background: #1a1a1a;
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	box-sizing: border-box;
+	padding: 0 20px;
+	color: #fff;
+}
+
+.b_head > span {
+	font-size: 18px;
+	font-weight: bold;
+	color: #fff;
+}
+
+.b_head > img {
+	width: 20px;
+	height: 20px;
+	cursor: pointer;
+}
+
+.b_head > svg {
+	width: 20px;
+	height: 20px;
+	cursor: pointer;
+}
+
+.b_main {
+	width: 100%;
+	height: 400px;
+	background: #fafafa;
+	padding: 20px 20px 20px 20px;
+	box-sizing: border-box;
+	overflow: auto;
+}
+
+.b_bottom {
+	width: 100%;
+	height: 70px;
+	display: flex;
+	align-items: center;
+	justify-content: flex-end;
+	box-sizing: border-box;
+	padding: 0 20px;
+}
+
+.b_bottom > div {
+	padding: 10px 25px;
+	/* background: #fff; */
+	color: #000;
+	border-radius: 4px;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	border: solid 1px #eeeeee;
+	margin-left: 15px;
+	cursor: pointer;
+	font-size: 16px;
+}
+
+.b_bottom > .b_b_submit {
+	background: #1a1a1a;
+	color: #d4d4d4;
+	border-color: #1a1a1a;
+}
+
+.b_m_classItem {
+	width: 32%;
+	height: 85px;
+	float: left;
+	margin-bottom: 20px;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	flex-direction: column;
+	background: #fff;
+	box-shadow:
+		0px 6px 30px 5px rgba(0, 0, 0, 0.05),
+		0px 16px 24px 2px rgba(0, 0, 0, 0.04),
+		0px 8px 10px -5px rgba(0, 0, 0, 0.08);
+	border-radius: 12px;
+	cursor: pointer;
+	transition: 0.2s;
+}
+
+.b_m_classItem > div {
+	color: #5f5f5f;
+	font-size: 16px;
+	margin: 4px 0;
+	display: flex;
+	flex-wrap: wrap;
+	align-content: center;
+}
+
+.b_m_classItem > div > span {
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	width: 25px;
+	height: 25px;
+	border-radius: 4px;
+	border: solid 1px #b0b0b0;
+}
+
+.b_m_classItem > div > svg {
+	width: 20px;
+	height: 25px;
+	margin: 0 5px;
+}
+
+.b_m_classItem > span {
+	color: #a3a3a3;
+	font-size: 14px;
+}
+
+.b_main > div:nth-child(3n-1) {
+	margin: 0 2%;
+}
+
+.b_m_classItem_active {
+	box-shadow: 4px 4px 4px 0px rgba(138, 238, 138, 0.555);
+}
+
+.b_m_noClassMsg {
+	width: 100%;
+	height: 100%;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+}
+</style>

+ 59 - 8
src/components/main/courseSelect.vue

@@ -25,6 +25,9 @@
     <el-button :class="volumes ? 'el_button_active' : ''" @click="volumes = true">上册</el-button>
     <el-button v-if="!courseTypeShow" :class="!volumes ? 'el_button_active' : ''"
       @click="volumes = false">下册</el-button>
+
+
+      <!-- 课程上下册区域 -->
     <div v-if="currentData && currentData.shang.length > 0 && volumes">
       <el-row :gutter="20">
         <el-col :span="6" v-for="item in currentData.shang" :key="item.title" style="margin-top: 10px;">
@@ -70,18 +73,20 @@
               </div>
             </div>
             <div class="class_button" v-if="isupdateCourse">
-              <el-popover v-if="item.courseType == '1'" placement="bottom" trigger="hover">
-                <template #reference>
-                  <el-button
-                    style="width: 50%;background: rgba(255, 255, 245, 1);color: rgba(0, 0, 0, 0.6);">备课</el-button>
-                </template>
+              <!-- <el-popover v-if="item.courseType == '1'" placement="bottom" trigger="hover">
+                <template #reference> -->
+                <el-button
+                @click="getCourseid(item.id)"
+                  style="width: 50%;background: rgba(255, 255, 245, 1);color: rgba(0, 0, 0, 0.6);">
+                  备课</el-button>
+                <!-- </template>
                 <ul class="beike">
                   <li @click="openCourseDetail(item.id)">查看</li>
                   <li @click="updateCourse(item.id, item)">修改</li>
                   <li @click="ReductionCourse(item.id)">还原</li>
                 </ul>
-              </el-popover>
-              <el-button :style="item.courseType == '1' ? 'width: 50%;' : 'width: 100%;'" class="el_button_active"
+              </el-popover> -->
+              <el-button style="width: 50%;" class="el_button_active"
                 @click="openCourseDetail(item.id, item)">上课</el-button>
             </div>
           </div>
@@ -249,6 +254,10 @@
       </div>
     </template>
   </el-dialog>
+
+  <selectTeachingClassDialog 
+  ref="DialogRef" />
+
 </template>
 <script setup>
 import { ref, onMounted, watchEffect } from 'vue';
@@ -259,6 +268,7 @@ import DownloadImg from '@/assets/img/download.png'
 // import PDFImg from '@/assets/img/PDF.png'
 import WarningImg from '@/assets/icon/icon.png'
 import courseDataJson from '@/assets/course.json'
+import selectTeachingClassDialog from '../dialog/selectTeachingClassDialog.vue'
 // import { Value } from 'sass';
 // import { dataType } from 'element-plus/es/components/table-v2/src/common';
 import axios from 'axios';
@@ -293,7 +303,7 @@ const checked1 = ref(false)
 const getUpdateCourseId = ref("")
 const courseTypeShow = ref(true) // old 旧版 new 纲要
 const setIntervalNum = ref(null)
-
+const DialogRef = ref(null)
 const courseData = ref(courseDataJson.new)
 const modData = ref(courseDataJson.mod)
 const AI6Data = ref(courseDataJson.AI6one)
@@ -340,6 +350,47 @@ const getImageUrl = (url) => {
   return new URL(url, import.meta.url).href
 }
 
+// 新课备课 获取id
+const getCourseid = (id) => {
+// 会返回复制得课程
+  let params ={id: id +','+ user.user.userid};
+  axios.post('https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz', params, {
+    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+    withCredentials: true
+  })
+    .then(res => {
+        console.log(res);
+        console.log(res.data[0]);
+        // console.log(res.data[0][0].courseId);
+        if (res.data[0].length > 0) {
+          DialogRef.value.getClasslist(res.data[0][0])
+        } else {
+          getCourseid2(id, "studyDetail")
+        }
+    })
+    .catch(err=>{
+        console.log(err);
+    })
+}
+
+// 复制课程并获取id
+const getCourseid2 = (id, type) => {
+  let params ={id: id +','+ user.user.userid};
+  axios.post('https://pbl.cocorobo.cn/api/pbl/copyCourseSz', params, {
+    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+    withCredentials: true
+  })
+    .then(res => {
+      console.log(res);
+      // console.log(res.data[0][0].courseId);
+      DialogRef.value.getClasslist(res.data[0][0])
+
+    })
+    .catch(err=>{
+      console.log(err);
+    })
+}
+
 const openCourseDetail = (id) => {
   console.log(user.user)
   // 会返回复制得课程