卢春龙
2026-08-17 f525b6c3cc105bd1a997d893937689bebcc9570d
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
import Taro from '@tarojs/taro';
import { HomePath } from './tools';
// import { MARKET_URL } from '../constants/api';
 
const ENV = process.env.TARO_ENV;
 
export function jumpTo(options) {
  const { url, type = 'nav', events } = options;
  const types = {
    tab: 'switchTab',
    rel: 'reLaunch',
    red: 'redirectTo',
    nav: 'navigateTo',
  }
  console.log('跳转路径:')
  console.log(url)
  if (type === 'back') {
      Taro.navigateBack();
  } else {
    Taro[types[type]]({
      url,
      events,// 只有navigateTo才有效
    })
  }
}
 
export function jumpToHome () {
  if (ENV === 'jd') {
    jumpTo({ type: 'red', url: HomePath[ENV] });
    // jumpTo({ type: 'red', url: `/pages/webpage/index?pageUrl=${encodeURIComponent(MARKET_URL)}` });
    return;
  }
 
  jumpTo({ type: 'tab', url: HomePath[ENV] });
}