|
@@ -13,11 +13,13 @@
|
|
|
<el-button :class="selectGrand == '六年级' ? 'el_button_active' : ''" @click="clickGrand('六年级')">六年级</el-button>
|
|
|
<el-button :class="selectGrand == '七年级' ? 'el_button_active' : ''" @click="clickGrand('七年级')">七年级</el-button>
|
|
|
<el-button :class="selectGrand == '八年级' ? 'el_button_active' : ''" @click="clickGrand('八年级')">八年级</el-button>
|
|
|
- <el-button v-if="courseTypeShow" :class="selectGrand == '九年级' ? 'el_button_active' : ''" @click="clickGrand('九年级')">九年级</el-button>
|
|
|
+ <el-button v-if="courseTypeShow" :class="selectGrand == '九年级' ? 'el_button_active' : ''"
|
|
|
+ @click="clickGrand('九年级')">九年级</el-button>
|
|
|
</div>
|
|
|
<div class="course_select">
|
|
|
<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>
|
|
|
+ <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;">
|
|
@@ -28,8 +30,8 @@
|
|
|
<span>上册</span>
|
|
|
{{ item.title }}
|
|
|
<!-- v-if="isupdateCourse" -->
|
|
|
- <el-popover v-if="isupdateCourse && item.courseType == '1'" placement="bottom" :width="210" trigger="click" show-after="500"
|
|
|
- @hide="checked1 = false">
|
|
|
+ <el-popover v-if="isupdateCourse && item.courseType == '1'" placement="bottom" :width="210"
|
|
|
+ trigger="click" show-after="500" @hide="checked1 = false">
|
|
|
<template #reference>
|
|
|
<img :src="DownloadImg" alt="" @click="getDate(item.dataId)">
|
|
|
</template>
|
|
@@ -68,11 +70,12 @@
|
|
|
</template>
|
|
|
<ul class="beike">
|
|
|
<li @click="openCourseDetail(item.id)">查看</li>
|
|
|
- <li @click="updateCourse(item.id,item)">修改</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" @click="openCourseDetail(item.id,item)">上课</el-button>
|
|
|
+ <el-button :style="item.courseType == '1' ? 'width: 50%;' : 'width: 100%;'" class="el_button_active"
|
|
|
+ @click="openCourseDetail(item.id, item)">上课</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -88,8 +91,8 @@
|
|
|
<span>下册</span>
|
|
|
{{ item.title }}
|
|
|
<!-- v-if="isupdateCourse" -->
|
|
|
- <el-popover v-if="isupdateCourse && item.courseType == '1'" placement="bottom" :width="210" trigger="click" show-after="500"
|
|
|
- @hide="checked1 = false">
|
|
|
+ <el-popover v-if="isupdateCourse && item.courseType == '1'" placement="bottom" :width="210"
|
|
|
+ trigger="click" show-after="500" @hide="checked1 = false">
|
|
|
<template #reference>
|
|
|
<img :src="DownloadImg" alt="" @click="getDate(item.dataId)">
|
|
|
</template>
|
|
@@ -128,11 +131,12 @@
|
|
|
</template>
|
|
|
<ul class="beike">
|
|
|
<li @click="openCourseDetail(item.id)">查看</li>
|
|
|
- <li @click="updateCourse(item.id,item)">修改</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" @click="openCourseDetail(item.id,item)">上课</el-button>
|
|
|
+ <el-button :style="item.courseType == '1' ? 'width: 50%;' : 'width: 100%;'" class="el_button_active"
|
|
|
+ @click="openCourseDetail(item.id, item)">上课</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -159,7 +163,7 @@
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { ref, onMounted, watchEffect } from 'vue';
|
|
|
-import { userCurrentRole, userInfoStore,userCurrent } from '../../stores/counter'
|
|
|
+import { userCurrentRole, userInfoStore, userCurrent } from '../../stores/counter'
|
|
|
import JSZip from 'jszip';
|
|
|
import { saveAs } from 'file-saver';
|
|
|
import DownloadImg from '@/assets/img/download.png'
|
|
@@ -168,6 +172,7 @@ import WarningImg from '@/assets/icon/icon.png'
|
|
|
import courseDataJson from '@/assets/course.json'
|
|
|
import { Value } from 'sass';
|
|
|
import { dataType } from 'element-plus/es/components/table-v2/src/common';
|
|
|
+import axios from 'axios';
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
@@ -189,10 +194,12 @@ const checked1 = ref(false)
|
|
|
const visible = ref(false)
|
|
|
const getUpdateCourseId = ref("")
|
|
|
const courseTypeShow = ref(true) // old 旧版 new 纲要
|
|
|
+const setIntervalNum = ref(null)
|
|
|
|
|
|
const courseData = ref(courseDataJson.new)
|
|
|
onMounted(() => {
|
|
|
currentData.value = courseData.value["三年级"]
|
|
|
+ getTimeCourse(1, 1)
|
|
|
})
|
|
|
const clickGrand = val => {
|
|
|
selectGrand.value = val
|
|
@@ -203,7 +210,7 @@ const SwitchCourseType = (val) => {
|
|
|
if (val) {
|
|
|
courseData.value = courseDataJson.new
|
|
|
volumes.value = true
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
courseData.value = courseDataJson.old
|
|
|
}
|
|
|
currentData.value = courseData.value[selectGrand.value]
|
|
@@ -212,10 +219,9 @@ const getImageUrl = (url) => {
|
|
|
return new URL(url, import.meta.url).href
|
|
|
}
|
|
|
|
|
|
-const openCourseDetail = (id,item) => {
|
|
|
+const openCourseDetail = (id) => {
|
|
|
console.log(user.user)
|
|
|
// 会返回复制得课程
|
|
|
- getTimeCourse(id,item)
|
|
|
top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
|
|
|
console.log(res)
|
|
|
if (res.value[0].length > 0) {
|
|
@@ -230,37 +236,48 @@ const openCourseDetail = (id,item) => {
|
|
|
}, [], { "type": "POST", "withCredentials": true });
|
|
|
|
|
|
}
|
|
|
-const getTimeCourse = (id,item) => {
|
|
|
- const interValtTime = Math.floor(Math.random() * (10 - 5 + 1) + 5) * 60 * 1000;
|
|
|
- // const params = {
|
|
|
- // serverName: "深教AI6",
|
|
|
- // dataType: type,
|
|
|
- // teacherName: user.user.name,
|
|
|
- // teacherAccount: "",
|
|
|
- // eduId: id,
|
|
|
- // schoolName: user.user.schoolName,
|
|
|
- // schoolType: user.user.userid,
|
|
|
- // area: user.user.name,
|
|
|
- // courseName: user.user.type,
|
|
|
- // courseGrade: user.user.role,
|
|
|
- // courseTime: user.user.grade,
|
|
|
- // startTime: user.user.class,
|
|
|
- // endTime: user.user.subject,
|
|
|
- // }
|
|
|
- console.log(user.user,Current,item,id,interValtTime)
|
|
|
- // try {
|
|
|
- // setInterval(() => {
|
|
|
- // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, id, '5', 30], function (res) {
|
|
|
- // console.log(res, "22222222222222222");
|
|
|
- // }, [], { "type": "POST", "withCredentials": true });
|
|
|
- // }, interValtTime)
|
|
|
- // } catch (e) {
|
|
|
- // console.log(e)
|
|
|
- // }
|
|
|
+const getTimeCourse = (id, item) => {
|
|
|
+ if (setIntervalNum.value) {
|
|
|
+ clearInterval(setIntervalNum.value)
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ setIntervalNum.value = setInterval(() => {
|
|
|
+ top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, id, '5', 30], function (res) {
|
|
|
+ console.log(res, "22222222222222222");
|
|
|
+ }, [], { "type": "POST", "withCredentials": true });
|
|
|
+ }, 30000)
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ //
|
|
|
+ const middleTime = Math.random() * 2 + 6;
|
|
|
+ const interValtTime = Math.floor(middleTime * 60) * 1000 + 30000;
|
|
|
+ const params = {
|
|
|
+ serverName: "深教AI6",
|
|
|
+ dataType: 0,
|
|
|
+ teacherName: user.user.name,
|
|
|
+ teacherAccount: "",
|
|
|
+ eduId: Current.userCurrent.eduId,
|
|
|
+ schoolName: user.user.schoolName,
|
|
|
+ schoolType: "",
|
|
|
+ area: "",
|
|
|
+ courseName: item.title,
|
|
|
+ courseGrade: selectGrand.value,
|
|
|
+ courseTime: Math.round(middleTime),
|
|
|
+ startTime: new Date().toLocaleString().replace(/\//g, "-"),
|
|
|
+ endTime: "",
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ params.endTime = new Date().toLocaleString().replace(/\//g, "-")
|
|
|
+ console.log(params, interValtTime)
|
|
|
+ axios.post("//pbl.cocorobo.cn/api/szdjg/sync/class", JSON.stringify(params)).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
+ }, interValtTime);
|
|
|
}
|
|
|
-const updateCourse = (id,item) => {
|
|
|
+const updateCourse = (id, item) => {
|
|
|
// 会返回courseId和state 两个参数 然后打开
|
|
|
- getTimeCourse(id,item)
|
|
|
+ getTimeCourse(id, item)
|
|
|
top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
|
|
|
console.log(res)
|
|
|
if (res.value[0].length > 0) {
|