[FIX]【商品商城】商品详情页样式调整

This commit is contained in:
yuweiqi
2020-07-01 15:55:54 +08:00
parent 446094d8d5
commit a5ee96c279

View File

@@ -5,10 +5,13 @@
<van-notice-bar wrapable :scrollable="false" text="温馨提示:您即将离开本站,访问的链接来源于第三方网站,可能存在风险,请谨慎操作!" /> <van-notice-bar wrapable :scrollable="false" text="温馨提示:您即将离开本站,访问的链接来源于第三方网站,可能存在风险,请谨慎操作!" />
</div> </div>
<div class="img-store clearfix"> <div class="img-store clearfix">
<div><img :src="$assetsUrl + detail.topImgUrl" alt="" width="100%" /></div> <div><img v-if="loaded" :src="$assetsUrl + detail.topImgUrl" alt="" width="100%" /></div>
<div class="mindle-img" :style="{ 'background-color': detail.color }"><img :src="$assetsUrl + detail.middleImgUrl" alt="" width="100%" /></div> <div>
<img v-if="loaded" @load="imageLoaded($event)" :src="$assetsUrl + detail.middleImgUrl" alt="" width="100%" />
<div class="mindle-img" :style="{ 'background-color': detail.color }" ref="fillContent"></div>
</div>
<div class="bottom-img"> <div class="bottom-img">
<img :src="$assetsUrl + detail.footerImgUrl" alt="" width="100%" /> <img v-if="loaded" :src="$assetsUrl + detail.footerImgUrl" alt="" width="100%" />
<div v-if="isWeixin"> <div v-if="isWeixin">
<van-field <van-field
v-model="loginInfo.aname" v-model="loginInfo.aname"
@@ -52,7 +55,6 @@ export default {
data() { data() {
let isWeixin = this.$utils.device().isWeixin //判断环境 let isWeixin = this.$utils.device().isWeixin //判断环境
return { return {
// bgc: '', //
isWeixin, //是否在微信 isWeixin, //是否在微信
mallId: '', //商城id mallId: '', //商城id
shareId: '', //分享id shareId: '', //分享id
@@ -68,7 +70,8 @@ export default {
linkUrl: '', //商城外链地址 linkUrl: '', //商城外链地址
name: '', //商城名称 name: '', //商城名称
color: '' //背景色 color: '' //背景色
} },
loaded: false
} }
}, },
created() { created() {
@@ -86,46 +89,34 @@ export default {
}, 100) }, 100)
} }
this.mallId = this.$route.query.mallId this.mallId = this.$route.query.mallId
},
async mounted() {
if (this.isWeixin) { if (this.isWeixin) {
window.localStorage.setItem('token', this.$route.query.token) window.localStorage.setItem('token', this.$route.query.token)
this.loginInfo.aname = decodeURI(this.$route.query.aname) this.loginInfo.aname = decodeURI(this.$route.query.aname)
this.loginInfo.password = decodeURI(this.$route.query.password) this.loginInfo.password = decodeURI(this.$route.query.password)
this.shareId = this.$route.query.shareId this.shareId = this.$route.query.shareId
this.name = decodeURI(this.$route.query.name) this.name = decodeURI(this.$route.query.name)
this.saveShareTrack({ id: this.shareId, mallId: this.mallId }) await this.saveShareTrack({ id: this.shareId, mallId: this.mallId })
} }
},
async mounted() {
await this.getShopList({ id: this.mallId }) await this.getShopList({ id: this.mallId })
window['appCallBack'] = this.appCallBack window['appCallBack'] = this.appCallBack
document.getElementsByTagName('body')[0].style.backgroundColor = this.detail.color
// this.bgc = document.getElementsByTagName('body')[0].style.backgroundColor
},
destroyed() {
// document.getElementsByTagName('body')[0].classList.remove('bg-white')
// document.getElementsByTagName('body')[0].style.backgroundColor = this.bgc
}, },
methods: { methods: {
//获取商城详情 //获取商城详情
getShopList(data) { async getShopList(data) {
return new Promise((resolve, reject) => { const res = await getShopList(data).catch(err => {
getShopList(data).then( this.loaded = false
res => { })
this.$toast.clear() if (!res) return
if (res.result == '0') { if (res.result == '0') {
this.detail = res.content[0] this.detail = res.content[0]
this.loaded = true
this.isCanCheck = false this.isCanCheck = false
resolve()
} else { } else {
reject(this.$toast(res.resultMessage)) this.$toast(res.resultMessage)
} }
}, },
error => {
reject(this.$toast(error))
}
)
})
},
//查看 //查看
check() { check() {
window.location.href = this.detail.linkUrl window.location.href = this.detail.linkUrl
@@ -144,12 +135,15 @@ export default {
}, },
//分享轨迹保存 //分享轨迹保存
saveShareTrack(data) { saveShareTrack(data) {
return new Promise((resolve, reject) => {
saveShareTrack(data).then(res => { saveShareTrack(data).then(res => {
if (res.result == '0') { if (res.result == '0') {
resolve()
} else { } else {
this.$toast(res.resultMessage) reject(this.$toast(res.resultMessage))
} }
}) })
})
}, },
//app回调 //app回调
appCallBack(data) { appCallBack(data) {
@@ -166,6 +160,13 @@ export default {
} }
}) })
} }
},
imageLoaded(e) {
const screeVH = window.innerHeight,
detailVH = e.path[3].offsetHeight
this.$nextTick(() => {
screeVH - detailVH > 0 ? (this.$refs.fillContent.style.height = screeVH - detailVH + 'px') : '0px'
})
} }
} }
} }
@@ -176,10 +177,6 @@ export default {
/deep/.van-field__label { /deep/.van-field__label {
width: 40%; width: 40%;
} }
.img-store > div {
float: left;
width: 100%;
}
.img-store { .img-store {
img { img {
display: block; display: block;
@@ -187,9 +184,6 @@ export default {
/deep/.van-button { /deep/.van-button {
width: 100%; width: 100%;
} }
.mindle-img {
height: 75vh;
}
} }
} }
</style> </style>