Commit 615c4ab871f3e9b34d8c0e80b417679eb9308c10
1 parent
a9d32cb6
购好物,8月需求开发中,低版本兼容判断~
Showing
1 changed file
with
53 additions
and
18 deletions
src/pages/optimization2/optimization2.vue
| ... | ... | @@ -393,6 +393,8 @@ |
| 393 | 393 | showNavs: false, // 是否显示其它频道跳转,默认不显示 |
| 394 | 394 | showIntegral: false, // 是否显示积分商城模块,默认不显示 |
| 395 | 395 | showOptimization: true, // 默认显示品质优选,高版本不显示品质优选 |
| 396 | + toAddToShoppingCart: false, // 是否支持App内“好物推荐”的“+”加入购物车,默认跳转详情 | |
| 397 | + toJumpToShopSearch: false, // 是否支持App内搜索栏跳转原生搜索页面,默认跳转H5搜索页面 | |
| 396 | 398 | points: null, // 用户积分 |
| 397 | 399 | pointsLists: null, // 积分商城数据 |
| 398 | 400 | pointsData: { |
| ... | ... | @@ -657,6 +659,14 @@ |
| 657 | 659 | // 获取平台版本 |
| 658 | 660 | let version = this.$route.query.version; |
| 659 | 661 | |
| 662 | + // 根据平台,判断是否符合版本,支持列表的“+”加入购物车/搜索跳转原生 | |
| 663 | + if ((this.isiPhone.value && this.$parent.compareVersion(version, '2.0.0')) || (this.isAndroid.value && this.$parent.compareVersion(version, '1.8.7.0'))) { | |
| 664 | + | |
| 665 | + // 设置列表的“+”加入购物车/搜索跳转原生 | |
| 666 | + this.$set(this, 'toAddToShoppingCart', true); | |
| 667 | + this.$set(this, 'toJumpToShopSearch', true); | |
| 668 | + } | |
| 669 | + | |
| 660 | 670 | // 根据平台,判断是否符合版本,显示搜索和其它导航菜单 |
| 661 | 671 | if ((this.isiPhone.value && this.$parent.compareVersion(version, '1.9.6')) || (this.isAndroid.value && this.$parent.compareVersion(version, '1.8.5.3'))) { |
| 662 | 672 | |
| ... | ... | @@ -1078,11 +1088,19 @@ |
| 1078 | 1088 | // 判断是否在App内 |
| 1079 | 1089 | if (this.isCNLive.value) { |
| 1080 | 1090 | |
| 1081 | - // 判断加入购物车函数是否存在 | |
| 1082 | - if (typeof this.$parent.addToShoppingCart === 'function') { | |
| 1091 | + // 判断App版本是否支持“好物推荐”的“+”加入购物车 | |
| 1092 | + if (this.toAddToShoppingCart) { | |
| 1093 | + | |
| 1094 | + // 判断加入购物车函数是否存在 | |
| 1095 | + if (typeof this.$parent.addToShoppingCart === 'function') { | |
| 1096 | + | |
| 1097 | + // 加入购物车 | |
| 1098 | + this.$parent.addToShoppingCart(item); | |
| 1099 | + } | |
| 1100 | + } else { | |
| 1083 | 1101 | |
| 1084 | - // 加入购物车 | |
| 1085 | - this.$parent.addToShoppingCart(item); | |
| 1102 | + // 跳转详情页面 | |
| 1103 | + this.toDetail(item); | |
| 1086 | 1104 | } |
| 1087 | 1105 | } else { |
| 1088 | 1106 | |
| ... | ... | @@ -1099,27 +1117,44 @@ |
| 1099 | 1117 | // 判断是否在App内 |
| 1100 | 1118 | if (this.isCNLive.value) { |
| 1101 | 1119 | |
| 1102 | - // 判断加入购物车函数是否存在 | |
| 1103 | - if (typeof this.$parent.jumpToShopSearch === 'function') { | |
| 1120 | + // 判断App版本是否支持跳转原生搜索页面 | |
| 1121 | + if (this.toJumpToShopSearch) { | |
| 1104 | 1122 | |
| 1105 | - // 跳转搜索页面(原生交互) | |
| 1106 | - this.$parent.jumpToShopSearch(); | |
| 1123 | + // 判断加入购物车函数是否存在 | |
| 1124 | + if (typeof this.$parent.jumpToShopSearch === 'function') { | |
| 1125 | + | |
| 1126 | + // 跳转搜索页面(原生交互) | |
| 1127 | + this.$parent.jumpToShopSearch(); | |
| 1128 | + } | |
| 1129 | + } else { | |
| 1130 | + | |
| 1131 | + // 跳转搜索页面(H5,跳转封装) | |
| 1132 | + this.toSearchH5(); | |
| 1107 | 1133 | } |
| 1108 | 1134 | } else { |
| 1109 | 1135 | |
| 1110 | 1136 | // 跳转搜索页面(H5,跳转封装) |
| 1111 | - if (typeof this.$parent.gotoDetail === 'function') { | |
| 1137 | + this.toSearchH5(); | |
| 1138 | + } | |
| 1139 | + }, | |
| 1112 | 1140 | |
| 1113 | - // 设置跳转参数 | |
| 1114 | - let params = { | |
| 1115 | - type: '5', | |
| 1116 | - to: window.location.origin + window.location.pathname + '#/search', | |
| 1117 | - shop_type: '' | |
| 1118 | - }; | |
| 1141 | + /** | |
| 1142 | + * 跳转H5搜索页面 | |
| 1143 | + */ | |
| 1144 | + toSearchH5() { | |
| 1119 | 1145 | |
| 1120 | - // 页面跳转 | |
| 1121 | - this.$parent.gotoDetail(params); | |
| 1122 | - } | |
| 1146 | + // 跳转搜索页面(H5,跳转封装) | |
| 1147 | + if (typeof this.$parent.gotoDetail === 'function') { | |
| 1148 | + | |
| 1149 | + // 设置跳转参数 | |
| 1150 | + let params = { | |
| 1151 | + type: '5', | |
| 1152 | + to: window.location.origin + window.location.pathname + '#/search', | |
| 1153 | + shop_type: '' | |
| 1154 | + }; | |
| 1155 | + | |
| 1156 | + // 页面跳转 | |
| 1157 | + this.$parent.gotoDetail(params); | |
| 1123 | 1158 | } |
| 1124 | 1159 | }, |
| 1125 | 1160 | ... | ... |