diff --git a/App.vue b/App.vue index 0544bf3..9325139 100644 --- a/App.vue +++ b/App.vue @@ -3,7 +3,8 @@ useUpdateApp } from '@/store/update.js'; import { - cxcJurisdictionApi + cxcJurisdictionApi, + taskListApi } from '@/api/api.js'; import { onLaunch, @@ -12,17 +13,27 @@ import { getLocation, getWeather, - beforeJump + // beforeJump } from './utils/index.js'; import { useStore } from '@/store'; + import { + ref + } from 'vue'; + onLaunch(() => { + console.log('---', todoNum.value) + + // 动态更新角标 + uni.setTabBarBadge({ + index: '1', + text: todoNum.value // 角标内容 + }); + uni.onTabBarMidButtonTap(() => { - beforeJump('/pages/task/index', () => { - uni.navigateTo({ - url: '/pages/task/index?id=0' - }) + uni.navigateTo({ + url: '/pages/task/todotask' }) }) @@ -32,6 +43,8 @@ getLocation() }) onShow(() => { + taskList() + cxcJurisdictionApi({ id: "1827997127165677570" }).then((res) => { @@ -43,6 +56,18 @@ } }) }) + const todoNum = ref(0) + const taskList = () => { + taskListApi({ + pageNo: 1, + pageSize: 4, + _t: new Date().getTime() + }).then((res) => { + if (res.success) { + todoNum.value = res.result.total + } + }) + }