1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { modalStore } from '@/store/modal'; const modal = modalStore()
- // 隐藏TabBar
- const hideBar = () => {
- uni.hideTabBar({
- success: () => {},
- fail: () => {} // 捕获报错,防止没有tabbar页面调用后控制台报错
- })
- }
- // 显示TabBar
- const showBar = () => {
- uni.showTabBar({
- success: () => {},
- fail: () => {} // 捕获报错,防止没有tabbar页面调用后控制台报错
- })
- }
- // 打开授权弹框
- export function showAuthModal(type = 'login') {
- if (modal.auth !== '') {
- // 注意:延迟修改,保证下面的 closeAuthModal 先执行掉
- setTimeout(() => {
- hideBar()
- modal.$patch((state) => {
- state.auth = type
- })
- }, 500)
- closeAuthModal()
- } else {
- hideBar()
- modal.$patch((state) => {
- state.auth = type
- })
- }
- }
- // 关闭授权弹框
- export function closeAuthModal() {
- showBar()
- modal.$patch((state) => {
- state.auth = ''
- })
- }
- // 打开分享弹框
- export function showShareModal() {
- hideBar()
- modal.$patch((state) => {
- state.share = true
- })
- }
- // 关闭分享弹框
- export function closeShareModal() {
- showBar()
- modal.$patch((state) => {
- state.share = false
- })
- }
|