登录配置相关,调整登录逻辑,底部导航配置相关

This commit is contained in:
Jason
2022-09-13 19:07:36 +08:00
parent b47fc4219e
commit 3fe17fae5a
12 changed files with 173 additions and 100 deletions

View File

@@ -0,0 +1,33 @@
<template>
<u-tabbar v-bind="tabbarStyle" :list="tabbarList" @change="handleChange"></u-tabbar>
</template>
<script lang="ts" setup>
import { useAppStore } from '@/stores/app'
import { currentPage, navigateTo } from '@/utils/util'
import { onLoad } from '@dcloudio/uni-app'
import { computed, onMounted, ref } from 'vue'
const appStore = useAppStore()
const tabbarList = computed(() => {
return appStore.getTabbarConfig.map((item: any) => ({
iconPath: item.unselected,
selectedIconPath: item.selected,
text: item.name,
link: JSON.parse(item.link),
pagePath: JSON.parse(item.link).path
}))
})
const tabbarStyle = computed(() => ({
activeColor: appStore.getStyleConfig.selectedColor,
inactiveColor: appStore.getStyleConfig.defaultColor
}))
const handleChange = (index: number) => {
const selectTab = tabbarList.value[index]
navigateTo(selectTab.link, 'reLaunch')
}
// onMounted(() => {
// const page = currentPage()
// console.log(page)
// })
</script>

View File

@@ -117,32 +117,6 @@
"navigationBarBackgroundColor": "#FFFFFF",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#666666",
"selectedColor": "#4173FF",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"iconPath": "/static/images/tabs/home.png",
"selectedIconPath": "/static/images/tabs/home_s.png",
"pagePath": "pages/index/index",
"text": "首页"
},
{
"iconPath": "/static/images/tabs/news.png",
"selectedIconPath": "/static/images/tabs/news_s.png",
"pagePath": "pages/news/news",
"text": "资讯"
},
{
"iconPath": "/static/images/tabs/user.png",
"selectedIconPath": "/static/images/tabs/user_s.png",
"pagePath": "pages/user/user",
"text": "我的"
}
]
},
"easycom": {
"custom": {
"^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue",

View File

@@ -24,6 +24,7 @@
:item="item"
/>
</view>
<tabbar />
</view>
</template>

View File

@@ -19,6 +19,7 @@
</view>
</tab>
</tabs>
<tabbar />
</view>
</template>

View File

@@ -16,6 +16,7 @@
<w-user-banner :content="item.content" :styles="item.styles" />
</template>
</view>
<tabbar />
</view>
</template>

View File

@@ -9,16 +9,16 @@ export const useAppStore = defineStore({
state: (): AppSate => ({
config: {
website: {},
login: {}
login: {},
tabbar: [],
style: {}
}
}),
getters: {
getWebsiteConfig(state) {
return state.config.website
},
getLoginConfig(state) {
return state.config.login
}
getWebsiteConfig: (state) => state.config.website,
getLoginConfig: (state) => state.config.login,
getTabbarConfig: (state) => state.config.tabbar,
getStyleConfig: (state) => state.config.style
},
actions: {
getImageUrl(url: string) {

View File

@@ -28,7 +28,6 @@ export const getRect = (selector: string, all = false, context?: any) => {
}
/**
<<<<<<< HEAD
* @description 获取当前页面实例
*/
export function currentPage() {
@@ -52,19 +51,16 @@ export enum LinkTypeEnum {
'SHOP_PAGES' = 'shop',
'CUSTOM_LINK' = 'custom'
}
export function navigateTo(link: Link) {
export function navigateTo(link: Link, navigateType: 'navigateTo' | 'reLaunch' = 'navigateTo') {
let url: string
switch (link.type) {
case LinkTypeEnum.SHOP_PAGES:
url = link.query ? `${link.path}?${objectToQuery(link.query)}` : link.path
if (link.isTab) {
uni.switchTab({ url })
} else {
uni.navigateTo({ url })
}
uni[navigateType]({ url })
break
case LinkTypeEnum.CUSTOM_LINK:
uni.navigateTo({ url: `/pages/webview/webview?url=${link.path}` })
uni[navigateType]({ url: `/pages/webview/webview?url=${link.path}` })
}
}