|
|
@ -1,56 +1,37 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
<div> |
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="tableData" style="width: 100%" @selection-change="handleSelectionChange" row-key="id" default-expand-all lazy :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> |
|
|
|
<el-table v-loading="loading" :data="tableData" style="width: 100%" |
|
|
|
|
|
|
|
@selection-change="handleSelectionChange" row-key="id" default-expand-all lazy |
|
|
|
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column prop="title" label="目录大纲"> |
|
|
|
<el-table-column prop="title" label="目录大纲"> |
|
|
|
<template #default='scope'> |
|
|
|
<template #default="scope"> |
|
|
|
<span v-if="scope.row.children" class="f18 fw600 col333">{{ scope.row.title }}</span> |
|
|
|
<span v-if="scope.row.children" class="f18 fw600 col333">{{ scope.row.title }}</span> |
|
|
|
<a v-else :href="'/class/play/'+classid+'/'+scope.row.id" target="_blank" class="item-pl f15"> |
|
|
|
<a v-else :href="'/class/play/' + classid + '/' + scope.row.id" target="_blank" class="item-pl f15"> <i class="iconfont icon-bofang2 colb3c f14 mrt10"></i>{{ scope.row.title }} </a> |
|
|
|
<i class="iconfont icon-bofang2 colb3c f14 mrt10"></i>{{scope.row.title}} |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column fixed="right" label="发布状态" width="100"> |
|
|
|
<el-table-column fixed="right" label="发布状态" width="100"> |
|
|
|
<template #default="scope"> |
|
|
|
<template #default="scope"> |
|
|
|
|
|
|
|
<el-switch v-if="!scope.row.children" v-model="scope.row.display" :active-value="1" :inactive-value="0" active-color="#0082fc" inactive-color="#dadde5" @click="handleClose(scope.row)"> </el-switch> |
|
|
|
<el-switch v-if="!scope.row.children" v-model="scope.row.display" :active-value="1" |
|
|
|
|
|
|
|
:inactive-value="0" active-color="#0082fc" inactive-color="#dadde5" |
|
|
|
|
|
|
|
@click="handleClose(scope.row)"> |
|
|
|
|
|
|
|
</el-switch> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
|
|
</el-table> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { useRoute } from 'vue-router' |
|
|
|
import { useRoute } from "vue-router"; |
|
|
|
import { scheduleList, noticeAdd, noticeEdit, scheduleUpdate, studyLog } from "@/api/study_admin"; |
|
|
|
import { scheduleList, noticeAdd, noticeEdit, scheduleUpdate, studyLog } from "@/api/study_admin"; |
|
|
|
import { ref, toRefs, reactive, getCurrentInstance, nextTick } from 'vue'; |
|
|
|
import { ref, toRefs, reactive, getCurrentInstance, nextTick } from "vue"; |
|
|
|
import store from '@/store' |
|
|
|
import store from "@/store"; |
|
|
|
import { _debounce } from "@/utils/debounce"; |
|
|
|
import { _debounce } from "@/utils/debounce"; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'class_homework', |
|
|
|
name: "class_homework", |
|
|
|
setup() { |
|
|
|
setup() { |
|
|
|
const { proxy } = getCurrentInstance() |
|
|
|
const { proxy } = getCurrentInstance(); |
|
|
|
const route = useRoute() |
|
|
|
const route = useRoute(); |
|
|
|
const classid = route.params.classid; |
|
|
|
const classid = route.params.classid; |
|
|
|
const state = reactive({ |
|
|
|
const state = reactive({ |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
'authentication': store.getters.get_authentication |
|
|
|
authentication: store.getters.get_authentication, |
|
|
|
}, |
|
|
|
}, |
|
|
|
loading: true, |
|
|
|
loading: true, |
|
|
|
tableData: [], // 数据列表 |
|
|
|
tableData: [], // 数据列表 |
|
|
@ -58,89 +39,84 @@ |
|
|
|
total: 0, // 总条数 |
|
|
|
total: 0, // 总条数 |
|
|
|
page: 1, // 当前页 |
|
|
|
page: 1, // 当前页 |
|
|
|
perpage: 10, // 分页大小 |
|
|
|
perpage: 10, // 分页大小 |
|
|
|
id: '', |
|
|
|
id: "", |
|
|
|
kw: '', |
|
|
|
kw: "", |
|
|
|
dialogFormVisible: false, |
|
|
|
dialogFormVisible: false, |
|
|
|
dialogEdit: false, |
|
|
|
dialogEdit: false, |
|
|
|
dialogUidLog: false, |
|
|
|
dialogUidLog: false, |
|
|
|
numbereRef: { |
|
|
|
numbereRef: { |
|
|
|
title: '', |
|
|
|
title: "", |
|
|
|
url: '', |
|
|
|
url: "", |
|
|
|
}, |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
rules: { |
|
|
|
title: [ |
|
|
|
title: [{ required: true, message: "请输入公告内容", trigger: "blur" }], |
|
|
|
{ required: true, message: '请输入公告内容', trigger: 'blur' }, |
|
|
|
url: [{ required: true, type: "url", message: "请输入正确的url", trigger: "blur" }], |
|
|
|
], |
|
|
|
|
|
|
|
url: [ |
|
|
|
|
|
|
|
{ required: true, type: "url", message: '请输入正确的url', trigger: 'blur' }, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
rowStudent: {}, |
|
|
|
rowStudent: {}, |
|
|
|
modEdit: { |
|
|
|
modEdit: { |
|
|
|
id: '', |
|
|
|
id: "", |
|
|
|
xs_name: '', |
|
|
|
xs_name: "", |
|
|
|
gongsi: '', |
|
|
|
gongsi: "", |
|
|
|
gangwei: '', |
|
|
|
gangwei: "", |
|
|
|
shouji: '', |
|
|
|
shouji: "", |
|
|
|
fenshu: '', |
|
|
|
fenshu: "", |
|
|
|
beizhu: '', |
|
|
|
beizhu: "", |
|
|
|
}, |
|
|
|
}, |
|
|
|
uidLog: [], |
|
|
|
uidLog: [], |
|
|
|
alltime: '', |
|
|
|
alltime: "", |
|
|
|
username: '', |
|
|
|
username: "", |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 获取学生列表 |
|
|
|
// 获取学生列表 |
|
|
|
const getnotice = async () => { |
|
|
|
const getnotice = async () => { |
|
|
|
state.loading = true |
|
|
|
state.loading = true; |
|
|
|
const res = await scheduleList(classid); |
|
|
|
const res = await scheduleList(classid); |
|
|
|
if (res.code === 200) { |
|
|
|
if (res.code === 200) { |
|
|
|
state.tableData = res.data |
|
|
|
state.tableData = res.data; |
|
|
|
state.total = res.data.total |
|
|
|
state.total = res.data.total; |
|
|
|
state.page = res.data.current_page |
|
|
|
state.page = res.data.current_page; |
|
|
|
state.loading = false |
|
|
|
state.loading = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
getnotice(); |
|
|
|
getnotice(); |
|
|
|
|
|
|
|
|
|
|
|
// 观看记录 |
|
|
|
// 观看记录 |
|
|
|
const getUserLog = async (uid) => { |
|
|
|
const getUserLog = async (uid) => { |
|
|
|
state.loading = true |
|
|
|
state.loading = true; |
|
|
|
const res = await studyLog(classid, uid); |
|
|
|
const res = await studyLog(classid, uid); |
|
|
|
if (res.code === 200) { |
|
|
|
if (res.code === 200) { |
|
|
|
state.uidLog = res.data.data; |
|
|
|
state.uidLog = res.data.data; |
|
|
|
state.alltime = res.data.alltime; |
|
|
|
state.alltime = res.data.alltime; |
|
|
|
state.username = res.data.username; |
|
|
|
state.username = res.data.username; |
|
|
|
state.dialogUidLog = true; |
|
|
|
state.dialogUidLog = true; |
|
|
|
state.loading = false |
|
|
|
state.loading = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 设置当前查看的数据item |
|
|
|
// 设置当前查看的数据item |
|
|
|
const setItem = (item) => { |
|
|
|
const setItem = (item) => { |
|
|
|
state.item = item |
|
|
|
state.item = item; |
|
|
|
state.isShowItem = true |
|
|
|
state.isShowItem = true; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleOption = () => { |
|
|
|
const handleOption = () => { |
|
|
|
state.page = 1 |
|
|
|
state.page = 1; |
|
|
|
getnotice() |
|
|
|
getnotice(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 选择项 |
|
|
|
// 选择项 |
|
|
|
const handleSelectionChange = (val) => { |
|
|
|
const handleSelectionChange = (val) => { |
|
|
|
state.multipleSelection = val |
|
|
|
state.multipleSelection = val; |
|
|
|
} |
|
|
|
}; |
|
|
|
const changePage = (val) => { |
|
|
|
const changePage = (val) => { |
|
|
|
state.page = val |
|
|
|
state.page = val; |
|
|
|
getnotice() |
|
|
|
getnotice(); |
|
|
|
} |
|
|
|
}; |
|
|
|
// 每页显示条数 |
|
|
|
// 每页显示条数 |
|
|
|
const handleSizeChange = (val) => { |
|
|
|
const handleSizeChange = (val) => { |
|
|
|
state.perpage = val |
|
|
|
state.perpage = val; |
|
|
|
getnotice() |
|
|
|
getnotice(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 更新状态 |
|
|
|
// 更新状态 |
|
|
|
const handleClose = async (row) => { |
|
|
|
const handleClose = async (row) => { |
|
|
@ -149,38 +125,38 @@ |
|
|
|
id: row.id, |
|
|
|
id: row.id, |
|
|
|
display: row.display, |
|
|
|
display: row.display, |
|
|
|
title: row.title, |
|
|
|
title: row.title, |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
const res = await scheduleUpdate(classid, params); |
|
|
|
const res = await scheduleUpdate(classid, params); |
|
|
|
if (res.message === 'success') { |
|
|
|
if (res.message === "success") { |
|
|
|
if (res.data.display == 1) { |
|
|
|
if (res.data.display == 1) { |
|
|
|
proxy.$notify({ |
|
|
|
proxy.$notify({ |
|
|
|
title: '发布成功', |
|
|
|
title: "发布成功", |
|
|
|
type: 'success', |
|
|
|
type: "success", |
|
|
|
message: res.data.title + '【发布成功】', |
|
|
|
iconClass: "schedule-success", |
|
|
|
|
|
|
|
message: res.data.title + "【发布成功】", |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
proxy.$notify.info({ |
|
|
|
proxy.$notify.info({ |
|
|
|
title: '取消发布成功', |
|
|
|
title: "取消发布成功", |
|
|
|
message: res.data.title + '【已取消发布】', |
|
|
|
type: "info", |
|
|
|
|
|
|
|
iconClass: "schedule-info", |
|
|
|
|
|
|
|
message: res.data.title + "【已取消发布】", |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
proxy.$message({ |
|
|
|
proxy.$message({ |
|
|
|
type: 'error', |
|
|
|
type: "error", |
|
|
|
message: '服务器错误', |
|
|
|
message: "服务器错误", |
|
|
|
center: true |
|
|
|
center: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 添加公告 |
|
|
|
// 添加公告 |
|
|
|
const submitForm = _debounce(() => { |
|
|
|
const submitForm = _debounce(() => { |
|
|
|
_submitForm(); |
|
|
|
_submitForm(); |
|
|
|
}, 300) |
|
|
|
}, 300); |
|
|
|
const numberValidateRef = ref(null); |
|
|
|
const numberValidateRef = ref(null); |
|
|
|
const _submitForm = () => { |
|
|
|
const _submitForm = () => { |
|
|
|
nextTick(() => { |
|
|
|
nextTick(() => { |
|
|
@ -189,23 +165,23 @@ |
|
|
|
const params = { |
|
|
|
const params = { |
|
|
|
title: state.numbereRef.title, |
|
|
|
title: state.numbereRef.title, |
|
|
|
url: state.numbereRef.url, |
|
|
|
url: state.numbereRef.url, |
|
|
|
} |
|
|
|
}; |
|
|
|
const res = await noticeAdd(classid, params) |
|
|
|
const res = await noticeAdd(classid, params); |
|
|
|
if (res.message === 'success') { |
|
|
|
if (res.message === "success") { |
|
|
|
state.dialogFormVisible = false; |
|
|
|
state.dialogFormVisible = false; |
|
|
|
proxy.$message({ |
|
|
|
proxy.$message({ |
|
|
|
type: 'success', |
|
|
|
type: "success", |
|
|
|
message: '添加成功', |
|
|
|
message: "添加成功", |
|
|
|
center: true |
|
|
|
center: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
setTimeout(function() { |
|
|
|
setTimeout(function() { |
|
|
|
getnotice() |
|
|
|
getnotice(); |
|
|
|
}, 100); |
|
|
|
}, 100); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const noticeValidateRef = ref(null); |
|
|
|
const noticeValidateRef = ref(null); |
|
|
|
const resnoticeEdit = () => { |
|
|
|
const resnoticeEdit = () => { |
|
|
@ -213,30 +189,29 @@ |
|
|
|
if (valid) { |
|
|
|
if (valid) { |
|
|
|
const params = { |
|
|
|
const params = { |
|
|
|
data: state.modEdit, |
|
|
|
data: state.modEdit, |
|
|
|
} |
|
|
|
}; |
|
|
|
const res = await noticeEdit(classid, params); |
|
|
|
const res = await noticeEdit(classid, params); |
|
|
|
if (res.code === 200) { |
|
|
|
if (res.code === 200) { |
|
|
|
state.dialogEdit = false; |
|
|
|
state.dialogEdit = false; |
|
|
|
proxy.$message({ |
|
|
|
proxy.$message({ |
|
|
|
type: 'success', |
|
|
|
type: "success", |
|
|
|
message: '编辑成功', |
|
|
|
message: "编辑成功", |
|
|
|
center: true |
|
|
|
center: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
getnotice() |
|
|
|
getnotice(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const openStudent = (row) => { |
|
|
|
const openStudent = (row) => { |
|
|
|
state.modEdit = row; |
|
|
|
state.modEdit = row; |
|
|
|
state.dialogEdit = true; |
|
|
|
state.dialogEdit = true; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const eidtForm = () => { |
|
|
|
const eidtForm = () => { |
|
|
|
resnoticeEdit(); |
|
|
|
resnoticeEdit(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// const tableRowClassName = ({ row }) => { |
|
|
|
// const tableRowClassName = ({ row }) => { |
|
|
|
// if (row.children) { |
|
|
|
// if (row.children) { |
|
|
@ -262,9 +237,9 @@ |
|
|
|
getUserLog, |
|
|
|
getUserLog, |
|
|
|
noticeValidateRef, |
|
|
|
noticeValidateRef, |
|
|
|
//tableRowClassName |
|
|
|
//tableRowClassName |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
@ -333,6 +308,12 @@ |
|
|
|
.el-dialog__body { |
|
|
|
.el-dialog__body { |
|
|
|
padding: 20px 30px 30px 30px; |
|
|
|
padding: 20px 30px 30px 30px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.schedule-success { |
|
|
|
|
|
|
|
color: #67c23a !important; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.schedule-info { |
|
|
|
|
|
|
|
color: #909399 !important; |
|
|
|
|
|
|
|
} |
|
|
|
/* .title-row td{ |
|
|
|
/* .title-row td{ |
|
|
|
background-color:#F3F8FF; |
|
|
|
background-color:#F3F8FF; |
|
|
|
} */ |
|
|
|
} */ |
|
|
|