|
|
@@ -9,6 +9,10 @@
|
|
|
@confirm="handleConfirm"
|
|
|
@cancel="handleCancel"
|
|
|
/>
|
|
|
+ <toast-message
|
|
|
+ :visible.sync="toastVisible"
|
|
|
+ :message="toastMessage"
|
|
|
+ />
|
|
|
|
|
|
<div class="pb_content_body" style="position: relative; margin: 0">
|
|
|
<div class="right">
|
|
|
@@ -797,11 +801,12 @@
|
|
|
</div>
|
|
|
<div class="modal-body publish-modal-body">
|
|
|
<div class="course-name-display">
|
|
|
- <div v-if="!editingCourseName" @click="editingCourseName = true" class="course-name-text">
|
|
|
+ <div v-if="!editingCourseName" @click="startEditCourseName" class="course-name-text">
|
|
|
{{ courseName || lang.ssUntitledCourse }}
|
|
|
</div>
|
|
|
<el-input v-else v-model="courseName" @blur="editingCourseName = false; handleUpdateTitle()"
|
|
|
- @keyup.enter="editingCourseName = false" class="course-name-input" autofocus></el-input>
|
|
|
+ @keyup.enter="editingCourseName = false" @input="updateInputWidth" ref="courseNameInput"
|
|
|
+ class="course-name-input" :style="{ width: inputWidth + 'px' }" autofocus></el-input>
|
|
|
</div>
|
|
|
|
|
|
<div class="form-box">
|
|
|
@@ -826,39 +831,14 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="form-row">
|
|
|
- <div class="form-item required" style="flex: 2;">
|
|
|
- <label class="form-label">{{ lang.ssClass }}</label>
|
|
|
- <selectTag
|
|
|
- v-model="checkboxList2"
|
|
|
- :options="classOptions"
|
|
|
- :placeholder=lang.ssSelectClass
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- <div class="form-row">
|
|
|
- <div class="form-item required">
|
|
|
- <label class="form-label">{{ lang.ssGradeType }}</label>
|
|
|
- <selectTag
|
|
|
- v-model="selectedGrade"
|
|
|
- :options="gradeOptions"
|
|
|
- :placeholder=lang.ssSelectGrade
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <GradeClassSelector
|
|
|
+ v-model="checkboxList2"
|
|
|
+ :grade-options="gradeOptions"
|
|
|
+ :class-options="classOptions"
|
|
|
+ :lang="lang"
|
|
|
+ @gradeChange="onGradeChange"
|
|
|
+ />
|
|
|
|
|
|
- <div class="form-item required">
|
|
|
- <label class="form-label">{{ lang.ssClass }}</label>
|
|
|
- <selectTag
|
|
|
- v-model="checkboxList2"
|
|
|
- :options="classOptions"
|
|
|
- :placeholder=lang.ssSelectClass
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
|
|
|
<div class="form-row">
|
|
|
<div class="form-item required">
|
|
|
@@ -968,6 +948,8 @@ import InteractiveToolDialog from "./dialog/InteractiveToolDialog.vue";
|
|
|
import VideoUploadDialog from "./dialog/VideoUploadDialog2.vue";
|
|
|
import ConfirmDialog from "../../common/ConfirmDialog";
|
|
|
import selectTag from "./dialog/selectTag3.vue";
|
|
|
+import ToastMessage from "./dialog/ToastMessage";
|
|
|
+import GradeClassSelector from "../../common/GradeClassSelector";
|
|
|
|
|
|
var OpenCC = require("opencc-js");
|
|
|
let converter = OpenCC.Converter({
|
|
|
@@ -1022,7 +1004,9 @@ export default {
|
|
|
BilibiliSearchDialog,
|
|
|
appDialog,
|
|
|
ConfirmDialog,
|
|
|
- selectTag
|
|
|
+ selectTag,
|
|
|
+ ToastMessage,
|
|
|
+ GradeClassSelector
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -1044,6 +1028,8 @@ export default {
|
|
|
confirmConfirmText: '',
|
|
|
confirmCancelText: '',
|
|
|
confirmCallback: null,
|
|
|
+ toastVisible: false,
|
|
|
+ toastMessage: '',
|
|
|
loading: false,
|
|
|
courseName: "",
|
|
|
isTeacherSee: false,
|
|
|
@@ -1122,6 +1108,7 @@ export default {
|
|
|
gradeList: [],
|
|
|
grade: [],
|
|
|
grade2: [],
|
|
|
+ gradeArray: [],
|
|
|
noneBtnImg: false,
|
|
|
inviteCode: [],
|
|
|
nbOrder: 0,
|
|
|
@@ -1360,8 +1347,32 @@ export default {
|
|
|
// 暂时使用模拟数据
|
|
|
this.classOptions = this.grade2.map(item => ({
|
|
|
id: item.id,
|
|
|
- name: item.classname ? item.classname + '-' + item.name : item.name
|
|
|
+ pid: item.pid,
|
|
|
+ name: item.name
|
|
|
}));
|
|
|
+
|
|
|
+ // 初始化年级选项,添加全部班级选项
|
|
|
+ this.gradeOptions = [
|
|
|
+ { id: '', name: '全部班级' }
|
|
|
+ ].concat(this.gradeArray.map(item => ({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name
|
|
|
+ })));
|
|
|
+
|
|
|
+ // 初始化筛选后的班级选项
|
|
|
+ this.filteredClassOptions = this.classOptions;
|
|
|
+ },
|
|
|
+ // 年级选择变化时筛选班级
|
|
|
+ onGradeChange() {
|
|
|
+ if (this.selectedGrade === '') {
|
|
|
+ // 选择了全部班级,显示所有班级
|
|
|
+ this.filteredClassOptions = this.classOptions;
|
|
|
+ } else {
|
|
|
+ // 根据选择的年级筛选班级
|
|
|
+ this.filteredClassOptions = this.classOptions.filter(item => item.pid === this.selectedGrade);
|
|
|
+ }
|
|
|
+ // 清空已选择的班级,因为筛选后班级列表可能已经改变
|
|
|
+ // this.checkboxList2 = [];
|
|
|
},
|
|
|
// 确认发布
|
|
|
confirmPublish() {
|
|
|
@@ -1711,6 +1722,40 @@ export default {
|
|
|
this.role
|
|
|
);
|
|
|
},
|
|
|
+ showToast(message) {
|
|
|
+ this.toastMessage = message;
|
|
|
+ this.toastVisible = true;
|
|
|
+ },
|
|
|
+ updateInputWidth() {
|
|
|
+ // 创建一个隐藏的span元素来计算文字宽度
|
|
|
+ const span = document.createElement('span');
|
|
|
+ span.style.fontSize = '14px'; // 与输入框字体大小一致
|
|
|
+ span.style.fontFamily = 'Arial, sans-serif'; // 与输入框字体一致
|
|
|
+ span.style.whiteSpace = 'nowrap';
|
|
|
+ span.style.visibility = 'hidden';
|
|
|
+ span.style.position = 'absolute';
|
|
|
+ span.textContent = this.courseName;
|
|
|
+ document.body.appendChild(span);
|
|
|
+
|
|
|
+ // 计算文字宽度,加上10px的padding
|
|
|
+ let width = span.offsetWidth + 10;
|
|
|
+
|
|
|
+ // 确保宽度在最小和最大范围内
|
|
|
+ width = Math.max(width, 120); // 最小宽度:4个汉字 + 10px
|
|
|
+ width = Math.min(width, 500); // 最大宽度:500px
|
|
|
+
|
|
|
+ this.inputWidth = width;
|
|
|
+
|
|
|
+ // 移除临时span元素
|
|
|
+ document.body.removeChild(span);
|
|
|
+ },
|
|
|
+ startEditCourseName() {
|
|
|
+ this.editingCourseName = true;
|
|
|
+ // 在下一个DOM更新周期后计算宽度
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.updateInputWidth();
|
|
|
+ });
|
|
|
+ },
|
|
|
//获取ppt的数据
|
|
|
async getPPtJson() {
|
|
|
const checkLoaded = async (resolve) => {
|
|
|
@@ -1942,10 +1987,7 @@ export default {
|
|
|
this.uploadWorkLoading = false;
|
|
|
console.log(this.steps);
|
|
|
// if (this.steps != 1 && this.steps != 2 && this.steps != 3) {
|
|
|
- this.$message({
|
|
|
- message: this.lang.ssAddSucc,
|
|
|
- type: "success"
|
|
|
- });
|
|
|
+ this.showToast(this.lang.ssSaveSuccess);
|
|
|
// }
|
|
|
this.number = res.data.ordernumber;
|
|
|
this.courseId = res.data.courseId;
|
|
|
@@ -2054,17 +2096,18 @@ export default {
|
|
|
.then(res => {
|
|
|
// if (this.steps != 1 && this.steps != 2 && this.steps != 3) {
|
|
|
this.uploadWorkLoading = false;
|
|
|
- if (this.cidType == 1) {
|
|
|
- this.$message({
|
|
|
- message: this.lang.ssModifySuccess,
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: this.lang.ssAddSucc,
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- }
|
|
|
+ // if (this.cidType == 1) {
|
|
|
+ // this.$message({
|
|
|
+ // message: this.lang.ssSaveSuccess,
|
|
|
+ // type: "success"
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // this.$message({
|
|
|
+ // message: this.lang.ssSaveSuccess,
|
|
|
+ // type: "success"
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ this.showToast(this.lang.ssSaveSuccess);
|
|
|
// }
|
|
|
this.number = this.nbOrder;
|
|
|
this.courseId = this.cid;
|
|
|
@@ -2108,6 +2151,7 @@ export default {
|
|
|
this.grade = res.data[0];
|
|
|
}
|
|
|
this.grade2 = res.data[0];
|
|
|
+ this.gradeArray = res.data[1];
|
|
|
this.classJuri = res.data[0];
|
|
|
let _check = [];
|
|
|
let _check2 = [];
|
|
|
@@ -2122,6 +2166,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.checkAll = _check2.length === _check.length;
|
|
|
+
|
|
|
+ // 初始化年级和班级选项
|
|
|
+ this.loadClassOptions();
|
|
|
})
|
|
|
.catch(err => {
|
|
|
this.isLoading = false;
|
|
|
@@ -5042,15 +5089,17 @@ export default {
|
|
|
}
|
|
|
|
|
|
.course-name-input {
|
|
|
- width: 80%;
|
|
|
+ display: inline-block;
|
|
|
+ width: auto;
|
|
|
+ min-width: 120px; /* 假设每个汉字宽度约为 27.5px,4个汉字 + 10px = 120px */
|
|
|
+ max-width: 500px;
|
|
|
margin: 0 auto;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
-.course-name-input .el-input__inner {
|
|
|
- font-size: 18px;
|
|
|
- font-weight: 600;
|
|
|
- text-align: center;
|
|
|
+.course-name-input >>> .el-input__inner {
|
|
|
+ background-color: #fff8f0;
|
|
|
+ border: 1px solid #f89a3d !important;
|
|
|
}
|
|
|
|
|
|
.publish-course-modal .form-box {
|
|
|
@@ -5368,8 +5417,8 @@ export default {
|
|
|
}
|
|
|
|
|
|
.web-search-footer .btn-cancel:hover {
|
|
|
- border-color: #c6e2ff;
|
|
|
- color: #409eff;
|
|
|
+ border-color: #ff9500;
|
|
|
+ color: #ff9500;
|
|
|
}
|
|
|
|
|
|
.web-search-footer .btn-confirm {
|