Browse Source

修复富文本框按顺序上传,更新榜单增加时间字段

master
sj 3 years ago
parent
commit
b77de18506
  1. 6
      src/components/editorMaterial/index.vue
  2. 41
      src/views/bxg/shop/yxStoreHotList/index.vue

6
src/components/editorMaterial/index.vue

@ -464,11 +464,13 @@ export default {
sureUrls() { sureUrls() {
let str = '' let str = ''
this.urls.forEach(item => { this.urls.forEach(item => {
str += '<img src="' + item + '">' // str += '<img src="' + item + '">'
//
nowEditor.editor.execCommand('insertimage',{src:item})
// this.$set(this.value, this.value.length, item) // this.$set(this.value, this.value.length, item)
}) })
nowEditor.dialog.close(true) nowEditor.dialog.close(true)
nowEditor.editor.setContent(str, true) // nowEditor.editor.setContent(str, true)
this.listDialogVisible = false this.listDialogVisible = false
} }
} }

41
src/views/bxg/shop/yxStoreHotList/index.vue

@ -13,6 +13,18 @@
<el-form-item label="榜单名称" prop="listName"> <el-form-item label="榜单名称" prop="listName">
<el-input v-model="form.listName" style="width: 380px;" /> <el-input v-model="form.listName" style="width: 380px;" />
</el-form-item> </el-form-item>
<el-form-item label="展示图片" prop="listImage">
<single-pic v-model="form.listImage" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="所属月份" prop="mouth" >
<el-date-picker
format="yyyy 年 MM 月"
value-format="yyyy-MM"
v-model="form.mouth"
type="month"
placeholder="选择榜单所属年月">
</el-date-picker>
</el-form-item>
<el-form-item label="商品列表"> <el-form-item label="商品列表">
<el-input style="width: 200px;" v-model="product" v-if="productNameList.length==0" <el-input style="width: 200px;" v-model="product" v-if="productNameList.length==0"
:readonly="true" @click.native="changeShow=!changeShow" placeholder="点击选择商品或收起商品列表"> :readonly="true" @click.native="changeShow=!changeShow" placeholder="点击选择商品或收起商品列表">
@ -66,10 +78,11 @@
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column v-if="columns.visible('id')" prop="id" label="榜单列表ID" /> <el-table-column v-if="columns.visible('id')" prop="id" label="榜单列表ID" />
<el-table-column v-if="columns.visible('listName')" prop="listName" label="榜单名称" /> <el-table-column v-if="columns.visible('listName')" prop="listName" label="榜单名称" />
<el-table-column v-if="columns.visible('mouth')" prop="mouth" label="所属月份" />
<el-table-column v-if="columns.visible('sort')" prop="sort" label="排序" /> <el-table-column v-if="columns.visible('sort')" prop="sort" label="排序" />
<el-table-column v-if="columns.visible('productlist')" prop="productlist" label="商品列表" width="250"> <el-table-column v-if="columns.visible('productlist')" prop="productlist" label="商品列表" width="250">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="(item,index) in JSON.parse(scope.row.productList)"> <div v-for="(item,index) in (scope.row.productInfoList)">
<span>top{{index+1}}:{{item.storeName}}</span> <span>top{{index+1}}:{{item.storeName}}</span>
</div> </div>
</template> </template>
@ -120,14 +133,15 @@ import pagination from '@crud/Pagination'
import MaterialList from "@/components/material"; import MaterialList from "@/components/material";
import {getInfo} from "@/api/bxg/yxStoreProduct"; import {getInfo} from "@/api/bxg/yxStoreProduct";
import {initData} from "@/api/bxg/data"; import {initData} from "@/api/bxg/data";
import singlePic from '@/components/singlematerial'
// crudpresenter // crudpresenter
const defaultCrud = CRUD({ title: '热门榜单', url: 'bxg/api/yxStoreHotList', sort: 'id,desc', crudMethod: { ...crudYxStoreHotList }}) const defaultCrud = CRUD({ title: '热门榜单', url: 'bxg/api/yxStoreHotList', sort: 'id,desc', crudMethod: { ...crudYxStoreHotList }})
const defaultForm = { id: null, listName: null, sort: null, productList: null, isShow: 1, const defaultForm = { id: null, listName: null, sort: 0, productList: null, isShow: 1,listImage:'',
mouth:null,
createTime: null, updateTime: null, isDel: null, tenantId: Cookies.get('tenantId') } createTime: null, updateTime: null, isDel: null, tenantId: Cookies.get('tenantId') }
export default { export default {
name: 'YxStoreHotList', name: 'YxStoreHotList',
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList}, components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList,singlePic},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() { data() {
return { return {
@ -150,6 +164,13 @@ export default {
} } } }
}, },
watch: { watch: {
// 'form.ListImage': function(val) {
// console.log('aaaa:'+val)
// if (val) {
// this.oneFormValidate[0].pic = val
// console.log('bbbbbb:'+this.oneFormValidate.pic)
// }
// },
}, },
mounted () { mounted () {
this.getInfo(); this.getInfo();
@ -165,7 +186,7 @@ export default {
productList=this.getCascader(val,this.oldProductList,this.$refs.quitCascader.getCheckedNodes(true)); productList=this.getCascader(val,this.oldProductList,this.$refs.quitCascader.getCheckedNodes(true));
this.productList = productList // this.productList = productList //
this.oldProductList=productList; this.oldProductList=productList;
console.log('val',val,'element',productList,'Nodes',this.$refs.quitCascader.getCheckedNodes(true)) // console.log('val',val,'element',productList,'Nodes',this.$refs.quitCascader.getCheckedNodes(true))
this.form.productList=JSON.stringify(this.productList.map(item=>item[1])); this.form.productList=JSON.stringify(this.productList.map(item=>item[1]));
}, },
getCascader(newVal,oldVal,Nodes) { getCascader(newVal,oldVal,Nodes) {
@ -211,7 +232,7 @@ export default {
Nodes.forEach(item=>{ Nodes.forEach(item=>{
if (item.value==ele[1]){ if (item.value==ele[1]){
// productNameList=item.parent.label+'/'+item.label+productNameList; // productNameList=item.parent.label+'/'+item.label+productNameList;
console.log('item.parent.label+\'/\'+item.label',item.parent.label+'/'+item.label) // console.log('item.parent.label+\'/\'+item.label',item.parent.label+'/'+item.label)
productNameList.push(item.parent.label+'/'+item.label) productNameList.push(item.parent.label+'/'+item.label)
} }
}) })
@ -258,11 +279,17 @@ export default {
return true return true
}, // }, //
[CRUD.HOOK.afterToCU](crud, form) { [CRUD.HOOK.afterToCU](crud, form) {
console.log('form',form)
this.changeShow=false; this.changeShow=false;
this.productNameList=[]; this.productNameList=[];
this.productList=[]; this.productList=[];
//
if (form.listImage==null && form.id) {
this.form.listImage=''
}
if (form.productList && form.id) { if (form.productList && form.id) {
let data=JSON.parse(this.form.productList) // let data=JSON.parse(this.form.productList)
let data=form.productInfoList
console.log('data',data) console.log('data',data)
let productNameList=[] let productNameList=[]
data.forEach(item=>{ data.forEach(item=>{

Loading…
Cancel
Save