|
|
@@ -11,7 +11,12 @@
|
|
|
<view v-if="postName && deptName" class="dot" />
|
|
|
<text v-if="deptName">{{ deptName }}</text>
|
|
|
</view>
|
|
|
- <text class="home-logout" @click="onLogout">退出登录</text>
|
|
|
+ <view class="meta__right">
|
|
|
+ <text class="home-mp-notify" @click="onTapMpNotify">
|
|
|
+ {{ mpNotifyBound ? '微信通知已开启' : '开启微信审批通知' }}
|
|
|
+ </text>
|
|
|
+ <text class="home-logout" @click="onLogout">退出登录</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -86,7 +91,12 @@
|
|
|
<script>
|
|
|
import MenuGrid from '../../components/MenuGrid.vue'
|
|
|
import VanEmpty from '../../components/van-empty/van-empty.vue'
|
|
|
- import { clearSession, fetchCurrentUser, getUser } from '../../utils/auth.js'
|
|
|
+ import {
|
|
|
+ clearSession,
|
|
|
+ fetchCurrentUser,
|
|
|
+ fetchMpBindStatus,
|
|
|
+ getUser
|
|
|
+ } from '../../utils/auth.js'
|
|
|
import { fetchMyMobileMenus } from '../../utils/menu.js'
|
|
|
import {
|
|
|
formatOaBadgeCount,
|
|
|
@@ -124,6 +134,8 @@
|
|
|
deptName: '',
|
|
|
menus: [],
|
|
|
menusLoading: true,
|
|
|
+ mpNotifyBound: false,
|
|
|
+ mpNotifyLoading: false,
|
|
|
banners: [
|
|
|
{
|
|
|
id: 'banner-video-1',
|
|
|
@@ -148,9 +160,28 @@
|
|
|
.catch(() => {
|
|
|
/* 本地缓存已展示,忽略刷新失败 */
|
|
|
})
|
|
|
+ this.refreshMpBindStatus()
|
|
|
this.loadMenus()
|
|
|
},
|
|
|
methods: {
|
|
|
+ async refreshMpBindStatus() {
|
|
|
+ this.mpNotifyLoading = true
|
|
|
+ try {
|
|
|
+ const res = await fetchMpBindStatus()
|
|
|
+ this.mpNotifyBound = !!(res && res.bound)
|
|
|
+ } catch (_) {
|
|
|
+ this.mpNotifyBound = false
|
|
|
+ } finally {
|
|
|
+ this.mpNotifyLoading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onTapMpNotify() {
|
|
|
+ if (this.mpNotifyBound) {
|
|
|
+ uni.showToast({ title: '已开启', icon: 'none' })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uni.navigateTo({ url: '/pages/oa/mp-bind/index' })
|
|
|
+ },
|
|
|
mergeBadgesIntoMenus(menus, badgeMap) {
|
|
|
const map = badgeMap || {}
|
|
|
return (menus || []).map((m) => {
|
|
|
@@ -222,6 +253,22 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+ .meta__right {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: flex-end;
|
|
|
+ gap: 12rpx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-mp-notify {
|
|
|
+ font-size: 22rpx;
|
|
|
+ line-height: 1.3;
|
|
|
+ color: rgba(6, 95, 70, 0.72);
|
|
|
+ text-decoration: underline;
|
|
|
+ text-underline-offset: 4rpx;
|
|
|
+ }
|
|
|
+
|
|
|
.home-menus-loading {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|