Commit 52ea5a18 by tang

feat: 定制服务调试

parent b6009ded
......@@ -22,9 +22,9 @@
</div>
</div>
</div>
<!-- <div class="d-none d-lg-block banner-tp">-->
<!-- <img :src="el.picIndexPath" alt="" class="container"/>-->
<!-- </div>-->
<!-- <div class="d-none d-lg-block banner-tp">-->
<!-- <img :src="el.picIndexPath" alt="" class="container"/>-->
<!-- </div>-->
<div class="banner-bg">
<img :src="el.picIndexPath" alt=""/>
</div>
......@@ -993,34 +993,52 @@ export default {
},
mounted() {
this.getCustomService()
// 从后端获取最新的定制服务
this.getCustomServiceFromServer()
},
methods: {
getCustomService() {
let service = localStorage.getItem('gs-custom-service') || ''
console.log('getCustomService-----------', service)
if(service) {
if (service) {
service = JSON.parse(service)
this.updateCustomService(service)
this.showCustomService(service)
}
},
async getCustomServiceFromServer() {
const searchGlnRes = await this.$api.home.customService();
const {returnCode, data} = searchGlnRes;
if (returnCode === "0") {
localStorage.setItem('gs-custom-service', JSON.stringify(data))
this.showCustomService(data)
}
},
updateCustomService(list){
this.dzfw.forEach(item=>{
showCustomService(list) {
this.dzfw.forEach(item => {
item.isChecked = item.name === "更多定制"
list.forEach(_item=>{
if(_item==item.id){
list.forEach(_item => {
if (_item == item.id) {
item.isChecked = true
}
})
})
},
setCustomService() {
const service = []
this.dzfw.forEach(item=>{
if(item.isChecked && item.name !== "更多定制"){
service.push(parseInt(item.id,10))
this.dzfw.forEach(item => {
if (item.isChecked && item.name !== "更多定制") {
service.push(parseInt(item.id, 10))
}
})
localStorage.setItem('gs-custom-service',JSON.stringify(service))
localStorage.setItem('gs-custom-service', JSON.stringify(service))
this.updateCustomService(service)
},
async updateCustomService(service) {
const searchGlnRes = await this.$api.home.updateCustomService({service});
},
// 初始化
init() {
......@@ -1187,7 +1205,7 @@ export default {
setTimeout(() => {
this.messageDialog.isShow = false;
}, 2000);
}else{
} else {
this.setCustomService()
}
console.log(this.dzfw[i], "newValue");
......@@ -1667,6 +1685,7 @@ export default {
@media screen and (max-width: 992px) {
z-index: -1
}
img {
width: 100%;
height: 100%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment