课程日历

dev
lion 4 months ago
parent 6bbb8abb47
commit 5c15941057

@ -54,28 +54,31 @@
</div> </div>
</div> </div>
</template> </template>
<template v-if="form.type===4" v-slot:url> <template v-if="form.type===4 || form.type===1" v-slot:url>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold"> <div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>资讯链接 <span style="color: red;font-weight: bold;padding-right: 4px;"></span>资讯链接
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input v-model="form.url" placeholder="请输入跳转链接,例:/news/2025-07-02/146.html" clearable <el-select filterable remote v-model="form.url" :remote-method="remoteMethod" :loading="loading"
style="width: 100%;"></el-input> placeholder="请输入关键词查询资讯" clearable style="width: 100%;">
<el-option v-for="item in zixunList" :key="item.id" :label="item.title" :value="item.titleurl">
</el-option>
</el-select>
</div>
</div>
</template>
<!-- <template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>日期
</div>
<div class="xy-table-item-content">
<el-date-picker v-model="form.date" style="width: 100%;"
type="date" value-format="yyyy-MM-dd" format="yyyy-MM-dd" placeholder="选择日期时间" align="right">
</el-date-picker>
</div> </div>
</div> </div>
</template>
<!-- <template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>日期
</div>
<div class="xy-table-item-content">
<el-date-picker v-model="form.date" style="width: 100%;"
type="date" value-format="yyyy-MM-dd" format="yyyy-MM-dd" placeholder="选择日期时间" align="right">
</el-date-picker>
</div>
</div>
</template> --> </template> -->
<template v-slot:start_time> <template v-slot:start_time>
<div class="xy-table-item"> <div class="xy-table-item">
@ -83,10 +86,8 @@
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>开始时间 <span style="color: red;font-weight: bold;padding-right: 4px;">*</span>开始时间
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-date-picker v-model="form.start_time" <el-date-picker v-model="form.start_time" style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%;" format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间" align="right"
value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
type="datetime" placeholder="选择日期时间" align="right"
:picker-options="pickerOptions"> :picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
</div> </div>
@ -98,16 +99,14 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>截止时间 <span style="color: red;font-weight: bold;padding-right: 4px;"></span>截止时间
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-date-picker v-model="form.end_time" <el-date-picker v-model="form.end_time" style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%;" format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间" align="right"
value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
type="datetime" placeholder="选择日期时间" align="right"
:picker-options="pickerOptions"> :picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
</div> </div>
</div> </div>
</template> </template>
<template v-slot:content v-if="form.type===3 || form.type===4"> <template v-slot:content v-if="form.type===3">
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold"> <div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>内容 <span style="color: red;font-weight: bold;padding-right: 4px;"></span>内容
@ -141,7 +140,7 @@
return { return {
isShow: false, isShow: false,
type: 'add', type: 'add',
id: '', id: '',
showTinymce: false, showTinymce: false,
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
@ -166,21 +165,22 @@
}] }]
}, },
type_options: [{ type_options: [{
id: 1, id: 1,
value: '课程' value: '课程'
}, },
// { // {
// id: 2, // id: 2,
// value: '' // value: ''
// }, // },
{ {
id: 3, id: 3,
value: '自定义事件' value: '自定义事件'
}, { }, {
id: 4, id: 4,
value: '资讯' value: '资讯'
}], }
course_content_options:[], ],
course_content_options: [],
course_options: [], course_options: [],
canSelect: false, canSelect: false,
form: { form: {
@ -191,7 +191,7 @@
url: '', url: '',
// date: '', // date: '',
start_time: '', start_time: '',
end_time: '', end_time: '',
content: '', content: '',
}, },
rules: { rules: {
@ -203,17 +203,52 @@
required: true, required: true,
message: '请选择开始时间' message: '请选择开始时间'
}], }],
end_time: [{ // end_time: [{
required: true, // required: true,
message: '请选择结束时间' // message: ''
}], // }],
} },
zixunList:[],
} }
}, },
created() { created() {
this.getCourseList() this.getCourseList()
this.getZxList()
}, },
methods: { methods: {
remoteMethod(query) {
if (query !== '') {
this.loading = true;
this.getZxList(query)
} else {
this.zixunList = [];
}
},
async getZxList(query) {
const proUrl = `${process.env.VUE_APP_PRO_API}`
var baseUrl = proUrl + '/e/extend/news.php'
try {
// axios.get()
const response = await axios.get(baseUrl, {
params: {
page: 1,
pagesize: 999,
keyword: query
}, // GET URL
timeout: 5000 //
});
//
if (response.status === 200) {
this.zixunList = response.data.rows;
}
this.loading = false
console.log('GET 请求成功:', response);
} catch (error) {
//
console.error('GET 请求失败:', error);
alert('请求失败:' + (error.response?.data?.msg || '网络错误'));
}
},
async getCourseList() { async getCourseList() {
const res = await courseIndex({ const res = await courseIndex({
page: 1, page: 1,
@ -239,44 +274,45 @@
return return
} }
this.course_content_options = res.data this.course_content_options = res.data
}, },
saveContent(e) { saveContent(e) {
this.form.content = e this.form.content = e
}, },
changeType(e) { changeType(e) {
console.log("type", e) console.log("type", e)
}, },
changeCourse(e) { changeCourse(e) {
console.log("course", e) console.log("course", e)
// //
if (this.form.type == 2) { if (this.form.type == 2) {
this.form.course_content_id = '' this.form.course_content_id = ''
this.getCourseContentList(e) this.getCourseContentList(e)
} }
// //
if(this.form.type==1){ if (this.form.type == 1) {
this.course_options.map(item=>{ this.course_options.map(item => {
if(item.id===e){ if (item.id === e) {
this.form.title = item.name this.form.title = item.name
this.form.start_time = item.start_date this.form.start_time = item.start_date?item.start_date+' 00:00:00':''
this.form.end_time = item.end_date this.form.end_time = item.end_date?item.end_date+' 00:00:00':''
this.form.date = item.start_date this.form.date = item.start_date
} this.form.url = item.url
}) }
})
} }
}, },
changeCourseContent(e) { changeCourseContent(e) {
// //
if(this.form.type==2){ if (this.form.type == 2) {
this.course_content_options.map(item=>{ this.course_content_options.map(item => {
if(item.id===e){ if (item.id === e) {
this.form.title = item.theme this.form.title = item.theme
this.form.start_time = item.start_date this.form.start_time = item.start_date
this.form.end_time = item.end_date this.form.end_time = item.end_date
this.form.date = item.start_date this.form.date = item.start_date
} }
}) })
} }
}, },
submit() { submit() {
@ -310,24 +346,24 @@
watch: { watch: {
isShow(newVal) { isShow(newVal) {
if (newVal) { if (newVal) {
if (this.type === 'editor') { if (this.type === 'editor') {
console.log("id",this.id) console.log("id", this.id)
this.getDetail() this.getDetail()
}else{ } else {
this.showTinymce = true this.showTinymce = true
} }
} else { } else {
this.id = '' this.id = ''
this.showTinymce = false this.showTinymce = false
this.form = { this.form = {
type: '', type: '',
course_id: '', course_id: '',
course_content_id: '', course_content_id: '',
title: '', title: '',
url: '', url: '',
date: '', date: '',
start_time: '', start_time: '',
end_time: '', end_time: '',
content: '', content: '',
} }
this.$refs['dialog'].reset() this.$refs['dialog'].reset()

File diff suppressed because it is too large Load Diff

@ -57,8 +57,9 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>资讯链接 <span style="color: red;font-weight: bold;padding-right: 4px;"></span>资讯链接
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-select v-model="form.url" placeholder="请选择" clearable style="width: 100%;"> <el-select filterable remote v-model="form.url" :remote-method="remoteMethod" :loading="loading"
<el-option v-for="item in false_or_true" :key="item.id" :label="item.value" :value="item.id"> placeholder="请输入关键词查询资讯" clearable style="width: 100%;">
<el-option v-for="item in zixunList" :key="item.id" :label="item.title" :value="item.titleurl">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
@ -405,31 +406,42 @@
sort_name: 'sort', sort_name: 'sort',
sort_type: 'ASC' sort_type: 'ASC'
}, },
formList: [], formList: [],
zxkeyword:'', loading: false,
zixunList:[] zixunList: []
} }
}, },
created() { created() {
this.getZxList() this.getZxList()
}, },
methods: { methods: {
async getZxList() { remoteMethod(query) {
if (query !== '') {
this.loading = true;
this.getZxList(query)
} else {
this.zixunList = [];
}
},
async getZxList(query) {
const proUrl = `${process.env.VUE_APP_PRO_API}` const proUrl = `${process.env.VUE_APP_PRO_API}`
var baseUrl = proUrl + '/e/extend/news.php' var baseUrl = proUrl + '/e/extend/news.php'
try { try {
// axios.get() // axios.get()
const response = await axios.get(baseUrl, { const response = await axios.get(baseUrl, {
params: { params: {
page:1, page: 1,
pagesize:5, pagesize: 999,
keyword:this.zxkeyword keyword: query
}, // GET URL }, // GET URL
timeout: 5000 // timeout: 5000 //
}); });
// //
this.zixunList = response.data; if(response.status===200){
console.log('GET 请求成功:', response.data); this.zixunList = response.data.rows;
}
this.loading = false
console.log('GET 请求成功:', response);
} catch (error) { } catch (error) {
// //
console.error('GET 请求失败:', error); console.error('GET 请求失败:', error);

@ -31,7 +31,7 @@
<div class="course-info"> <div class="course-info">
<span><i class="el-icon-date"></i> {{ course.date }} - {{course.period}}</span> <span><i class="el-icon-date"></i> {{ course.date }} - {{course.period}}</span>
<span><i class="el-icon-location"></i> {{ course.address }}</span> <span><i class="el-icon-location"></i> {{ course.address }}</span>
<span><i class="el-icon-user"></i> {{ course.teacher.name }}</span> <span><i class="el-icon-user"></i> {{ course.teacher?course.teacher.name:'' }}</span>
</div> </div>
</div> </div>
</template> </template>
@ -64,7 +64,7 @@
<div><strong>主题</strong>{{ selectedCourse.theme }}</div> <div><strong>主题</strong>{{ selectedCourse.theme }}</div>
<div><strong>时间</strong>{{ selectedCourse.date }} - {{selectedCourse.period}}</div> <div><strong>时间</strong>{{ selectedCourse.date }} - {{selectedCourse.period}}</div>
<div><strong>地点</strong>{{ selectedCourse.address }}</div> <div><strong>地点</strong>{{ selectedCourse.address }}</div>
<div><strong>主讲</strong>{{ selectedCourse.teacher.name }}</div> <div><strong>主讲</strong>{{ selectedCourse.teacher?selectedCourse.teacher.name:'' }}</div>
</div> </div>
</div> </div>
<div class="qr-actions"> <div class="qr-actions">
@ -185,8 +185,14 @@
op: 'eq', op: 'eq',
value: date ? date : '' value: date ? date : ''
}] }]
}) })
this.courseContentList = res.data if(res.data.length>0){
this.courseContentList = res.data
}else{
this.courseContentList = []
this.$message.warning("该课程还未添加课表");
}
}, },
getCousreContent(){ getCousreContent(){
this.getCourseContent(this.course_id,this.course_date) this.getCourseContent(this.course_id,this.course_date)

Loading…
Cancel
Save