Page({
  data: {
    shortcuts: [
      {
        iconType: 'circle',
        id: 'cc7e704a-b47d-4bdf-9c7f-ae40e1de4fd3',
        type: 'page',
        url:
          'https://user-assets.sxlcdn.com/images/376562/Frj2f53OLrwiz2ArUZCnt1SExckY.png?imageMogr2/strip/thumbnail/800x450>/format/png',
        name: 'tab页跳转',
        value: '/pages/index/index',
        linkError: false
      },
      {
        iconType: 'circle',
        id: 'a8b6d2dd-9e6b-45b3-aa09-04a6609f6ffa',
        type: 'page',
        url:
          'https://user-assets.sxlcdn.com/images/376562/Fgv5M4MZLVS_vxzus3P157nehD0U.png?imageMogr2/strip/thumbnail/800x450>/quality/90!/format/png',
        name: '非tab页跳转',
        value: '/pages/sxl/sxl',
        linkError: false
      },
      {
        iconType: 'circle',
        id: 'e36d9873-0bac-48aa-abbf-5029946945d9',
        type: 'blogPost',
        url:
          'https://user-assets.sxlcdn.com/images/376562/Fq708Ri7--Sic2xEkv960IptDOvs.png?imageMogr2/strip/thumbnail/800x450>/quality/90!/format/png',
        name: '文章跳转',
        value: '1956034',
        linkError: false
      },
      {
        iconType: 'circle',
        id: 'e36d9873-0bac-48aa-abbf-5029946945d9',
        type: 'category',
        url:
          'https://user-assets.sxlcdn.com/images/376562/Fu9weiSOvE9v46xx4-9vLjzbGnh4.png?imageMogr2/strip/thumbnail/800x450>/quality/90!/format/png',
        name: '分类跳转',
        value: {
          id: '6135',
          name: '精彩视频'
        },
        linkError: false
      },
      {
        iconType: 'circle',
        id: 'e36d9873-0bac-48aa-abbf-5029946945d9',
        type: 'usage',
        url:
          'https://user-assets.sxlcdn.com/images/376562/Fn21oXKs8qTcduF7kuUgBZHk7RZD.png?imageMogr2/strip/thumbnail/800x450>/quality/90!/format/png',
        name: '打电话',
        value: '',
        number: '13458543021',
        linkError: false
      }
    ]
  },
  onPostTap(e) {
    const { postId } = e.detail
    wx.navigateTo({ url: `plugin://blogPlugin/postDetail?postId=${postId}` })
  },
  onCategoryTap(e) {
    const { name, id } = e.detail

    wx.navigateTo({
      url: `plugin://blogPlugin/postList?category=${name}&categoryId=${id}`
    })
  },
  onPageTap(e) {
    const tabList = [
      '/pages/index/index',
      '/pages/blog/blog',
      '/pages/mine/mine'
    ]
    const { url } = e.detail
    if (tabList.includes(url)) {
      wx.switchTab({ url })
    } else {
      wx.navigateTo({ url })
    }
  }
})
