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

bug fixes

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