ann0707
2018-08-16 c9bc8ec61cff4076132f6396d99d383a2cdf5a03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * Created by cy
 * 2017/11/27.
 * 产品申请时跳转链接
 */
/**
 * 产品详情的跳转与sessionStorage的设置
 * @param response
 * @param context
 * @param productOrglink
 */
import {querystring} from 'vux';
 
function jumpAndSetSession(response, context, productOrglink) {
    window.sessionStorage.setItem('newProductDetailPage', productOrglink);
    // 加上这个参数,是为了传递个后台,每一个收入贷接口都要加上这个prodId这个参数
    context.$router.push({
        path: response.body,
        query: {prodId: context.$route.query.id}
    });
}
 
/**
 * 根据产品的类型判断,进行页面的跳转
 * @param { Object } response 后台返回的response
 * @param { Object } context 上下文对象(即this对象)
 * @param { String } productOrglink 当前页面的全路由
 */
function productJump(response, context, productOrglink) {
    let url = decodeURIComponent(response.body);
    // 如果是来自于收入贷,那么此时的非标准产品
    if (response.body.indexOf('/incomeLoan') !== -1) {
        jumpAndSetSession(response, context, productOrglink)
    } else if (response.body.split('/')[1] == 'bnd') {
        jumpAndSetSession(response, context, productOrglink)
    } else if (url.indexOf('/f-raindrops') !== -1) {
        let params = querystring.parse(url.split('?')[1]);
        context.$router.push({
            path: '/f-raindrops',
            query: params
        })
    } else {
        // 这个是跳转第三方链接的产品
        window.location.href = decodeURIComponent(response.body);
    }
}
 
export default productJump;