Commit b68ee9346eff8598c543e6d1a8d0fa6a32af737d

Authored by zhiyangdu
1 parent 624810d5

和原生联调

src/components/giftGivingItem/giftGivingItem.vue
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 class="giftItem_box" 4 class="giftItem_box"
5 v-for="(item, index) in giftGivingItem" 5 v-for="(item, index) in giftGivingItem"
6 :key="index" 6 :key="index"
  7 + @click="onGiftGiving(item)"
7 > 8 >
8 <!--用户信息--> 9 <!--用户信息-->
9 <div class="user_info"> 10 <div class="user_info">
@@ -52,8 +53,9 @@ export default { @@ -52,8 +53,9 @@ export default {
52 props: ["giftGivingItem"], 53 props: ["giftGivingItem"],
53 created() {}, 54 created() {},
54 methods: { 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,12 +4,13 @@
4 class="giftItem_box" 4 class="giftItem_box"
5 v-for="(item, index) in receivingGiftsInfo" 5 v-for="(item, index) in receivingGiftsInfo"
6 :key="index" 6 :key="index"
  7 + @click="onReceivingGifts(item)"
7 > 8 >
8 <!--用户信息--> 9 <!--用户信息-->
9 <div class="user_info"> 10 <div class="user_info">
10 <img v-lazy="item.user.img" /> 11 <img v-lazy="item.user.img" />
11 <div class="name">{{ item.user.username }}(赠礼)</div> 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 <div class="gift_active"></div> 14 <div class="gift_active"></div>
14 </div> 15 </div>
15 <!--商品信息--> 16 <!--商品信息-->
@@ -136,8 +137,13 @@ export default { @@ -136,8 +137,13 @@ export default {
136 props: ["receivingGiftsInfo"], 137 props: ["receivingGiftsInfo"],
137 created() {}, 138 created() {},
138 methods: { 139 methods: {
  140 + // 回赠礼物跳转到商城
139 giftInReturn(item){ 141 giftInReturn(item){
140 this.$emit('giftInReturn',item) 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,15 +18,17 @@
18 infinite-scroll-disabled="loading" 18 infinite-scroll-disabled="loading"
19 :infinite-scroll-distance="50" 19 :infinite-scroll-distance="50"
20 > 20 >
21 - <!-- 礼列表 --> 21 + <!-- 礼列表 -->
22 <receiving-gifts-item 22 <receiving-gifts-item
23 v-show="active != 1 && active == 0" 23 v-show="active != 1 && active == 0"
24 @giftInReturn="giftInReturn" 24 @giftInReturn="giftInReturn"
  25 + @onReceivingGifts="onReceivingGifts"
25 :receivingGiftsInfo="receivingGiftsInfo" 26 :receivingGiftsInfo="receivingGiftsInfo"
26 ></receiving-gifts-item> 27 ></receiving-gifts-item>
27 - <!-- 礼列表 --> 28 + <!-- 礼列表 -->
28 <giftGivingItem 29 <giftGivingItem
29 - v-show="active != 0 && active == 1" 30 + @onGiftGiving="onGiftGiving"
  31 + v-show="active != 0 && active == 1"
30 :giftGivingItem="giftGivingItem" 32 :giftGivingItem="giftGivingItem"
31 > 33 >
32 </giftGivingItem> 34 </giftGivingItem>
@@ -65,11 +67,33 @@ export default { @@ -65,11 +67,33 @@ export default {
65 this.getorderGiftList(); 67 this.getorderGiftList();
66 // 送礼订单列表 68 // 送礼订单列表
67 this.getorderGiveGiftList(); 69 this.getorderGiveGiftList();
  70 + // 联调
  71 + this.setGiftBottomVisibleBySwitchTab();
68 }, 72 },
69 methods: { 73 methods: {
70 onTap(active) { 74 onTap(active) {
71 this.active = active; 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,6 +169,34 @@ export default {
145 this.$parent.gotoDetail(item); 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 */