| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- const LOGIN_PAGE = '/pages/passport/lobby'
- const LABELS = {
- 'zh-Hant': ['發動態', '發視頻', '開始直播'],
- 'zh-cn': ['发圈子', '上传视频', '开始直播'],
- default: ['Send Mood', 'Send Video', 'Send Live']
- }
- const ROUTES = [
- '/pages/dynamics/publish',
- '/pages/dynamics/publish?type=video',
- '/pages/shop/live/live'
- ]
- function resolveLabels(locale) {
- if (locale === 'zh-Hant' || locale === 'zh-cn') return LABELS[locale]
- return LABELS.default
- }
- function openPublishRoute(index) {
- const url = ROUTES[index]
- if (index === 2) {
- // #ifdef APP-PLUS || MP-WEIXIN
- uni.navigateTo({ url })
- // #endif
- // #ifndef APP-PLUS || MP-WEIXIN
- uni.showToast({ title: '目前只开放App和微信小程序直播', icon: 'none' })
- // #endif
- return
- }
- uni.navigateTo({ url })
- }
- export function bindTabCenterPublisher(vm) {
- uni.onTabBarMidButtonTap(() => {
- const loggedIn = vm.$store?.state?.user?.isLogin
- if (!loggedIn) {
- uni.navigateTo({ url: LOGIN_PAGE })
- return
- }
- const locale = uni.getLocale()
- uni.showActionSheet({
- itemList: resolveLabels(locale),
- success: ({ tapIndex }) => openPublishRoute(tapIndex)
- })
- })
- }
|