/** * 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;