jump-to-miniapp.js 997 Bytes
import wx from '../utils/wx';
import {
  stringify
} from '../vendors/query-stringify';
import config from '../common/config';

const appData = {
  yohostore: {
    appId: 'wx8c854ca3917e9ba8',
    page: {

    }
  },
  yohobuy: {
    appId: 'wx084ab813d88c594b',
    page: {
      productDetail: '/pages/goodsDetail/goodsDetail',
      brandDetail: '/pages/goodsList/brand',
      guangDetail: '/pages/guang/detail'
    }
  },
  anotherApp: {
    appId: 'wx084ab813d88c594b',
    page: {
      home: '/pages/goodsDetail/goodsDetail'
    }
  }
};

// 跳转同公众号下其他小程序页面
/**
 * params参数:{
            app: qs.app,
            path: `${path}?${stringify(qs)}`
        }
 */
export default function(params) {
  let navigateToMiniParams = {
    appId: appData[params.app].appId,
    path: params.path || `${appData[params.app].page[params.page]}?${stringify(params.data)}`,
    envVersion: config.envVersion
  };

  return wx.navigateToMiniProgram(navigateToMiniParams);
}