jump-to-miniapp.js 1.08 KB
import wx from '../utils/wx';
import {stringify} from '../vendors/query-string';

const appData = {
    yohobuyLimitChannel: {
        appId: 'wxed31f9e8705fb8d1',
        page: {
            limitProductList: 'pages/index/index',
            limitProductDetail: 'pages/product/detail/detail'
        }
    },
    groupBuy: { // 拼团
        appId: 'wx207f18be42db9028',
        page: {
            home: '/pages/group/home',
            detail: '/pages/group/detail',
            list: '/pages/group/list'
        }
    },
    yoLuck: {
        appId: 'wx7678b61d1e6702fe',
        page: {
          home: '/pages/zeroSell/index',
          detail: '/pages/zeroSell/detail'
        }
    },
    anotherApp: {
        appId: 'tt8a52fcef1578326b',
        page: {
            home: '/pages/product/detail/detail'
        }
    }
};

export default function(params) {
    let navigateToMiniParams = {
        appId: appData[params.app].appId,
        path: params.path || `${appData[params.app].page[params.page]}?${stringify(params.data)}`
    };

    return tt.navigateToMiniProgram(navigateToMiniParams);
}