提交 833f9d61 authored 作者: pengxiaohui's avatar pengxiaohui

bug fixes

上级 6c277e63
...@@ -125,11 +125,10 @@ ...@@ -125,11 +125,10 @@
<el-table-column <el-table-column
fixed="right" fixed="right"
label="操作" label="操作"
width="100"> width="110">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown @command="type => handleCommand(type, scope.row)"> <el-dropdown @command="type => handleCommand(type, scope.row)">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<!-- 请选择<i class="el-icon-arrow-down el-icon--right"></i> -->
<el-button size="mini">请选择<i class="el-icon-arrow-down el-icon--right"></i></el-button> <el-button size="mini">请选择<i class="el-icon-arrow-down el-icon--right"></i></el-button>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
...@@ -594,7 +593,7 @@ export default { ...@@ -594,7 +593,7 @@ export default {
} }
}, },
handlePublish(val) { handlePublish(val) {
console.log(val) // console.log(val)
casesApi.publishCase2(val.id, { is_show: val.is_show }).then(res => { casesApi.publishCase2(val.id, { is_show: val.is_show }).then(res => {
if (res.code === 0 && res.data && res.data.status) { if (res.code === 0 && res.data && res.data.status) {
this.$message.success('更新发布状态成功') this.$message.success('更新发布状态成功')
...@@ -741,52 +740,7 @@ export default { ...@@ -741,52 +740,7 @@ export default {
return res return res
}, },
initAddForm() { initAddForm() {
this.addForm = { this.addForm = Object.assign({}, defaultForm)
name: '',
level: '',
category_id: 0,
accessory: '',
url: '',
production_detail: [
{
name: '',
show_type: 'input',
show_info: '',
keywords: [
{
name: '',
score: '0'
}
]
}
],
fund_detail: [
{
name: '',
show_type: 'input',
show_info: '',
keywords: [
{
name: '',
score: 0
}
]
}
],
invest_detail: [
{
name: '',
show_type: 'input',
show_info: '',
keywords: [
{
name: '',
score: 0
}
]
}
]
}
}, },
searchCategory(keyword) { searchCategory(keyword) {
categoryApi.categories({ name: keyword, page: 1, limit: 10 }).then(res => { categoryApi.categories({ name: keyword, page: 1, limit: 10 }).then(res => {
...@@ -948,8 +902,8 @@ export default { ...@@ -948,8 +902,8 @@ export default {
} }
</script> </script>
<style scoped> <style>
.el-drawer { .el-drawer .el-drawer__body {
overflow: auto; overflow: auto;
} }
</style> </style>
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
<el-upload <el-upload
action="/api/opera/v1/file/upload" action="/api/opera/v1/file/upload"
list-type="picture-card" list-type="picture-card"
:limit="1" :limit="100"
:file-list="urlFiles" :file-list="updateForm.uris"
:on-success="uploadUrlSuccess" :on-success="uploadUrlSuccess"
:multiple="false" :multiple="false"
:data="{ type: 'image' }" :data="{ type: 'image' }"
...@@ -68,8 +68,8 @@ ...@@ -68,8 +68,8 @@
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
<el-dialog :visible.sync="visible" append-to-body> <el-dialog :visible.sync="visible" append-to-body>
<img width="100%" :src="updateForm.url" alt=""> <img width="100%" :src="imgPreview" alt="">
<el-input :v-model="updateForm.url" :value="updateForm.url"></el-input> <el-input :v-model="imgPreview" :value="imgPreview"></el-input>
</el-dialog> </el-dialog>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -244,6 +244,7 @@ export default { ...@@ -244,6 +244,7 @@ export default {
category_id: 0, category_id: 0,
accessory: '', accessory: '',
url: '', url: '',
uris: [],
production_detail: [ production_detail: [
{ {
name: '', name: '',
...@@ -283,7 +284,8 @@ export default { ...@@ -283,7 +284,8 @@ export default {
] ]
} }
] ]
} },
imgPreview: ''
} }
}, },
mounted() { mounted() {
...@@ -293,7 +295,14 @@ export default { ...@@ -293,7 +295,14 @@ export default {
}, },
methods: { methods: {
save() { save() {
casesApi.updateCase2(this.id, this.updateForm).then(res => { const form = { ...this.updateForm }
const checkedPro = this.checkFormDetailsNull(form.production_detail)
const checkedFoud = this.checkFormDetailsNull(form.fund_detail)
const checkedInvest = this.checkFormDetailsNull(form.invest_detail)
if (!checkedPro) delete form.production_detail
if (!checkedFoud) delete form.fund_detail
if (!checkedInvest) delete form.invest_detail
casesApi.updateCase2(this.id, form).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message.success(res.message) this.$message.success(res.message)
return true return true
...@@ -303,6 +312,27 @@ export default { ...@@ -303,6 +312,27 @@ export default {
} }
}) })
}, },
checkFormDetailsNull(list) {
let res = true
list.forEach(item => {
if (item.name) res = false
})
for (let i = 0; i < list.length; i++) {
if (list[i].name || list[i].show_info) {
res = false
break
} else {
const keywords = list[i].keywords
for (let j = 0; j < keywords.length; j++) {
if (keywords[i].name || list[i].score !== '0') {
res = false
break
}
}
}
}
return res
},
getInfo(id) { getInfo(id) {
casesApi.Case2(id).then(res => { casesApi.Case2(id).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -314,20 +344,20 @@ export default { ...@@ -314,20 +344,20 @@ export default {
} }
this.updateForm.accessory = data.accessory this.updateForm.accessory = data.accessory
this.updateForm.url = data.url this.updateForm.url = data.url
if (data.production_detail) { if (data.production_detail && data.production_detail.length > 0) {
this.updateForm.production_detail = data.production_detail this.updateForm.production_detail = data.production_detail
} }
if (data.invest_detail) { if (data.invest_detail && data.invest_detail.length > 0) {
this.updateForm.invest_detail = data.invest_detail this.updateForm.invest_detail = data.invest_detail
} }
if (data.fund_detail) { if (data.fund_detail && data.fund_detail.length > 0) {
this.updateForm.fund_detail = data.fund_detail this.updateForm.fund_detail = data.fund_detail
} }
if (data.accessory) { if (data.accessory) {
this.accessoryFiles = [{ url: data.accessory, name: data.accessory }] this.accessoryFiles = [{ url: data.accessory, name: data.accessory }]
} }
if (data.url) { if (data.uris) {
this.urlFiles = [{ url: data.url }] this.updateForm.uris = data.uris
} }
} else { } else {
this.$message.error(res.message) this.$message.error(res.message)
...@@ -406,6 +436,13 @@ export default { ...@@ -406,6 +436,13 @@ export default {
var data = response.data var data = response.data
var imageInfo = data[0] var imageInfo = data[0]
this.updateForm.url = imageInfo.url this.updateForm.url = imageInfo.url
this.updateForm.uris.push({
uri: imageInfo.url,
url: imageInfo.url,
title: imageInfo.title,
size: imageInfo.size,
md5: imageInfo.md5
})
this.visible = false this.visible = false
} else { } else {
console.log('文件上传失败') console.log('文件上传失败')
...@@ -416,9 +453,7 @@ export default { ...@@ -416,9 +453,7 @@ export default {
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`) this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
}, },
createPictureCardPreview(file) { createPictureCardPreview(file) {
if (!this.updateForm.url) { this.imgPreview = file.url
this.updateForm.url = file.url
}
this.visible = true this.visible = true
}, },
addNames(detailName, index) { addNames(detailName, index) {
......
...@@ -664,7 +664,7 @@ export default { ...@@ -664,7 +664,7 @@ export default {
</script> </script>
<style> <style>
.el-drawer { .el-drawer .el-drawer__body {
overflow: auto; overflow: auto;
} }
</style> </style>
...@@ -373,7 +373,7 @@ export default { ...@@ -373,7 +373,7 @@ export default {
</script> </script>
<style> <style>
.el-drawer { .el-drawer .el-drawer__body {
overflow: auto; overflow: auto;
} }
</style> </style>
...@@ -297,7 +297,7 @@ export default { ...@@ -297,7 +297,7 @@ export default {
</script> </script>
<style> <style>
.el-drawer { .el-drawer .el-drawer__body {
overflow: auto; overflow: auto;
} }
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论