提交 2a5300a3 authored 作者: wangyizheng's avatar wangyizheng

编辑案例

上级 b8bfad4d
...@@ -30,9 +30,9 @@ export function Case2(id, params = {}) { ...@@ -30,9 +30,9 @@ export function Case2(id, params = {}) {
} }
// 更新案例 // 更新案例
export function updateCase2(data) { export function updateCase2(id, data) {
var headers = { var headers = {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
return httpRequest.put('/api/opera/v2/training/cases', data, { headers }) return httpRequest.put(`/api/opera/v2/training/${id}/case`, data, { headers })
} }
...@@ -136,9 +136,9 @@ ...@@ -136,9 +136,9 @@
<embed class="embed" width="600px" height="700px" :src="pdfUrl" type="application/pdf"/> <embed class="embed" width="600px" height="700px" :src="pdfUrl" type="application/pdf"/>
</div> </div>
<div> <div>
<el-dialog title="产品概况" :visible.sync="productionDialogFormVisible" width="90%" center> <el-dialog title="产品概况" :visible.sync="productionDialogFormVisible" width="40%" center>
<el-card :body-style="{ padding: '0px' }"> <div style="padding: 14px;" v-for="(production, productionIndex) in productionDetail" :key="productionIndex">
<div style="padding: 14px;" v-for="(production, productionIndex) in productionDetail" :key="productionIndex"> <el-card>
<div> <div>
<span><strong>产品信息:</strong></span><span>{{ production.name }}</span> <span><strong>产品信息:</strong></span><span>{{ production.name }}</span>
</div> </div>
...@@ -149,15 +149,14 @@ ...@@ -149,15 +149,14 @@
<br/> <br/>
</div> </div>
</div> </div>
<el-divider v-if="productionIndex < productionDetail.length - 1" content-position="right"></el-divider> </el-card>
</div> </div>
</el-card>
</el-dialog> </el-dialog>
</div> </div>
<div> <div>
<el-dialog title="基金投资与净值表现" :visible.sync="fundDialogFormVisible" width="90%" center> <el-dialog title="基金投资与净值表现" :visible.sync="fundDialogFormVisible" width="40%" center>
<el-card :body-style="{ padding: '0px' }"> <div style="padding: 14px;" v-for="(production, index) in fundDetail" :key="index">
<div style="padding: 14px;" v-for="(production, index) in fundDetail" :key="index"> <el-card>
<div> <div>
<span><strong>产品信息:</strong></span><span>{{ production.name }}</span> <span><strong>产品信息:</strong></span><span>{{ production.name }}</span>
</div> </div>
...@@ -168,15 +167,14 @@ ...@@ -168,15 +167,14 @@
<br/> <br/>
</div> </div>
</div> </div>
<el-divider v-if="index < fundDetail.length - 1" content-position="right"></el-divider> </el-card>
</div> </div>
</el-card>
</el-dialog> </el-dialog>
</div> </div>
<div> <div>
<el-dialog title="投资本基金涉及的费用" :visible.sync="investDialogFormVisible" width="90%" center> <el-dialog title="投资本基金涉及的费用" :visible.sync="investDialogFormVisible" width="40%" center>
<el-card :body-style="{ padding: '0px' }"> <div style="padding: 14px;" v-for="(production, index) in investDetail" :key="index">
<div style="padding: 14px;" v-for="(production, index) in investDetail" :key="index"> <el-card>
<div> <div>
<span><strong>产品信息:</strong></span><span>{{ production.name }}</span> <span><strong>产品信息:</strong></span><span>{{ production.name }}</span>
</div> </div>
...@@ -187,25 +185,24 @@ ...@@ -187,25 +185,24 @@
<br/> <br/>
</div> </div>
</div> </div>
<el-divider v-if="index < investDetail.length - 1" content-position="right"></el-divider> </el-card>
</div> </div>
</el-card>
</el-dialog> </el-dialog>
</div> </div>
<div> <div>
<el-scrollbar style="height: 80%"> <el-scrollbar style="height: 80%">
<el-drawer <el-drawer
title="创建案例" title="创建案例"
:visible.sync="drawer" :visible.sync="drawer"
:direction="direction" :direction="direction"
:append-to-body="true" :append-to-body="true"
:withHeader="true" :withHeader="true"
:before-close="handleClose" :before-close="handleClose"
ref="drawer" ref="drawer"
size="50%"> size="50%">
<div class="demo-drawer__content"> <div class="demo-drawer__content">
<el-form :model="addForm" size="mini"> <el-form :model="addForm" size="mini">
<el-form-item label="案例名称" :label-width="formLabelWidth"> <el-form-item label="案例名称" :label-width="formLabelWidth" style="margin-right: 5%">
<el-input v-model="addForm.name" autocomplete="off"></el-input> <el-input v-model="addForm.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="案例等级" :label-width="formLabelWidth"> <el-form-item label="案例等级" :label-width="formLabelWidth">
...@@ -217,37 +214,37 @@ ...@@ -217,37 +214,37 @@
</el-form-item> </el-form-item>
<el-form-item label="案例分类" :label-width="formLabelWidth"> <el-form-item label="案例分类" :label-width="formLabelWidth">
<el-cascader <el-cascader
v-model="addForm.category_id" v-model="addForm.category_id"
:options="options" :options="options"
:show-all-levels="false" :show-all-levels="false"
filterable filterable
:before-filter="searchCategory" :before-filter="searchCategory"
:props="{value: 'id', label: 'name', emitPath: false}" :props="{value: 'id', label: 'name', emitPath: false}"
placeholder="试试搜索:分类"> placeholder="试试搜索:分类">
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="产品说明书(pdf附件)" :label-width="formLabelWidth"> <el-form-item label="产品说明书(pdf附件)" :label-width="formLabelWidth">
<el-upload <el-upload
class="upload-pdf" class="upload-pdf"
action="/api/opera/v1/file/upload" action="/api/opera/v1/file/upload"
:on-preview="handlePreview" :on-preview="handlePreview"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:limit="1" :limit="1"
:on-exceed="handleExceed"> :on-exceed="handleExceed">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传pdf文件</div> <div slot="tip" class="el-upload__tip">只能上传pdf文件</div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="图片" :label-width="formLabelWidth"> <el-form-item label="图片" :label-width="formLabelWidth">
<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="1"
:on-success="uploadUrlSuccess" :on-success="uploadUrlSuccess"
:multiple="false" :multiple="false"
:data="{ type: 'image' }" :data="{ type: 'image' }"
:on-preview="createPictureCardPreview"> :on-preview="createPictureCardPreview">
<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>
...@@ -259,64 +256,88 @@ ...@@ -259,64 +256,88 @@
<el-divider content-position="left">产品概况配置</el-divider> <el-divider content-position="left">产品概况配置</el-divider>
</el-form-item> </el-form-item>
<div v-for="(item, index) in addForm.production_detail" :key="'production-'+index"> <div v-for="(item, index) in addForm.production_detail" :key="'production-'+index">
<div style="margin-left: 5%"> <div style="margin-left: 5%; margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addNames('production_detail', index)">添加</i> <i class="el-icon-circle-plus-outline" @click="addNames('production_detail', index)">添加</i>
<i class="el-icon-remove-outline" @click="removeNames('production_detail', index)">删除</i> <i class="el-icon-remove-outline" @click="removeNames('production_detail', index)">删除</i>
</div> </div>
<el-form-item style="margin-left: 5%; margin-top: 2%" label-width="formLabelWidth" label="二级标题"> <el-card style="margin-left: 5%; margin-top: 2%; margin-right: 5%">
<el-input v-model="item.name" placeholder="请输入内容" style="width: 50%"></el-input> <div>
</el-form-item> <span>
<div v-for="(keywrod, index1) in item.keywords" :key="'production-'+index1" style="margin-top: 2%"> 二级标题:
<el-form-item style="margin-left: 2%" label="关键词" :label-width="formLabelWidth"> <el-input size="mini" v-model="item.name" placeholder="请输入内容" style="width: 50%"></el-input>
<el-input v-model="keywrod.name" placeholder="请输入关键词" style="width: 50%"></el-input> </span>
<span>关键词得分:</span> </div>
<el-input v-model.number="keywrod.score" placeholder="得分" style="width: 20%"></el-input> <div v-for="(keywrod, index1) in item.keywords" :key="'production-'+index1" style="margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addKeywords('production_detail', index)"></i> <el-card>
<i class="el-icon-remove-outline" @click="removeKeywords('production_detail', index, index1)"></i> <span>
</el-form-item> <span>关键词</span>
</div> <el-input size="mini" v-model="keywrod.name" placeholder="请输入关键词" style="width: 40%"></el-input>
<span style="margin-left: 2%">关键词得分:</span>
<el-input size="mini" v-model.number="keywrod.score" placeholder="得分" style="width: 20%"></el-input>
<i class="el-icon-circle-plus-outline" @click="addKeywords('production_detail', index)"></i>
<i class="el-icon-remove-outline" @click="removeKeywords('production_detail', index, index1)"></i>
</span>
</el-card>
</div>
</el-card>
</div> </div>
<el-form-item> <el-form-item>
<el-divider content-position="left">案例基金与净值表现配置</el-divider> <el-divider content-position="left">案例基金与净值表现配置</el-divider>
</el-form-item> </el-form-item>
<div v-for="(fundItem, fundIndex) in addForm.fund_detail" :key="'fund-'+fundIndex"> <div v-for="(fundItem, fundIndex) in addForm.fund_detail" :key="'fund-'+fundIndex">
<div style="margin-left: 5%"> <div style="margin-left: 5%; margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addNames('fund_detail', fundIndex)">添加</i> <i class="el-icon-circle-plus-outline" @click="addNames('fund_detail', fundIndex)">添加</i>
<i class="el-icon-remove-outline" @click="removeNames('fund_detail', fundIndex)">删除</i> <i class="el-icon-remove-outline" @click="removeNames('fund_detail', fundIndex)">删除</i>
</div> </div>
<el-form-item style="margin-left: 5%; margin-top: 2%" label-width="formLabelWidth" label="二级标题"> <el-card style="margin-left: 5%; margin-top: 2%; margin-right: 5%">
<el-input v-model="fundItem.name" placeholder="请输入内容" style="width: 50%"></el-input> <div>
</el-form-item> <span>
<div v-for="(fundKeywrod, fundIndex1) in fundItem.keywords" :key="'fund-'+fundIndex1" style="margin-top: 2%"> 二级标题:
<el-form-item style="margin-left: 2%" label="关键词" :label-width="formLabelWidth"> <el-input size="mini" v-model="fundItem.name" placeholder="请输入内容" style="width: 50%"></el-input>
<el-input v-model="fundKeywrod.name" placeholder="请输入关键词" style="width: 50%"></el-input> </span>
<span>关键词得分:</span> </div>
<el-input v-model.number="fundKeywrod.score" placeholder="得分" style="width: 20%"></el-input> <div v-for="(fundKeywrod, fundIndex1) in fundItem.keywords" :key="'fund-'+fundIndex1" style="margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addKeywords('fund_detail', fundIndex)"></i> <el-card>
<i class="el-icon-remove-outline" @click="removeKeywords('fund_detail', fundIndex, fundIndex1)"></i> <span>
</el-form-item> <span>关键词</span>
</div> <el-input size="mini" v-model="fundKeywrod.name" placeholder="请输入关键词" style="width: 40%"></el-input>
<span style="margin-left: 2%">关键词得分:</span>
<el-input size="mini" v-model.number="fundKeywrod.score" placeholder="得分" style="width: 20%"></el-input>
<i class="el-icon-circle-plus-outline" @click="addKeywords('fund_detail', fundIndex)"></i>
<i class="el-icon-remove-outline" @click="removeKeywords('fund_detail', fundIndex, fundIndex1)"></i>
</span>
</el-card>
</div>
</el-card>
</div> </div>
<el-form-item> <el-form-item>
<el-divider content-position="left">案例投资本基金净值表现配置</el-divider> <el-divider content-position="left">案例投资本基金净值表现配置</el-divider>
</el-form-item> </el-form-item>
<div v-for="(investItem, investIndex) in addForm.invest_detail" :key="'invest-'+investIndex"> <div v-for="(investItem, investIndex) in addForm.invest_detail" :key="'invest-'+investIndex">
<div style="margin-left: 5%"> <div style="margin-left: 5%; margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addNames('invest_detail', investIndex)">添加</i> <i class="el-icon-circle-plus-outline" @click="addNames('invest_detail', investIndex)">添加</i>
<i class="el-icon-remove-outline" @click="removeNames('invest_detail', investIndex)">删除</i> <i class="el-icon-remove-outline" @click="removeNames('invest_detail', investIndex)">删除</i>
</div> </div>
<el-form-item style="margin-left: 5%; margin-top: 2%" label-width="formLabelWidth" label="二级标题"> <el-card style="margin-left: 5%; margin-top: 2%; margin-right: 5%">
<el-input v-model="investItem.name" placeholder="请输入内容" style="width: 50%"></el-input> <div>
</el-form-item> <span>
<div v-for="(investKeyword, investIndex1) in investItem.keywords" :key="'invest-'+investIndex1" style="margin-top: 2%"> 二级标题:
<el-form-item style="margin-left: 2%" label="关键词" :label-width="formLabelWidth"> <el-input size="mini" v-model="investItem.name" placeholder="请输入内容" style="width: 50%"></el-input>
<el-input v-model="investKeyword.name" placeholder="请输入关键词" style="width: 50%"></el-input> </span>
<span>关键词得分:</span> </div>
<el-input v-model.number="investKeyword.score" placeholder="得分" style="width: 20%"></el-input> <div v-for="(investKeyword, investIndex1) in investItem.keywords" :key="'invest-'+investIndex1" style="margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addKeywords('invest_detail', investIndex)"></i> <el-card>
<span>
<span>关键词</span>
<el-input size="mini" v-model="investKeyword.name" placeholder="请输入关键词" style="width: 40%"></el-input>
<span style="margin-left: 2%">关键词得分:</span>
<el-input size="mini" v-model.number="investKeyword.score" placeholder="得分" style="width: 20%"></el-input>
<i class="el-icon-circle-plus-outline" @click="addKeywords('invest_detail', investIndex)"></i>
<i class="el-icon-remove-outline" @click="removeKeywords('invest_detail', investIndex, investIndex1)"></i> <i class="el-icon-remove-outline" @click="removeKeywords('invest_detail', investIndex, investIndex1)"></i>
</el-form-item> </span>
</div> </el-card>
</div>
</el-card>
</div> </div>
<el-form-item> <el-form-item>
<el-divider content-position="left"></el-divider> <el-divider content-position="left"></el-divider>
...@@ -635,7 +656,6 @@ export default { ...@@ -635,7 +656,6 @@ export default {
if (!this.addForm.accessory) { if (!this.addForm.accessory) {
this.addForm.accessory = file.url this.addForm.accessory = file.url
} }
this.visible = true
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
console.log(file, fileList) console.log(file, fileList)
......
...@@ -37,20 +37,30 @@ ...@@ -37,20 +37,30 @@
<el-upload <el-upload
class="upload-pdf" class="upload-pdf"
action="/api/opera/v1/file/upload" action="/api/opera/v1/file/upload"
:on-preview="handlePreview"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:file-list="accessoryFiles"
:limit="1" :limit="1"
:on-preview="handlePreview"
:on-exceed="handleExceed"> :on-exceed="handleExceed">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传pdf文件</div> <div slot="tip" class="el-upload__tip">只能上传pdf文件</div>
</el-upload> </el-upload>
<el-popover
placement="right"
width="500"
trigger="click"
v-if="updateForm.accessory">
<embed class="embed" width="600px" height="700px" :src="updateForm.accessory" type="application/pdf"/>
<el-button slot="reference" size="mini" round>预览pdf</el-button>
</el-popover>
</el-form-item> </el-form-item>
<el-form-item label="图片" :label-width="formLabelWidth"> <el-form-item label="图片" :label-width="formLabelWidth">
<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="1"
:file-list="urlFiles"
:on-success="uploadUrlSuccess" :on-success="uploadUrlSuccess"
:multiple="false" :multiple="false"
:data="{ type: 'image' }" :data="{ type: 'image' }"
...@@ -62,6 +72,101 @@ ...@@ -62,6 +72,101 @@
<el-input :v-model="updateForm.url" :value="updateForm.url"></el-input> <el-input :v-model="updateForm.url" :value="updateForm.url"></el-input>
</el-dialog> </el-dialog>
</el-form-item> </el-form-item>
<el-form-item>
<el-divider content-position="left">产品概况配置</el-divider>
</el-form-item>
<div v-for="(item, index) in updateForm.production_detail" :key="'production-'+index">
<div style="margin-left: 5%; margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addNames('production_detail', index)">添加</i>
<i class="el-icon-remove-outline" @click="removeNames('production_detail', index)">删除</i>
</div>
<el-card style="margin-top: 2%">
<div>
<span>
二级标题:
<el-input size="mini" v-model="item.name" placeholder="请输入内容" style="width: 50%"></el-input>
</span>
</div>
<div v-for="(keywrod, index1) in item.keywords" :key="'production-'+index1" style="margin-top: 2%">
<el-card>
<span>
<span>关键词:</span>
<el-input size="mini" v-model="keywrod.name" placeholder="请输入关键词" style="width: 50%"></el-input>
<span style="margin-left: 2%">关键词得分:</span>
<el-input size="mini" v-model.number="keywrod.score" placeholder="得分" style="width: 10%"></el-input>
<i class="el-icon-circle-plus-outline" @click="addKeywords('production_detail', index)"></i>
<i class="el-icon-remove-outline" @click="removeKeywords('production_detail', index, index1)"></i>
</span>
</el-card>
</div>
</el-card>
</div>
<el-form-item>
<el-divider content-position="left">案例基金与净值表现配置</el-divider>
</el-form-item>
<div v-for="(fundItem, fundIndex) in updateForm.fund_detail" :key="'fund-'+fundIndex">
<div style="margin-left: 5%; margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addNames('fund_detail', fundIndex)">添加</i>
<i class="el-icon-remove-outline" @click="removeNames('fund_detail', fundIndex)">删除</i>
</div>
<el-card style="margin-top: 2%">
<div>
<span>
二级标题:
<el-input size="mini" v-model="fundItem.name" placeholder="请输入内容" style="width: 50%"></el-input>
</span>
</div>
<div v-for="(fundKeywrod, fundIndex1) in fundItem.keywords" :key="'fund-'+fundIndex1" style="margin-top: 2%">
<el-card>
<span>
<span>关键词:</span>
<el-input size="mini" v-model="fundKeywrod.name" placeholder="请输入关键词" style="width: 50%"></el-input>
<span style="margin-left: 2%">关键词得分:</span>
<el-input size="mini" v-model.number="fundKeywrod.score" placeholder="得分" style="width: 10%"></el-input>
<i class="el-icon-circle-plus-outline" @click="addKeywords('fund_detail', fundIndex)"></i>
<i class="el-icon-remove-outline" @click="removeKeywords('fund_detail', fundIndex, fundIndex1)"></i>
</span>
</el-card>
</div>
</el-card>
</div>
<el-form-item>
<el-divider content-position="left">案例投资本基金净值表现配置</el-divider>
</el-form-item>
<div v-for="(investItem, investIndex) in updateForm.invest_detail" :key="'invest-'+investIndex">
<div style="margin-left: 5%; margin-top: 2%">
<i class="el-icon-circle-plus-outline" @click="addNames('invest_detail', investIndex)">添加</i>
<i class="el-icon-remove-outline" @click="removeNames('invest_detail', investIndex)">删除</i>
</div>
<el-card style="margin-top: 2%">
<div>
<span>
二级标题:
<el-input size="mini" v-model="investItem.name" placeholder="请输入内容" style="width: 50%"></el-input>
</span>
</div>
<div v-for="(investKeyword, investIndex1) in investItem.keywords" :key="'invest-'+investIndex1" style="margin-top: 2%">
<el-card>
<span>
<span>关键词:</span>
<el-input size="mini" v-model="investKeyword.name" placeholder="请输入关键词" style="width: 50%"></el-input>
<span style="margin-left: 2%">关键词得分:</span>
<el-input size="mini" v-model.number="investKeyword.score" placeholder="得分" style="width: 10%"></el-input>
<i class="el-icon-circle-plus-outline" @click="addKeywords('invest_detail', investIndex)"></i>
<i class="el-icon-remove-outline" @click="removeKeywords('invest_detail', investIndex, investIndex1)"></i>
</span>
</el-card>
</div>
</el-card>
</div>
<el-form-item>
<el-divider content-position="left"></el-divider>
</el-form-item>
<el-form-item>
<div class="demo-drawer__footer" style="margin-left: 60%">
<el-button type="primary" @click="save">保 存</el-button>
</div>
</el-form-item>
</el-form> </el-form>
</el-card> </el-card>
</div> </div>
...@@ -70,6 +175,7 @@ ...@@ -70,6 +175,7 @@
<script> <script>
import * as categoryApi from '@/api/categories' import * as categoryApi from '@/api/categories'
import * as casesApi from '@/api/cases2'
export default { export default {
name: 'update', name: 'update',
data() { data() {
...@@ -78,6 +184,8 @@ export default { ...@@ -78,6 +184,8 @@ export default {
formLabelWidth: '100px', formLabelWidth: '100px',
options: [], options: [],
visible: false, visible: false,
accessoryFiles: [],
urlFiles: [],
updateForm: { updateForm: {
name: '', name: '',
level: '', level: '',
...@@ -121,9 +229,54 @@ export default { ...@@ -121,9 +229,54 @@ export default {
} }
}, },
mounted() { mounted() {
this.id = this.$route.query.id
this.getInfo(this.id)
this.categoryList() this.categoryList()
}, },
methods: { methods: {
save() {
casesApi.updateCase2(this.id, this.updateForm).then(res => {
if (res.code === 0) {
this.$message.success(res.message)
return true
} else {
this.$message.error(res.message)
return false
}
})
},
getInfo(id) {
casesApi.Case2(id).then(res => {
if (res.code === 0) {
var data = res.data
this.updateForm.name = data.name
this.updateForm.level = data.level
if (data.categories) {
this.updateForm.category_id = data.categories[0].id
}
this.updateForm.accessory = data.accessory
this.updateForm.url = data.url
if (data.production_detail) {
this.updateForm.production_detail = data.production_detail
}
if (data.invest_detail) {
this.updateForm.invest_detail = data.invest_detail
}
if (data.fund_detail) {
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 }]
}
} else {
this.$message.error(res.message)
return false
}
})
},
searchCategory(keyword) { searchCategory(keyword) {
categoryApi.categories({ name: keyword, page: 1, limit: 10 }).then(res => { categoryApi.categories({ name: keyword, page: 1, limit: 10 }).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -175,7 +328,6 @@ export default { ...@@ -175,7 +328,6 @@ export default {
if (!this.updateForm.accessory) { if (!this.updateForm.accessory) {
this.updateForm.accessory = file.url this.updateForm.accessory = file.url
} }
this.visible = true
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
console.log(file, fileList) console.log(file, fileList)
...@@ -209,7 +361,71 @@ export default { ...@@ -209,7 +361,71 @@ export default {
if (!this.updateForm.url) { if (!this.updateForm.url) {
this.updateForm.url = file.url this.updateForm.url = file.url
} }
this.updateForm = true this.visible = true
},
addNames(detailName, index) {
switch (detailName) {
case 'production_detail':
this.updateForm.production_detail.push({ name: '', keywords: [{ name: '', score: 0 }] })
break
case 'fund_detail':
this.updateForm.fund_detail.push({ name: '', keywords: [{ name: '', score: 0 }] })
break
case 'invest_detail':
this.updateForm.invest_detail.push({ name: '', keywords: [{ name: '', score: 0 }] })
break
}
},
removeNames (detailName, index) {
switch (detailName) {
case 'production_detail':
if (this.updateForm.production_detail.length > 1) {
this.updateForm.production_detail.splice(index, 1)
}
break
case 'fund_detail':
if (this.updateForm.fund_detail.length > 1) {
this.updateForm.fund_detail.splice(index, 1)
}
break
case 'invest_detail':
if (this.updateForm.invest_detail.length > 1) {
this.updateForm.invest_detail.splice(index, 1)
}
break
}
},
addKeywords(detailName, index) {
switch (detailName) {
case 'production_detail':
this.updateForm.production_detail[index].keywords.push({ name: '', score: 0 })
break
case 'fund_detail':
this.updateForm.fund_detail[index].keywords.push({ name: '', score: 0 })
break
case 'invest_detail':
this.updateForm.invest_detail[index].keywords.push({ name: '', score: 0 })
break
}
},
removeKeywords (detailName, index, index1) {
switch (detailName) {
case 'production_detail':
if (this.updateForm.production_detail[index].keywords.length > 1) {
this.updateForm.production_detail[index].keywords.splice(index1, 1)
}
break
case 'fund_detail':
if (this.updateForm.fund_detail[index].keywords.length > 1) {
this.updateForm.fund_detail[index].keywords.splice(index1, 1)
}
break
case 'invest_detail':
if (this.updateForm.invest_detail[index].keywords.length > 1) {
this.updateForm.invest_detail[index].keywords.splice(index1, 1)
}
break
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论