|
|
@@ -18,14 +18,7 @@
|
|
|
>
|
|
|
<el-button>{{ type === 'h5_games' ? '选择Zip压缩包或单个html文件' : '选取' + labelText + '文件' }}</el-button>
|
|
|
</el-upload>
|
|
|
- <el-button
|
|
|
- v-if="isEnable(projectResourcePopedom.is_can_upload)"
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- @click="uploadFiles"
|
|
|
- >
|
|
|
- 上传
|
|
|
- </el-button>
|
|
|
+ <el-button size="small" type="primary" @click="uploadFiles"> 上传 </el-button>
|
|
|
<el-button v-if="isEnable(projectResourcePopedom.is_can_use)" size="small" type="primary" @click="useResource">
|
|
|
使用资源
|
|
|
</el-button>
|
|
|
@@ -47,7 +40,7 @@
|
|
|
<span v-else>{{
|
|
|
canEditName && file.file_id
|
|
|
? content.file_info[file.file_id].xuhao + content.file_info[file.file_id].file_name
|
|
|
- : (file.file_name ?? file.name)
|
|
|
+ : file.file_name ?? file.name
|
|
|
}}</span>
|
|
|
<!-- <span>({{ file.size }})</span> -->
|
|
|
</span>
|
|
|
@@ -60,7 +53,7 @@
|
|
|
stroke-linecap="butt"
|
|
|
:show-text="false"
|
|
|
/>
|
|
|
- <span v-else-if="file.file_id"> 完成 </span>
|
|
|
+ <span v-else-if="file.file_id"> 完成</span>
|
|
|
</div>
|
|
|
<SvgIcon icon-class="delete-black" size="12" @click="removeFile(file, i)" />
|
|
|
<SvgIcon
|
|
|
@@ -79,6 +72,20 @@
|
|
|
/>
|
|
|
<SvgIcon v-else icon-class="icon-edit" size="12" @click="changeIsEdit(content.file_info[file.file_id])" />
|
|
|
</template>
|
|
|
+
|
|
|
+ <el-tooltip effect="dark" placement="top" content="提交到资源库">
|
|
|
+ <SvgIcon
|
|
|
+ v-if="isEnable(projectResourcePopedom.is_can_upload) && canEditName && file.file_id"
|
|
|
+ icon-class="upload"
|
|
|
+ @click="addResource(file)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+
|
|
|
+ <SvgIcon
|
|
|
+ v-if="isEnable(projectResourcePopedom.is_can_download) && canEditName && file.file_id"
|
|
|
+ icon-class="download"
|
|
|
+ @click="downLoad(file)"
|
|
|
+ />
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
@@ -98,10 +105,11 @@
|
|
|
import { fileUpload } from '@/api/app';
|
|
|
import { conversionSize } from '@/utils/common';
|
|
|
import { isEnable } from '@/views/book/courseware/data/common';
|
|
|
+import { getConfig, getToken } from '@/utils/auth';
|
|
|
|
|
|
import FillDescribe from '../../common/FillDescribe.vue';
|
|
|
import SelectResource from './SelectResource.vue';
|
|
|
-
|
|
|
+import { SubmitFileToResourceStore } from '@/api/book';
|
|
|
export default {
|
|
|
name: 'UploadFile',
|
|
|
components: {
|
|
|
@@ -264,7 +272,9 @@ export default {
|
|
|
});
|
|
|
if (this.limit !== null && this.content.file_list.length + files.length > this.limit) {
|
|
|
this.$message.warning(
|
|
|
- `当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + this.content.file_list.length} 个文件`,
|
|
|
+ `当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
|
|
+ files.length + this.content.file_list.length
|
|
|
+ } 个文件`
|
|
|
);
|
|
|
return;
|
|
|
}
|
|
|
@@ -273,7 +283,9 @@ export default {
|
|
|
|
|
|
handleExceed(files, fileList) {
|
|
|
this.$message.warning(
|
|
|
- `当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`,
|
|
|
+ `当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
|
|
+ files.length + fileList.length
|
|
|
+ } 个文件`
|
|
|
);
|
|
|
},
|
|
|
|
|
|
@@ -462,6 +474,33 @@ export default {
|
|
|
changeIsEdit(file) {
|
|
|
file.isEdit = !file.isEdit;
|
|
|
},
|
|
|
+
|
|
|
+ //提交到资源库
|
|
|
+ addResource(file) {
|
|
|
+ let data = {
|
|
|
+ project_id: this.project_id,
|
|
|
+ file_id: file.file_id,
|
|
|
+ };
|
|
|
+ SubmitFileToResourceStore(data)
|
|
|
+ .then((res) => {})
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 下载文件
|
|
|
+ downLoad(file) {
|
|
|
+ let userInfor = getToken();
|
|
|
+ let AccessToken = '';
|
|
|
+ if (userInfor) {
|
|
|
+ AccessToken = userInfor.access_token;
|
|
|
+ }
|
|
|
+ let FileID = file.file_id;
|
|
|
+ let data = {
|
|
|
+ AccessToken,
|
|
|
+ FileID,
|
|
|
+ };
|
|
|
+ location.href = `${process.env.VUE_APP_EEP}/FileServer/WebFileDownload?AccessToken=${data.AccessToken}&FileID=${data.FileID}`;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|