修改已知问题
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
<template>
|
||||
<div class="customContent-box">
|
||||
<div class="box-content">
|
||||
<div class="box-content" v-for="(item,index) in dataSourceContentList" :key="index">
|
||||
<img src="../../../assets/jspg.png" class="img" alt="">
|
||||
<div class="text">我的收藏</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<img src="../../../assets/jspg.png" class="img" alt="">
|
||||
<div class="text">我的收藏</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<img src="../../../assets/jspg.png" class="img" alt="">
|
||||
<div class="text">我的收藏</div>
|
||||
<div class="text">{{item.iconName}}</div>
|
||||
</div>
|
||||
<div class="box-content" @click="customClick()">
|
||||
<img src="../../../assets/zdy.png" class="img" alt="">
|
||||
@@ -27,8 +19,8 @@
|
||||
>
|
||||
<div class="selected">{{$t('selected')}}:</div>
|
||||
<div class="box-model">
|
||||
<div style="display: inline-block" v-for="(item,index) in dataSource">
|
||||
<div class="box-top" v-if="item.state == 1" @click="statusClick(item,index)">
|
||||
<div style="display: inline-block" v-for="(item,index) in dataSourceTopList">
|
||||
<div class="box-top" @click="statusClick(1,item,index)">
|
||||
<div class="box-content">
|
||||
<img src="../../../assets/jspg.png" class="img" alt="">
|
||||
<div class="text">{{item.iconName}}</div>
|
||||
@@ -40,9 +32,10 @@
|
||||
<div class="selected">{{$t('notSelected')}}:</div>
|
||||
<div class="box-model">
|
||||
<div style="display: inline-block" v-for="(item,index) in dataSource">
|
||||
<div class="box-top" v-if="!item.state || item.state == 2" @click="statusClick(item,index)">
|
||||
<div class="box-top" v-if="!item.state || item.state == 0 || item.state == 2"
|
||||
@click="statusClick(2,item,index)">
|
||||
<div class="box-content">
|
||||
<img src="../../../assets/jspg.png" class="img" alt="">
|
||||
<img :src="item.iconPath" class="img" alt="">
|
||||
<div class="text">{{item.iconName}}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,45 +54,54 @@
|
||||
return {
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
dataSourceTopList: [],
|
||||
dataSourceContentList: [],
|
||||
url: {
|
||||
list: '/home/homeFunctionModuleEO/list',
|
||||
add: '/home/homeFunctionModuleEO/add'
|
||||
},
|
||||
dataSource: [
|
||||
{
|
||||
iconName: '我的收藏',
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
iconName: '我的收藏1',
|
||||
id: 2
|
||||
},
|
||||
{
|
||||
iconName: '我的收藏1',
|
||||
id: 3
|
||||
}
|
||||
],
|
||||
dataSource: [],
|
||||
topList: [],
|
||||
footerList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
customClick() {
|
||||
this.visible = true
|
||||
this.dataSourceTopList = []
|
||||
this.dataSourceContentList = []
|
||||
this.getList()
|
||||
},
|
||||
getList() {
|
||||
getAction(this.url.list, {}).then((res) => {
|
||||
if (res.success) {
|
||||
|
||||
this.dataSource = res.result || []
|
||||
this.dataSource.forEach(val => {
|
||||
if (res.state == 1) {
|
||||
this.dataSourceTopList.push(val)
|
||||
this.dataSourceContentList.push(val)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.dataSource = []
|
||||
}
|
||||
})
|
||||
},
|
||||
handleOk() {
|
||||
this.confirmLoading = true
|
||||
postAction(this.url.add, this.dataSource).then((res) => {
|
||||
let dataSource = []
|
||||
dataSource = this.dataSource.filter(res => {
|
||||
return res.state == 2 || res.state == 0 || !res.state
|
||||
})
|
||||
let dataSourceTopList = JSON.parse(JSON.stringify(this.dataSourceTopList))
|
||||
dataSourceTopList = dataSourceTopList.reverse()
|
||||
dataSourceTopList.forEach(res => {
|
||||
dataSource.unshift(res)
|
||||
})
|
||||
postAction(this.url.add, dataSource).then((res) => {
|
||||
if (res.success) {
|
||||
this.visible = false
|
||||
this.confirmLoading = false
|
||||
@@ -113,11 +115,38 @@
|
||||
handleCancel() {
|
||||
this.visible = false
|
||||
},
|
||||
statusClick(item, index) {
|
||||
if (item.state == 1) {
|
||||
this.dataSource[index].state = 2
|
||||
statusClick(num, item, index) {
|
||||
if (num == 1) {
|
||||
if (this.dataSourceTopList && this.dataSourceTopList.length > 0) {
|
||||
for (let i = 0; i < this.dataSourceTopList.length; i++) {
|
||||
if (index == i) {
|
||||
this.dataSourceTopList.splice(i, 1)
|
||||
i--
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.dataSourceTopList = []
|
||||
}
|
||||
if (this.dataSource && this.dataSource.length > 0) {
|
||||
for (let i = 0; i < this.dataSource.length; i++) {
|
||||
if (this.dataSource[i].id == item.id) {
|
||||
this.dataSource[i].state = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.dataSource[index].state = 1
|
||||
this.dataSourceTopList.push(item)
|
||||
for (let i = 0; i < this.dataSourceTopList.length; i++) {
|
||||
this.dataSourceTopList[i].sort = i
|
||||
}
|
||||
if (this.dataSource && this.dataSource.length > 0) {
|
||||
for (let i = 0; i < this.dataSource.length; i++) {
|
||||
if (this.dataSource[i].id == item.id) {
|
||||
this.dataSource[i].state = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.dataSource = [...this.dataSource]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user