|
@@ -1,4 +1,4 @@
|
|
-<!-- -->
|
|
|
|
|
|
+<!-- 资源详情 -->
|
|
<template>
|
|
<template>
|
|
<div class="book-vocab">
|
|
<div class="book-vocab">
|
|
<div class="book-vocab-content">
|
|
<div class="book-vocab-content">
|
|
@@ -23,7 +23,7 @@
|
|
<el-form-item label="上传资源" label-width="90px" prop="fileList">
|
|
<el-form-item label="上传资源" label-width="90px" prop="fileList">
|
|
<el-upload
|
|
<el-upload
|
|
action="url"
|
|
action="url"
|
|
- :limit="1"
|
|
|
|
|
|
+ :limit="uploadType === 'edit' ? 0 : 1"
|
|
:on-exceed="handleExceed"
|
|
:on-exceed="handleExceed"
|
|
:on-preview="handlePreview"
|
|
:on-preview="handlePreview"
|
|
:on-remove="handleRemove"
|
|
:on-remove="handleRemove"
|
|
@@ -38,13 +38,18 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<el-button
|
|
<el-button
|
|
- v-if="resource_key === ''"
|
|
|
|
|
|
+ v-if="resourceKey === ''"
|
|
class="submitBtn"
|
|
class="submitBtn"
|
|
size="mini"
|
|
size="mini"
|
|
type="primary"
|
|
type="primary"
|
|
@click="saveWord"
|
|
@click="saveWord"
|
|
- >保存资源</el-button
|
|
|
|
>
|
|
>
|
|
|
|
+ 保存资源
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div v-if="uploadType === 'edit'" class="book-vocab-footer">
|
|
|
|
+ <el-button type="primary" size="mini" @click="saveWord">修改</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -55,11 +60,14 @@ import { getContent } from '@/api/ajax';
|
|
import { fileUpload } from '@/api/app';
|
|
import { fileUpload } from '@/api/app';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- components: {},
|
|
|
|
props: {
|
|
props: {
|
|
- resource_key: {
|
|
|
|
|
|
+ resourceKey: {
|
|
default: '',
|
|
default: '',
|
|
type: String
|
|
type: String
|
|
|
|
+ },
|
|
|
|
+ uploadType: {
|
|
|
|
+ default: 'add',
|
|
|
|
+ type: String
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
@@ -91,31 +99,28 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- resource_key: {
|
|
|
|
- handler: function (val, oldVal) {
|
|
|
|
|
|
+ resourceKey: {
|
|
|
|
+ handler: function (val) {
|
|
this.$refs.searchForm.resetFields();
|
|
this.$refs.searchForm.resetFields();
|
|
if (val) {
|
|
if (val) {
|
|
- this.searchForm.resource_key = this.resource_key;
|
|
|
|
- if (this.resource_key !== '') {
|
|
|
|
|
|
+ this.searchForm.resource_key = val;
|
|
|
|
+ if (val !== '') {
|
|
this.getDetail();
|
|
this.getDetail();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- this.resource_key = '';
|
|
|
|
this.searchForm.name = '';
|
|
this.searchForm.name = '';
|
|
this.searchForm.resource_key = '';
|
|
this.searchForm.resource_key = '';
|
|
this.searchForm.memo = '';
|
|
this.searchForm.memo = '';
|
|
this.fileList = [];
|
|
this.fileList = [];
|
|
}
|
|
}
|
|
- },
|
|
|
|
- deep: true
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.searchForm.resource_key = this.resource_key;
|
|
|
|
- if (this.resource_key !== '') {
|
|
|
|
|
|
+ this.searchForm.resource_key = this.resourceKey;
|
|
|
|
+ if (this.resourceKey !== '') {
|
|
this.getDetail();
|
|
this.getDetail();
|
|
} else {
|
|
} else {
|
|
- this.resource_key = '';
|
|
|
|
this.searchForm.name = '';
|
|
this.searchForm.name = '';
|
|
this.searchForm.resource_key = '';
|
|
this.searchForm.resource_key = '';
|
|
this.searchForm.memo = '';
|
|
this.searchForm.memo = '';
|
|
@@ -147,12 +152,6 @@ export default {
|
|
getContent(MethodName, data)
|
|
getContent(MethodName, data)
|
|
.then(res => {
|
|
.then(res => {
|
|
this.$message.success('保存成功');
|
|
this.$message.success('保存成功');
|
|
- this.isSaving = false;
|
|
|
|
- this.resource_key = '';
|
|
|
|
- this.searchForm.name = '';
|
|
|
|
- this.searchForm.resource_key = '';
|
|
|
|
- this.searchForm.memo = '';
|
|
|
|
- this.fileList = [];
|
|
|
|
this.$emit('closeDialog');
|
|
this.$emit('closeDialog');
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|
|
@@ -162,6 +161,9 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
upload(file) {
|
|
upload(file) {
|
|
|
|
+ if (this.uploadType === 'edit') {
|
|
|
|
+ this.fileList = [];
|
|
|
|
+ }
|
|
fileUpload('Open', file).then(response => {
|
|
fileUpload('Open', file).then(response => {
|
|
if (response.status === 1) {
|
|
if (response.status === 1) {
|
|
response.file_info_list.forEach((item, index) => {
|
|
response.file_info_list.forEach((item, index) => {
|
|
@@ -183,6 +185,13 @@ export default {
|
|
handleRemove(file, fileList) {
|
|
handleRemove(file, fileList) {
|
|
this.fileList = fileList;
|
|
this.fileList = fileList;
|
|
},
|
|
},
|
|
|
|
+ handleExceed(files, fileList) {
|
|
|
|
+ this.$message.warning(
|
|
|
|
+ `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
|
|
|
+ files.length + fileList.length
|
|
|
|
+ } 个文件`
|
|
|
|
+ );
|
|
|
|
+ },
|
|
handlePreview(file) {
|
|
handlePreview(file) {
|
|
console.log(file);
|
|
console.log(file);
|
|
},
|
|
},
|
|
@@ -190,7 +199,7 @@ export default {
|
|
getDetail() {
|
|
getDetail() {
|
|
let MethodName = 'file_resource_manager-GetFileResource';
|
|
let MethodName = 'file_resource_manager-GetFileResource';
|
|
let data_list = [];
|
|
let data_list = [];
|
|
- data_list.push(this.resource_key);
|
|
|
|
|
|
+ data_list.push(this.resourceKey);
|
|
let data = {
|
|
let data = {
|
|
resource_key_list: data_list
|
|
resource_key_list: data_list
|
|
};
|
|
};
|
|
@@ -209,15 +218,8 @@ export default {
|
|
});
|
|
});
|
|
})
|
|
})
|
|
.catch(() => {});
|
|
.catch(() => {});
|
|
- },
|
|
|
|
- handleExceed(files, fileList) {
|
|
|
|
- this.$message.warning(
|
|
|
|
- `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
|
|
|
- files.length + fileList.length
|
|
|
|
- } 个文件`
|
|
|
|
- );
|
|
|
|
}
|
|
}
|
|
- } // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
|
|
|
+ }
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -227,40 +229,18 @@ export default {
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
|
|
|
&-content {
|
|
&-content {
|
|
|
|
+ width: 100%;
|
|
margin: 0 auto;
|
|
margin: 0 auto;
|
|
- padding: 30px 0;
|
|
|
|
-
|
|
|
|
- .changeLang {
|
|
|
|
- margin-right: 10px;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- &-create {
|
|
|
|
- width: 100%;
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: flex-start;
|
|
|
|
- align-items: center;
|
|
|
|
- margin-bottom: 20px;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- &-search {
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: space-between;
|
|
|
|
- align-items: flex-start;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- &-table {
|
|
|
|
- width: 100%;
|
|
|
|
- height: calc(100vh - 120px);
|
|
|
|
- overflow-y: scroll;
|
|
|
|
- }
|
|
|
|
|
|
+ padding: 20px 0;
|
|
|
|
+ }
|
|
|
|
|
|
- &-pag {
|
|
|
|
- padding-top: 30px;
|
|
|
|
- }
|
|
|
|
|
|
+ .submitBtn {
|
|
|
|
+ margin-left: 90px;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
-.submitBtn {
|
|
|
|
- margin-left: 90px;
|
|
|
|
|
|
+ &-footer {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|