Commit 278a2f16 authored by 王's avatar

素材管理

parent 0e8b8f99
......@@ -66,7 +66,7 @@
this.$store.dispatch('setToken',res.token);
this.$store.dispatch('setUserName',res.desc);
this.$store.dispatch('setPermission',JSON.parse(res.roles.menu_ids));
// window.location.href = '/'
window.location.href = '/'
})
}
})
......
......@@ -147,12 +147,6 @@
startTime: [],
newDialog: {
form: {
id: 0,
title: '',
start_num: 0,
start_at: '',
rest_week_day: [],
goods_id:''
},
show: false,
title: ''
......@@ -211,7 +205,7 @@
},
onAdd(){
this.newDialog.form.id = '';
this.newDialog.start_num = '';
this.newDialog.form.startNum = '';
this.newDialog.form.goods_id = '';
this.newDialog.form.title = '';
this.newDialog.form.start_at = '';
......@@ -221,26 +215,27 @@
this.newDialog.show = true;
},
onEdit(row){
this.newDialog.form.id = row.id;
this.newDialog.form.start_num = row.start_num;
this.newDialog.form.start_at = row.start_at;
this.newDialog.form.title = row.title;
this.newDialog.form.goods_id = row.goods_id;
let weekList = [];
if(row.rest_week_day){
row.rest_week_day.split(',').forEach((val)=>{
weekList.push(parseInt(val));
})
}
this.newDialog.form.rest_week_day = weekList;
let teacherList = [];
console.log('row edit', row);
if(row.teacher_ids){
row.teacher_ids.split(',').forEach((val)=>{
teacherList.push(parseInt(val));
})
}
this.newDialog.form.teacher_ids = teacherList;
this.newDialog.form = {
id: row.id,
startNum: row.start_num,
start_at: row.start_at,
title: row.title,
goods_id: row.goods_id,
rest_week_day: weekList,
teacher_ids: teacherList
}
this.newDialog.title = '编辑期数';
this.newDialog.show = true;
},
......
......@@ -25,8 +25,8 @@
<el-form-item label="期数名称" prop="title">
<el-input v-model="form.title"></el-input>
</el-form-item>
<el-form-item label="开始主题" prop="start_num">
<el-select v-model="form.start_num" clearable placeholder="请选择">
<el-form-item label="开始主题" prop="startNum">
<el-select v-model="form.startNum" clearable placeholder="请选择">
<el-option
v-for="item in itemOptions"
:key="item.id"
......@@ -143,7 +143,7 @@
title:[
{ required: true, message: '请输入名称', trigger: 'change' }
],
start_num:[
startNum:[
{ required: true, message: '请输入开始主题', trigger: 'change' }
],
start_at:[
......@@ -194,7 +194,7 @@
let _id = this.form.goods_id;
let json = {
title: this.form.title,
start_num: this.form.start_num,
start_num: this.form.startNum,
start_at: this.form.start_at,
rest_week_day: this.form.rest_week_day ? this.form.rest_week_day.join(',') : ''
}
......@@ -263,6 +263,8 @@
this.form.start_num=''
getLessonDetailApi(id,{}).then((res) => {
this.itemOptions = res.detail[res.type]
console.log('getLessonDetail id', id)
console.log('getLessonDetailthis.itemOptions', this.itemOptions)
})
},
getGoodsOption(){
......@@ -277,12 +279,13 @@
},
mounted(){
// this.initPage()
this.form = this.dialogObj.form;
this.getTeachers();
this.getGoodsOption();
if(this.dialogObj.form.course_id){
this.getLessonDetail(this.dialogObj.form.course_id);
console.log('this.dialogObj.form', this.dialogObj.form)
if(this.dialogObj.form.goods_id){
this.getLessonDetail(this.dialogObj.form.goods_id);
}
this.form = this.dialogObj.form;
this.teacherList = this.dialogObj.form.teacher_ids;
}
}
......
......@@ -4,9 +4,9 @@
<div>
<ul class="media-navs">
<!---->
<!--<li class="media-nav js_top" :class="type === 'news' ? 'media-current-nav' : ''" @click="getMediaType('news')">-->
<!--<a href="javascript:void(0);">图文消息<br /></a>-->
<!--</li>-->
<li class="media-nav js_top" :class="type === 'news' ? 'media-current-nav' : ''" @click="getMediaType('news')">
<a href="javascript:void(0);">图文消息<br /></a>
</li>
<li class="media-nav js_top" :class="type === 'image' ? 'media-current-nav' : ''" @click="getMediaType('image')">
<a href="javascript:void(0);">图片<br /></a>
</li>
......@@ -40,7 +40,36 @@
</el-upload>
</div>
</div>
<div v-if="mediaList.length > 0">
<div v-if="mediaList.length > 0 && type === 'news'" class="d-start">
<div v-for="(item,index) in mediaList" :key="index" class="news-media">
<el-card :body-style="{ padding: '0px' }">
<div v-for="(child, childIndex) in item.content.news_item" style="position: relative">
<div v-if="item.content.news_item.length === 1" class="single-cover">
<div class="title">{{child.title}}</div>
<img :src="child.thumb_url" style="width: 100%;margin-top: 20px;"/>
<div class="digest">{{child.digest}}</div>
<a class="preview" :href="child.url" target="_blank">
预览文章
</a>
</div>
<div v-else-if="item.content.news_item.length > 1" class="clear-both bottomCover" style="position: relative">
<div v-if="childIndex === 0" class="muti-cover">
<img style="width: 100%;margin-top: 20px;" :src="child.thumb_url"/>
<div class="bottom-title">{{child.title}}</div>
</div>
<div class="next-cover" v-else>
<span class="next-title">{{child.title}}</span>
<img class="next-img" :src="child.thumb_url"/>
</div>
<a class="preview" :href="child.url" target="_blank">
预览文章
</a>
</div>
</div>
</el-card>
</div>
</div>
<div v-if="mediaList.length > 0 && type !== 'news'">
<el-table
:data="mediaList"
style="width: 100%">
......@@ -62,7 +91,7 @@
<!--<source :src="scope.row.info.down_url"/>-->
<!--Your browser does not support the video tag.-->
<!--</video>-->
<a :href="scope.row.info.down_url" v-if="type === 'video'" target="_blank">
<a :href="scope.row.info.down_url" v-if="type === 'video' && scope.row.info && scope.row.info.down_url" target="_blank">
{{scope.row.info.title}}
</a>
<audio v-if="type === 'voice'" id="myAudio" controls>
......@@ -94,7 +123,7 @@
total: 0,
limit: 5,
loading: false,
type: 'image',
type: 'news',
imageList: [],
uploadParam: {
type: 'wechat',
......@@ -256,4 +285,100 @@
}
}
}
.clear-both{
&:after{
content: '';
display: block;
clear: both;
}
}
</style>
<style>
.news-media {
padding: 10px;
width: 300px;
}
.news-media img{
width: 100%;
}
.f-news {
max-height: 300px;
overflow: hidden;
}
.s-news img {
width: 50px;
float: right;
}
.title {
font-size: 16px;
font-weight: 400;
display: block;
line-height: 1.2;
color: #353535;
}
.digest {
padding-top: 12px;
color: #9A9A9A;
font-size: 14px;
}
.single-cover {
padding: 20px 15px 15px;
}
.muti-title {
position: absolute;
}
.muti-cover {
position: relative;
padding: 20px 15px 0 15px;
}
.bottom-title {
color: #FFFFFF;
background-color: rgba(0, 0, 0, 0.55);
position: absolute;
left: 15px;
right: 15px;
bottom: 0;
padding: 8px 12px;
}
.next-cover {
padding: 12px 15px;
position: relative;
}
.next-img {
float: right;
margin-left: 12px;
width: 60px !important;
height: 60px !important;
}
.next-title {
overflow: hidden;
font-weight: 400;
word-wrap: break-word;
-webkit-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
color: #353535;
}
.single-cover:hover .preview,.bottomCover:hover .preview{
display: flex;
justify-content: center;
align-items: center;
color: #fff;
}
.d-start {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
align-items: flex-start;
}
.preview {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
text-decoration: none;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment