|
@@ -1,28 +1,43 @@
|
|
|
<template>
|
|
|
- <div class="select-upload" :style="{ width: width }">
|
|
|
- <span v-if="label" class="label-text">{{ label }}</span>
|
|
|
- <el-upload
|
|
|
- ref="upload"
|
|
|
- class="file-uploader"
|
|
|
- action="no"
|
|
|
- :accept="curTypeObj.accept"
|
|
|
- :multiple="multiple"
|
|
|
- :show-file-list="false"
|
|
|
- :auto-upload="false"
|
|
|
- :limit="limit"
|
|
|
- :on-change="onFileChange"
|
|
|
- >
|
|
|
- <el-button>{{ showText }}</el-button>
|
|
|
- </el-upload>
|
|
|
- <el-button size="small" class="upload-button" type="primary" @click="uploadFiles">上传</el-button>
|
|
|
+ <div>
|
|
|
+ <div class="select-upload" :style="{ width: width }">
|
|
|
+ <span v-if="label" class="label-text">{{ label }}</span>
|
|
|
+ <el-upload
|
|
|
+ ref="upload"
|
|
|
+ class="file-uploader"
|
|
|
+ action="no"
|
|
|
+ :accept="curTypeObj.accept"
|
|
|
+ :multiple="multiple"
|
|
|
+ :show-file-list="false"
|
|
|
+ :auto-upload="false"
|
|
|
+ :limit="limit"
|
|
|
+ :on-change="onFileChange"
|
|
|
+ >
|
|
|
+ <el-button>{{ showText }}</el-button>
|
|
|
+ </el-upload>
|
|
|
+ <el-button size="small" class="upload-button" type="primary" @click="uploadFiles">上传</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="useResource">使用资源</el-button>
|
|
|
+ </div>
|
|
|
+ <SelectResource
|
|
|
+ :visible.sync="visibleResource"
|
|
|
+ :project-id="project_id"
|
|
|
+ :accept="type"
|
|
|
+ :courseware-id="courseware_id"
|
|
|
+ @selectResource="selectResource"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { fileUpload } from '@/api/app';
|
|
|
+import SelectResource from '../base/common/SelectResource.vue';
|
|
|
|
|
|
export default {
|
|
|
name: 'SelectUpload',
|
|
|
+ inject: ['courseware_id', 'project_id'],
|
|
|
+ components: {
|
|
|
+ SelectResource,
|
|
|
+ },
|
|
|
props: {
|
|
|
type: {
|
|
|
type: String,
|
|
@@ -66,6 +81,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
fileList: [],
|
|
|
+ visibleResource: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -105,6 +121,14 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ // 使用资源
|
|
|
+ useResource() {
|
|
|
+ this.visibleResource = true;
|
|
|
+ },
|
|
|
+ selectResource({ file_id, file_name, file_url, intro }) {
|
|
|
+ this.$emit('uploadSuccess', [{ file_id, file_name, file_url }]);
|
|
|
+ this.visibleResource = false;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|