|
|
@ -3,12 +3,17 @@ |
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick"> |
|
|
|
<el-tab-pane label="为你推荐" name="1"> |
|
|
|
<div class="theme_img"> |
|
|
|
<img |
|
|
|
v-for="(item, index) in 14" |
|
|
|
<div |
|
|
|
v-for="(item, index) in listData" |
|
|
|
:key="index" |
|
|
|
src="@/assets/images/home/theme_Img_03.png" |
|
|
|
alt |
|
|
|
/> |
|
|
|
:class="['theme_item', { 'item_multi': contentIds.includes(item.id) }]" |
|
|
|
> |
|
|
|
<img |
|
|
|
:src="item.coverImg" |
|
|
|
alt |
|
|
|
/> |
|
|
|
<span v-if="isMultiSelected" class="checked_btn" @click="selectedItem(item.id, item.type)"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<el-tab-pane label="人工智能" name="2">人工智能</el-tab-pane> |
|
|
@ -22,7 +27,7 @@ |
|
|
|
<div class="home_publish_btn"> |
|
|
|
<el-button round @click="publishHandle(0)">即时发布</el-button> |
|
|
|
<el-button round type="primary" @click="publishHandle(1)">定时发布</el-button> |
|
|
|
<el-button round class="publish_muilt_btn">多选</el-button> |
|
|
|
<el-button round class="publish_muilt_btn" @click="multiSelectBtn">{{ mulitText }}</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
@ -32,7 +37,82 @@ export default { |
|
|
|
name: 'ThemeGallery', |
|
|
|
data() { |
|
|
|
return { |
|
|
|
activeName: '1' |
|
|
|
activeName: '1', |
|
|
|
mulitText: '多选', |
|
|
|
isMultiSelected: false, |
|
|
|
listData: [ |
|
|
|
{ |
|
|
|
id: '1', |
|
|
|
name: '人工智能', |
|
|
|
type: 'JPG', |
|
|
|
coverImg: require('@/assets/images//home/theme_Img_03.png'), |
|
|
|
time: '' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '2', |
|
|
|
name: '防控疫情小贴士', |
|
|
|
type: 'vedio', |
|
|
|
coverImg: require('@/assets/images/background.jpg'), |
|
|
|
time: '03:00' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '3', |
|
|
|
name: '人工智能', |
|
|
|
type: 'JPG', |
|
|
|
coverImg: require('@/assets/images//home/theme_Img_03.png'), |
|
|
|
time: '' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '4', |
|
|
|
name: '防控疫情小贴士', |
|
|
|
type: 'vedio', |
|
|
|
coverImg: require('@/assets/images/background.jpg'), |
|
|
|
time: '03:00' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '5', |
|
|
|
name: '人工智能', |
|
|
|
type: 'JPG', |
|
|
|
coverImg: require('@/assets/images//home/theme_Img_03.png'), |
|
|
|
time: '' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '6', |
|
|
|
name: '防控疫情小贴士', |
|
|
|
type: 'vedio', |
|
|
|
coverImg: require('@/assets/images/background.jpg'), |
|
|
|
time: '03:00' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '7', |
|
|
|
name: '人工智能', |
|
|
|
type: 'JPG', |
|
|
|
coverImg: require('@/assets/images//home/theme_Img_03.png'), |
|
|
|
time: '' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '8', |
|
|
|
name: '防控疫情小贴士', |
|
|
|
type: 'vedio', |
|
|
|
coverImg: require('@/assets/images/background.jpg'), |
|
|
|
time: '03:00' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '9', |
|
|
|
name: '人工智能', |
|
|
|
type: 'JPG', |
|
|
|
coverImg: require('@/assets/images//home/theme_Img_03.png'), |
|
|
|
time: '' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '10', |
|
|
|
name: '防控疫情小贴士', |
|
|
|
type: 'vedio', |
|
|
|
coverImg: require('@/assets/images/background.jpg'), |
|
|
|
time: '03:00' |
|
|
|
} |
|
|
|
], |
|
|
|
contentIds: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
@ -41,6 +121,30 @@ export default { |
|
|
|
handleClick(tab, event) { |
|
|
|
console.log(tab, event) |
|
|
|
}, |
|
|
|
// 多选btn |
|
|
|
multiSelectBtn() { |
|
|
|
this.isMultiSelected = !this.isMultiSelected |
|
|
|
if (this.isMultiSelected) { |
|
|
|
this.mulitText = '取消' |
|
|
|
} else { |
|
|
|
this.mulitText = '多选' |
|
|
|
} |
|
|
|
// this.$refs.MaterialList.multiSelectList() |
|
|
|
}, |
|
|
|
// 多选选中 |
|
|
|
selectedItem(id) { |
|
|
|
const arr = this.contentIds |
|
|
|
// includes()方法判断是否包含某一元素,返回true或false表示是否包含元素,对NaN一样有效 |
|
|
|
if (arr.includes(id)) { |
|
|
|
// 判断数组中是否有选中的id,如果有则去掉 |
|
|
|
const index = arr.indexOf(id) |
|
|
|
if (index > -1) { |
|
|
|
arr.splice(index, 1) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.contentIds.push(id) |
|
|
|
} |
|
|
|
}, |
|
|
|
publishHandle(index) { |
|
|
|
this.$router.push( |
|
|
|
{ |
|
|
@ -76,15 +180,22 @@ export default { |
|
|
|
display: flex; |
|
|
|
flex-wrap: wrap; |
|
|
|
padding-left: 26px; |
|
|
|
img { |
|
|
|
display: block; |
|
|
|
width: 200px; |
|
|
|
height: 280px; |
|
|
|
height: calc(100vh - 449px); |
|
|
|
overflow-y: auto; |
|
|
|
.theme_item{ |
|
|
|
position: relative; |
|
|
|
width: 160px; |
|
|
|
height: 284px; |
|
|
|
border: 1px solid #f0f0f0; |
|
|
|
border-radius: 4px; |
|
|
|
margin: 0 23px 24px 0; |
|
|
|
margin: 0 24px 24px 0; |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
img { |
|
|
|
display: block; |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
.publish_muilt_btn{ |
|
|
|
padding: 6px 20px; |
|
|
|