课程日历

master
lion 3 months ago
parent 6bbb8abb47
commit 5c15941057

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

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

Loading…
Cancel
Save