Merge pull request 'zouyf_dev' (#193) from zouyf_dev into main

Reviewed-on: #193
This commit is contained in:
zouyf 2024-12-27 16:49:46 +08:00
commit 8fc1a22d2f
5 changed files with 42 additions and 24 deletions

View File

@ -15,7 +15,7 @@ const size = ref('default')
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; /* text-align: center; */
color: #2c3e50; color: #2c3e50;
width: 100%; width: 100%;
} }

View File

@ -7,11 +7,20 @@
<i class="iconfont icon-xiangyou"></i> <i class="iconfont icon-xiangyou"></i>
</div> </div>
<div class="book-list" v-loading="treeLoading"> <div class="book-list" v-loading="treeLoading">
<el-tree :data="treeData" accordion :props="defaultProps" node-key="id" :render-content="renderContent" <el-tree :data="treeData" accordion :props="defaultProps" node-key="id"
:default-expanded-keys="defaultExpandedKeys" :current-node-key="curNode.data.id" highlight-current :default-expanded-keys="defaultExpandedKeys" :current-node-key="curNode.data.id" highlight-current
@node-click="handleNodeClick"> @node-click="handleNodeClick">
<template #default="{ node }"> <template #default="{ node, data }">
<span :title="node.label" class="tree-label">{{ node.label }}</span> <div v-if="props.isClassTask && (data.bookId == '' || data.bookId == '0')">
<el-tooltip effect="light" placement="right" content="该单元章节无自主试题">
<span class="tree-label" style="color: #A5B3CA">
{{ node.label }}
</span>
</el-tooltip>
</div>
<div v-else>
<span class="tree-label">{{ node.label }}</span>
</div>
</template> </template>
</el-tree> </el-tree>
</div> </div>
@ -51,6 +60,13 @@ import useUserStore from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
const props = defineProps({
// []使()
isClassTask: {
default: false
},
})
const isStadium = () => { const isStadium = () => {
let roles = userStore.user.roles let roles = userStore.user.roles
return roles.some(item => item.roleKey === 'stadium') return roles.some(item => item.roleKey === 'stadium')
@ -179,17 +195,6 @@ const handleNodeClick = (data) => {
emit('nodeClick', curData) emit('nodeClick', curData)
} }
const renderContent = (h, { node, data, store }) => {
return h(
'span',
{
style: {
color: data.bookId==''||data.bookId=='0' ? '#A5B3CA' : 'black',
},
},
node.label
);
}
onMounted( async () => { onMounted( async () => {
treeLoading.value = true treeLoading.value = true
try{ try{

View File

@ -169,6 +169,10 @@ const emits = defineEmits(['getData'])
// ppt // ppt
const isShow = ref(false) const isShow = ref(false)
const propsQueryTask = {
id: route.query.classTaskId, // id
isInit: false, //
}
const propsQueryCourseObj = route.query.courseObj;// const propsQueryCourseObj = route.query.courseObj;//
const courseObj = reactive({ const courseObj = reactive({
// : id,id,id, // : id,id,id,
@ -198,7 +202,7 @@ const boardLoading = ref(false);
const fileLoading = ref(false); // loading const fileLoading = ref(false); // loading
onMounted(() => { onMounted(() => {
console.log("----onMounted-------") //console.log("----onMounted-------");
currentRow.value.id = 0 currentRow.value.id = 0
if(propsQueryCourseObj){ if(propsQueryCourseObj){
if(JSON.parse(propsQueryCourseObj)){ if(JSON.parse(propsQueryCourseObj)){
@ -311,7 +315,7 @@ const selectable=(row, index)=>{
/** /**
* 获取 entpcourseid 获取作业列表 * 获取 entpcourseid 获取作业列表
*/ */
const initHomeWork = async()=> { const initHomeWork = async ()=> {
tasklist_loading.value = true; tasklist_loading.value = true;
// const { res, chapterId } = await useGetHomework(courseObj.node); // const { res, chapterId } = await useGetHomework(courseObj.node);
const { res, chapterId } = await useGetHomework(sessionStore.get('subject.curNode')); const { res, chapterId } = await useGetHomework(sessionStore.get('subject.curNode'));
@ -319,6 +323,16 @@ const initHomeWork = async()=> {
console.log('res', res); console.log('res', res);
entpcourseid.value = chapterId; entpcourseid.value = chapterId;
taskList.value = res; taskList.value = res;
// , id
const taskId = propsQueryTask?.id ?? 0;
if (!propsQueryTask.isInit && taskId!=0){
const activeRow = taskList.value.find(o => o.id == taskId);
if (activeRow){
propsQueryTask.isInit = true; //
taskTable.value.setCurrentRow(activeRow);
handleCurrentChange(activeRow);
}
}
tasklist_loading.value = false; tasklist_loading.value = false;
} }
@ -414,7 +428,6 @@ const successHomework = () => {
initHomeWork(); initHomeWork();
}) })
} }
// -------------------- // --------------------
let classWorkForm = reactive({ let classWorkForm = reactive({
id: '',// cloneDeep(props.propsformobj.id), id: '',// cloneDeep(props.propsformobj.id),
@ -814,11 +827,12 @@ const editWork = async (cform) =>{
let res = await updateClasswork(cform); let res = await updateClasswork(cform);
if (res.code == 200) { if (res.code == 200) {
ElMessage.success('更新成功'); ElMessage.success('更新成功');
taskList.value = [] taskList.value = [];
// //
if(isShow.value){ if(isShow.value){
currentRow.value.id = 1; currentRow.value.id = 1;
}else{ }else{
handleNewAllClass();
currentRow.value.id = 0; currentRow.value.id = 0;
} }
initHomeWork(); initHomeWork();

View File

@ -1,7 +1,7 @@
<template> <template>
<el-row class="model-wrap"> <el-row class="model-wrap">
<!-- 左侧 选择教材 目录 --> <!-- 左侧 选择教材 目录 -->
<ChooseTextbook @change-book="changeBook" @node-click="changeBook" /> <ChooseTextbook :isClassTask="true" @change-book="changeBook" @node-click="changeBook" />
<!-- 右侧 展示内容 --> <!-- 右侧 展示内容 -->
<div class="right-content"> <div class="right-content">
<div class="content-header-wrap"> <div class="content-header-wrap">

View File

@ -1047,7 +1047,7 @@ export default {
goNewClassTask(){ goNewClassTask(){
// router.push({ path: '/newClassTask' }); // router.push({ path: '/newClassTask' });
this.$router.push({ this.$router.push({
path: '/newClassTask', path: '/model/newClassTaskAssign',
query: { query: {
isBack: true, isBack: true,
} }
@ -1074,14 +1074,13 @@ export default {
coursetitle: this.currentNode.itemtitle, // (/) , coursetitle: this.currentNode.itemtitle, // (/) ,
node: this.currentNode, // node: this.currentNode, //
} }
console.log('courseObj', courseObj)
editListItem(row, courseObj).then((obj) => { editListItem(row, courseObj).then((obj) => {
if(obj){ if(obj){
// //
this.$router.push({ this.$router.push({
path: '/newClassTask', path: '/model/newClassTaskAssign',
query: { query: {
classtaskObj: JSON.stringify(obj), classTaskId: parseInt(obj.id),
} }
}) })
} }