Commit 203588fd14122ee905b788ebbce9df9476025106
1 parent
d19ce286
积分商城首页
Showing
2 changed files
with
107 additions
and
3 deletions
src/pages/pointsMall/pointsMall.less
src/pages/pointsMall/pointsMall.vue
| ... | ... | @@ -113,8 +113,11 @@ |
| 113 | 113 | import goodsItem2 from "@/components/goodsItem_2/goodsItem_2"; |
| 114 | 114 | import columnListBox from "@/components/columnListBox/columnListBox"; |
| 115 | 115 | export default { |
| 116 | + name: 'pointsmall', | |
| 116 | 117 | data () { |
| 117 | 118 | return { |
| 119 | + title: "", // 标题 | |
| 120 | + backs: null, // 后退按钮组 | |
| 118 | 121 | goodsLists: null, // 为你推荐商品 |
| 119 | 122 | phyicalGoods: null, // 实物商品 |
| 120 | 123 | virtualGoods: null, // 虚拟商品 |
| ... | ... | @@ -138,9 +141,9 @@ export default { |
| 138 | 141 | //方法表示一个具体的操作,主要书写业务逻辑; |
| 139 | 142 | methods: { |
| 140 | 143 | /** |
| 141 | - * 跳转商品详情 | |
| 142 | - * @param {Object} item [数据对象] | |
| 143 | - */ | |
| 144 | + * 跳转商品详情 | |
| 145 | + * @param {Object} item [数据对象] | |
| 146 | + */ | |
| 144 | 147 | toDetail (item) { |
| 145 | 148 | |
| 146 | 149 | // 判断通用跳转函数是否存在 |
| ... | ... | @@ -154,9 +157,78 @@ export default { |
| 154 | 157 | this.$parent.gotoDetail(item); |
| 155 | 158 | } |
| 156 | 159 | }, |
| 160 | + /** | |
| 161 | + * 分享 | |
| 162 | + */ | |
| 163 | + toShare () { | |
| 164 | + | |
| 165 | + // 判断分享 | |
| 166 | + if (typeof this.$parent.toShare === 'function') { | |
| 167 | + this.$parent.toShare(38, this.$route.query.id || 0); | |
| 168 | + } | |
| 169 | + }, | |
| 170 | + | |
| 171 | + /** | |
| 172 | + * 后退 | |
| 173 | + */ | |
| 174 | + back () { | |
| 175 | + | |
| 176 | + // 判断是否有处理函数 | |
| 177 | + if (typeof this.$parent.back === 'function') { | |
| 178 | + | |
| 179 | + // 后退 | |
| 180 | + this.$parent.back(); | |
| 181 | + } else { | |
| 182 | + | |
| 183 | + // 后退 | |
| 184 | + window.history.go(-1); | |
| 185 | + } | |
| 186 | + } | |
| 187 | + }, | |
| 188 | + head: { | |
| 189 | + title () { | |
| 190 | + return { | |
| 191 | + inner: this.title | |
| 192 | + } | |
| 193 | + } | |
| 194 | + }, | |
| 195 | + watch: { | |
| 196 | + | |
| 197 | + // 设置页面标题 | |
| 198 | + title (newVal) { | |
| 199 | + if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") { | |
| 200 | + this.$iFrame.insertIFrame(newVal); | |
| 201 | + } else { | |
| 202 | + this.$emit("updateHead"); | |
| 203 | + } | |
| 204 | + } | |
| 157 | 205 | }, |
| 158 | 206 | //请求数据 |
| 159 | 207 | created () { |
| 208 | + // 设置标题 | |
| 209 | + this.$set(this, "title", "优选"); | |
| 210 | + | |
| 211 | + // 判断是否在App内 | |
| 212 | + if (this.isCNLive.value) { | |
| 213 | + | |
| 214 | + // 添加后退按钮组“后退”和“分享”按钮 | |
| 215 | + this.$set(this, 'backs', { | |
| 216 | + funcs: { | |
| 217 | + back: { | |
| 218 | + icon: "static/img/icon_back.png" | |
| 219 | + }, | |
| 220 | + funcArray: [ | |
| 221 | + { | |
| 222 | + icon: "static/img/icon_share.png", | |
| 223 | + func: this.toShare | |
| 224 | + } | |
| 225 | + ] | |
| 226 | + } | |
| 227 | + }); | |
| 228 | + | |
| 229 | + // 设置标题 | |
| 230 | + this.$set(this.backs, 'title', '优选'); | |
| 231 | + } | |
| 160 | 232 | // 临时,为你推荐商品数据 |
| 161 | 233 | this.$set(this, 'goodsLists', [ |
| 162 | 234 | { |
| ... | ... | @@ -405,6 +477,27 @@ export default { |
| 405 | 477 | }); |
| 406 | 478 | }, |
| 407 | 479 | mounted () { |
| 480 | + // 如果是App外,设置唤起App和微信内分享参数 | |
| 481 | + if (!this.isCNLive.value) { | |
| 482 | + | |
| 483 | + // 唤起详情页 | |
| 484 | + if (typeof this.$parent.getOpenApp === "function") { | |
| 485 | + this.$parent.getOpenApp({ | |
| 486 | + type: 38, | |
| 487 | + id: this.$route.query.id || 1, | |
| 488 | + url: "" | |
| 489 | + }); | |
| 490 | + } | |
| 491 | + | |
| 492 | + // 分享详情页 | |
| 493 | + if (typeof this.$parent.getShareData === "function") { | |
| 494 | + this.$parent.getShareData({ | |
| 495 | + type: 38, | |
| 496 | + id: this.$route.query.id || 1, | |
| 497 | + url: "" | |
| 498 | + }); | |
| 499 | + } | |
| 500 | + } | |
| 408 | 501 | } |
| 409 | 502 | } |
| 410 | 503 | </script> | ... | ... |