|
|
@@ -78,7 +78,9 @@
|
|
|
// url: '',
|
|
|
// clipboard: {},
|
|
|
showMainSearch: false,
|
|
|
- title: '优软商城'
|
|
|
+ title: '优软商城',
|
|
|
+ showHeader: false,
|
|
|
+ showSearch: false
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
@@ -102,13 +104,13 @@
|
|
|
},
|
|
|
component () {
|
|
|
return this.$store.state.componentDetail.detail.data
|
|
|
- },
|
|
|
- showHeader () {
|
|
|
- return this.$route.path !== '/' || !this.$route.path || this.$route.path === ''
|
|
|
- },
|
|
|
- showSearch () {
|
|
|
- return this.$route.path !== '/' && !this.$route.path.startsWith('/mobile/search')
|
|
|
}
|
|
|
+// showHeader () {
|
|
|
+// return this.$route.path !== '/' || !this.$route.path || this.$route.path === ''
|
|
|
+// },
|
|
|
+// showSearch () {
|
|
|
+// return this.$route.path !== '/' && !this.$route.path.startsWith('/mobile/search')
|
|
|
+// }
|
|
|
},
|
|
|
// mounted () {
|
|
|
// let _this = this
|
|
|
@@ -128,14 +130,23 @@
|
|
|
window.history.back(-1)
|
|
|
},
|
|
|
initHeader: function (val) {
|
|
|
+// if (val !== '/' || !val || val === '') {
|
|
|
+// this.showHeader = true
|
|
|
+// this.showSearch = !val.startsWith('/mobile/search')
|
|
|
+// } else {
|
|
|
+// this.showHeader = false
|
|
|
+// this.showSearch = false
|
|
|
+// }
|
|
|
+ this.showHeader = val !== '/' || !val || val === ''
|
|
|
+ this.showSearch = val !== '/' && !this.startWith(val, '/mobile/search')
|
|
|
let title = '优软商城'
|
|
|
- if (val.startsWith('/mobile/brand/componentDetail/')) {
|
|
|
+ if (this.startWith(val, '/mobile/brand/componentDetail/')) {
|
|
|
title = this.component.code
|
|
|
// this.rightIcon = 'share'
|
|
|
- } else if (val.startsWith('/mobile/brand/brandCenter')) {
|
|
|
+ } else if (this.startWith(val, '/mobile/brand/brandCenter')) {
|
|
|
title = '品牌墙'
|
|
|
// this.rightIcon = 'share'
|
|
|
- } else if (val.startsWith('/mobile/brand/')) {
|
|
|
+ } else if (this.startWith(val, '/mobile/brand/')) {
|
|
|
if (this.brandDetail.nameCn) {
|
|
|
if (this.brandDetail.nameCn !== this.brandDetail.nameEn) {
|
|
|
title = this.brandDetail.nameEn + '(' + this.brandDetail.nameCn + ')'
|
|
|
@@ -150,16 +161,16 @@
|
|
|
}
|
|
|
}
|
|
|
// this.rightIcon = 'share'
|
|
|
- } else if (val.startsWith('/mobile/shop/')) {
|
|
|
+ } else if (this.startWith(val, '/mobile/shop/')) {
|
|
|
title = this.store.storeName
|
|
|
// this.rightIcon = 'phone'
|
|
|
- } else if (val.startsWith('/mobile/shop')) {
|
|
|
+ } else if (this.startWith(val, '/mobile/shop')) {
|
|
|
title = '店铺列表'
|
|
|
// this.rightIcon = 'phone'
|
|
|
- } else if (val.startsWith('/mobile/user')) {
|
|
|
+ } else if (this.startWith(val, '/mobile/user')) {
|
|
|
title = '我的收藏'
|
|
|
// this.rightIcon = 'phone'
|
|
|
- } else if (val.startsWith('/mobile/search')) {
|
|
|
+ } else if (this.startWith(val, '/mobile/search')) {
|
|
|
title = '搜索结果'
|
|
|
// this.rightIcon = 'share'
|
|
|
} else if (val === '' || val === '/' || !val) {
|
|
|
@@ -240,12 +251,15 @@
|
|
|
goMainSearch: function () {
|
|
|
this.showMainSearch = true
|
|
|
this.$store.dispatch('searchData/getSearchHistory')
|
|
|
+ },
|
|
|
+ startWith: function (str, s) {
|
|
|
+ let reg = new RegExp('^' + s)
|
|
|
+ return reg.test(str)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
- @import '~assets/scss/mobileCommon';
|
|
|
.mobile-header{
|
|
|
width:100%;
|
|
|
height:.88rem;
|