fix:换回uniapp自带tabbar
This commit is contained in:
parent
973c4f5ab6
commit
549e25155c
@ -33,7 +33,7 @@ export const responseInterceptor = async <T>(
|
||||
response: ResponseData<T>,
|
||||
): Promise<ResponseData<T>> => {
|
||||
const { statusCode, data } = response as any
|
||||
console.log('response', response)
|
||||
// console.log('response', response)
|
||||
|
||||
// 处理成功响应
|
||||
if (statusCode === HTTP_STATUS.SUCCESS && data.code === 200) {
|
||||
|
@ -375,11 +375,36 @@
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#333333",
|
||||
"selectedColor": "#333333",
|
||||
"color": "#8E8D9D",
|
||||
"selectedColor": "#625EFF",
|
||||
"borderStyle": "white",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": []
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/home/index",
|
||||
"iconPath": "static/tabBar/homeno.png",
|
||||
"selectedIconPath": "static/tabBar/home.png",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/academicReport/index",
|
||||
"iconPath": "static/tabBar/studyReportNo.png",
|
||||
"selectedIconPath": "static/tabBar/studyReport.png",
|
||||
"text": "学情报告"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/applicationManagement/index",
|
||||
"iconPath": "static/tabBar/applicationNo.png",
|
||||
"selectedIconPath": "static/tabBar/application.png",
|
||||
"text": "应用管控"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/mine/index",
|
||||
"iconPath": "static/tabBar/mineno.png",
|
||||
"selectedIconPath": "static/tabBar/mine.png",
|
||||
"text": "我的"
|
||||
}
|
||||
]
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
@ -6,52 +6,25 @@
|
||||
@updateShowItem="handleUpdateShowChild"
|
||||
/>
|
||||
<Empty v-if="empty" content="暂无学情报告数据哦~" />
|
||||
<template v-if="subjectList?.length">
|
||||
<view class="single_box filter_box">
|
||||
<view class="title">学科选择</view>
|
||||
<subjectFilter
|
||||
:userId="showChildrenInfo?.childId"
|
||||
:tabsList="subjectList"
|
||||
@handleFilter="tapFilterSubject"
|
||||
/>
|
||||
</view>
|
||||
<StudyTime :subjectId="chooseSubject?.subjectId" :userId="showChildrenInfo?.childId" />
|
||||
<VideoTime :subjectId="chooseSubject?.subjectId" :userId="showChildrenInfo?.childId" />
|
||||
<KnowledgeChart :subjectId="chooseSubject?.subjectId" :userId="showChildrenInfo?.childId" />
|
||||
<ExerciseStatistics
|
||||
:subjectId="chooseSubject?.subjectId"
|
||||
:userId="showChildrenInfo?.childId"
|
||||
/>
|
||||
<LanguageStatistics
|
||||
:show="chooseSubject?.subjectId === 3"
|
||||
:userId="showChildrenInfo?.childId"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<TabBar :selectedIndex="1" />
|
||||
</mj-page>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import Empty from '@/components/Empty/index.vue'
|
||||
import ChildrenBox from './components/childrenBox.vue'
|
||||
import SubjectFilter from './components/subjectFilter.vue'
|
||||
import TabBar from '@/components/Tabbar/index.vue'
|
||||
import StudyTime from './components/studyTime.vue'
|
||||
import VideoTime from './components/videoTime.vue'
|
||||
import KnowledgeChart from './components/knowledgeChart.vue'
|
||||
import ExerciseStatistics from './components/exerciseStatistics.vue'
|
||||
import LanguageStatistics from './components/languageStatistics.vue'
|
||||
|
||||
import type { ChildrenType } from '@/pages/mine/interface'
|
||||
import type { SubjectType } from './interface'
|
||||
import './index.scss'
|
||||
import { getParentBindChildApi, subjectApi } from '@/api'
|
||||
import { userStore } from '@/store'
|
||||
import { userStore, bindApplyStore } from '@/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import db from '@/utils/db'
|
||||
import hud from '@/utils/hud'
|
||||
|
||||
const { userInfo } = storeToRefs(userStore())
|
||||
const { getApplyBindInfoList } = bindApplyStore()
|
||||
|
||||
const childrenList = ref<ChildrenType[]>() // 所有孩子
|
||||
const empty = ref(false)
|
||||
@ -98,11 +71,33 @@ async function getSubject() {
|
||||
subjectList.value = data
|
||||
chooseSubject.value = data[0]
|
||||
}
|
||||
// 处理红点逻辑
|
||||
async function handleTabBarBadge() {
|
||||
await getApplyBindInfoList()
|
||||
const hasApplyMsg = db.get('applyBindMsg')
|
||||
|
||||
if (hasApplyMsg) {
|
||||
uni.setTabBarBadge({
|
||||
index: 3, // "我的"页面在tabBar中的索引
|
||||
text: '●',
|
||||
})
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
index: 3,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
handleTabBarBadge()
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
hud.loading()
|
||||
await getParentBindChild()
|
||||
await getSubject()
|
||||
handleTabBarBadge()
|
||||
} finally {
|
||||
hud.hide()
|
||||
}
|
||||
|
@ -118,7 +118,7 @@
|
||||
safe-area-inset-bottom
|
||||
position="bottom"
|
||||
custom-style="border-radius: 20px 20px 0 0;padding-bottom: 30px;"
|
||||
@click-modal="() => (hideTabBar = false)"
|
||||
@click-modal="() => {}"
|
||||
>
|
||||
<view class="bottom_popup">
|
||||
<view class="header_title"> 选择使用方式 </view>
|
||||
@ -132,21 +132,24 @@
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
<view v-if="!hideTabBar"> <TabBar :selectedIndex="2" /></view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { studentHeadImage } from '@/hooks/useImage'
|
||||
import { getParentBindDeviceApi, parentDeviceCurrentLoginApi, queryAppRecordApi } from '@/api'
|
||||
import TabBar from '@/components/Tabbar/index.vue'
|
||||
|
||||
import CustomPopup from '@/components/CustomPopup/index.vue'
|
||||
import Empty from '@/components/Empty/index.vue'
|
||||
import { userStore } from '@/store'
|
||||
import { userStore, bindApplyStore } from '@/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import db from '@/utils/db'
|
||||
|
||||
const { userInfo } = storeToRefs(userStore())
|
||||
const { getApplyBindInfoList } = bindApplyStore()
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST
|
||||
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`
|
||||
const arrow = `${OSS_URL}/iconfont/down_arrow.png`
|
||||
@ -154,7 +157,7 @@ const checked = `${OSS_URL}/iconfont/checked.png`
|
||||
const unchecked = `${OSS_URL}/iconfont/unchecked.png`
|
||||
const showAllEquipment = ref(false)
|
||||
const showCustomPopup = ref(false)
|
||||
const hideTabBar = ref(false)
|
||||
|
||||
|
||||
const methodPopup = ref(false)
|
||||
const methodList = ref([
|
||||
@ -220,13 +223,11 @@ function swicthNav(i) {
|
||||
}
|
||||
// 管控
|
||||
function handleControl() {
|
||||
hideTabBar.value = true
|
||||
methodPopup.value = true
|
||||
}
|
||||
|
||||
function handleConfirmControl() {
|
||||
methodPopup.value = false
|
||||
hideTabBar.value = false
|
||||
setTimeout(() => {
|
||||
methodPopup.value = false
|
||||
}, 200)
|
||||
@ -287,9 +288,31 @@ async function fetchAppRecord() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
// 处理红点逻辑
|
||||
async function handleTabBarBadge() {
|
||||
await getApplyBindInfoList()
|
||||
const hasApplyMsg = db.get('applyBindMsg')
|
||||
|
||||
if (hasApplyMsg) {
|
||||
uni.setTabBarBadge({
|
||||
index: 3, // "我的"页面在tabBar中的索引
|
||||
text: '●'
|
||||
})
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
index: 3
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
handleTabBarBadge()
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getParentBindDevice()
|
||||
fetchAppRecord()
|
||||
handleTabBarBadge()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -71,14 +71,17 @@
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<TabBar :selectedIndex="0" />
|
||||
|
||||
</mj-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { getParentBindDeviceApi, parentDeviceCurrentLoginApi } from '@/api'
|
||||
import TabBar from '@/components/Tabbar/index.vue'
|
||||
import { bindApplyStore } from '@/store'
|
||||
import db from '@/utils/db'
|
||||
|
||||
import { userStore } from '@/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import hud from '@/utils/hud'
|
||||
@ -86,7 +89,8 @@ import router from '@/router/router'
|
||||
|
||||
const store = userStore()
|
||||
const { getUserInfo } = store
|
||||
const { userInfo } = storeToRefs(store)
|
||||
const { userInfo } = storeToRefs(userStore())
|
||||
const { getApplyBindInfoList } = bindApplyStore()
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST
|
||||
const scanQr = `${OSS_URL}/iconfont/scan_qr.png`
|
||||
const arrow = `${OSS_URL}/iconfont/down_arrow.png`
|
||||
@ -206,9 +210,31 @@ async function getParentBindDevice() {
|
||||
},
|
||||
})
|
||||
}
|
||||
// 处理红点逻辑
|
||||
async function handleTabBarBadge() {
|
||||
await getApplyBindInfoList()
|
||||
const hasApplyMsg = db.get('applyBindMsg')
|
||||
|
||||
if (hasApplyMsg) {
|
||||
uni.setTabBarBadge({
|
||||
index: 3, // "我的"页面在tabBar中的索引
|
||||
text: '●'
|
||||
})
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
index: 3
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
handleTabBarBadge()
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getUserInfo()
|
||||
getParentBindDevice()
|
||||
handleTabBarBadge()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -2,14 +2,36 @@
|
||||
<view class="content">
|
||||
<PatriarchCard />
|
||||
<AbountMine />
|
||||
<TabBar :selectedIndex="3" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import TabBar from '@/components/Tabbar/index.vue';
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { bindApplyStore } from '@/store'
|
||||
import db from '@/utils/db'
|
||||
|
||||
import PatriarchCard from './patriarchCard.vue';
|
||||
import AbountMine from './aboutMine.vue';
|
||||
|
||||
const { getApplyBindInfoList } = bindApplyStore()
|
||||
|
||||
onShow(async () => {
|
||||
// 获取绑定申请信息并设置红点
|
||||
await getApplyBindInfoList()
|
||||
const hasApplyMsg = db.get('applyBindMsg')
|
||||
|
||||
if (hasApplyMsg) {
|
||||
uni.setTabBarBadge({
|
||||
index: 3, // "我的"页面在tabBar中的索引
|
||||
text: '●'
|
||||
})
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
index: 3
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
Loading…
x
Reference in New Issue
Block a user