|
@@ -31,7 +31,7 @@
|
|
>{{ item.label }}</label
|
|
>{{ item.label }}</label
|
|
>
|
|
>
|
|
<el-input v-model="search_content"></el-input>
|
|
<el-input v-model="search_content"></el-input>
|
|
- <el-button type="primary" @click="queryList">查询</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="queryList('')">查询</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="search-right">
|
|
<div class="search-right">
|
|
<label>排序:</label>
|
|
<label>排序:</label>
|
|
@@ -47,24 +47,76 @@
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="sources-box" :style="{ height: height + 'px' }" v-if="height > 0"></div>
|
|
|
|
|
|
+ <div class="sources-box" :style="{ height: height + 'px' }" v-if="height > 0" v-loading="boxLoading">
|
|
|
|
+ <div v-for="(item, index) in list" :key="index" @click="selectSourceNode(item)" class="sources-item">
|
|
|
|
+ <template v-if="type_index === 0">
|
|
|
|
+ <el-image :src="item.file_url" :preview-src-list="[item.file_url]" fit="contain"></el-image
|
|
|
|
+ ></template>
|
|
|
|
+ <template v-if="type_index === 1">
|
|
|
|
+ <AudioLine
|
|
|
|
+ ref="audioLine"
|
|
|
|
+ :audio-id="'resource-audio-' + index"
|
|
|
|
+ :mp3="item.file_url"
|
|
|
|
+ :get-cur-time="getCurTime"
|
|
|
|
+ :width="200"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="type_index === 2">
|
|
|
|
+ <video controls :src="item.file_url" width="100%" height="140px"></video>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <p class="name">{{ item.name }}</p>
|
|
|
|
+ <b class="label">{{ item.label }}</b>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<PaginationPage ref="pagination" :total="total" @getList="queryList" />
|
|
<PaginationPage ref="pagination" :total="total" @getList="queryList" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <!-- 上传 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ :visible.sync="sourceAddFlag"
|
|
|
|
+ width="500px"
|
|
|
|
+ append-to-body
|
|
|
|
+ :show-close="true"
|
|
|
|
+ title="上传资源"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ class="module-content"
|
|
|
|
+ >
|
|
|
|
+ <UploadFile
|
|
|
|
+ key="upload_resources"
|
|
|
|
+ :type="'upload_resources_manager'"
|
|
|
|
+ :total-size="20000"
|
|
|
|
+ :file-list="file_list"
|
|
|
|
+ :file-id-list="file_id_list"
|
|
|
|
+ :label-text="labelText"
|
|
|
|
+ :accept-file-type="acceptFileType"
|
|
|
|
+ :icon-class="iconClass"
|
|
|
|
+ :limit="limit"
|
|
|
|
+ :single-size="200"
|
|
|
|
+ :uploadTip="uploadTip"
|
|
|
|
+ @updateFileList="updateFileList"
|
|
|
|
+ />
|
|
|
|
+ <footer style="text-align: right">
|
|
|
|
+ <el-button @click="handleCancle">取 消</el-button>
|
|
|
|
+ <el-button :loading="loading" type="primary" @click="submitAdd">确 定</el-button>
|
|
|
|
+ </footer>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import MenuPage from '../common/menu.vue';
|
|
import MenuPage from '../common/menu.vue';
|
|
import MenuTree from './components/MenuTree.vue';
|
|
import MenuTree from './components/MenuTree.vue';
|
|
-import { ChapterGetBookChapterStruct } from '@/api/book';
|
|
|
|
|
|
+import { ChapterGetBookChapterStruct, MangerAddResource, MangerDeleteResource } from '@/api/book';
|
|
import { GetProjectBaseInfo } from '@/api/project';
|
|
import { GetProjectBaseInfo } from '@/api/project';
|
|
import PaginationPage from '@/components/PaginationPage.vue';
|
|
import PaginationPage from '@/components/PaginationPage.vue';
|
|
import { PageQueryProjectResourceList } from '@/api/list';
|
|
import { PageQueryProjectResourceList } from '@/api/list';
|
|
|
|
+import UploadFile from './components/UploadFile.vue';
|
|
|
|
+import AudioLine from './components/AudioLine.vue';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'ProjectResourceManager',
|
|
name: 'ProjectResourceManager',
|
|
- components: { MenuPage, MenuTree, PaginationPage },
|
|
|
|
|
|
+ components: { MenuPage, MenuTree, PaginationPage, UploadFile, AudioLine },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
book_id: this.$route.params.id,
|
|
book_id: this.$route.params.id,
|
|
@@ -121,6 +173,17 @@ export default {
|
|
height: 0,
|
|
height: 0,
|
|
page_capacity: 10,
|
|
page_capacity: 10,
|
|
cur_page: 1,
|
|
cur_page: 1,
|
|
|
|
+ sourceAddFlag: false, // 新增flag
|
|
|
|
+ labelText: '资源',
|
|
|
|
+ acceptFileType: '.jpg,.png,.jpeg',
|
|
|
|
+ iconClass: '',
|
|
|
|
+ file_id_list: [],
|
|
|
|
+ file_list: [],
|
|
|
|
+ loading: false,
|
|
|
|
+ acceptFileTypeList: ['.jpg,.png,.jpeg', '.mp3', '.mp4', '*', '*', '*'],
|
|
|
|
+ limit: 10,
|
|
|
|
+ uploadTip: '',
|
|
|
|
+ boxLoading: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -138,6 +201,7 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
selectNode(nodeId) {
|
|
selectNode(nodeId) {
|
|
this.select_node = nodeId;
|
|
this.select_node = nodeId;
|
|
|
|
+ this.queryList('');
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 获取项目基本信息
|
|
* 获取项目基本信息
|
|
@@ -193,13 +257,39 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 上传
|
|
// 上传
|
|
- handleAdd() {},
|
|
|
|
|
|
+ handleAdd() {
|
|
|
|
+ this.limit = 10;
|
|
|
|
+ this.uploadTip = '最多上传 10 个文件,多文件分批上传';
|
|
|
|
+ this.sourceAddFlag = true;
|
|
|
|
+ },
|
|
// 删除
|
|
// 删除
|
|
- handleDelete() {},
|
|
|
|
|
|
+ handleDelete() {
|
|
|
|
+ if (this.select_sources_id) {
|
|
|
|
+ this.$confirm('确定要删除此条资源吗?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ MangerDeleteResource({ id: this.select_sources_id }).then(() => {
|
|
|
|
+ this.$message.success('删除成功!');
|
|
|
|
+ this.select_sources_id = '';
|
|
|
|
+ this.queryList('');
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.warning('请先选择文件');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 设置信息
|
|
// 设置信息
|
|
handleSetInfo() {},
|
|
handleSetInfo() {},
|
|
// 更换文件
|
|
// 更换文件
|
|
- handleChangeFile() {},
|
|
|
|
|
|
+ handleChangeFile() {
|
|
|
|
+ this.limit = 1;
|
|
|
|
+ this.uploadTip = '只能上传 1 个文件';
|
|
|
|
+ this.sourceAddFlag = true;
|
|
|
|
+ },
|
|
|
|
|
|
// 设置项目成员资源使用权限
|
|
// 设置项目成员资源使用权限
|
|
handlePersonal() {},
|
|
handlePersonal() {},
|
|
@@ -210,10 +300,12 @@ export default {
|
|
changeType(index) {
|
|
changeType(index) {
|
|
this.type_index = index;
|
|
this.type_index = index;
|
|
this.select_sources_id = '';
|
|
this.select_sources_id = '';
|
|
- this.queryList();
|
|
|
|
|
|
+ this.acceptFileType = this.acceptFileTypeList[index];
|
|
|
|
+ this.queryList('');
|
|
},
|
|
},
|
|
// 查询列表
|
|
// 查询列表
|
|
queryList(data) {
|
|
queryList(data) {
|
|
|
|
+ this.boxLoading = true;
|
|
if (data) {
|
|
if (data) {
|
|
this.page_capacity = data.page_capacity;
|
|
this.page_capacity = data.page_capacity;
|
|
this.cur_page = data.cur_page;
|
|
this.cur_page = data.cur_page;
|
|
@@ -235,16 +327,56 @@ export default {
|
|
name_or_label: this.search_content,
|
|
name_or_label: this.search_content,
|
|
order_column_list: order_column_list,
|
|
order_column_list: order_column_list,
|
|
};
|
|
};
|
|
- PageQueryProjectResourceList(datas).then(({ total_count, resource_list }) => {
|
|
|
|
- this.total = total_count;
|
|
|
|
- this.list = resource_list;
|
|
|
|
- });
|
|
|
|
|
|
+ PageQueryProjectResourceList(datas)
|
|
|
|
+ .then(({ total_count, resource_list }) => {
|
|
|
|
+ this.boxLoading = false;
|
|
|
|
+ this.total = total_count;
|
|
|
|
+ this.list = resource_list;
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.boxLoading = false;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
|
|
|
|
// 切换排序升序降序
|
|
// 切换排序升序降序
|
|
changeSort() {
|
|
changeSort() {
|
|
this.isDesc = !this.isDesc;
|
|
this.isDesc = !this.isDesc;
|
|
},
|
|
},
|
|
|
|
+ updateFileList({ file_list, file_id_list }) {
|
|
|
|
+ this.file_list = file_list;
|
|
|
|
+ this.file_id_list = file_id_list;
|
|
|
|
+ },
|
|
|
|
+ handleCancle() {
|
|
|
|
+ this.sourceAddFlag = false;
|
|
|
|
+ this.file_list = [];
|
|
|
|
+ this.file_id_list = [];
|
|
|
|
+ },
|
|
|
|
+ // 确定新增资源
|
|
|
|
+ submitAdd() {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ let data = {
|
|
|
|
+ project_id: this.book_id,
|
|
|
|
+ book_chapter_node_id: this.select_node,
|
|
|
|
+ type: this.type_list[this.type_index].value,
|
|
|
|
+ file_id_list: this.file_id_list,
|
|
|
|
+ };
|
|
|
|
+ MangerAddResource(data)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ this.sourceAddFlag = false;
|
|
|
|
+ if (res.status === 1) {
|
|
|
|
+ this.queryList('');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 点击资源
|
|
|
|
+ selectSourceNode(item) {
|
|
|
|
+ this.select_sources_id = item.id;
|
|
|
|
+ },
|
|
|
|
+ getCurTime() {},
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -336,7 +468,33 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
.sources-box {
|
|
.sources-box {
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-flow: wrap;
|
|
|
|
+ gap: 10px;
|
|
|
|
+ place-content: start start;
|
|
|
|
+ padding: 5px;
|
|
overflow: auto;
|
|
overflow: auto;
|
|
|
|
+
|
|
|
|
+ .sources-item {
|
|
|
|
+ width: 200px;
|
|
|
|
+
|
|
|
|
+ .el-image {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 140px;
|
|
|
|
+ border: 1px solid #ccc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .name,
|
|
|
|
+ .label {
|
|
|
|
+ margin: 5px 0;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ line-height: 1.3;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ :deep .audioLine {
|
|
|
|
+ background: #f2f3f5;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|