v1.0.0
This commit is contained in:
61
src/layouts/home.vue
Normal file
61
src/layouts/home.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<script setup>
|
||||
import PrivacyModal from '@/components/PrivacyModel.vue'
|
||||
|
||||
const tabbar = ref('index')
|
||||
|
||||
const menu = reactive([{ title: '首页', icon: 'home', name: 'index' }, { title: 'AI律师', icon: 'chat', name: 'ai' }, { title: '我的', icon: 'user', name: 'me' }])
|
||||
|
||||
function tabChange({ value }) {
|
||||
uni.switchTab({
|
||||
url: `/pages/${value}`,
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
const currentPage = getCurrentPages()[getCurrentPages().length - 1].route
|
||||
const pageName = currentPage.split('/').pop()
|
||||
tabbar.value = pageName
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
uni.hideTabBar()
|
||||
|
||||
const currentPage = getCurrentPages()[getCurrentPages().length - 1].route
|
||||
const pageName = currentPage.split('/').pop()
|
||||
tabbar.value = pageName
|
||||
})
|
||||
function toComplaint() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/complaint',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
options: {
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<slot />
|
||||
<view>
|
||||
<wd-tabbar v-model="tabbar" custom-class="qnc-tabbar" shape="round" safe-area-inset-bottom fixed @change="tabChange">
|
||||
<wd-tabbar-item v-for="(item, index) in menu" :key="index" :name="item.name" :title="item.title" :icon="item.icon" />
|
||||
</wd-tabbar>
|
||||
</view>
|
||||
<view class="fixed bottom-24 right-4 z-1000 flex items-center rounded-3xl from-red-500 to-red-400 bg-gradient-to-b px-2 py-1 text-center text-white shadow-2xl">
|
||||
<wd-icon name="warning" class="mr-1" size="18px" />
|
||||
<view class="text-xs" @click="toComplaint">
|
||||
投诉
|
||||
</view>
|
||||
</view>
|
||||
<PrivacyModal />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.qnc-tabbar) {
|
||||
bottom: 16px !important;
|
||||
}
|
||||
</style>
|
||||
31
src/layouts/login.vue
Normal file
31
src/layouts/login.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<script setup>
|
||||
function handleClickLeft() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- -->
|
||||
<view class="h-screen bg-[#EBF1FD]">
|
||||
<view class="login-layout min-h-full">
|
||||
<wd-navbar
|
||||
title="用户登录"
|
||||
left-arrow
|
||||
safe-area-inset-top
|
||||
custom-style="background-color: transparent !important;"
|
||||
@click-left="handleClickLeft"
|
||||
/>
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.login-layout{
|
||||
background: url("/static/image/login_bg.png") no-repeat;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
}
|
||||
</style>
|
||||
35
src/layouts/page.vue
Normal file
35
src/layouts/page.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<script setup>
|
||||
import pagesJson from '@/pages.json'
|
||||
|
||||
const pagesConfig = pagesJson.pages
|
||||
const title = ref('')
|
||||
function getPageTitle() {
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1] // 当前页面
|
||||
const currentRoute = currentPage.route // 当前页面路径,例如 "pages/authorization"
|
||||
|
||||
// 根据路径查找 pages.json 中的配置
|
||||
const currentPageConfig = pagesConfig.find(page => page.path === currentRoute)
|
||||
console.log('currentPageConfig', currentPageConfig)
|
||||
// 返回页面标题,如果未找到,则返回默认标题
|
||||
return currentPageConfig?.title || ''
|
||||
}
|
||||
onLoad(() => {
|
||||
title.value = getPageTitle()
|
||||
})
|
||||
|
||||
function handleClickLeft() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<wd-navbar :title="title" left-text="返回" placeholder left-arrow safe-area-inset-top fixed @click-left="handleClickLeft" />
|
||||
<view class="box-border min-h-screen">
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user