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