<!--
|
* @Author: 张嘉彬
|
* @Date: 2021-09-28 14:42:15
|
* @Description:
|
-->
|
<template>
|
<div class="notice-bar" ref="swiper" :style="{
|
width: infoData.width,
|
height: infoData.height,
|
position: 'absolute',
|
top: infoData.codeY,
|
left: infoData.codeX,
|
zIndex: infoData.z,
|
}">
|
<swiper :options="swiperOption" class="swiper-container" ref="noticeSwiper"
|
v-if="infoData.noticeList.length != 0" :style="{height: infoData.height}">
|
<swiper-slide v-for="item in infoData.noticeList" :key="item.id">
|
<div class="notice-box" @click="swiperclickfn(item)" :style="{height: infoData.height}">
|
{{ item.title }}</div>
|
</swiper-slide>
|
</swiper>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: 'Notice',
|
props: {
|
infoData: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
}
|
},
|
data () {
|
return {
|
swiperOption: {
|
direction: 'vertical',
|
autoplay: {
|
delay: 2000,
|
disableOnInteraction: false
|
}
|
}
|
}
|
},
|
methods: {
|
// "消息类型:1 商品推送,2 文章推送,3 系统消息,4 活动消息,5 账号通知 6 物流消息"
|
swiperclickfn (active) {
|
if (this.$route.query.isPreview) return
|
// 商品详情
|
if (active.messageType === '1') {
|
const _obj = { shopSpuId: active.shopSpuId }
|
const params = active.shopSkuId ? { ..._obj, ...{ shopSkuId: active.shopSkuId } } : _obj
|
console.log(params, '====商品详情传参')
|
if (this.$root.isIos) {
|
const _strP = `?shopSpuId=${params.shopSpuId}`
|
window.webkit.messageHandlers.iosRouter.postMessage(
|
`wlyxls://product_detail${params.shopSkuId ? `${_strP}&shopSkuId=${params.shopSkuId}` : _strP}`
|
)
|
} else {
|
window.wlyxls.toCommodityDetailPage(JSON.stringify(params))
|
}
|
}
|
if (active.messageType === '2') {
|
this.goMsgCentre(active, 1)
|
}
|
if (active.messageType === '5' || active.messageType === '3') {
|
this.goMsgCentre(active, 2)
|
}
|
// 满减满赠
|
if (active.messageType === '4') {
|
const params = { promotionId: active.promotionId || '' }
|
if (this.$root.isIos) {
|
window.webkit.messageHandlers.iosRouter.postMessage(
|
`wlyxls://category_search_result?promotionId=${params.promotionId}`
|
)
|
} else {
|
window.wlyxls.toActivityCommodityListPage(JSON.stringify(params))
|
}
|
}
|
// 订单详情
|
if (active.messageType === '6') {
|
const params = { orderId: active.prodNo }
|
if (this.$root.isIos) {
|
window.webkit.messageHandlers.iosRouter.postMessage(
|
`wlyxls://order_detail?orderId=${params.orderId}`
|
)
|
} else {
|
window.wlyxls.toOrderDetailPage(JSON.stringify(params))
|
}
|
}
|
},
|
/*
|
* @Author: huangpan
|
* @params: active:选中的详细信息 position:选中项 0-物流列表/1-活动列表/2-系统消息
|
* @Description:跳转到消息中心
|
* @Date: 2022-01-18 09:24:47
|
*/
|
goMsgCentre (active, position) {
|
const p1 = { url: active.jumpLink, isShowTitle: true }
|
const p2 = { position: position }
|
if (this.$root.isIos) {
|
if (p1.url) {
|
console.log(`wlyxls://browser?url=${encodeURIComponent(p1.url)}&isShowTitle=${p1.isShowTitle}`)
|
window.webkit.messageHandlers.iosRouter.postMessage(
|
`wlyxls://browser?url=${encodeURIComponent(p1.url)}&isShowTitle=${p1.isShowTitle}`
|
)
|
} else {
|
window.webkit.messageHandlers.iosRouter.postMessage(
|
`wlyxls://message_center?position=${p2.position}`
|
)
|
}
|
} else {
|
if (p1.url) {
|
window.wlyxls.openUrlOnNewPage(JSON.stringify(p1))
|
} else {
|
window.wlyxls.toMessageCenterPage(JSON.stringify(p2))
|
}
|
}
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.notice-box {
|
height: 100%;
|
display: flex;
|
align-items: center;
|
}
|
</style>
|