Browse Source

主题-发布

dev
xuhuajiao 3 years ago
parent
commit
b545e2f6f1
  1. 9
      src/api/theme/theme.js
  2. 12
      src/assets/styles/adminIndex.scss
  3. 34
      src/views/ThemeGallery/index.vue
  4. 350
      src/views/components/ThemeGalleryList.vue
  5. 390
      src/views/components/materialFolder.vue
  6. 16
      src/views/dashboard/HomeThemeGallery.vue
  7. 37
      src/views/immediateRelease/index.vue
  8. 12
      src/views/materialContent/materialList/index.vue

9
src/api/theme/theme.js

@ -19,6 +19,15 @@ export function FetchThemeClassList(parameter) {
})
}
// 根据类别id查询类别详情
export function FetchFindThemeClassDetails(parameter) {
return request({
url: 'api/themeclass/findThemeClassDetails',
method: 'get',
params: parameter
})
}
// 新增| 编辑 主题库分类菜单
export function FetchAddOrEdit(parameter) {
return request({

12
src/assets/styles/adminIndex.scss

@ -401,11 +401,11 @@
border-radius: 4px;
overflow: hidden;
margin: 0 24px 24px 0;
}
img {
display: block;
width: 100%;
height: 100%;
img {
display: block;
width: 100%;
height: 100%;
}
}
}
@ -561,7 +561,7 @@
bottom: 60px;
left: 50%;
// width: 1100px;
padding: 25px 150px;
padding: 25px 140px;
background: rgba(0, 0, 0, 0.5);
border-radius: 4px;
transform: translateX(-40%);

34
src/views/ThemeGallery/index.vue

@ -162,7 +162,7 @@
</template>
<script>
import { FetchAddOrEdit, FetchThemeHistoryList, FetchUpdateThemeState } from '@/api/theme/theme.js'
import { FetchAddOrEdit, FetchThemeHistoryList, FetchUpdateThemeState, FetchFindThemeClassDetails } from '@/api/theme/theme.js'
import { saveMaterial } from '@/api/material/material'
import ThemeGalleryList from '../components/ThemeGalleryList.vue'
import Upload from '../components/upload'
@ -190,6 +190,7 @@ export default {
orga_ids: []
},
tabItem: [], // data
isAllSelect: [],
searchClassify: [], //
oldSearchClassify: [],
organOptions: [ // list-data
@ -292,12 +293,23 @@ export default {
this.activeIndex = this.$refs.ThemeGalleryList.activeIndex
this.classifyForm.class_name = this.tabItem[this.activeIndex].class_name
this.classifyForm.id = this.tabItem[this.activeIndex].id
// if (this.classifyForm.is_all) {
// this.classifyForm.is_all_name == ''
// this.classifyForm.orga_ids = []
// } else {
// this.classifyForm.is_all_name == ''
// }
//
this.isAllSelect = []
for (const item of this.organOptions) {
this.isAllSelect.push(item.id)
}
const params = {
theme_class_id: this.classifyForm.id
}
FetchFindThemeClassDetails(params).then(res => {
if (res.code == 200) {
if (res.data.is_all) {
this.searchClassify = this.isAllSelect
} else {
this.searchClassify.push(res.data.orgs)
}
}
})
} else {
this.layerTitle = '新增'
this.isAddEdit = 0
@ -346,7 +358,9 @@ export default {
this.uploadForm.img_path = null
this.materialImgPath = null
this.$nextTick(() => {
this.$refs.uploadMaterial.filePercent = 0
if (this.$refs.uploadMaterial) {
this.$refs.uploadMaterial.filePercent = 0
}
if (this.$refs.childUpload) {
this.$refs.childUpload.imageUrl = null
}
@ -474,7 +488,9 @@ export default {
this.uploadForm.img_path = null
this.materialImgPath = null
this.$nextTick(() => {
this.$refs.uploadMaterial.filePercent = 0
if (this.$refs.uploadMaterial) {
this.$refs.uploadMaterial.filePercent = 0
}
if (this.$refs.childUpload) {
this.$refs.childUpload.imageUrl = null
}

350
src/views/components/ThemeGalleryList.vue

@ -4,11 +4,11 @@
<el-tab-pane v-for="(item,index) in tabItem" :key="index" :label="item.class_name" :name="item.name" />
</el-tabs>
<el-tabs v-if="showItemInfo" v-model="themeItemActive" class="theme_item_tab" @tab-click="tabItemClick">
<el-tab-pane label="竖屏" name="1" />
<el-tab-pane label="横屏" name="2" />
<el-tab-pane label="我的画册" name="3" />
<el-tab-pane label="竖屏" name="0" />
<el-tab-pane label="横屏" name="1" />
<el-tab-pane label="我的画册" name="2" />
</el-tabs>
<div v-if="isToFolder && themeItemActive=='3'" class="material_crumbs">
<div v-if="isToFolder && themeItemActive==2" class="material_crumbs">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item><a href="/theme">主题库</a></el-breadcrumb-item>
<el-breadcrumb-item><a @click="breadcrumbToAlbum">我的画册</a></el-breadcrumb-item>
@ -16,108 +16,57 @@
</el-breadcrumb>
</div>
<div class="theme_img">
<!-- 我的画册-创建文件夹btn -->
<div v-if="themeItemActive=='3' && !isToFolder" class="theme_mkdir cont_upload" @click="handleMkdir(0)">
<svg class="font-icon icon" aria-hidden="true">
<use xlink:href="#icon-a-xinzeng" />
</svg>
<el-button class="mkdir_btn" round type="primary">创建文件夹</el-button>
</div>
<div v-if="themeItemActive=='3' && isToFolder" class="theme_mkdir cont_upload">
<el-button class="cont_upload_btn" round type="primary">添加</el-button>
<el-button class="return_btn" round type="primary" @click="breadcrumbToAlbum">返回</el-button>
</div>
<!-- 我的画册-某一文件夹 -->
<div v-if="themeItemActive=='3'" style="display:flex">
<div v-for="(item,index) in materialFolders" :key="item.id" :class="['theme_mkdir', 'folder', { 'item_multi': folderChecked == index }]" @click.stop="editFolder(item,index)" @dblclick="floderDbClick(item,index)">
<div class="icon_bg">
<svg v-if="!item.imgPath" class="font-icon icon" aria-hidden="true">
<use xlink:href="#icon-wenjianjia" />
</svg>
<img v-else :src="item.imgPath" />
<MaterialFolder
ref="MaterialFolder"
:theme-item-active="themeItemActive"
:material-folders="materialFolders"
:is-to-folder="isToFolder"
:this-fold-id="thisFoldId"
:selected-list-id="selectedListId"
:select-in-folderid="selectInFolderid"
@getMyAlbum="getMyAlbum"
/>
<div style="display: flex;">
<!-- 主题库list -->
<div v-for="(item, index) in themeGalleryList" :key="index" :class="['theme_item', { 'item_multi': selectedListId.includes(item.material_id) }]">
<img v-if="item.img_path || item.material_type == 1" :src="item.img_path" :onerror="defaultImg" alt />
<div v-if="!item.img_path && item.material_type == 2" class="radio_img"></div>
<div v-if="showItemInfo" class="item_format">
<span class="item_type">{{ item.deposit_url | getFileFormat }}</span>
<span v-if="item.material_type != 0" class="item_time">{{ item.duration | getSeconds }}</span>
</div>
<p class="file_name">{{ item.name }}</p>
<span v-if="folderChecked == index" class="checked_btn"></span>
</div>
</div>
<!-- 主题库list -->
<div v-for="(item, index) in themeGalleryList" :key="index" :class="['theme_item', { 'item_multi': selectedListId.includes(item.material_id) }]">
<img v-if="item.img_path || item.material_type == 1" :src="item.img_path" :onerror="defaultImg" alt />
<div v-if="!item.img_path && item.material_type == 2" class="radio_img"></div>
<div v-if="showItemInfo" class="item_format">
<span class="item_type">{{ item.deposit_url | getFileFormat }}</span>
<span v-if="item.material_type != 0" class="item_time">{{ item.duration | getSeconds }}</span>
<div v-if="showItemInfo" class="file_name">{{ item.material_name }}</div>
<span v-if="isMultiSelected" class="checked_btn" @click="selectedItem(item)"></span>
</div>
<div v-if="showItemInfo" class="file_name">{{ item.material_name }}</div>
<span v-if="isMultiSelected" class="checked_btn" @click="selectedItem(item)"></span>
</div>
</div>
<!-- 多选操作 -->
<div v-if="selectedListId.length !== 0 || folderChecked != -1" class="multi_handle">
<div v-if="!isEditFolder && folderChecked == -1 && isMultiSelected">
<el-button type="button" class="mulit_btn" @click="publishHandle(0)">即时发布</el-button>
<el-button type="button" class="mulit_btn" @click="publishHandle(1)">定时发布</el-button>
<el-button type="button" class="mulit_btn">下载</el-button>
<el-button v-if="themeItemActive!='3'" type="button" class="mulit_btn" @click="addToAlbum">添加到画册</el-button>
<el-button v-if="themeItemActive=='3'" type="button" class="mulit_btn" @click="moveingTo()">移动</el-button>
<el-button v-if="themeItemActive=='3'" type="button" class="mulit_btn mulit_delt_btn" @click="deltMyAlbumItem">删除</el-button>
</div>
<div v-else>
<el-button type="button" class="mulit_btn" @click="handleMkdir(1)">编辑</el-button>
<el-button type="button" class="mulit_btn mulit_delt_btn" @click="deleteMaterialFolder">删除</el-button>
</div>
</div>
<!-- 创建文件夹layer / 编辑 -->
<div class="publish_layer">
<el-dialog title="创建文件夹" :close-on-click-modal="false" :show-close="false" :visible.sync="mkdirVisible" width="616px" height="384px">
<el-form ref="folderForm" :inline="true" :model="folderForm" size="small" label-width="100px">
<el-form-item
label="文件夹名称"
prop="name"
:rules="[
{ required: true, message: '请输入名称', trigger: 'blur' }
]"
>
<el-input v-model="folderForm.name" style="width: 336px" />
</el-form-item>
<el-form-item label="封面" prop="file">
<UploadCover ref="childUpload" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" round @click="submitFolderForm('folderForm')"> </el-button>
<el-button round @click="mkdirVisible=false"> </el-button>
<div v-if="showItemInfo">
<div v-if="selectedListId.length !== 0 || folderChecked != -1" class="multi_handle">
<div v-if="!isEditFolder && folderChecked == -1 && isMultiSelected">
<el-button type="button" class="mulit_btn" @click="publishHandle(0)">即时发布</el-button>
<el-button type="button" class="mulit_btn" @click="publishHandle(1)">定时发布</el-button>
<el-button type="button" class="mulit_btn">下载</el-button>
<el-button v-if="themeItemActive!=2" type="button" class="mulit_btn" @click="addToAlbum">添加到画册</el-button>
<el-button v-if="themeItemActive==2" type="button" class="mulit_btn" @click="moveingTo">移动</el-button>
<el-button v-if="themeItemActive==2" type="button" class="mulit_btn mulit_delt_btn" @click="deltMyAlbumItem">删除</el-button>
</div>
</el-dialog>
</div>
<!-- 移动至layer -->
<div class="wjj_layer">
<!-- width="736px" -->
<el-dialog title="移动至" :close-on-click-modal="false" :show-close="false" :visible.sync="movingVisible" width="576px" height="384px">
<div class="wjj_list">
<div v-for="(item, index) in folderList" :key="index" :class="['wjj_item', { 'wjj_item_active': folderListChecked == index }]" @click="wjjSelected(item,index)">
<svg class="font-icon icon" aria-hidden="true">
<use xlink:href="#icon-wenjianjia" />
</svg>
<p class="wjj_name">{{ item.name }}</p>
</div>
<div v-else>
<el-button type="button" class="mulit_btn" @click="handleMkdir(1)">编辑</el-button>
<el-button type="button" class="mulit_btn mulit_delt_btn" @click="deleteMaterialFolder">删除</el-button>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" round @click="moveFile">确定</el-button>
<el-button round @click="movingVisible=false">取消</el-button>
</div>
</el-dialog>
</div>
</div>
</div>
</template>
<script>
import { FetchThemeClassList, FetchThemeGallery, FetchMyAlbum, FetchAddToMyAlbum, FetchDeleteMyAlbum, FetchSaveThemeFolder, FetchDeleteThemeFolder, FetchMoveMyThemeMaterial } from '@/api/theme/theme.js'
import { FetchThemeClassList, FetchThemeGallery, FetchMyAlbum, FetchAddToMyAlbum, FetchDeleteMyAlbum } from '@/api/theme/theme.js'
import { getSeconds, getFileFormat } from '@/utils/index.js'
import UploadCover from './upload_cover'
import MaterialFolder from './materialFolder'
export default {
name: 'ThemeGalleryList',
components: { UploadCover },
components: { MaterialFolder },
filters: {
getSeconds(s) {
return getSeconds(s)
@ -159,28 +108,19 @@ export default {
total: 0,
tabItem: [], //
activeIndex: 0,
themeItemActive: '1', // / / activeIndex
themeItemActive: 0 || '0', // / / activeIndex
themeGalleryList: [], //
movingVisible: false,
movingChecked: null,
folderForm: { // form
fid: '',
id: '',
img_path: '',
name: '',
orga_id: ''
},
materialFolders: [], // list
selectedListId: [],
selectinFolderid: [], // ID
selectInFolderid: [], // ID
selectedMaterial: [], //
thisFoldId: null || '',
rootFolderId: null,
thisAlbumFoldId: null,
isEditFolder: false, //
mkdirVisible: false, // layer
folderChecked: -1, //
isEditMaterial: false, //
folderList: [], // list
folderListChecked: -1,
isToFolder: false, //
currentFolder: '', //
@ -218,7 +158,7 @@ export default {
// -
tabThemeClassifyClick(tab) {
this.activeIndex = tab.index
if (this.themeItemActive == 3) {
if (this.themeItemActive == 2) {
this.getMyAlbum()
} else {
this.themeGalleryList = []
@ -226,8 +166,9 @@ export default {
}
},
// / /
tabItemClick() {
if (this.themeItemActive == 3) {
tabItemClick(tab) {
this.themeItemActive = tab.index
if (this.themeItemActive == 2) {
this.$router.push('/theme')
this.getMyAlbum()
} else {
@ -243,7 +184,12 @@ export default {
getThemeGallery() {
this.themeListForm.orga_id = this.orga_id
this.themeListForm.theme_class = this.tabItem[this.activeIndex].id
this.themeListForm.device_direction = this.themeItemActive == 1 ? 2 : 1
console.log(this.showItemInfo)
if (this.showItemInfo) {
this.themeListForm.device_direction = this.themeItemActive == 0 ? 2 : 1
} else {
this.themeListForm.device_direction = null
}
this.themeListForm.page = this.page
this.themeListForm.size = this.size
FetchThemeGallery(this.themeListForm).then(res => {
@ -325,7 +271,7 @@ export default {
//
deltMyAlbumItem() {
const params = {
ids: this.selectinFolderid
ids: this.selectInFolderid
}
FetchDeleteMyAlbum(params).then(res => {
if (res.code == 200) {
@ -346,188 +292,32 @@ export default {
const index = arr.indexOf(id)
if (index > -1) {
arr.splice(index, 1)
this.selectinFolderid.splice(index, 1)
this.selectInFolderid.splice(index, 1)
this.selectedMaterial.splice(index, 1)
}
} else {
this.selectedListId.push(id)
this.selectinFolderid.push(inFolderId)
this.selectInFolderid.push(inFolderId)
this.selectedMaterial.push(item)
// this.formatType = type
}
},
// /
handleMkdir(mkdirType) {
this.mkdirVisible = true
this.folderForm.fid = this.thisFoldId
this.folderForm.orga_id = this.orga_id
if (mkdirType === 0) {
this.$nextTick(() => {
this.$refs.childUpload.imageUrl = ''
this.folderForm.img_path = ''
this.folderForm.name = ''
})
delete this.folderForm.id
} else {
this.$nextTick(() => {
this.$refs.childUpload.imageUrl = this.folderForm.img_path
})
}
},
//
floderDbClick(item, index) {
this.isEditMaterial = false
this.$router.replace(
{
path: '/theme', query: { folderTag: 1 }
}
)
this.currentFolder = item.name
this.currentFolderId = item.id
localStorage.setItem('currentFolder', this.currentFolder)
localStorage.setItem('currentFolderId', this.currentFolderId)
this.getMyAlbum()
this.selectedListId = []
this.folderChecked = -1
this.isEditFolder = false
},
//
hiddenFolderActiveClick() {
this.folderChecked = -1
this.isEditFolder = false
},
//
editFolder(item, index) {
this.isEditMaterial = false
this.selectedListId = []
//
this.$emit('changedMultiSelected')
if (index != this.folderChecked) {
this.folderChecked = index
this.isEditFolder = true
this.folderForm = {
fid: item.fid,
id: item.id,
name: item.name,
img_path: item.imgPath,
orga_id: item.orgaId
}
} else {
this.folderChecked = -1
this.isEditFolder = false
}
},
//
deleteMaterialFolder() {
console.log(this.folderForm.id)
this.$confirm('此操作将永久删除该文件夹, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const ids = []
ids.push(this.folderForm.id)
const params = {
ids: ids
}
FetchDeleteThemeFolder(params).then(res => {
if (res.code === 200) {
this.$message({
message: '删除文件夹成功',
type: 'success'
})
this.getMyAlbum()
this.folderChecked = -1
this.isEditFolder = false
}
})
}).catch(() => {
this.$message({
message: '已取消删除',
type: 'info'
})
})
},
// - /
submitFolderForm(formName) {
this.folderForm.img_path = this.$refs.childUpload.imageUrl
console.log(this.folderForm)
this.$refs[formName].validate((valid) => {
if (valid) {
FetchSaveThemeFolder(this.folderForm).then(res => {
if (res.code === 200) {
this.$message({
message: '创建文件夹成功',
duration: 2000,
type: 'success'
})
this.mkdirVisible = false
this.getMyAlbum()
} else {
this.$message({
message: '创建文件夹失败',
duration: 2000,
type: 'warning'
})
}
})
} else {
console.log('error submit!!')
return false
// /
publishHandle(index) {
localStorage.removeItem('selectedMaterial')
localStorage.removeItem('releaseId')
localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
//
const resultAudio = []
this.selectedMaterial.map(item => {
if (item.material_type == 2) {
resultAudio.push(item)
}
})
},
// -btn
moveingTo(index) {
this.folderList = []
if (this.materialFolders.length > 0) {
this.folderList = this.materialFolders.slice(0, this.materialFolders.length)
}
this.rootFolderId = localStorage.getItem('rootFolderId')
const returnFolder = {
id: this.rootFolderId,
name: '返回上一级'
}
this.folderList.unshift(returnFolder)
this.movingVisible = true
},
// list -
wjjSelected(item, index) {
this.folderListChecked = index
this.thisFoldId = item.id
},
// -
moveFile() {
if (this.materialFolders.length > 0) {
if (this.thisFoldId == this.rootFolderId) {
this.$message({
message: '不能讲文件移动到自身目录下哦~',
type: 'error'
})
return
}
} else {
this.thisFoldId = this.rootFolderId
}
const params = {
'folder_id': this.thisFoldId,
'ids': this.selectinFolderid,
'material_ids': this.selectedListId
if (resultAudio.length > 1) {
this.$message.error('音频类型的文件只可选择1个')
return
}
FetchMoveMyThemeMaterial(params).then(res => {
if (res.code === 200) {
this.$message({
message: '移动成功',
type: 'success'
})
this.movingVisible = false
this.getMyAlbum()
this.selectedListId = []
}
})
},
// /
publishHandle(index) {
this.$router.push(
{
path: '/release', query: { tag: index }

390
src/views/components/materialFolder.vue

@ -0,0 +1,390 @@
<template>
<div v-if="themeItemActive==2" style="display:flex; flex-wrap: wrap">
<!-- 我的画册-创建文件夹btn -->
<div v-if="!isToFolder" class="theme_mkdir cont_upload" @click="handleMkdir(0)">
<svg class="font-icon icon" aria-hidden="true">
<use xlink:href="#icon-a-xinzeng" />
</svg>
<el-button class="mkdir_btn" round type="primary">创建文件夹</el-button>
</div>
<div v-else class="theme_mkdir cont_upload">
<el-button class="cont_upload_btn" round type="primary">添加</el-button>
<el-button class="return_btn" round type="primary" @click="breadcrumbToAlbum">返回</el-button>
</div>
<!-- 我的画册-某一文件夹 -->
<div v-for="(item,index) in childMaterialFolders" :key="item.id" :class="[,'theme_mkdir', 'folder', { 'item_multi': folderChecked == index }]" @click.stop="editFolder(item,index)" @dblclick="floderDbClick(item,index)">
<div class="icon_bg">
<svg v-if="!item.imgPath" class="font-icon icon" aria-hidden="true">
<use xlink:href="#icon-wenjianjia" />
</svg>
<img v-else :src="item.imgPath" />
</div>
<p class="file_name">{{ item.name }}</p>
<span v-if="folderChecked == index" class="checked_btn"></span>
</div>
<!-- 创建文件夹layer / 编辑 -->
<div class="publish_layer">
<el-dialog title="创建文件夹" :close-on-click-modal="false" :show-close="false" :visible.sync="mkdirVisible" width="616px" height="384px">
<el-form ref="folderForm" :inline="true" :model="folderForm" size="small" label-width="100px">
<el-form-item
label="文件夹名称"
prop="name"
:rules="[
{ required: true, message: '请输入名称', trigger: 'blur' }
]"
>
<el-input v-model="folderForm.name" style="width: 336px" />
</el-form-item>
<el-form-item label="封面" prop="file">
<UploadCover ref="childUpload" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" round @click="submitFolderForm('folderForm')"> </el-button>
<el-button round @click="mkdirVisible=false"> </el-button>
</div>
</el-dialog>
</div>
<!-- 移动至layer -->
<div class="wjj_layer">
<!-- width="736px" -->
<el-dialog title="移动至" :close-on-click-modal="false" :show-close="false" :visible.sync="movingVisible" width="576px" height="384px">
<div class="wjj_list">
<div v-for="(item, index) in folderList" :key="index" :class="['wjj_item', { 'wjj_item_active': folderListChecked == index }]" @click="wjjSelected(item,index)">
<svg class="font-icon icon" aria-hidden="true">
<use xlink:href="#icon-wenjianjia" />
</svg>
<p class="wjj_name">{{ item.name }}</p>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" round @click="moveFile">确定</el-button>
<el-button round @click="movingVisible=false">取消</el-button>
</div>
</el-dialog>
</div>
</div>
</template>
<script>
import { FetchSaveThemeFolder, FetchDeleteThemeFolder, FetchMoveMyThemeMaterial } from '@/api/theme/theme.js'
import UploadCover from './upload_cover'
export default {
name: 'MaterialFolder',
components: { UploadCover },
props: {
themeItemActive: {
type: String,
required: true
},
materialFolders: {
type: Array,
required: true
},
isToFolder: {
type: Boolean,
required: true
},
thisFoldId: {
type: String,
required: true
},
selectedListId: {
type: Array,
required: true
},
selectInFolderid: {
type: Array,
required: true
}
},
data() {
return {
orga_id: '133221333123111', // ID
movingVisible: false,
folderForm: { // form
fid: '',
id: '',
img_path: '',
name: '',
orga_id: ''
},
childMaterialFolders: [], // list
rootFolderId: null,
isEditFolder: false, //
mkdirVisible: false, // layer
folderChecked: -1, //
isEditMaterial: false, //
folderList: [], // list
folderListChecked: -1,
currentFolder: '', //
currentFolderId: null
}
},
computed: {
defaultImg() {
return 'this.src="' + require('@/assets/images/menu_bg_02.png') + '"'
}
},
watch: {
materialFolders(newName, oldName) {
this.childMaterialFolders = newName
},
thisFoldId(newName, oldName) {
this.thisChildFoldId = newName
},
selectedListId(newName, oldName) {
this.ChildSelectedListId = newName
},
selectInFolderid(newName, oldName) {
this.ChildSelectInFolderid = newName
}
},
mounted() {
console.log('444444444444')
console.log(this.childMaterialFolders)
console.log('555')
// this.$emit('getMyAlbum')
document.addEventListener('click', this.hiddenFolderActiveClick)
},
methods: {
breadcrumbToAlbum() {
this.$router.push('/theme')
this.$emit('getMyAlbum')
},
// /
handleMkdir(mkdirType) {
this.mkdirVisible = true
this.folderForm.fid = this.thisChildFoldId
this.folderForm.orga_id = this.orga_id
if (mkdirType === 0) {
this.$nextTick(() => {
this.$refs.childUpload.imageUrl = ''
this.folderForm.img_path = ''
this.folderForm.name = ''
})
delete this.folderForm.id
} else {
this.$nextTick(() => {
this.$refs.childUpload.imageUrl = this.folderForm.img_path
})
}
},
//
floderDbClick(item, index) {
this.isEditMaterial = false
this.$router.replace(
{
path: '/theme', query: { folderTag: 1 }
}
)
this.currentFolder = item.name
this.currentFolderId = item.id
localStorage.setItem('currentFolder', this.currentFolder)
localStorage.setItem('currentFolderId', this.currentFolderId)
this.$emit('getMyAlbum')
this.ChildSelectedListId = []
this.folderChecked = -1
this.isEditFolder = false
},
//
hiddenFolderActiveClick() {
this.folderChecked = -1
this.isEditFolder = false
},
//
editFolder(item, index) {
this.isEditMaterial = false
this.ChildSelectedListId = []
//
this.$emit('changedMultiSelected')
if (index != this.folderChecked) {
this.folderChecked = index
this.isEditFolder = true
this.folderForm = {
fid: item.fid,
id: item.id,
name: item.name,
img_path: item.imgPath,
orga_id: item.orgaId
}
} else {
this.folderChecked = -1
this.isEditFolder = false
}
},
//
deleteMaterialFolder() {
console.log(this.folderForm.id)
this.$confirm('此操作将永久删除该文件夹, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const ids = []
ids.push(this.folderForm.id)
const params = {
ids: ids
}
FetchDeleteThemeFolder(params).then(res => {
if (res.code === 200) {
this.$message({
message: '删除文件夹成功',
type: 'success'
})
// this.getMyAlbum()
this.$emit('getMyAlbum')
this.folderChecked = -1
this.isEditFolder = false
}
})
}).catch(() => {
this.$message({
message: '已取消删除',
type: 'info'
})
})
},
// - /
submitFolderForm(formName) {
this.folderForm.img_path = this.$refs.childUpload.imageUrl
console.log(this.folderForm)
this.$refs[formName].validate((valid) => {
if (valid) {
FetchSaveThemeFolder(this.folderForm).then(res => {
if (res.code === 200) {
this.$message({
message: '创建文件夹成功',
duration: 2000,
type: 'success'
})
this.mkdirVisible = false
// this.getMyAlbum()
this.$emit('getMyAlbum')
} else {
this.$message({
message: '创建文件夹失败',
duration: 2000,
type: 'warning'
})
}
})
} else {
console.log('error submit!!')
return false
}
})
},
// -btn
moveingTo(index) {
this.folderList = []
if (this.childMaterialFolders.length > 0) {
this.folderList = this.childMaterialFolders.slice(0, this.materialFolders.length)
}
this.rootFolderId = localStorage.getItem('rootFolderId')
const returnFolder = {
id: this.rootFolderId,
name: '返回上一级'
}
this.folderList.unshift(returnFolder)
this.movingVisible = true
},
// list -
wjjSelected(item, index) {
this.folderListChecked = index
this.thisChildFoldId = item.id
},
// -
moveFile() {
if (this.childMaterialFolders.length > 0) {
if (this.thisChildFoldId == this.rootFolderId) {
this.$message({
message: '不能讲文件移动到自身目录下哦~',
type: 'error'
})
return
}
} else {
this.thisChildFoldId = this.rootFolderId
}
const params = {
'folder_id': this.thisChildFoldId,
'ids': this.ChildSelectInFolderid,
'material_ids': this.ChildSelectedListId
}
FetchMoveMyThemeMaterial(params).then(res => {
if (res.code === 200) {
this.$message({
message: '移动成功',
type: 'success'
})
this.movingVisible = false
// this.getMyAlbum()
this.$emit('getMyAlbum')
this.ChildSelectedListId = []
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-tabs {
margin-bottom: 0;
}
::v-deep .el-tabs__item.is-active {
color: #3a8aeb;
}
.theme_mkdir {
position: relative;
width: 140px;
height: 250px;
margin: 0 24px 24px 0;
&.cont_upload .font-icon {
width: 45px;
height: 45px;
margin-bottom: 20px;
}
&.folder .font-icon {
width: 84px;
height: 69px;
}
.icon_bg{
img{
display: block;
width: 140px;
height: 250px;
}
}
}
.theme_item {
width: 140px;
height: 250px;
}
.icon_bg {
height: 220px;
}
.theme_item {
.file_name {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 30px;
background: rgba(255, 255, 255, 0.6);
line-height: 30px;
}
}
.material_crumbs {
padding: 15px 24px 0 24px;
line-height: 30px;
background: #fff;
::v-deep .el-breadcrumb {
font-size: 12px;
color: #999999;
}
}
</style>

16
src/views/dashboard/HomeThemeGallery.vue

@ -26,7 +26,8 @@ export default {
data() {
return {
mulitText: '多选',
isMultiSelected: false
isMultiSelected: false,
selectedMaterial: []
}
},
mounted() {
@ -44,6 +45,19 @@ export default {
publishHandle(index) {
localStorage.removeItem('selectedMaterial')
localStorage.removeItem('releaseId')
this.selectedMaterial = this.$refs.ThemeGalleryList.selectedMaterial
localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
//
const resultAudio = []
this.selectedMaterial.map(item => {
if (item.material_type == 2) {
resultAudio.push(item)
}
})
if (resultAudio.length > 1) {
this.$message.error('音频类型的文件只可选择1个')
return
}
this.$router.push(
{
path: '/release', query: { tag: index }

37
src/views/immediateRelease/index.vue

@ -283,6 +283,7 @@ export default {
},
data() {
return {
isThemeOrMaterial: false,
orga_id: '133221333123111',
selectedMaterial: [], //
publishType: 0, //
@ -818,14 +819,28 @@ export default {
this.isMultiSelected = !this.isMultiSelected
if (this.isMultiSelected) {
this.mulitText = '取消'
this.$refs.MaterialList.selectedListId = []
this.$refs.MaterialList.selectedMaterial = []
// -list
if (this.selectedMaterial) {
this.selectedMaterial.forEach(item => {
this.$refs.MaterialList.selectedListId.push(item.material_id)
this.$refs.MaterialList.selectedMaterial.push(item)
})
console.log(this.activeItemIndex)
if (this.activeIndex == 0) {
this.$refs.MaterialList.selectedListId = []
this.$refs.MaterialList.selectedMaterial = []
// -list
if (this.selectedMaterial) {
this.selectedMaterial.forEach(item => {
this.$refs.MaterialList.selectedListId.push(item.material_id)
this.$refs.MaterialList.selectedMaterial.push(item)
})
}
} else {
this.$refs.ThemeGalleryList.selectedListId = []
this.$refs.ThemeGalleryList.selectedMaterial = []
// -list
if (this.selectedMaterial) {
this.selectedMaterial.forEach(item => {
this.$refs.ThemeGalleryList.selectedListId.push(item.material_id)
this.$refs.ThemeGalleryList.selectedMaterial.push(item)
})
}
// this.selectedMaterial = this.$refs.ThemeGalleryList.selectedMaterial
}
} else {
if (type == 'audio') {
@ -840,7 +855,11 @@ export default {
uploadSelected() {
this.selectContVisible = false
this.selectedMaterial = []
this.selectedMaterial = this.$refs.MaterialList.selectedMaterial
if (this.activeIndex == 0) {
this.selectedMaterial = this.$refs.MaterialList.selectedMaterial
} else {
this.selectedMaterial = this.$refs.ThemeGalleryList.selectedMaterial
}
if (this.release_id) {
// - -
const editMaterialId = []

12
src/views/materialContent/materialList/index.vue

@ -9,7 +9,7 @@
<div class="material_content">
<!-- 上传 / 创建文件夹 -->
<div class="material_item cont_upload">
<Upload ref="uploadMaterial" @saveMaterial="saveMaterial" />
<Upload ref="uploadMaterial" :is-theme="isTheme" @saveMaterial="saveMaterial" />
<el-button v-if="!isToFolder" class="mkdir_btn" round type="primary" @click="handleMkdir(0)">创建文件夹</el-button>
<el-button v-else class="return_btn" round type="primary"><a href="/content">返回</a></el-button>
</div>
@ -80,7 +80,6 @@
<!-- 移动至layer -->
<div class="wjj_layer">
<!-- width="736px" -->
<el-dialog title="移动至" :close-on-click-modal="false" :show-close="false" :visible.sync="movingVisible" width="576px" height="384px">
<div class="wjj_list">
<div v-for="(item, index) in folderList" :key="index" :class="['wjj_item', { 'wjj_item_active': folderListChecked == index }]" @click="wjjSelected(item,index)">
@ -123,6 +122,7 @@ export default {
},
data() {
return {
isTheme: false,
orga_id: '133221333123111', // ID
rootFolderId: null, // ID
thisFoldId: null, // ID
@ -148,7 +148,7 @@ export default {
uploadFileUrl: null, //
selectedMaterial: [], //
selectedListId: [], // material_id
selectinFolderid: [], // id -- in_folder_id
selectInFolderid: [], // id -- in_folder_id
layerTitle: '创建文件夹', // /title
labelTxt: '文件夹名称',
isToFolder: false, //
@ -462,12 +462,12 @@ export default {
const index = arr.indexOf(id)
if (index > -1) {
arr.splice(index, 1)
this.selectinFolderid.splice(index, 1)
this.selectInFolderid.splice(index, 1)
this.selectedMaterial.splice(index, 1)
}
} else {
this.selectedListId.push(id)
this.selectinFolderid.push(inFolderId)
this.selectInFolderid.push(inFolderId)
this.selectedMaterial.push(item)
this.formatType = type
}
@ -536,7 +536,7 @@ export default {
}
const params = {
'folder_id': this.thisFoldId,
'ids': this.selectinFolderid,
'ids': this.selectInFolderid,
'material_ids': this.selectedListId
}
moveMyMaterial(params).then(res => {

Loading…
Cancel
Save