Showing
2 changed files
with
16 additions
and
2 deletions
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | import 'scss/activity/have-gain-promodetail.page.scss'; | 2 | import 'scss/activity/have-gain-promodetail.page.scss'; |
3 | import $ from 'yoho-jquery'; | 3 | import $ from 'yoho-jquery'; |
4 | const tip = require('js/plugin/tip'); | 4 | const tip = require('js/plugin/tip'); |
5 | +const yoho = require('../yoho-app'); | ||
5 | 6 | ||
6 | const $promoStatus = $('.promo-status.js-submit'); | 7 | const $promoStatus = $('.promo-status.js-submit'); |
7 | 8 | ||
@@ -9,6 +10,14 @@ function joinActivity(id) { | @@ -9,6 +10,14 @@ function joinActivity(id) { | ||
9 | return $.post(`/activity/have-gain/promo/${id}`); | 10 | return $.post(`/activity/have-gain/promo/${id}`); |
10 | } | 11 | } |
11 | 12 | ||
13 | +function click(url) { | ||
14 | + let a = document.createElement('a'); | ||
15 | + | ||
16 | + a.href = url; | ||
17 | + document.body.appendChild(a); | ||
18 | + a.click(); | ||
19 | +} | ||
20 | + | ||
12 | $promoStatus.on('click', function() { | 21 | $promoStatus.on('click', function() { |
13 | const $this = $(this); | 22 | const $this = $(this); |
14 | const url = $this.data('url'); | 23 | const url = $this.data('url'); |
@@ -24,7 +33,11 @@ $promoStatus.on('click', function() { | @@ -24,7 +33,11 @@ $promoStatus.on('click', function() { | ||
24 | if (pid) { | 33 | if (pid) { |
25 | joinActivity(pid).then(result => { | 34 | joinActivity(pid).then(result => { |
26 | if (result.code === 400) { | 35 | if (result.code === 400) { |
27 | - window.location.href = result.redirect; | 36 | + if (yoho.isApp) { |
37 | + yoho.goLogin(window.location.href); | ||
38 | + } else { | ||
39 | + window.location.href = result.redirect; | ||
40 | + } | ||
28 | return; | 41 | return; |
29 | } | 42 | } |
30 | 43 | ||
@@ -52,7 +65,7 @@ $promoStatus.on('click', function() { | @@ -52,7 +65,7 @@ $promoStatus.on('click', function() { | ||
52 | break; | 65 | break; |
53 | } | 66 | } |
54 | case 3: { | 67 | case 3: { |
55 | - window.location.href = url; | 68 | + click(url); |
56 | break; | 69 | break; |
57 | } | 70 | } |
58 | default: | 71 | default: |
-
Please register or login to post a comment