diff --git a/App.vue b/App.vue index 9325139..5ddd792 100644 --- a/App.vue +++ b/App.vue @@ -3,8 +3,7 @@ useUpdateApp } from '@/store/update.js'; import { - cxcJurisdictionApi, - taskListApi + cxcJurisdictionApi } from '@/api/api.js'; import { onLaunch, @@ -13,7 +12,6 @@ import { getLocation, getWeather, - // beforeJump } from './utils/index.js'; import { useStore @@ -21,30 +19,18 @@ import { ref } from 'vue'; - onLaunch(() => { - console.log('---', todoNum.value) - - // 动态更新角标 - uni.setTabBarBadge({ - index: '1', - text: todoNum.value // 角标内容 - }); - - uni.onTabBarMidButtonTap(() => { - uni.navigateTo({ - url: '/pages/task/todotask' - }) - }) - // 检查更新 useUpdateApp().checkAppUpdate() // 定位 getLocation() }) onShow(() => { - taskList() + //是否灰化 + ifGray() + }) + const ifGray = () => { cxcJurisdictionApi({ id: "1827997127165677570" }).then((res) => { @@ -55,18 +41,6 @@ store.setIsgray(res.result.value) } }) - }) - 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 - } - }) } diff --git a/pages.json b/pages.json index 1eb8d88..2d22149 100644 --- a/pages.json +++ b/pages.json @@ -14,13 +14,14 @@ } }, { - "path": "pages/tab/office", + "path": "pages/task/todotask", "style": { - "navigationStyle": "custom" + "navigationStyle": "custom", + "enablePullDownRefresh": true } }, { - "path": "pages/tab/product", + "path": "pages/tab/office", "style": { "navigationStyle": "custom" } @@ -147,14 +148,14 @@ "navigationBarTextStyle": "white" } }, - { - "path": "pages/task/todotask", - "style": { - "navigationBarTitleText": "个人办公", - "enablePullDownRefresh": false, - "navigationBarTextStyle": "white" - } - }, + // { + // "path": "pages/task/todotask", + // "style": { + // "navigationBarTitleText": "个人办公", + // "enablePullDownRefresh": false, + // "navigationBarTextStyle": "white" + // } + // }, { "path": "pages/safe/manage", "style": { @@ -210,14 +211,14 @@ "selectedIconPath": "static/tab/index2.png" }, { - "text": "办公", - "pagePath": "pages/tab/office", + "text": "任务", + "pagePath": "pages/task/todotask", "iconPath": "static/tab/office1.png", "selectedIconPath": "static/tab/office2.png" }, { - "text": "生产", - "pagePath": "pages/tab/product", + "text": "办公", + "pagePath": "pages/tab/office", "iconPath": "static/tab/product1.png", "selectedIconPath": "static/tab/product2.png" }, @@ -227,15 +228,15 @@ "iconPath": "static/tab/user1.png", "selectedIconPath": "static/tab/user2.png" } - ], + ] - "midButton": { - "width": "65px", - "height": "75px", - "text": "", - "iconPath": "static/tab/todo.png", - "iconWidth": "50px" - } + // "midButton": { + // "width": "65px", + // "height": "75px", + // "text": "", + // "iconPath": "static/tab/todo.png", + // "iconWidth": "50px", + // } }, "globalStyle": { "app-plus": { diff --git a/pages/login/login.vue b/pages/login/login.vue index d72b264..728d69e 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -45,6 +45,9 @@ localLoginApi, queryRoleApi } from '@/api/login.js'; + import { + taskListApi + } from '@/api/api.js'; import Base64 from 'base-64'; import { onLoad @@ -92,14 +95,14 @@ username: un, password: pw, ip: getDeviceIp() - /*生产环境 end */ + /*生产环境 end */ - /*开发环境 begin */ - // localLoginApi({ - // username: username.value, - // password: password.value, - // captcha: 'app' - /*开发环境 end */ + /*开发环境 begin */ + // localLoginApi({ + // username: username.value, + // password: password.value, + // captcha: 'app' + /*开发环境 end */ }).then((loginres) => { if (loginres.success) { uni.setStorageSync('token', loginres.result.token) @@ -119,6 +122,9 @@ .userInfo)) store.setUserInfo(loginres.result.userInfo) + //获取任务列表角标 + loadBadge() + // 跳转首页 uni.switchTab({ url: '/pages/tab/index' @@ -143,6 +149,25 @@ // accountArr.value = localAccountArr }) + const loadBadge = () => { + taskListApi().then((res) => { + if (res.success) { + if (res.result.total > 0) { + uni.setTabBarBadge({ + index: '1', + text: res.result.total // 角标内容 + }); + } else { + uni.removeTabBarBadge({ // 移除角标 + index: '1', + }); + } + + } + }) + } + + function getDeviceIp() { // #ifdef APP-PLUS diff --git a/pages/tab/office.vue b/pages/tab/office.vue index 0a128eb..7ce8567 100644 --- a/pages/tab/office.vue +++ b/pages/tab/office.vue @@ -2,7 +2,7 @@ -