批量优化
This commit is contained in:
1 parent
e3db229f41
commit
aa92ca40a2
79 files changed
+7495
-1104
No files matched your search
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!--
|
||||
小程序端 web-view 组件会自动铺满整屏(不受样式约束),
|
||||
因此该端使用原生导航栏(pages.json 里 navigationStyle 保持 default);
|
||||
H5 / App 端 web-view 渲染为 iframe,需要自绘标题栏。
|
||||
-->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<view class="bar">
|
||||
<view class="bar-btn" @tap="goBack">
|
||||
<FaIcon name="chevron-left" color="#1f2b48" :size="20" />
|
||||
</view>
|
||||
<text class="bar-title">{{ title }}</text>
|
||||
<view class="bar-btn" @tap="onReload">
|
||||
<FaIcon name="rotate" color="#5b6780" :size="18" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
<web-view v-if="url" :src="url" @message="onMessage" />
|
||||
|
||||
<view v-else class="empty">
|
||||
<FaIcon name="triangle-exclamation" color="#c0c4cc" :size="40" />
|
||||
<text class="empty-text">没有可打开的页面地址</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { resolveWebConsoleURL, resolveWebSSOURL } from '@/api/config.js'
|
||||
|
||||
const url = ref('')
|
||||
const title = ref('功能')
|
||||
|
||||
/**
|
||||
* 参数解码。
|
||||
* 各端行为不一致:H5(vue-router)会先解一次码,小程序不会。
|
||||
* 这里对纯 ASCII 参数(path / ticket)重复解码是幂等的,安全;
|
||||
* 含中文的 title 解码一次后已无可解字符,再解也是空操作。
|
||||
*/
|
||||
function decodeParam(v) {
|
||||
if (!v) return ''
|
||||
try {
|
||||
return decodeURIComponent(v)
|
||||
} catch (e) {
|
||||
return v
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
const opt = options || {}
|
||||
const raw = decodeParam(opt.p || opt.url)
|
||||
const ticket = decodeParam(opt.k)
|
||||
title.value = decodeParam(opt.t || opt.title) || '功能'
|
||||
|
||||
if (!raw) {
|
||||
uni.setNavigationBarTitle({ title: title.value })
|
||||
return
|
||||
}
|
||||
|
||||
// 带票据 → 走 Web 端免登录兑换页;否则按普通深链打开
|
||||
if (ticket) {
|
||||
url.value = resolveWebSSOURL(raw, ticket)
|
||||
} else if (/^https?:\/\//i.test(raw)) {
|
||||
url.value = raw
|
||||
} else {
|
||||
url.value = resolveWebConsoleURL(raw)
|
||||
}
|
||||
|
||||
uni.setNavigationBarTitle({ title: title.value })
|
||||
})
|
||||
|
||||
function goBack() {
|
||||
const pages = getCurrentPages()
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
}
|
||||
}
|
||||
|
||||
// 重新加载:改 src 强制 webview/iframe 刷新
|
||||
function onReload() {
|
||||
const cur = url.value
|
||||
if (!cur) return
|
||||
const sep = cur.includes('?') ? '&' : '?'
|
||||
url.value = cur + sep + '_t=' + Date.now()
|
||||
}
|
||||
|
||||
function onMessage() {
|
||||
// 预留:Web 端 postMessage 回传(如通知外层刷新数据)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/src/styles/page-common.scss';
|
||||
|
||||
.page {
|
||||
@include page-shell;
|
||||
}
|
||||
|
||||
.bar {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
height: 88rpx;
|
||||
padding: 0 16rpx;
|
||||
background: $color-card;
|
||||
border-bottom: 1rpx solid $color-border;
|
||||
}
|
||||
|
||||
.bar-btn {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.bar-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: $color-text;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.empty {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubFunctions slug="cms" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* cms 子系统 · functions 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubFunctions from '@/components/sub/SubFunctions.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubHome slug="cms" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* cms 子系统 · home 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubHome from '@/components/sub/SubHome.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubMine slug="cms" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* cms 子系统 · 我的页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubMine.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubMine from '@/components/sub/SubMine.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubTodo slug="cms" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* cms 子系统 · todo 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubTodo from '@/components/sub/SubTodo.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubFunctions slug="crm" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* crm 子系统 · functions 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubFunctions from '@/components/sub/SubFunctions.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubHome slug="crm" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* crm 子系统 · home 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubHome from '@/components/sub/SubHome.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubMine slug="crm" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* crm 子系统 · 我的页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubMine.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubMine from '@/components/sub/SubMine.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubTodo slug="crm" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* crm 子系统 · todo 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubTodo from '@/components/sub/SubTodo.vue'
|
||||
</script>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubFunctions slug="erp" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* erp 子系统 · functions 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubFunctions from '@/components/sub/SubFunctions.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubHome slug="erp" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* erp 子系统 · home 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubHome from '@/components/sub/SubHome.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubMine slug="erp" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* erp 子系统 · 我的页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubMine.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubMine from '@/components/sub/SubMine.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubTodo slug="erp" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* erp 子系统 · todo 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubTodo from '@/components/sub/SubTodo.vue'
|
||||
</script>
|
||||
+343
-201
@@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 吸顶搜索 -->
|
||||
<view class="search-wrap">
|
||||
<view class="search-bar">
|
||||
<FaIcon name="magnifying-glass" color="#909399" :size="16" />
|
||||
<FaIcon name="magnifying-glass" color="#8a94ad" :size="16" />
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="keyword"
|
||||
class="search-input"
|
||||
type="text"
|
||||
placeholder="搜索功能名称"
|
||||
placeholder="搜索应用或功能名称"
|
||||
placeholder-class="search-placeholder"
|
||||
confirm-type="search"
|
||||
/>
|
||||
@@ -18,33 +19,106 @@
|
||||
</view>
|
||||
|
||||
<view class="body">
|
||||
<view class="sidebar">
|
||||
<view
|
||||
v-for="(cat, index) in categories"
|
||||
:key="cat.id"
|
||||
class="category-item"
|
||||
:class="{ active: activeIndex === index }"
|
||||
@tap="selectCategory(index)"
|
||||
>
|
||||
<text class="category-text">{{ cat.title }}</text>
|
||||
<!-- 搜索结果:跨模块扁平列表 -->
|
||||
<block v-if="keyword.trim()">
|
||||
<view class="result-hint">
|
||||
<text class="result-hint-text">找到 {{ searchResults.length }} 个结果</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<view v-if="displayItems.length === 0" class="empty">
|
||||
<view v-if="searchResults.length === 0" class="empty-box">
|
||||
<FaIcon name="magnifying-glass" color="#c0c4cc" :size="32" />
|
||||
<text class="empty-text">未找到相关功能</text>
|
||||
<text class="empty-text">没有找到「{{ keyword.trim() }}」相关功能</text>
|
||||
</view>
|
||||
<view
|
||||
v-for="item in displayItems"
|
||||
:key="item.id"
|
||||
class="item-card"
|
||||
:class="{ active: activeItemId === item.id }"
|
||||
@tap="onItemTap(item)"
|
||||
>
|
||||
<text class="item-name">{{ item.name }}</text>
|
||||
<view v-else class="list-card">
|
||||
<view
|
||||
v-for="item in searchResults"
|
||||
:key="item.menu.id"
|
||||
class="list-item"
|
||||
@tap="openMenu(item.menu, item.menu.title)"
|
||||
>
|
||||
<view class="row-icon" :class="item.locked ? 'tint-off' : item.tint">
|
||||
<FaIcon :name="item.icon" color="#ffffff" :size="16" />
|
||||
</view>
|
||||
<view class="row-body">
|
||||
<text class="row-title">{{ item.menu.title }}</text>
|
||||
<text class="row-sub">{{ item.moduleName }}</text>
|
||||
</view>
|
||||
<text v-if="item.locked" class="row-lock">未开通</text>
|
||||
<FaIcon v-else name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 默认:按业务域分组浏览 -->
|
||||
<block v-else>
|
||||
<view v-if="groups.length === 0" class="empty-box">
|
||||
<FaIcon name="cube" color="#c0c4cc" :size="32" />
|
||||
<text class="empty-text">尚未配置应用模块</text>
|
||||
</view>
|
||||
|
||||
<view v-for="group in groups" :key="group.code || group.id" class="group">
|
||||
<view class="group-head">
|
||||
<view class="tint-icon group-icon" :class="group.tint">
|
||||
<FaIcon :name="group.icon" color="#ffffff" :size="18" />
|
||||
</view>
|
||||
<view class="group-meta">
|
||||
<view class="group-title-row">
|
||||
<text class="group-name">{{ group.name }}</text>
|
||||
<text v-if="group.locked" class="group-lock">未开通</text>
|
||||
</view>
|
||||
<text class="group-count">{{ group.items.length }} 个功能</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list-card">
|
||||
<view
|
||||
v-for="item in group.items"
|
||||
:key="item.id"
|
||||
class="list-item"
|
||||
@tap="openMenu(item, item.title)"
|
||||
>
|
||||
<view class="dot" :class="item.locked ? 'off' : 'primary'" />
|
||||
<view class="row-body">
|
||||
<text class="row-title">{{ item.title }}</text>
|
||||
<text v-if="item.path" class="row-sub">{{ item.path }}</text>
|
||||
</view>
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
<view v-if="group.items.length === 0" class="group-empty">
|
||||
<text class="group-empty-text">该模块下暂无你可见的功能</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="commonMenus.length" class="group">
|
||||
<view class="group-head">
|
||||
<view class="tint-icon group-icon tint-3">
|
||||
<FaIcon name="wrench" color="#ffffff" :size="18" />
|
||||
</view>
|
||||
<view class="group-meta">
|
||||
<view class="group-title-row">
|
||||
<text class="group-name">协作工具</text>
|
||||
</view>
|
||||
<text class="group-count">{{ commonMenus.length }} 个功能</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list-card">
|
||||
<view
|
||||
v-for="item in commonMenus"
|
||||
:key="item.id"
|
||||
class="list-item"
|
||||
@tap="openMenu(item, item.title)"
|
||||
>
|
||||
<view class="dot primary" />
|
||||
<view class="row-body">
|
||||
<text class="row-title">{{ item.title }}</text>
|
||||
</view>
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="bottom-space" />
|
||||
</view>
|
||||
|
||||
<AppTabbar current="features" />
|
||||
@@ -53,115 +127,124 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
import AppTabbar from '@/components/AppTabbar.vue'
|
||||
import { fetchHome } from '@/api/workspace.js'
|
||||
import { openMenu } from '@/utils/nav.js'
|
||||
import AppTabbar from '@/components/MainTabbar.vue'
|
||||
|
||||
const keyword = ref('')
|
||||
const activeIndex = ref(0)
|
||||
const activeItemId = ref('')
|
||||
|
||||
const routeMap = {
|
||||
notepad: '/pages/tools/notepad/index',
|
||||
schedule: '/pages/tools/schedule/index'
|
||||
const MODULE_ICONS = {
|
||||
crm: 'handshake',
|
||||
erp: 'boxes-stacked',
|
||||
oa: 'clipboard-check',
|
||||
cms: 'globe',
|
||||
ai: 'robot',
|
||||
system: 'gear',
|
||||
tool: 'wrench'
|
||||
}
|
||||
|
||||
const categories = ref([
|
||||
{
|
||||
id: 'handy',
|
||||
title: '便捷工具',
|
||||
items: [
|
||||
{ id: 'notepad', name: '记事本', route: routeMap.notepad },
|
||||
{ id: 'schedule', name: '日程提醒', route: routeMap.schedule }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'tools',
|
||||
title: '常用工具',
|
||||
items: [
|
||||
{ id: 't1', name: '扫一扫' },
|
||||
{ id: 't2', name: '收付款' },
|
||||
{ id: 't3', name: '卡包管理' },
|
||||
{ id: 't4', name: '出行服务' },
|
||||
{ id: 't5', name: '二维码生成' },
|
||||
{ id: 't6', name: '发票助手' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'life',
|
||||
title: '生活服务',
|
||||
items: [
|
||||
{ id: 'l1', name: '外卖订餐' },
|
||||
{ id: 'l2', name: '电影购票' },
|
||||
{ id: 'l3', name: '酒店预订' },
|
||||
{ id: 'l4', name: '快递查询' },
|
||||
{ id: 'l5', name: '家政预约' },
|
||||
{ id: 'l6', name: '更多服务' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'office',
|
||||
title: '办公效率',
|
||||
items: [
|
||||
{ id: 'o1', name: '文档协作' },
|
||||
{ id: 'o2', name: '日程管理' },
|
||||
{ id: 'o3', name: '云盘存储' },
|
||||
{ id: 'o4', name: '视频会议' },
|
||||
{ id: 'o5', name: '任务看板' },
|
||||
{ id: 'o6', name: '审批流程' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'data',
|
||||
title: '数据报表',
|
||||
items: [
|
||||
{ id: 'd1', name: '销售统计' },
|
||||
{ id: 'd2', name: '用户分析' },
|
||||
{ id: 'd3', name: '访问趋势' },
|
||||
{ id: 'd4', name: '转化报表' },
|
||||
{ id: 'd5', name: '导出数据' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'system',
|
||||
title: '系统设置',
|
||||
items: [
|
||||
{ id: 's1', name: '账号管理' },
|
||||
{ id: 's2', name: '权限配置' },
|
||||
{ id: 's3', name: '消息通知' },
|
||||
{ id: 's4', name: '安全中心' },
|
||||
{ id: 's5', name: '关于系统' }
|
||||
]
|
||||
const keyword = ref('')
|
||||
const loading = ref(true)
|
||||
const modules = ref([])
|
||||
const menus = ref([])
|
||||
|
||||
/** 按模块 code 归组的全部菜单(含目录与锁定项,便于浏览) */
|
||||
const groups = computed(() => {
|
||||
const byCode = {}
|
||||
menus.value.forEach((m) => {
|
||||
if (!m.module) return
|
||||
if (!byCode[m.module]) byCode[m.module] = []
|
||||
byCode[m.module].push(m)
|
||||
})
|
||||
|
||||
// 这里展示全部模块(含 type=2 系统设置),与工作台首页只展示业务模块形成分工
|
||||
const list = modules.value.map((mod, index) => ({
|
||||
id: mod.id,
|
||||
code: mod.code,
|
||||
name: mod.name || '未命名应用',
|
||||
icon: mod.type === 2 ? 'gear' : MODULE_ICONS[String(mod.code || '').toLowerCase()] || 'cube',
|
||||
tint: mod.enabled === false ? 'tint-off' : 'tint-' + (index % 8),
|
||||
locked: mod.enabled === false,
|
||||
items: (byCode[mod.code] || []).slice().sort((a, b) => a.sort - b.sort)
|
||||
}))
|
||||
|
||||
// 兜底:模块表里没有对应记录(或已删除)的菜单
|
||||
const known = {}
|
||||
list.forEach((g) => {
|
||||
known[String(g.code || '').toLowerCase()] = true
|
||||
})
|
||||
const orphan = []
|
||||
menus.value.forEach((m) => {
|
||||
const code = String(m.module || '').toLowerCase()
|
||||
if (code && !known[code]) orphan.push(m)
|
||||
})
|
||||
if (orphan.length) {
|
||||
list.push({
|
||||
id: 'other',
|
||||
code: 'other',
|
||||
name: '其他功能',
|
||||
icon: 'file-lines',
|
||||
tint: 'tint-7',
|
||||
locked: false,
|
||||
items: orphan
|
||||
})
|
||||
}
|
||||
])
|
||||
|
||||
const currentCategory = computed(() => categories.value[activeIndex.value])
|
||||
|
||||
const displayItems = computed(() => {
|
||||
const items = currentCategory.value?.items || []
|
||||
const q = keyword.value.trim().toLowerCase()
|
||||
if (!q) return items
|
||||
return items.filter(item => item.name.toLowerCase().includes(q))
|
||||
return list
|
||||
})
|
||||
|
||||
const commonMenus = computed(() => menus.value.filter((m) => !m.module))
|
||||
|
||||
/** 跨模块搜索:应用名 + 模块名 + 菜单标题 */
|
||||
const searchResults = computed(() => {
|
||||
const q = keyword.value.trim().toLowerCase()
|
||||
if (!q) return []
|
||||
const moduleName = {}
|
||||
modules.value.forEach((m) => {
|
||||
moduleName[String(m.code || '').toLowerCase()] = m.name
|
||||
})
|
||||
|
||||
return menus.value
|
||||
.filter((m) => {
|
||||
const mod = modules.value.find((x) => x.code === m.module)
|
||||
const hay = [m.title, m.path, mod && mod.name].join(' ').toLowerCase()
|
||||
return hay.indexOf(q) > -1
|
||||
})
|
||||
.map((m, i) => {
|
||||
const mod = modules.value.find((x) => x.code === m.module)
|
||||
return {
|
||||
menu: m,
|
||||
moduleName: (mod && mod.name) || '协作工具',
|
||||
icon: MODULE_ICONS[String(m.module || '').toLowerCase()] || 'file-lines',
|
||||
tint: mod && mod.enabled === false ? 'tint-off' : 'tint-' + (i % 8),
|
||||
locked: m.locked === true || (mod && mod.enabled === false)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await fetchHome()
|
||||
modules.value = Array.isArray(data.modules) ? data.modules : []
|
||||
menus.value = Array.isArray(data.menus) ? data.menus : []
|
||||
} catch (e) {
|
||||
console.error('[apps] load failed:', e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
}
|
||||
})
|
||||
|
||||
function selectCategory(index) {
|
||||
activeIndex.value = index
|
||||
activeItemId.value = ''
|
||||
}
|
||||
|
||||
function onItemTap(item) {
|
||||
activeItemId.value = item.id
|
||||
if (item.route) {
|
||||
uni.navigateTo({ url: item.route })
|
||||
return
|
||||
}
|
||||
uni.showToast({ title: item.name, icon: 'none' })
|
||||
}
|
||||
load()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
if (isLoggedIn() && !loading.value) load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -173,15 +256,16 @@ function onItemTap(item) {
|
||||
|
||||
.search-wrap {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 16rpx) 24rpx 20rpx;
|
||||
padding: calc(var(--status-bar-height, 44px) + 16rpx) $page-padding-x 20rpx;
|
||||
background: $color-card;
|
||||
box-shadow: $shadow-header;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
height: 72rpx;
|
||||
height: 76rpx;
|
||||
padding: 0 24rpx;
|
||||
background: $color-bg-page;
|
||||
border-radius: $radius-full;
|
||||
@@ -189,7 +273,8 @@ function onItemTap(item) {
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
height: 72rpx;
|
||||
min-width: 0;
|
||||
height: 76rpx;
|
||||
font-size: 28rpx;
|
||||
color: $color-text;
|
||||
}
|
||||
@@ -207,98 +292,155 @@ function onItemTap(item) {
|
||||
|
||||
.body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
background: $color-card;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 200rpx;
|
||||
flex-shrink: 0;
|
||||
background: $color-bg-page;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding: 24rpx $page-padding-x 0;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
position: relative;
|
||||
padding: 32rpx 16rpx;
|
||||
text-align: center;
|
||||
|
||||
&.active {
|
||||
background: $color-card;
|
||||
|
||||
.category-text {
|
||||
color: $color-primary;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6rpx;
|
||||
height: 36rpx;
|
||||
background: linear-gradient(180deg, #4facfe 0%, #00f2fe 100%);
|
||||
border-radius: 0 4rpx 4rpx 0;
|
||||
}
|
||||
}
|
||||
.result-hint {
|
||||
padding: 0 4rpx 16rpx;
|
||||
}
|
||||
|
||||
.category-text {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-secondary;
|
||||
line-height: 1.4;
|
||||
.result-hint-text {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding: 20rpx 24rpx;
|
||||
background: $color-card;
|
||||
}
|
||||
|
||||
.item-card {
|
||||
padding: 28rpx 24rpx;
|
||||
margin-bottom: 16rpx;
|
||||
background: $color-bg-page;
|
||||
border-radius: $radius-md;
|
||||
|
||||
&.active {
|
||||
background: linear-gradient(135deg, rgba(79, 172, 254, 0.08) 0%, rgba(0, 242, 254, 0.08) 100%);
|
||||
|
||||
.item-name {
|
||||
color: #4facfe;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-size: 28rpx;
|
||||
color: $color-text;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.empty {
|
||||
.empty-box {
|
||||
@include card;
|
||||
margin-top: 24rpx;
|
||||
padding: 80rpx 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 120rpx 0;
|
||||
gap: 20rpx;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.group-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
margin-bottom: 18rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
|
||||
.group-icon {
|
||||
@include tint-icon(72rpx, 18rpx);
|
||||
}
|
||||
|
||||
.group-meta {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.group-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.group-name {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.group-lock {
|
||||
@include chip(#fef3f2, $color-danger);
|
||||
}
|
||||
|
||||
.group-count {
|
||||
display: block;
|
||||
margin-top: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
@include card;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
padding: 26rpx 24rpx;
|
||||
|
||||
& + & {
|
||||
border-top: 1rpx solid $color-divider;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: $color-bg-page;
|
||||
}
|
||||
}
|
||||
|
||||
.row-icon {
|
||||
@include tint-icon(60rpx, 16rpx);
|
||||
}
|
||||
|
||||
.row-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.row-title {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: $color-text;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.row-sub {
|
||||
display: block;
|
||||
margin-top: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.row-lock {
|
||||
@include chip(#fef3f2, $color-danger);
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
background: $color-text-muted;
|
||||
|
||||
&.primary { background: $color-primary; }
|
||||
&.off { background: $color-border; }
|
||||
}
|
||||
|
||||
.group-empty {
|
||||
padding: 40rpx 24rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.group-empty-text {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.bottom-space {
|
||||
height: 40rpx;
|
||||
}
|
||||
</style>
|
||||
+742
-554
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,369 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 顶部信息:融入页面背景,不再单独做彩色抬头 -->
|
||||
<view class="head">
|
||||
<view class="head-row">
|
||||
<text class="head-title">选择子系统</text>
|
||||
<text class="head-count">{{ enabledCount }}/{{ cards.length }} 已开通</text>
|
||||
</view>
|
||||
<text class="head-sub">{{ user.tenant || '云泽平台' }}<text v-if="user.account"> · {{ user.account }}</text></text>
|
||||
</view>
|
||||
|
||||
<view class="body">
|
||||
<!-- 加载失败 -->
|
||||
<view v-if="loadError" class="err-box" @tap="load(true)">
|
||||
<FaIcon name="triangle-exclamation" color="#f04438" :size="18" />
|
||||
<view class="err-body">
|
||||
<text class="err-title">子系统加载失败</text>
|
||||
<text class="err-msg">{{ loadError }},点击重试</text>
|
||||
</view>
|
||||
<FaIcon name="rotate" color="#f04438" :size="16" />
|
||||
</view>
|
||||
|
||||
<!-- 子系统宫格 -->
|
||||
<view v-else-if="!loading && cards.length === 0" class="empty-box">
|
||||
<FaIcon name="cube" color="#c0c4cc" :size="32" />
|
||||
<text class="empty-text">暂无子系统,请联系管理员开通</text>
|
||||
</view>
|
||||
|
||||
<view v-else class="card-grid">
|
||||
<view
|
||||
v-for="card in cards"
|
||||
:key="card.code || card.id"
|
||||
class="sub-card"
|
||||
:class="{ locked: card.locked }"
|
||||
@tap="enter(card)"
|
||||
>
|
||||
<view class="tint-icon sub-icon" :class="card.tint">
|
||||
<FaIcon :name="card.icon" color="#ffffff" :size="26" />
|
||||
</view>
|
||||
<text class="sub-name">{{ card.name }}</text>
|
||||
<text class="sub-desc">{{ card.desc }}</text>
|
||||
<view class="sub-go">
|
||||
<text class="sub-go-text">进入</text>
|
||||
<FaIcon name="arrow-right" color="#ffffff" :size="11" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bottom-space" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
import { fetchHome } from '@/api/workspace.js'
|
||||
import { openMenu } from '@/utils/nav.js'
|
||||
import { getSubsystemByModule, goSubsystem } from '@/config/subsystems.js'
|
||||
|
||||
/** 模块 code → 子系统 slug → 进入其概览页;未注册返回 false */
|
||||
function goSubsystemByModule(code) {
|
||||
const sub = getSubsystemByModule(code)
|
||||
return sub ? goSubsystem(sub.slug) : false
|
||||
}
|
||||
|
||||
/** 模块 code → 端上图标(后端 icon 存的是 Element Plus 图标名,端上用不了) */
|
||||
const MODULE_ICONS = {
|
||||
crm: 'handshake',
|
||||
erp: 'boxes-stacked',
|
||||
oa: 'clipboard-check',
|
||||
cms: 'globe',
|
||||
ai: 'robot',
|
||||
system: 'gear',
|
||||
tool: 'wrench'
|
||||
}
|
||||
|
||||
const loading = ref(true)
|
||||
const loadError = ref('')
|
||||
const user = ref({})
|
||||
const modules = ref([])
|
||||
const menus = ref([])
|
||||
|
||||
/** 叶子菜单(可直接跳转的功能页),已锁定的过滤掉 */
|
||||
const leafMenus = computed(() => menus.value.filter((m) => m.leaf !== false && !m.locked))
|
||||
|
||||
/** 子系统卡片:每个业务模块一张卡 */
|
||||
const cards = computed(() => {
|
||||
const byCode = {}
|
||||
leafMenus.value.forEach((m) => {
|
||||
if (!m.module) return
|
||||
if (!byCode[m.module]) byCode[m.module] = []
|
||||
byCode[m.module].push(m)
|
||||
})
|
||||
|
||||
return modules.value
|
||||
.filter((m) => m.type !== 2) // 2=系统配置,不作为子系统入口
|
||||
.map((mod, index) => {
|
||||
const code = String(mod.code || '').toLowerCase()
|
||||
const items = byCode[mod.code] || []
|
||||
const locked = mod.enabled === false
|
||||
return {
|
||||
id: mod.id,
|
||||
code: mod.code,
|
||||
path: mod.path || '',
|
||||
name: mod.name || '未命名系统',
|
||||
desc: locked
|
||||
? '未开通该模块'
|
||||
: mod.description || (items.length ? items.length + ' 个功能' : '暂无功能'),
|
||||
icon: MODULE_ICONS[code] || 'cube',
|
||||
tint: locked ? 'tint-off' : 'tint-' + (index % 8),
|
||||
locked,
|
||||
items,
|
||||
total: items.length
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const enabledCount = computed(() => cards.value.filter((c) => !c.locked).length)
|
||||
|
||||
/* ==================== 数据加载 ==================== */
|
||||
|
||||
async function load(force = false) {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await fetchHome(force)
|
||||
user.value = data.user || {}
|
||||
modules.value = Array.isArray(data.modules) ? data.modules : []
|
||||
menus.value = Array.isArray(data.menus) ? data.menus : []
|
||||
loadError.value = ''
|
||||
} catch (e) {
|
||||
console.error('[nav] load failed:', e)
|
||||
loadError.value = (e && e.message) || '接口请求失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================== 交互 ==================== */
|
||||
|
||||
/**
|
||||
* 点击子系统卡片 → 进入该子系统独立页面组(带自己的 tabbar)。
|
||||
* 未在 config/subsystems.js 注册的模块,降级为直接打开 Web 端该模块首页。
|
||||
*/
|
||||
function enter(card) {
|
||||
if (card.locked) {
|
||||
openMenu({ locked: true, title: card.name })
|
||||
return
|
||||
}
|
||||
if (goSubsystemByModule(card.code)) return
|
||||
if (card.items.length) {
|
||||
openMenu(card.items[0], card.name)
|
||||
return
|
||||
}
|
||||
if (card.path) {
|
||||
openMenu({ title: card.name, path: card.path, leaf: true }, card.name)
|
||||
return
|
||||
}
|
||||
uni.showToast({ title: card.name + '暂未开放', icon: 'none' })
|
||||
}
|
||||
|
||||
/* ==================== 生命周期 ==================== */
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
return
|
||||
}
|
||||
load()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
if (isLoggedIn() && !loading.value) load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/src/styles/page-common.scss';
|
||||
|
||||
.page {
|
||||
@include page-shell;
|
||||
}
|
||||
|
||||
/* ============ 顶部信息(融入页面背景) ============ */
|
||||
.head {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 32rpx) $page-padding-x 12rpx;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.head-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.head-title {
|
||||
font-size: 42rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
.head-count {
|
||||
font-size: 23rpx;
|
||||
color: $color-text-muted;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.head-sub {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
font-size: 23rpx;
|
||||
color: $color-text-muted;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ============ 内容区 ============ */
|
||||
.body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding: 8rpx $page-padding-x 0;
|
||||
}
|
||||
|
||||
/* ============ 失败提示 ============ */
|
||||
.err-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 24rpx 22rpx;
|
||||
background: #fef3f2;
|
||||
border: 1rpx solid #fdd8d4;
|
||||
border-radius: $radius-md;
|
||||
}
|
||||
|
||||
.err-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.err-title {
|
||||
display: block;
|
||||
font-size: 27rpx;
|
||||
font-weight: 500;
|
||||
color: $color-danger;
|
||||
}
|
||||
|
||||
.err-msg {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: #b42318;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.empty-box {
|
||||
@include card;
|
||||
margin-top: 24rpx;
|
||||
padding: 80rpx 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 子系统宫格 ============
|
||||
用 flex 换行而不是 grid:小程序端 wxss 对 grid 的支持不稳定,
|
||||
用 flex-wrap + 百分比宽度才能保证任何屏宽都稳定两列,
|
||||
且同一行卡片高度自动拉齐(align-items 默认 stretch)。 */
|
||||
.card-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.sub-card {
|
||||
@include card;
|
||||
width: calc(50% - 10rpx);
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 26rpx 22rpx 22rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: transform 0.15s ease, box-shadow 0.2s ease;
|
||||
|
||||
/* 每行第 2 个不右边距,保证 50%-10rpx + 20rpx + 50%-10rpx = 100% */
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
/* 未开通:靠灰色图标与灰色文字表达,不使用角标 */
|
||||
&.locked {
|
||||
.sub-name,
|
||||
.sub-desc {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.sub-go {
|
||||
background: $color-border;
|
||||
}
|
||||
|
||||
.sub-go-text {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sub-icon {
|
||||
@include tint-icon(88rpx, 24rpx);
|
||||
}
|
||||
|
||||
.sub-name {
|
||||
margin-top: 20rpx;
|
||||
font-size: 31rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sub-desc {
|
||||
margin-top: 8rpx;
|
||||
/* 按钮用 margin-top:auto 吸底,这里保证内容短时也有最小间距 */
|
||||
margin-bottom: 20rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 进入按钮:吸底 + 撑满宽度,同一行的卡片按钮位置自动对齐 */
|
||||
.sub-go {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6rpx;
|
||||
height: 58rpx;
|
||||
margin-top: auto;
|
||||
border-radius: $radius-md;
|
||||
background: $color-primary;
|
||||
}
|
||||
|
||||
.sub-go-text {
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.bottom-space {
|
||||
height: 48rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubFunctions slug="oa" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · functions 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubFunctions from '@/components/sub/SubFunctions.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubHome slug="oa" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · home 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubHome from '@/components/sub/SubHome.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubMine slug="oa" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · 我的页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubMine.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubMine from '@/components/sub/SubMine.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubTodo slug="oa" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · todo 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubTodo from '@/components/sub/SubTodo.vue'
|
||||
</script>
|
||||
@@ -32,7 +32,7 @@
|
||||
>
|
||||
<view class="menu-left">
|
||||
<view class="menu-icon">
|
||||
<FaIcon :name="item.icon" color="#3c9cff" :size="18" />
|
||||
<FaIcon :name="item.icon" color="#3973ff" :size="18" />
|
||||
</view>
|
||||
<text class="menu-title">{{ item.title }}</text>
|
||||
</view>
|
||||
@@ -56,9 +56,9 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { getUser, setUser, logout, isLoggedIn } from '@/utils/auth.js'
|
||||
import { getCurrentUser, logoutApi } from '@/api/auth.js'
|
||||
import AppTabbar from '@/components/AppTabbar.vue'
|
||||
import { getUser, setUser, logout, isLoggedIn, isSSOEnabled, getToken } from '@/utils/auth.js'
|
||||
import { getCurrentUser, logoutApi, logoutUAC } from '@/api/auth.js'
|
||||
import AppTabbar from '@/components/MainTabbar.vue'
|
||||
|
||||
const user = ref(null)
|
||||
|
||||
@@ -148,10 +148,14 @@ function handleLogout() {
|
||||
cancelText: '取消',
|
||||
success(res) {
|
||||
if (!res.confirm) return
|
||||
// 先清本地并跳转,避免接口超时/失败导致“退出无效”
|
||||
// 统一认证:先吊销服务端会话与令牌(默认 1 号 1 机,不吊销会占着名额)
|
||||
if (isSSOEnabled() && getToken()) {
|
||||
logoutUAC().catch(() => {})
|
||||
} else {
|
||||
logoutApi().catch(() => {})
|
||||
}
|
||||
// 再清本地并跳转,避免接口超时/失败导致“退出无效”
|
||||
logout()
|
||||
// 后端无状态退出,失败可忽略(不阻塞)
|
||||
logoutApi().catch(() => {})
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
}
|
||||
})
|
||||
@@ -168,7 +172,7 @@ function handleLogout() {
|
||||
.profile-header {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 24rpx) $page-padding-x 40rpx;
|
||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||
background: $hero-gradient;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -332,7 +336,7 @@ function handleLogout() {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 12rpx;
|
||||
background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
|
||||
background: linear-gradient(135deg, rgba(57, 115, 255, 0.12) 0%, rgba(82, 168, 255, 0.14) 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -356,13 +360,13 @@ function handleLogout() {
|
||||
font-size: 20rpx;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||
background: linear-gradient(135deg, #3973ff 0%, #52a8ff 100%);
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 12rpx;
|
||||
min-width: 36rpx;
|
||||
text-align: center;
|
||||
line-height: 1.4;
|
||||
box-shadow: 0 4rpx 12rpx rgba(79, 172, 254, 0.3);
|
||||
box-shadow: 0 4rpx 12rpx rgba(57, 115, 255, 0.3);
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubFunctions slug="toolbox" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* tools 子系统 · functions 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubFunctions from '@/components/sub/SubFunctions.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubHome slug="toolbox" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* tools 子系统 · home 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubHome from '@/components/sub/SubHome.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubMine slug="toolbox" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* toolbox 子系统 · 我的页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubMine.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubMine from '@/components/sub/SubMine.vue'
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<SubTodo slug="toolbox" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* tools 子系统 · todo 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubTodo from '@/components/sub/SubTodo.vue'
|
||||
</script>
|
||||
Reference in new issue
Block a user