Commit b68ee9346eff8598c543e6d1a8d0fa6a32af737d
1 parent
624810d5
和原生联调
Showing
3 changed files
with
66 additions
and
6 deletions
src/components/giftGivingItem/giftGivingItem.vue
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | class="giftItem_box" |
| 5 | 5 | v-for="(item, index) in giftGivingItem" |
| 6 | 6 | :key="index" |
| 7 | + @click="onGiftGiving(item)" | |
| 7 | 8 | > |
| 8 | 9 | <!--用户信息--> |
| 9 | 10 | <div class="user_info"> |
| ... | ... | @@ -52,8 +53,9 @@ export default { |
| 52 | 53 | props: ["giftGivingItem"], |
| 53 | 54 | created() {}, |
| 54 | 55 | methods: { |
| 55 | - giftInReturn(item) { | |
| 56 | - this.$emit("giftInReturn", item); | |
| 56 | + // 跳转到礼物详情页 | |
| 57 | + onGiftGiving(item){ | |
| 58 | + this.$emit('onGiftGiving',item) | |
| 57 | 59 | } |
| 58 | 60 | } |
| 59 | 61 | }; | ... | ... |
src/components/receivingGiftsItem/receivingGiftsItem.vue
| ... | ... | @@ -4,12 +4,13 @@ |
| 4 | 4 | class="giftItem_box" |
| 5 | 5 | v-for="(item, index) in receivingGiftsInfo" |
| 6 | 6 | :key="index" |
| 7 | + @click="onReceivingGifts(item)" | |
| 7 | 8 | > |
| 8 | 9 | <!--用户信息--> |
| 9 | 10 | <div class="user_info"> |
| 10 | 11 | <img v-lazy="item.user.img" /> |
| 11 | 12 | <div class="name">{{ item.user.username }}(赠礼)</div> |
| 12 | - <div @click="giftInReturn(item)" class="btn">回赠礼物</div> | |
| 13 | + <div v-on:click.stop="giftInReturn(item)" class="btn">回赠礼物</div> | |
| 13 | 14 | <div class="gift_active"></div> |
| 14 | 15 | </div> |
| 15 | 16 | <!--商品信息--> |
| ... | ... | @@ -136,8 +137,13 @@ export default { |
| 136 | 137 | props: ["receivingGiftsInfo"], |
| 137 | 138 | created() {}, |
| 138 | 139 | methods: { |
| 140 | + // 回赠礼物跳转到商城 | |
| 139 | 141 | giftInReturn(item){ |
| 140 | 142 | this.$emit('giftInReturn',item) |
| 143 | + }, | |
| 144 | + // 跳转到礼物详情页 | |
| 145 | + onReceivingGifts(item){ | |
| 146 | + this.$emit('onReceivingGifts',item) | |
| 141 | 147 | } |
| 142 | 148 | } |
| 143 | 149 | }; | ... | ... |
src/pages/myGiftBox/myGiftBox.vue
| ... | ... | @@ -18,15 +18,17 @@ |
| 18 | 18 | infinite-scroll-disabled="loading" |
| 19 | 19 | :infinite-scroll-distance="50" |
| 20 | 20 | > |
| 21 | - <!-- 送礼列表 --> | |
| 21 | + <!-- 收礼列表 --> | |
| 22 | 22 | <receiving-gifts-item |
| 23 | 23 | v-show="active != 1 && active == 0" |
| 24 | 24 | @giftInReturn="giftInReturn" |
| 25 | + @onReceivingGifts="onReceivingGifts" | |
| 25 | 26 | :receivingGiftsInfo="receivingGiftsInfo" |
| 26 | 27 | ></receiving-gifts-item> |
| 27 | - <!-- 收礼列表 --> | |
| 28 | + <!-- 送礼列表 --> | |
| 28 | 29 | <giftGivingItem |
| 29 | - v-show="active != 0 && active == 1" | |
| 30 | + @onGiftGiving="onGiftGiving" | |
| 31 | + v-show="active != 0 && active == 1" | |
| 30 | 32 | :giftGivingItem="giftGivingItem" |
| 31 | 33 | > |
| 32 | 34 | </giftGivingItem> |
| ... | ... | @@ -65,11 +67,33 @@ export default { |
| 65 | 67 | this.getorderGiftList(); |
| 66 | 68 | // 送礼订单列表 |
| 67 | 69 | this.getorderGiveGiftList(); |
| 70 | + // 联调 | |
| 71 | + this.setGiftBottomVisibleBySwitchTab(); | |
| 68 | 72 | }, |
| 69 | 73 | methods: { |
| 70 | 74 | onTap(active) { |
| 71 | 75 | this.active = active; |
| 72 | 76 | }, |
| 77 | + /** | |
| 78 | + * 显示和隐藏聊天 | |
| 79 | + */ | |
| 80 | + setGiftBottomVisibleBySwitchTab() { | |
| 81 | + | |
| 82 | + // App内 | |
| 83 | + if (this.isCNLive.value) { | |
| 84 | + | |
| 85 | + // 调用App,返回按键 | |
| 86 | + if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.setGiftBottomVisibleBySwitchTab) { | |
| 87 | + | |
| 88 | + // App内,iOS销毁WebView | |
| 89 | + window.webkit.messageHandlers.setGiftBottomVisibleBySwitchTab.postMessage({body: {visible: 1}}); | |
| 90 | + } else if (window.obj && window.obj.setGiftBottomVisibleBySwitchTab) { | |
| 91 | + | |
| 92 | + // App内,Android销毁WebView | |
| 93 | + window.obj.setGiftBottomVisibleBySwitchTab(1); | |
| 94 | + } | |
| 95 | + } | |
| 96 | + }, | |
| 73 | 97 | /** |
| 74 | 98 | * 获取收礼礼物列表 |
| 75 | 99 | */ |
| ... | ... | @@ -145,6 +169,34 @@ export default { |
| 145 | 169 | this.$parent.gotoDetail(item); |
| 146 | 170 | } |
| 147 | 171 | }, |
| 172 | + // 收礼商品跳转到详情页 | |
| 173 | + onReceivingGifts(item) { | |
| 174 | + // 判断并调用通用跳转 | |
| 175 | + if (typeof this.$parent.gotoDetail === "function") { | |
| 176 | + // 临时,设置跳转商品详情参数 | |
| 177 | + Object.assign(item, { | |
| 178 | + type: "26", | |
| 179 | + to: "", | |
| 180 | + shop_type: "" | |
| 181 | + }); | |
| 182 | + | |
| 183 | + this.$parent.gotoDetail(item); | |
| 184 | + } | |
| 185 | + }, | |
| 186 | + // 送礼商品跳转到详情页 | |
| 187 | + onGiftGiving(item) { | |
| 188 | + // 判断并调用通用跳转 | |
| 189 | + if (typeof this.$parent.gotoDetail === "function") { | |
| 190 | + // 临时,设置跳转商品详情参数 | |
| 191 | + Object.assign(item, { | |
| 192 | + type: "36", | |
| 193 | + to: "", | |
| 194 | + shop_type: "" | |
| 195 | + }); | |
| 196 | + | |
| 197 | + this.$parent.gotoDetail(item); | |
| 198 | + } | |
| 199 | + }, | |
| 148 | 200 | /** |
| 149 | 201 | * 获取送礼礼物列表 |
| 150 | 202 | */ | ... | ... |