123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import { modalStore } from '@/store/modal';
- const modal = modalStore()
- // 隐藏TabBar
- const hideBar = () => {
- // 关闭tabBar
- const currentPage = getCurrentPages()
- if (!currentPage) {
- return
- }
- const currentTabBar = currentPage[0]?.getTabBar?.();
- currentTabBar?.setData({ show: false });
- }
- // 显示TabBar
- const showBar = () => {
- // 打开tabBar
- const currentPage = getCurrentPages()
- if (!currentPage) {
- return
- }
- const currentTabBar = currentPage[0]?.getTabBar?.();
- currentTabBar?.setData({ show: true });
- }
- // 打开授权弹框
- 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
- })
- }
|