Commit 52ea5a18 by tang

feat: 定制服务调试

parent b6009ded
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="d-none d-lg-block banner-tp">--> <!-- <div class="d-none d-lg-block banner-tp">-->
<!-- <img :src="el.picIndexPath" alt="" class="container"/>--> <!-- <img :src="el.picIndexPath" alt="" class="container"/>-->
<!-- </div>--> <!-- </div>-->
<div class="banner-bg"> <div class="banner-bg">
<img :src="el.picIndexPath" alt=""/> <img :src="el.picIndexPath" alt=""/>
</div> </div>
...@@ -993,34 +993,52 @@ export default { ...@@ -993,34 +993,52 @@ export default {
}, },
mounted() { mounted() {
this.getCustomService() this.getCustomService()
// 从后端获取最新的定制服务
this.getCustomServiceFromServer()
}, },
methods: { methods: {
getCustomService() { getCustomService() {
let service = localStorage.getItem('gs-custom-service') || '' let service = localStorage.getItem('gs-custom-service') || ''
console.log('getCustomService-----------', service) console.log('getCustomService-----------', service)
if(service) { if (service) {
service = JSON.parse(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 === "更多定制" item.isChecked = item.name === "更多定制"
list.forEach(_item=>{ list.forEach(_item => {
if(_item==item.id){ if (_item == item.id) {
item.isChecked = true item.isChecked = true
} }
}) })
}) })
}, },
setCustomService() { setCustomService() {
const service = [] const service = []
this.dzfw.forEach(item=>{ this.dzfw.forEach(item => {
if(item.isChecked && item.name !== "更多定制"){ if (item.isChecked && item.name !== "更多定制") {
service.push(parseInt(item.id,10)) 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() { init() {
...@@ -1187,7 +1205,7 @@ export default { ...@@ -1187,7 +1205,7 @@ export default {
setTimeout(() => { setTimeout(() => {
this.messageDialog.isShow = false; this.messageDialog.isShow = false;
}, 2000); }, 2000);
}else{ } else {
this.setCustomService() this.setCustomService()
} }
console.log(this.dzfw[i], "newValue"); console.log(this.dzfw[i], "newValue");
...@@ -1667,6 +1685,7 @@ export default { ...@@ -1667,6 +1685,7 @@ export default {
@media screen and (max-width: 992px) { @media screen and (max-width: 992px) {
z-index: -1 z-index: -1
} }
img { img {
width: 100%; width: 100%;
height: 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