更新若干
This commit is contained in:
1 parent
54c90072fb
commit
5682069553
59 files changed
+3813
-1617
No files matched your search
@@ -1,37 +1,5 @@
|
||||
<script>
|
||||
import { getBaseURL } from '@/api/request.js'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
import { getGuestToken } from '@/utils/guest.js'
|
||||
|
||||
const LOGIN_PAGE = '/pages/login/login'
|
||||
const PUBLIC_ROUTES = [
|
||||
'pages/nav/nav',
|
||||
'pages/login/login',
|
||||
'pages/login/register',
|
||||
'pages/login/forget',
|
||||
'pages/login/geetest-webview',
|
||||
'pages/register/confirm',
|
||||
'pages/index/index'
|
||||
]
|
||||
|
||||
function currentRoute() {
|
||||
try {
|
||||
const pages = getCurrentPages()
|
||||
if (!pages.length) return ''
|
||||
const cur = pages[pages.length - 1]
|
||||
return (cur && (cur.route || (cur.$page && cur.$page.path))) || ''
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
function ensureLogin() {
|
||||
const route = currentRoute()
|
||||
if (!route || PUBLIC_ROUTES.indexOf(route) !== -1) return
|
||||
if (isLoggedIn()) return
|
||||
if (getGuestToken()) return
|
||||
uni.reLaunch({ url: LOGIN_PAGE })
|
||||
}
|
||||
|
||||
export default {
|
||||
onLaunch() {
|
||||
@@ -39,7 +7,6 @@
|
||||
},
|
||||
onShow() {
|
||||
console.log('App Show')
|
||||
ensureLogin()
|
||||
},
|
||||
onHide() {
|
||||
console.log('App Hide')
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
const fs = require('fs');
|
||||
const p = require('path');
|
||||
|
||||
const root = 'dist/build/mp-weixin';
|
||||
const appJson = JSON.parse(fs.readFileSync(p.join(root, 'app.json'), 'utf8'));
|
||||
|
||||
// 收集所有被 app.json 引用/声明的页面路径
|
||||
const declared = new Set();
|
||||
(appJson.pages || []).forEach((x) => declared.add(x));
|
||||
(appJson.subPackages || []).forEach((s) => {
|
||||
const base = s.root.replace(/\/$/, '');
|
||||
(s.pages || []).forEach((x) => declared.add(`${base}/${x}`));
|
||||
});
|
||||
|
||||
function walk(d, out) {
|
||||
for (const f of fs.readdirSync(d, { withFileTypes: true })) {
|
||||
const fp = p.join(d, f.name);
|
||||
if (f.isDirectory()) walk(fp, out);
|
||||
else out.push({ rel: p.relative(root, fp).replace(/\\/g, '/'), size: fs.statSync(fp).size });
|
||||
}
|
||||
}
|
||||
const all = [];
|
||||
walk(root, all);
|
||||
|
||||
// 找出 pages 与 components 下没有被声明的页面文件
|
||||
const orphans = [];
|
||||
for (const x of all) {
|
||||
const rel = x.rel;
|
||||
if (!rel.startsWith('pages/')) continue;
|
||||
const noExt = rel.replace(/\.(js|json|wxml|wxss)$/, '');
|
||||
if (!declared.has(noExt)) orphans.push(x);
|
||||
}
|
||||
|
||||
const orphanTotal = orphans.reduce((s, x) => s + x.size, 0);
|
||||
console.log('孤儿页面文件数:', orphans.length, '总大小:', (orphanTotal / 1024).toFixed(1), 'KB');
|
||||
console.log('\n孤儿文件 TOP 20:');
|
||||
orphans.sort((a, b) => b.size - a.size).slice(0, 20).forEach((x) => console.log((x.size / 1024).toFixed(1).padStart(9), 'KB', x.rel));
|
||||
|
||||
// 检查 app.json 声明的页面是否都真实存在
|
||||
const missing = [];
|
||||
for (const d of declared) {
|
||||
const base = p.join(root, d);
|
||||
if (!fs.existsSync(base + '.js') && !fs.existsSync(base + '.wxml')) missing.push(d);
|
||||
}
|
||||
console.log('\n声明但缺失的页面:', missing.length);
|
||||
missing.slice(0, 10).forEach((m) => console.log(' MISSING:', m));
|
||||
|
||||
console.log('\n主包 & 分包文件总数:', all.length);
|
||||
+22
-2
@@ -16,7 +16,8 @@ export function loginUAC(data) {
|
||||
return request({
|
||||
url: '/auth/login',
|
||||
method: 'POST',
|
||||
data: Object.assign({ client_id: clientId }, data)
|
||||
data: Object.assign({ client_id: clientId }, data),
|
||||
skipAuthRedirect: true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -86,7 +87,8 @@ export function loginByMiniapp({ code, phoneCode = '' } = {}) {
|
||||
client_id: 'yz-miniapp',
|
||||
code,
|
||||
phone_code: phoneCode
|
||||
}
|
||||
},
|
||||
skipAuthRedirect: true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -136,6 +138,24 @@ export function sendLoginCode(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function sendAuthLoginCode(data) {
|
||||
return request({
|
||||
url: '/auth/login/code/send',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function loginByAuthCode(data) {
|
||||
const clientId = 'yz-miniapp'
|
||||
return request({
|
||||
url: '/auth/login/code/verify',
|
||||
method: 'POST',
|
||||
data: Object.assign({ client_id: clientId }, data),
|
||||
skipAuthRedirect: true
|
||||
})
|
||||
}
|
||||
|
||||
export function loginBySms(data) {
|
||||
return request({
|
||||
url: '/api/loginBySms',
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
import { request } from '@/api/request.js'
|
||||
import { moneyText } from '@/api/erp.js'
|
||||
|
||||
export const PROJECT_TYPE = {
|
||||
SINGLE: 1,
|
||||
UP_DOWN: 2,
|
||||
UP_MID: 3
|
||||
}
|
||||
|
||||
export const PROJECT_TYPE_LABEL = {
|
||||
1: '单一项目',
|
||||
2: '上下游项目',
|
||||
3: '上中游项目'
|
||||
}
|
||||
|
||||
export const PROJECT_STATUS = {
|
||||
PENDING: 1,
|
||||
OPERATING: 2,
|
||||
WAITING: 3,
|
||||
SUSPENDED: 4,
|
||||
ABNORMAL: 5
|
||||
}
|
||||
|
||||
export const PROJECT_STATUS_LABEL = {
|
||||
1: '未开始',
|
||||
2: '进行中',
|
||||
3: '已完成',
|
||||
4: '已暂停',
|
||||
5: '异常'
|
||||
}
|
||||
|
||||
export function projectTypeLabel(type) {
|
||||
return PROJECT_TYPE_LABEL[type] || '项目'
|
||||
}
|
||||
|
||||
export function projectStatusLabel(status) {
|
||||
return PROJECT_STATUS_LABEL[status] || '未知'
|
||||
}
|
||||
|
||||
export function projectTypeOptions() {
|
||||
return Object.keys(PROJECT_TYPE).map((k) => ({
|
||||
value: Number(k),
|
||||
label: projectTypeLabel(Number(k))
|
||||
}))
|
||||
}
|
||||
|
||||
export function projectStatusOptions() {
|
||||
return Object.keys(PROJECT_STATUS).map((k) => ({
|
||||
value: Number(k),
|
||||
label: projectStatusLabel(Number(k))
|
||||
}))
|
||||
}
|
||||
|
||||
export function formatDate(value) {
|
||||
const s = String(value || '')
|
||||
return s ? s.slice(0, 10) : ''
|
||||
}
|
||||
|
||||
export function formatMoney(value) {
|
||||
return moneyText(value)
|
||||
}
|
||||
|
||||
export async function fetchProjects(params = {}) {
|
||||
const data = await request({
|
||||
url: '/api/crm/project/list',
|
||||
data: {
|
||||
page: params.page || 1,
|
||||
pageSize: params.pageSize || 20,
|
||||
keyword: params.keyword || '',
|
||||
status: params.status ?? '',
|
||||
project_type: params.projectType ?? '',
|
||||
year: params.year || ''
|
||||
}
|
||||
})
|
||||
return { list: (data.list || []).map(normalizeProject), total: data.total || 0 }
|
||||
}
|
||||
|
||||
export async function getProject(id) {
|
||||
const data = await request({ url: `/api/crm/project/detail/${id}` })
|
||||
return data ? normalizeProject(data) : null
|
||||
}
|
||||
|
||||
export async function saveProject(project) {
|
||||
const data = await request({
|
||||
url: '/api/crm/project/save',
|
||||
method: 'POST',
|
||||
data: normalizeSavePayload(project)
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
export async function changeProjectStatus(id, status, reason) {
|
||||
return request({
|
||||
url: `/api/crm/project/status/${id}`,
|
||||
method: 'POST',
|
||||
data: { status, reason: reason || '' }
|
||||
})
|
||||
}
|
||||
|
||||
export async function deleteProject(id) {
|
||||
return request({
|
||||
url: `/api/crm/project/delete/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
}
|
||||
|
||||
function normalizeProject(p) {
|
||||
return {
|
||||
...p,
|
||||
upstream_amount: Number(p.upstream_amount || 0),
|
||||
downstream_amount: Number(p.downstream_amount || 0),
|
||||
amount: Number(p.amount || 0),
|
||||
status: Number(p.status || 1)
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeSavePayload(p) {
|
||||
return {
|
||||
id: p.id || 0,
|
||||
project_name: p.projectName || '',
|
||||
project_no: p.projectNo || '',
|
||||
project_type: p.projectType || 1,
|
||||
customer_id: p.customerId || 0,
|
||||
customer_ref_type: p.customerRefType || 1,
|
||||
customer_name: p.customerName || '',
|
||||
supplier_id: p.supplierId || 0,
|
||||
supplier_ref_type: p.supplierRefType || 0,
|
||||
supplier_name: p.supplierName || '',
|
||||
supplier_industry: p.supplierIndustry || '',
|
||||
owner_user_id: p.ownerUserId || '',
|
||||
owner_user_name: p.ownerUserName || '',
|
||||
industry: p.industry || '',
|
||||
upstream_amount: p.upstreamAmount || 0,
|
||||
downstream_amount: p.downstreamAmount || 0,
|
||||
status: p.status || 1,
|
||||
start_date: formatDate(p.startDate),
|
||||
end_date: formatDate(p.endDate),
|
||||
upstream_contact: p.upstreamContact || '',
|
||||
upstream_phone: p.upstreamPhone || '',
|
||||
downstream_contact: p.downstreamContact || '',
|
||||
downstream_phone: p.downstreamPhone || '',
|
||||
address: p.address || '',
|
||||
remark: p.remark || ''
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ async function replayRequest(options) {
|
||||
}
|
||||
|
||||
export function request(options = {}) {
|
||||
const { url, method = 'GET', data, header = {}, silent = false, timeout = 30000 } = options
|
||||
const { url, method = 'GET', data, header = {}, silent = false, timeout = 30000, skipAuthRedirect = false } = options
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
...header
|
||||
@@ -82,6 +82,14 @@ export function request(options = {}) {
|
||||
const body = res.data || {}
|
||||
|
||||
if (status === 401 || body.code === 401) {
|
||||
if (skipAuthRedirect) {
|
||||
const msg = body.msg || '登录失败'
|
||||
const err = new Error(msg)
|
||||
err.code = 401
|
||||
err.response = body
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
if (!isLoggedIn() && getGuestToken()) {
|
||||
clearGuestToken()
|
||||
if (!silent) {
|
||||
|
||||
@@ -43,7 +43,62 @@ const parsed = computed(() => {
|
||||
return { name: raw.replace(/^fa-/, ''), brands: props.type === 'brands' }
|
||||
})
|
||||
|
||||
const iconChar = computed(() => FA_ICONS[parsed.value.name] || '')
|
||||
// Element Plus / 历史菜单使用的是 PascalCase 图标名,这里统一转换为 Font Awesome 名称
|
||||
const ICON_ALIAS = {
|
||||
notebook: 'book',
|
||||
tickets: 'ticket',
|
||||
ticket: 'ticket',
|
||||
document: 'file-lines',
|
||||
files: 'folder-open',
|
||||
calendar: 'calendar-days',
|
||||
reading: 'book-open',
|
||||
postcard: 'envelope',
|
||||
chatdotround: 'comments',
|
||||
chatdot: 'comment',
|
||||
editpen: 'pen',
|
||||
pencil: 'pen',
|
||||
pricetag: 'tag',
|
||||
operation: 'sliders',
|
||||
coin: 'coins',
|
||||
goods: 'box',
|
||||
setting: 'gear',
|
||||
dataline: 'chart-line',
|
||||
officebuilding: 'building',
|
||||
fold: 'folder',
|
||||
menu: 'bars',
|
||||
search: 'magnifying-glass',
|
||||
bell: 'bell',
|
||||
notification: 'bell',
|
||||
homefilled: 'house',
|
||||
position: 'location-dot',
|
||||
promotion: 'gift',
|
||||
discount: 'tag',
|
||||
userfilled: 'user',
|
||||
documentcopy: 'copy',
|
||||
memo: 'note-sticky',
|
||||
management: 'list',
|
||||
tools: 'wrench',
|
||||
service: 'headset'
|
||||
}
|
||||
|
||||
function toKebabCase(name) {
|
||||
return String(name)
|
||||
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
||||
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
|
||||
.replace(/[\s_]+/g, '-')
|
||||
.toLowerCase()
|
||||
}
|
||||
|
||||
const iconChar = computed(() => {
|
||||
const name = parsed.value.name
|
||||
if (!name) return ''
|
||||
if (FA_ICONS[name]) return FA_ICONS[name]
|
||||
const kebab = toKebabCase(name)
|
||||
if (FA_ICONS[kebab]) return FA_ICONS[kebab]
|
||||
const alias = ICON_ALIAS[kebab]
|
||||
if (alias && FA_ICONS[alias]) return FA_ICONS[alias]
|
||||
return ''
|
||||
})
|
||||
|
||||
const fontClass = computed(() =>
|
||||
parsed.value.brands ? 'fa-font-brands' : 'fa-font-solid'
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
v-if="isOa && dash"
|
||||
part="top"
|
||||
:data="dash"
|
||||
@view-notices="goNotices"
|
||||
@view-schedules="goSchedules"
|
||||
/>
|
||||
|
||||
@@ -87,7 +86,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="isOa" class="block">
|
||||
<view v-if="isOa && !embedded" class="block">
|
||||
<view class="block-head">
|
||||
<text class="block-title">最新公告</text>
|
||||
<view class="block-more" @tap="goNotices">
|
||||
@@ -158,7 +157,6 @@
|
||||
v-if="isOa && dash"
|
||||
part="bottom"
|
||||
:data="dash"
|
||||
@view-notices="goNotices"
|
||||
@view-schedules="goSchedules"
|
||||
/>
|
||||
</view>
|
||||
@@ -229,7 +227,7 @@ import { isLoggedIn } from '@/utils/auth.js'
|
||||
import { getGuestToken } from '@/utils/guest.js'
|
||||
import { request } from '@/api/request.js'
|
||||
import { clearHomeCache } from '@/api/workspace.js'
|
||||
import { openMenu } from '@/utils/nav.js'
|
||||
import { openMenu, orderQuickMenus } from '@/utils/nav.js'
|
||||
import { useSubsystem } from '@/utils/subsystem.js'
|
||||
import AppTabbar from '@/components/AppTabbar.vue'
|
||||
import SubOaDashboard from '@/components/sub/SubOaDashboard.vue'
|
||||
@@ -268,10 +266,12 @@ function isDashboardMenu(m) {
|
||||
}
|
||||
|
||||
const quickCandidates = computed(() =>
|
||||
allMenus.value
|
||||
.filter((m) => m.leaf !== false && !isDashboardMenu(m))
|
||||
.slice()
|
||||
.sort((a, b) => (a.sort || 0) - (b.sort || 0))
|
||||
orderQuickMenus(
|
||||
allMenus.value
|
||||
.filter((m) => m.leaf !== false && !isDashboardMenu(m))
|
||||
.slice()
|
||||
.sort((a, b) => (a.sort || 0) - (b.sort || 0))
|
||||
)
|
||||
)
|
||||
|
||||
const QUICK_MAX = 7
|
||||
@@ -419,7 +419,7 @@ async function loadTodo() {
|
||||
}
|
||||
|
||||
async function loadNotices() {
|
||||
if (!isOa.value) return
|
||||
if (!isOa.value || props.embedded) return
|
||||
try {
|
||||
const data = await request({ url: '/api/oa/notice/list', data: { pageSize: 3 } })
|
||||
notices.value = (data && data.list) || []
|
||||
|
||||
@@ -152,7 +152,7 @@ function handleLogout() {
|
||||
clearPendingAuth()
|
||||
clearHomeCache()
|
||||
logout()
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,47 +1,6 @@
|
||||
<template>
|
||||
<view class="oa-dash">
|
||||
<template v-if="part !== 'bottom'">
|
||||
<view class="dash-card">
|
||||
<view class="dash-head">
|
||||
<view class="dash-head-left">
|
||||
<view class="head-icon hi-notice">
|
||||
<FaIcon name="bullhorn" color="#2563eb" :size="12" />
|
||||
</view>
|
||||
<text class="dash-title">公告</text>
|
||||
</view>
|
||||
<view class="dash-more" @tap="emit('view-notices')">
|
||||
<text class="dash-more-text">查看全部</text>
|
||||
<FaIcon name="chevron-right" color="#94a3b8" :size="11" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!notices.length" class="dash-empty">
|
||||
<FaIcon name="bullhorn" color="#c0c4cc" :size="24" />
|
||||
<text class="dash-empty-text">暂无公告</text>
|
||||
</view>
|
||||
<swiper
|
||||
v-else
|
||||
class="notice-swiper"
|
||||
vertical
|
||||
autoplay
|
||||
circular
|
||||
:interval="3000"
|
||||
:duration="500"
|
||||
>
|
||||
<swiper-item v-for="n in notices" :key="n.id" @tap="emit('view-notices')">
|
||||
<view class="notice-line">
|
||||
<view class="notice-main">
|
||||
<text class="notice-tag" :class="'nt-' + (n.notice_type || 0)">
|
||||
{{ noticeTypeLabel(n.notice_type) }}
|
||||
</text>
|
||||
<text v-if="n.is_top === 1" class="notice-top">置顶</text>
|
||||
<text class="notice-title">{{ n.title }}</text>
|
||||
</view>
|
||||
<text class="notice-time">{{ noticeTime(n.publish_time) }}</text>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<view class="dash-card">
|
||||
<view class="dash-head">
|
||||
<view class="dash-head-left">
|
||||
@@ -148,7 +107,7 @@ const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
part: { type: String, default: 'top' }
|
||||
})
|
||||
const emit = defineEmits(['view-notices', 'view-schedules'])
|
||||
const emit = defineEmits(['view-schedules'])
|
||||
|
||||
const num = (v) => Number(v || 0)
|
||||
|
||||
@@ -187,22 +146,6 @@ const statusList = computed(() => {
|
||||
.map((x) => ({ ...x, pct: Math.round((num(x.count) / total) * 100) + '%' }))
|
||||
})
|
||||
|
||||
const notices = computed(() => props.data?.notices || [])
|
||||
|
||||
const noticeTypeLabel = (type) => ({ 1: '公告', 2: '活动' }[type] || '通知')
|
||||
|
||||
const pad2 = (n) => String(n).padStart(2, '0')
|
||||
const fmtDate = (d) => `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`
|
||||
function noticeTime(ts) {
|
||||
if (!ts) return ''
|
||||
const d = new Date(String(ts).replace(/-/g, '/'))
|
||||
if (Number.isNaN(d.getTime())) return String(ts).slice(5, 10)
|
||||
const now = new Date()
|
||||
if (fmtDate(d) === fmtDate(now)) return `${pad2(d.getHours())}:${pad2(d.getMinutes())}`
|
||||
if (d.getFullYear() === now.getFullYear()) return `${d.getMonth() + 1}/${d.getDate()}`
|
||||
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`
|
||||
}
|
||||
|
||||
const money = (value) =>
|
||||
Number(value || 0).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||
</script>
|
||||
@@ -242,7 +185,6 @@ const money = (value) =>
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.hi-notice,
|
||||
&.hi-stat {
|
||||
background: $color-primary-bg;
|
||||
}
|
||||
@@ -277,19 +219,6 @@ const money = (value) =>
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.dash-empty {
|
||||
padding: 36rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.dash-empty-text {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.stat-tile {
|
||||
padding: 20rpx 20rpx 8rpx;
|
||||
border-radius: $radius-md;
|
||||
@@ -503,63 +432,4 @@ const money = (value) =>
|
||||
color: $color-text-muted;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.notice-swiper {
|
||||
height: 68rpx;
|
||||
}
|
||||
|
||||
.notice-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
height: 68rpx;
|
||||
|
||||
&:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.notice-tag {
|
||||
flex-shrink: 0;
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 12rpx;
|
||||
border-radius: $radius-sm;
|
||||
background: $color-primary-bg;
|
||||
color: $color-primary;
|
||||
|
||||
&.nt-2 {
|
||||
background: #ecfdf5;
|
||||
color: $color-success;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-top {
|
||||
flex-shrink: 0;
|
||||
font-size: 20rpx;
|
||||
color: $color-danger;
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 26rpx;
|
||||
color: $color-text;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.notice-time {
|
||||
flex-shrink: 0;
|
||||
font-size: 20rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
</style>
|
||||
@@ -60,7 +60,7 @@
|
||||
"appid" : "wxd500522c8b9440a6",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"minified" : true,
|
||||
"minified" : false,
|
||||
"postcss" : true
|
||||
},
|
||||
"usingComponents" : true,
|
||||
|
||||
@@ -161,7 +161,15 @@
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系 · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "project/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客户项目",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -157,7 +157,7 @@ const currentNodeLabel = computed(() => {
|
||||
|
||||
onLoad((options) => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
const id = options && options.id
|
||||
|
||||
+107
-72
@@ -14,72 +14,77 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="tab-scroll" scroll-x :show-scrollbar="false">
|
||||
<view class="tab-list">
|
||||
<view class="body">
|
||||
<scroll-view class="side-nav" scroll-y :show-scrollbar="false">
|
||||
<view
|
||||
v-for="tab in statusTabs"
|
||||
:key="String(tab.value)"
|
||||
class="tab-item"
|
||||
class="side-item"
|
||||
:class="{ active: currentStatus === tab.value }"
|
||||
@tap="onStatusChange(tab.value)"
|
||||
>
|
||||
<text>{{ tab.label }}</text>
|
||||
<text class="side-text">{{ tab.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
|
||||
<text class="page-tip">审批由各业务模块提交后在此查看与处理</text>
|
||||
<view class="content">
|
||||
<view class="content-head">
|
||||
<text class="content-title">{{ currentTabLabel }}</text>
|
||||
<text class="page-tip">审批由各业务模块提交后在此查看与处理</text>
|
||||
</view>
|
||||
|
||||
<scroll-view class="list-scroll" scroll-y :show-scrollbar="false" @scrolltolower="loadMore">
|
||||
<view v-if="loading && !list.length" class="state-box">
|
||||
<text class="state-text">加载中...</text>
|
||||
<scroll-view class="list-scroll" scroll-y :show-scrollbar="false" @scrolltolower="loadMore">
|
||||
<view v-if="loading && !list.length" class="state-box">
|
||||
<text class="state-text">加载中...</text>
|
||||
</view>
|
||||
<view v-else-if="!list.length" class="state-box">
|
||||
<u-empty mode="list" text="暂无审批记录" />
|
||||
</view>
|
||||
<block v-else>
|
||||
<view
|
||||
v-for="row in list"
|
||||
:key="row.id"
|
||||
class="approval-card"
|
||||
>
|
||||
<view class="card-top">
|
||||
<text class="card-title">{{ row.biz_title || '(无标题)' }}</text>
|
||||
<u-tag
|
||||
:text="row.status_label || ''"
|
||||
:type="row.status_tag || 'info'"
|
||||
size="mini"
|
||||
/>
|
||||
</view>
|
||||
<view class="card-meta">
|
||||
<text class="meta-text">{{ row.biz_type || '-' }}</text>
|
||||
<text class="meta-text">发起人:{{ row.submit_user_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="card-meta">
|
||||
<text class="meta-text">提交:{{ row.submit_time || row.create_time || '-' }}</text>
|
||||
<text v-if="row.finish_time" class="meta-text">完成:{{ row.finish_time }}</text>
|
||||
</view>
|
||||
<view v-if="row.current_node" class="card-meta">
|
||||
<text class="meta-text">当前节点:{{ row.current_node }}</text>
|
||||
</view>
|
||||
<view class="card-actions">
|
||||
<view class="op-btn op-view" hover-class="btn-active" @tap.stop="openDetail(row.id)">查看详情</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="finished" class="load-done">
|
||||
<text>{{ list.length ? '没有更多了' : '' }}</text>
|
||||
</view>
|
||||
<view v-else class="more-tip" @tap="loadMore">
|
||||
<text>加载更多</text>
|
||||
</view>
|
||||
</block>
|
||||
<view class="bottom-space" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view v-else-if="!list.length" class="state-box">
|
||||
<u-empty mode="list" text="暂无审批记录" />
|
||||
</view>
|
||||
<block v-else>
|
||||
<view
|
||||
v-for="row in list"
|
||||
:key="row.id"
|
||||
class="approval-card"
|
||||
>
|
||||
<view class="card-top">
|
||||
<text class="card-title">{{ row.biz_title || '(无标题)' }}</text>
|
||||
<u-tag
|
||||
:text="row.status_label || ''"
|
||||
:type="row.status_tag || 'info'"
|
||||
size="mini"
|
||||
/>
|
||||
</view>
|
||||
<view class="card-meta">
|
||||
<text class="meta-text">{{ row.biz_type || '-' }}</text>
|
||||
<text class="meta-text">发起人:{{ row.submit_user_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="card-meta">
|
||||
<text class="meta-text">提交:{{ row.submit_time || row.create_time || '-' }}</text>
|
||||
<text v-if="row.finish_time" class="meta-text">完成:{{ row.finish_time }}</text>
|
||||
</view>
|
||||
<view v-if="row.current_node" class="card-meta">
|
||||
<text class="meta-text">当前节点:{{ row.current_node }}</text>
|
||||
</view>
|
||||
<view class="card-actions">
|
||||
<view class="op-btn op-view" hover-class="btn-active" @tap.stop="openDetail(row.id)">查看详情</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="finished" class="load-done">
|
||||
<text>{{ list.length ? '没有更多了' : '' }}</text>
|
||||
</view>
|
||||
<view v-else class="more-tip" @tap="loadMore">
|
||||
<text>加载更多</text>
|
||||
</view>
|
||||
</block>
|
||||
<view class="bottom-space" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import {
|
||||
fetchApprovalList,
|
||||
@@ -103,9 +108,14 @@ const finished = ref(false)
|
||||
const keyword = ref('')
|
||||
const currentStatus = ref('')
|
||||
|
||||
const currentTabLabel = computed(() => {
|
||||
const hit = statusTabs.find(tab => tab.value === currentStatus.value)
|
||||
return hit ? hit.label : '全部'
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
refresh()
|
||||
@@ -215,37 +225,62 @@ function openDetail(id) {
|
||||
}
|
||||
}
|
||||
|
||||
.tab-scroll {
|
||||
.body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.side-nav {
|
||||
flex-shrink: 0;
|
||||
white-space: nowrap;
|
||||
align-self: stretch;
|
||||
width: 184rpx;
|
||||
background: $color-card;
|
||||
padding: 0 $page-padding-x 12rpx;
|
||||
border-right: 1rpx solid $color-divider;
|
||||
}
|
||||
|
||||
.tab-list {
|
||||
display: inline-flex;
|
||||
gap: 16rpx;
|
||||
padding: 16rpx 0 4rpx;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
padding: 10rpx 28rpx;
|
||||
border-radius: $radius-full;
|
||||
background: $color-bg-page;
|
||||
.side-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 26rpx 12rpx;
|
||||
border-left: 6rpx solid transparent;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-secondary;
|
||||
box-shadow: $shadow-card;
|
||||
|
||||
&.active {
|
||||
background: $color-primary;
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
background: $color-bg-page;
|
||||
border-left-color: $color-primary;
|
||||
color: $color-primary;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.content-head {
|
||||
flex-shrink: 0;
|
||||
padding: 18rpx 20rpx 0;
|
||||
}
|
||||
|
||||
.content-title {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.page-tip {
|
||||
display: block;
|
||||
padding: 12rpx $page-padding-x 0;
|
||||
margin-top: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
@@ -257,7 +292,7 @@ function openDetail(id) {
|
||||
|
||||
.approval-card {
|
||||
@include card;
|
||||
margin: 16rpx $page-padding-x 0;
|
||||
margin: 16rpx 20rpx 0;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -88,7 +88,7 @@ const keyword = ref('')
|
||||
|
||||
onLoad(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
refresh()
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -183,7 +183,7 @@ const headPad = mpHeadPad()
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
import { fetchHome } from '@/api/workspace.js'
|
||||
import { openMenu, resolveNativeRoute } from '@/utils/nav.js'
|
||||
import { openMenu, resolveNativeRoute, orderQuickMenus, QUICK_TITLE_ICONS } from '@/utils/nav.js'
|
||||
import { request } from '@/api/request.js'
|
||||
import AppTabbar from '@/components/MainTabbar.vue'
|
||||
|
||||
@@ -286,16 +286,16 @@ const quickApps = computed(() => {
|
||||
key: 'm' + menu.id,
|
||||
name: menu.title,
|
||||
menu,
|
||||
icon: icon || 'circle',
|
||||
icon: icon || menu.icon || QUICK_TITLE_ICONS[menu.title] || 'circle',
|
||||
tint: 'tint-' + (picked.length % 8)
|
||||
})
|
||||
}
|
||||
|
||||
leafMenus.value.filter((m) => resolveNativeRoute(m)).forEach((m) => push(m))
|
||||
moduleGroups.value.filter((g) => !g.locked).forEach((g) => push(g.items[0], g.icon))
|
||||
commonMenus.value.forEach((m, i) => push(m, TOOL_ICONS[i % TOOL_ICONS.length]))
|
||||
commonMenus.value.forEach((m, i) => push(m, QUICK_TITLE_ICONS[m.title] || TOOL_ICONS[i % TOOL_ICONS.length]))
|
||||
|
||||
return picked
|
||||
return orderQuickMenus(picked)
|
||||
})
|
||||
|
||||
const kpiList = computed(() => [
|
||||
@@ -410,7 +410,7 @@ function formatTime(dateStr) {
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
loadAll()
|
||||
|
||||
@@ -97,7 +97,7 @@ const headPad = mpHeadPad()
|
||||
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 { openMenu, orderQuickMenus } from '@/utils/nav.js'
|
||||
import AppTabbar from '@/components/MainTabbar.vue'
|
||||
|
||||
const MODULE_ICONS = {
|
||||
@@ -159,6 +159,7 @@ const groups = computed(() => {
|
||||
const dirGroups = []
|
||||
groupMap.forEach((g) => dirGroups.push(g))
|
||||
dirGroups.sort((a, b) => (a.sort || 0) - (b.sort || 0))
|
||||
common.items = orderQuickMenus(common.items)
|
||||
|
||||
const all = []
|
||||
if (common.items.length) all.push(common)
|
||||
@@ -216,7 +217,7 @@ async function load() {
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
load()
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
|
||||
<script>
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
|
||||
onShow(() => {
|
||||
uni.reLaunch({ url: isLoggedIn() ? '/pages/nav/nav' : '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ async function handleResetPassword() {
|
||||
resetCountdown()
|
||||
uni.showToast({ title: '重置成功,请登录', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
}, 600)
|
||||
} catch (err) {
|
||||
} finally {
|
||||
@@ -432,7 +432,7 @@ function backToPrev() {
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/login/login' }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/nav/nav' }) })
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
+342
-1023
File diff suppressed because it is too large.
Load diff
@@ -195,7 +195,7 @@ async function handleSubmit() {
|
||||
setTenantName(form.tenant_name.trim())
|
||||
uni.showToast({ title: '注册成功,请登录', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/login/login' }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/nav/nav' }) })
|
||||
}, 500)
|
||||
} catch {
|
||||
} finally {
|
||||
@@ -204,7 +204,7 @@ async function handleSubmit() {
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/login/login' }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/nav/nav' }) })
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
+126
-206
@@ -7,7 +7,7 @@
|
||||
<text class="head-title">工作台</text>
|
||||
</view>
|
||||
<view v-if="!guest" class="account-chip" @tap="goProfile"><FaIcon name="user" color="#3478f6" :size="15" /><text>{{ user.name || user.nickname || '未设置姓名' }}</text></view>
|
||||
<button v-else class="account-chip account-chip-button" open-type="getPhoneNumber" @getphonenumber="onCardPhone($event)"><FaIcon name="user" color="#3478f6" :size="15" /><text>游客</text></button>
|
||||
<view v-else class="account-chip" @tap="goLogin"><FaIcon name="user" color="#3478f6" :size="15" /><text>登录 / 注册</text></view>
|
||||
</view>
|
||||
<view v-if="!guest" class="tenant-switch" @tap="chooseTenant">
|
||||
<view class="tenant-mark"><FaIcon name="building" color="#ffffff" :size="19" /></view>
|
||||
@@ -32,26 +32,8 @@
|
||||
</view>
|
||||
|
||||
<view v-else class="grid">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button
|
||||
v-for="card in cards"
|
||||
v-show="guest"
|
||||
:key="'phone-' + (card.code || card.id)"
|
||||
class="cell cell-button"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="onCardPhone($event, card)"
|
||||
>
|
||||
<view class="portal-card" :class="{ locked: card.locked }">
|
||||
<view class="tint-icon portal-icon" :class="card.tint">
|
||||
<FaIcon :name="card.icon" color="#ffffff" :size="26" />
|
||||
</view>
|
||||
<text class="portal-name">{{ card.name }}</text>
|
||||
</view>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<view
|
||||
v-for="card in cards"
|
||||
v-show="!guest || !isMp"
|
||||
:key="card.code || card.id"
|
||||
class="cell"
|
||||
@tap="enter(card)"
|
||||
@@ -61,6 +43,7 @@
|
||||
<FaIcon :name="card.icon" color="#ffffff" :size="26" />
|
||||
</view>
|
||||
<text class="portal-name">{{ card.name }}</text>
|
||||
<text v-if="card.locked" class="portal-lock-tag">登录后可体验</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -115,6 +98,19 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="guestLoginVisible" class="guest-login-mask" @tap="closeGuestLogin">
|
||||
<view class="guest-login-card" @tap.stop>
|
||||
<view class="guest-login-icon"><FaIcon name="lock" color="#2563eb" :size="24" /></view>
|
||||
<text class="guest-login-title">{{ guestLoginTitle }}</text>
|
||||
<text class="guest-login-desc">该功能需要登录企业账号后使用,您也可以继续以游客身份浏览公开功能。</text>
|
||||
<button class="guest-login-btn" @tap="goLogin">
|
||||
<FaIcon name="user" color="#ffffff" :size="18" />
|
||||
<text>登录 / 注册</text>
|
||||
</button>
|
||||
<view class="guest-login-cancel" @tap="closeGuestLogin"><text>暂不登录</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -127,36 +123,22 @@ import { onShow } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn, getTenants, getTid, setAuthTokens, setTenants, setTid, setTenantName, getUser, setUser } from '@/utils/auth.js'
|
||||
import { switchTenant, loginByMiniapp } from '@/api/auth.js'
|
||||
import { fetchHome, fetchPublicModules, fetchPublicMenus, clearHomeCache } from '@/api/workspace.js'
|
||||
import { onboardingPhone, getOnboardingStatus } from '@/api/onboarding.js'
|
||||
import { setPendingCard, takePendingCard } from '@/utils/onboarding.js'
|
||||
import { getOnboardingStatus } from '@/api/onboarding.js'
|
||||
import { openMenu } from '@/utils/nav.js'
|
||||
import { getSubsystemByModule, goSubsystem } from '@/config/subsystems.js'
|
||||
import { getGuestToken, setGuestToken, clearGuestToken } from '@/utils/guest.js'
|
||||
import { guestMiniLogin, guestMerge } from '@/api/guest.js'
|
||||
import { getGuestToken, clearGuestToken } from '@/utils/guest.js'
|
||||
import { guestMerge } from '@/api/guest.js'
|
||||
|
||||
const guestAuthVisible = ref(false)
|
||||
const guestAuthLoading = ref(false)
|
||||
const guestAuthDismissed = ref(false)
|
||||
const phoneBusy = ref(false)
|
||||
let isMp = false
|
||||
// #ifdef MP-WEIXIN
|
||||
isMp = true
|
||||
// #endif
|
||||
const guestLoginVisible = ref(false)
|
||||
const guestLoginTitle = ref('登录后可体验')
|
||||
|
||||
function canRequestGuestPhone() {
|
||||
// #ifdef MP-WEIXIN
|
||||
return true
|
||||
// #endif
|
||||
// eslint-disable-next-line no-unreachable
|
||||
return false
|
||||
function openGuestLogin(name) {
|
||||
guestLoginTitle.value = name ? '「' + name + '」登录后可体验' : '登录后可体验'
|
||||
guestLoginVisible.value = true
|
||||
}
|
||||
|
||||
function maybeAskGuestAuth() {
|
||||
if (!guest.value || getGuestToken() || guestAuthDismissed.value || !canRequestGuestPhone()) {
|
||||
guestAuthVisible.value = false
|
||||
return
|
||||
}
|
||||
guestAuthVisible.value = true
|
||||
function closeGuestLogin() {
|
||||
guestLoginVisible.value = false
|
||||
}
|
||||
|
||||
function navUniLoginCode() {
|
||||
@@ -169,58 +151,6 @@ function navUniLoginCode() {
|
||||
})
|
||||
}
|
||||
|
||||
async function onGuestPhone(e) {
|
||||
const detail = (e && e.detail) || {}
|
||||
if (String(detail.errMsg || '').indexOf('ok') === -1 || !detail.code) {
|
||||
uni.showToast({ title: '未获取到手机号,请重试', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (guestAuthLoading.value) return
|
||||
guestAuthLoading.value = true
|
||||
try {
|
||||
const code = await navUniLoginCode()
|
||||
let appid = ''
|
||||
try {
|
||||
appid = (uni.getAccountInfoSync().miniProgram || {}).appId || ''
|
||||
} catch (err) {
|
||||
appid = ''
|
||||
}
|
||||
const res = await guestMiniLogin({ code, phoneCode: detail.code, appid })
|
||||
if (res && res.type === 'user') {
|
||||
guestAuthVisible.value = false
|
||||
await completeUserLogin(res)
|
||||
return
|
||||
}
|
||||
if (!res || !res.token) throw new Error('未返回游客令牌')
|
||||
setGuestToken(res.token)
|
||||
guestAuthVisible.value = false
|
||||
uni.showToast({ title: '验证成功,数据可保存了', icon: 'none' })
|
||||
} catch (err) {
|
||||
console.error('[nav] guest mini-login failed:', err)
|
||||
uni.showToast({ title: (err && err.message) || '验证失败,请重试', icon: 'none' })
|
||||
} finally {
|
||||
guestAuthLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function completeUserLogin(res) {
|
||||
const list = Array.isArray(res.tenants) ? res.tenants : []
|
||||
setAuthTokens(res.tokens || {})
|
||||
if (res.need_choose_tenant && list.length > 1) {
|
||||
askChooseTenant(list)
|
||||
return
|
||||
}
|
||||
const t0 = list[0] || {}
|
||||
setTenants(list)
|
||||
if (t0.tid) {
|
||||
setTid(t0.tid)
|
||||
setTenantName(t0.tenant_name || '')
|
||||
}
|
||||
await mergeGuestIfAny()
|
||||
await load(true)
|
||||
uni.showToast({ title: '已登录,欢迎回来', icon: 'none' })
|
||||
}
|
||||
|
||||
const tenantPickerVisible = ref(false)
|
||||
const tenantPickerRequired = ref(false)
|
||||
const tenantPickerMode = ref('login')
|
||||
@@ -294,11 +224,6 @@ async function pickTenant(item) {
|
||||
}
|
||||
}
|
||||
|
||||
function skipGuestAuth() {
|
||||
guestAuthDismissed.value = true
|
||||
guestAuthVisible.value = false
|
||||
}
|
||||
|
||||
async function mergeGuestIfAny() {
|
||||
if (!getGuestToken()) return
|
||||
try {
|
||||
@@ -343,18 +268,19 @@ const leafMenus = computed(() => menus.value.filter((m) => m.leaf !== false && !
|
||||
|
||||
const cards = computed(() => {
|
||||
if (guest.value) {
|
||||
return publicModules.value.map((mod, index) => {
|
||||
const code = String(mod.code || '').toLowerCase()
|
||||
const needTenant = mod.require_login !== 0
|
||||
return {
|
||||
return publicModules.value.map((mod, index) => {
|
||||
const code = String(mod.code || '').toLowerCase()
|
||||
const needTenant = mod.require_login !== 0
|
||||
const locked = needTenant
|
||||
return {
|
||||
id: mod.id,
|
||||
code: mod.code,
|
||||
path: mod.path || '',
|
||||
name: mod.name || '未命名系统',
|
||||
desc: mod.description || (needTenant ? '加入企业后可用' : '可直接使用'),
|
||||
desc: locked ? '登录后可体验完整功能' : (mod.description || '可直接使用'),
|
||||
icon: MODULE_ICONS[code] || 'cube',
|
||||
tint: 'tint-' + (index % 8),
|
||||
locked: false,
|
||||
locked,
|
||||
needTenant,
|
||||
items: [],
|
||||
total: 0
|
||||
@@ -429,6 +355,11 @@ function goProfile() {
|
||||
uni.navigateTo({ url: '/pages/profile/profile' })
|
||||
}
|
||||
|
||||
function goLogin() {
|
||||
closeGuestLogin()
|
||||
uni.navigateTo({ url: '/pages/login/login' })
|
||||
}
|
||||
|
||||
function chooseTenant() {
|
||||
const list = tenants.value
|
||||
if (list.length <= 1) { uni.showToast({ title: list.length ? '当前账号仅绑定一个企业' : '暂无可切换的企业', icon: 'none' })
|
||||
@@ -438,49 +369,6 @@ function chooseTenant() {
|
||||
openTenantPicker(list, 'switch', false)
|
||||
}
|
||||
|
||||
async function onCardPhone(e, card = null) {
|
||||
const detail = (e && e.detail) || {}
|
||||
if (String(detail.errMsg || '').indexOf('ok') === -1 || !detail.code) {
|
||||
uni.showToast({ title: '请先完成手机号验证才能使用', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (phoneBusy.value) return
|
||||
phoneBusy.value = true
|
||||
uni.showLoading({ title: '验证中...', mask: true })
|
||||
try {
|
||||
const code = await navUniLoginCode()
|
||||
let appid = ''
|
||||
try {
|
||||
appid = (uni.getAccountInfoSync().miniProgram || {}).appId || ''
|
||||
} catch (err) {
|
||||
appid = ''
|
||||
}
|
||||
if (card) setPendingCard(card)
|
||||
const res = await onboardingPhone({ code, phoneCode: detail.code, appid })
|
||||
if (res && res.need_register) {
|
||||
uni.hideLoading()
|
||||
uni.navigateTo({
|
||||
url: '/pages/onboarding/register?token=' + encodeURIComponent(res.register_token || '') +
|
||||
'&mobile_mask=' + encodeURIComponent(res.mobile_mask || '')
|
||||
})
|
||||
return
|
||||
}
|
||||
const ready = await silentLogin(code, detail.code)
|
||||
if (!ready) return
|
||||
await load(true)
|
||||
if (card) {
|
||||
await enter(card)
|
||||
takePendingCard()
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[nav] onboarding phone failed:', err)
|
||||
uni.showToast({ title: (err && err.message) || '验证失败,请重试', icon: 'none' })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
phoneBusy.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function silentLogin(code, phoneCode) {
|
||||
const res = await loginByMiniapp({ code, phoneCode })
|
||||
if (!res || !res.tokens || !res.tokens.access_token) {
|
||||
@@ -503,11 +391,20 @@ async function silentLogin(code, phoneCode) {
|
||||
|
||||
async function enter(card) {
|
||||
if (card.locked) {
|
||||
if (guest.value) {
|
||||
openGuestLogin(card.name)
|
||||
return
|
||||
}
|
||||
openMenu({ locked: true, title: card.name })
|
||||
return
|
||||
}
|
||||
if (guest.value) {
|
||||
uni.showToast({ title: '请先完成手机号验证', icon: 'none' })
|
||||
if (goSubsystemByModule(card.code)) return
|
||||
if (card.path) {
|
||||
openMenu({ title: card.name, path: card.path, leaf: true }, card.name)
|
||||
return
|
||||
}
|
||||
uni.showToast({ title: card.name + '暂未开放', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (card.needTenant) {
|
||||
@@ -554,10 +451,6 @@ onMounted(() => {
|
||||
|
||||
onShow(() => {
|
||||
if (!loading.value) load()
|
||||
const pending = takePendingCard()
|
||||
if (pending && isLoggedIn()) {
|
||||
setTimeout(() => enter(pending), 600)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -770,64 +663,18 @@ onShow(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.cell-button {
|
||||
display: block;
|
||||
margin: 0 0 20rpx 0;
|
||||
padding: 0 20rpx 0 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
line-height: normal;
|
||||
text-align: left;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
.portal-lock-tag {
|
||||
padding: 4rpx 14rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #eef2f8;
|
||||
color: #8a9bb3;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.bottom-space {
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.guest-auth-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.guest-auth-full {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
opacity: 0;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.guest-auth-later {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 64rpx;
|
||||
z-index: 100;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #94a3b8;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.tenant-picker-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
@@ -995,4 +842,77 @@ onShow(() => {
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.guest-login-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 1200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 60rpx;
|
||||
background: rgba(15, 23, 42, .48);
|
||||
}
|
||||
.guest-login-card {
|
||||
width: 100%;
|
||||
max-width: 560rpx;
|
||||
padding: 48rpx 40rpx 32rpx;
|
||||
border-radius: 28rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 20rpx 60rpx rgba(15, 23, 42, .18);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.guest-login-icon {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 28rpx;
|
||||
background: #eaf2ff;
|
||||
}
|
||||
.guest-login-title {
|
||||
margin-top: 24rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #17345f;
|
||||
text-align: center;
|
||||
}
|
||||
.guest-login-desc {
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.6;
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
}
|
||||
.guest-login-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
margin: 36rpx 0 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
border: none;
|
||||
border-radius: $radius-full;
|
||||
background: linear-gradient(135deg, #60a5fa, #2563eb);
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 10rpx 24rpx rgba(37, 99, 235, .22);
|
||||
|
||||
&::after { border: none; }
|
||||
}
|
||||
.guest-login-cancel {
|
||||
margin-top: 20rpx;
|
||||
padding: 16rpx;
|
||||
font-size: 26rpx;
|
||||
color: #8a9bb3;
|
||||
}
|
||||
</style>
|
||||
@@ -623,7 +623,7 @@ async function punch(type) {
|
||||
|
||||
onShow(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
startTimer()
|
||||
|
||||
@@ -155,7 +155,7 @@ const deductItems = computed(() => {
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
const pages = getCurrentPages()
|
||||
|
||||
@@ -58,7 +58,7 @@ const currentMonth = `${now.getFullYear()}-${pad(now.getMonth() + 1)}`
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
loadPayrolls()
|
||||
|
||||
@@ -159,7 +159,7 @@ const callPhone = computed(() => (contact.value ? primaryPhone(contact.value) :
|
||||
|
||||
onLoad((options) => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
id.value = Number((options && options.id) || 0)
|
||||
|
||||
@@ -109,7 +109,7 @@ const hasMore = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
loadOrgTree()
|
||||
|
||||
@@ -406,7 +406,7 @@ function onCalendarCellTap(cell) {
|
||||
|
||||
onShow(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
reload()
|
||||
|
||||
@@ -103,7 +103,7 @@ const loading = ref(true)
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
const pages = getCurrentPages()
|
||||
|
||||
@@ -105,7 +105,7 @@ const loading = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
loadCategories()
|
||||
|
||||
@@ -192,7 +192,7 @@ const recordGroups = computed(() => {
|
||||
|
||||
onLoad((options) => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
fileId.value = Number((options && options.id) || 0)
|
||||
|
||||
@@ -109,7 +109,7 @@ const hasMore = ref(false)
|
||||
|
||||
onLoad(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
init()
|
||||
|
||||
@@ -58,7 +58,7 @@ const loading = ref(true)
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
const pages = getCurrentPages()
|
||||
|
||||
@@ -57,7 +57,7 @@ const loading = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
loadNotices()
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="nav-bar" :style="headPad">
|
||||
<view class="nav-back" @tap="goBack">
|
||||
<FaIcon name="chevron-left" color="#1e293b" :size="20" />
|
||||
<text class="nav-back-text">返回</text>
|
||||
</view>
|
||||
<text class="nav-title">设置登录密码</text>
|
||||
<view class="nav-side" />
|
||||
</view>
|
||||
|
||||
<view class="hero">
|
||||
<text class="eyebrow">YUNZE WORKSPACE</text>
|
||||
<text class="title">设置登录密码</text>
|
||||
<text class="desc">手机号 {{ mobileMask || '已验证' }} 尚未注册,设置密码后即可使用工作台</text>
|
||||
<text class="title">设置登录密码(可选)</text>
|
||||
<text class="desc">手机号 {{ mobileMask || '已验证' }} 尚未注册。可设置密码解锁完整服务,也可直接返回,继续免登录体验公开功能</text>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
@@ -15,11 +24,12 @@
|
||||
<text class="label">确认密码</text>
|
||||
<input v-model="confirmPassword" class="input" type="password" placeholder="再输入一次" :maxlength="32" />
|
||||
</view>
|
||||
<text class="hint">密码至少 6 位;当前账号会在注册时自动绑定,下次可直接进入</text>
|
||||
<text class="hint">密码至少 6 位;此步骤为可选,跳过不影响继续浏览公开功能</text>
|
||||
<view v-if="errorMsg" class="error"><text>{{ errorMsg }}</text></view>
|
||||
<button class="submit" :disabled="loading" @tap="handleSubmit">
|
||||
{{ loading ? '注册中…' : '完成注册' }}
|
||||
</button>
|
||||
<view class="skip" @tap="goBack"><text>暂不设置,返回工作台</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -27,12 +37,15 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { mpHeadPad } from '@/utils/mpHead.js'
|
||||
import FaIcon from '@/components/FaIcon.vue'
|
||||
import { onboardingRegister } from '@/api/onboarding.js'
|
||||
import { setAuthTokens, setTid, setTenantName } from '@/utils/auth.js'
|
||||
import { guestMerge } from '@/api/guest.js'
|
||||
import { getGuestToken, clearGuestToken } from '@/utils/guest.js'
|
||||
import { clearHomeCache } from '@/api/workspace.js'
|
||||
|
||||
const headPad = mpHeadPad()
|
||||
const token = ref('')
|
||||
const mobileMask = ref('')
|
||||
const password = ref('')
|
||||
@@ -44,15 +57,21 @@ onLoad((options = {}) => {
|
||||
token.value = options.token || ''
|
||||
mobileMask.value = decodeURIComponent(options.mobile_mask || '')
|
||||
if (!token.value) {
|
||||
errorMsg.value = '验证会话已失效,请返回工作台重新验证手机号'
|
||||
errorMsg.value = '验证会话已失效,可返回工作台继续使用公开功能'
|
||||
}
|
||||
})
|
||||
|
||||
function goBack() {
|
||||
const pages = (typeof getCurrentPages === 'function' && getCurrentPages()) || []
|
||||
if (pages.length > 1) uni.navigateBack()
|
||||
else uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (loading.value) return
|
||||
errorMsg.value = ''
|
||||
if (!token.value) {
|
||||
errorMsg.value = '验证会话已失效,请返回工作台重新验证手机号'
|
||||
errorMsg.value = '验证会话已失效,可返回工作台继续使用公开功能'
|
||||
return
|
||||
}
|
||||
if (password.value.length < 6) {
|
||||
@@ -103,7 +122,24 @@ async function handleSubmit() {
|
||||
background: linear-gradient(160deg, #eaf3ff 0%, #f8fafc 42%, #f8fafc 100%);
|
||||
}
|
||||
|
||||
.hero { padding: 120rpx 8rpx 56rpx; }
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 16rpx;
|
||||
}
|
||||
.nav-back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
min-width: 120rpx;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
.nav-back-text { font-size: 28rpx; color: #1e293b; }
|
||||
.nav-title { flex: 1; text-align: center; font-size: 30rpx; font-weight: 600; color: #1e293b; }
|
||||
.nav-side { min-width: 120rpx; }
|
||||
|
||||
.hero { padding: 56rpx 8rpx 48rpx; }
|
||||
.eyebrow { display: block; font-size: 20rpx; font-weight: 700; letter-spacing: 3rpx; color: #6e9de5; }
|
||||
.title { display: block; margin-top: 14rpx; font-size: 46rpx; font-weight: 700; color: #17345f; }
|
||||
.desc { display: block; margin-top: 16rpx; font-size: 25rpx; line-height: 1.6; color: #64748b; }
|
||||
@@ -142,4 +178,11 @@ async function handleSubmit() {
|
||||
&::after { border: none; }
|
||||
&[disabled] { opacity: .6; }
|
||||
}
|
||||
.skip {
|
||||
margin-top: 28rpx;
|
||||
padding: 18rpx 0;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #64748b;
|
||||
}
|
||||
</style>
|
||||
+234
-2
@@ -9,6 +9,10 @@
|
||||
<text class="hero-name">{{ sub.title }}</text>
|
||||
<text class="hero-desc">{{ sub.desc }}</text>
|
||||
</view>
|
||||
<view v-if="isOa" class="hero-notice" hover-class="hero-notice-on" @tap="openNotices">
|
||||
<FaIcon name="bell" color="#ffffff" :size="20" />
|
||||
<view v-if="noticeCount > 0" class="notice-badge">{{ noticeCount > 99 ? '99+' : noticeCount }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -27,15 +31,49 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view v-if="noticeVisible" class="popup-mask" @tap="closeNotices">
|
||||
<view class="notice-sheet" @tap.stop>
|
||||
<view class="notice-head">
|
||||
<text class="notice-sheet-title">最新公告</text>
|
||||
<view class="notice-more" @tap="goNoticeList">
|
||||
<text class="notice-more-text">全部</text>
|
||||
<FaIcon name="chevron-right" color="#8a94ad" :size="11" />
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view class="notice-body" scroll-y :show-scrollbar="false">
|
||||
<view v-if="notices.length === 0" class="notice-empty">
|
||||
<FaIcon name="bullhorn" color="#c0c4cc" :size="26" />
|
||||
<text class="notice-empty-text">暂无公告</text>
|
||||
</view>
|
||||
<view
|
||||
v-for="item in notices"
|
||||
:key="item.id"
|
||||
class="notice-item"
|
||||
@tap="goNoticeDetail(item.id)"
|
||||
>
|
||||
<view class="notice-dot" :class="{ 'notice-dot-top': item.is_top }" />
|
||||
<view class="notice-item-body">
|
||||
<text class="notice-item-title">{{ item.title }}</text>
|
||||
<text class="notice-item-time">{{ item.publish_time || item.publisher_name || '' }}</text>
|
||||
</view>
|
||||
<FaIcon name="chevron-right" color="#c0c4cc" :size="11" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<AppTabbar variant="switch" :current="activeTab" :tabs="tabs" @change="onTabChange" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { getSubsystem } from '@/config/subsystems.js'
|
||||
import { mpHeadPad } from '@/utils/mpHead.js'
|
||||
import { fetchNotices } from '@/api/oa.js'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
import { getGuestToken } from '@/utils/guest.js'
|
||||
import AppTabbar from '@/components/AppTabbar.vue'
|
||||
import SubHome from '@/components/sub/SubHome.vue'
|
||||
import SubFunctions from '@/components/sub/SubFunctions.vue'
|
||||
@@ -55,12 +93,56 @@ const visited = ref({ home: true, functions: false, mine: false })
|
||||
|
||||
const headPad = mpHeadPad()
|
||||
|
||||
const isOa = computed(() => String((sub.value && sub.value.module) || '').toLowerCase() === 'oa')
|
||||
|
||||
const notices = ref([])
|
||||
const noticeTotal = ref(0)
|
||||
const noticeVisible = ref(false)
|
||||
|
||||
const noticeCount = computed(() => Number(noticeTotal.value) || notices.value.length)
|
||||
|
||||
async function loadNotices() {
|
||||
if (!isOa.value) return
|
||||
if (!isLoggedIn() && !getGuestToken()) return
|
||||
try {
|
||||
const res = await fetchNotices({ pageSize: 10 })
|
||||
notices.value = res.list || []
|
||||
noticeTotal.value = res.total || 0
|
||||
} catch (e) {
|
||||
notices.value = []
|
||||
noticeTotal.value = 0
|
||||
}
|
||||
}
|
||||
|
||||
function openNotices() {
|
||||
noticeVisible.value = true
|
||||
if (!notices.value.length && noticeTotal.value > 0) loadNotices()
|
||||
}
|
||||
|
||||
function closeNotices() {
|
||||
noticeVisible.value = false
|
||||
}
|
||||
|
||||
function goNoticeList() {
|
||||
closeNotices()
|
||||
uni.navigateTo({ url: '/pages/oa/notice/index' })
|
||||
}
|
||||
|
||||
function goNoticeDetail(id) {
|
||||
closeNotices()
|
||||
uni.navigateTo({ url: `/pages/oa/notice/detail?id=${id}` })
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
slug.value = options && options.slug ? options.slug : 'crm'
|
||||
sub.value = getSubsystem(slug.value)
|
||||
if (!sub.value) uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
loadNotices()
|
||||
})
|
||||
|
||||
function onTabChange(name) {
|
||||
activeTab.value = name
|
||||
if (!visited.value[name]) visited.value[name] = true
|
||||
@@ -151,4 +233,154 @@ function goBackNav() {
|
||||
.pane-bottom {
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.hero-notice {
|
||||
position: relative;
|
||||
margin-left: auto;
|
||||
flex-shrink: 0;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.28);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.hero-notice-on {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-badge {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: -10rpx;
|
||||
min-width: 32rpx;
|
||||
height: 32rpx;
|
||||
padding: 0 8rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: $radius-full;
|
||||
background: #f04438;
|
||||
color: #ffffff;
|
||||
font-size: 20rpx;
|
||||
line-height: 32rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.popup-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 999;
|
||||
background: rgba(15, 23, 42, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 60rpx;
|
||||
}
|
||||
|
||||
.notice-sheet {
|
||||
width: 100%;
|
||||
max-height: 900rpx;
|
||||
background: $color-card;
|
||||
border-radius: $radius-lg;
|
||||
box-shadow: $shadow-float;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
@include sheet-responsive(560px);
|
||||
}
|
||||
|
||||
.notice-head {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 26rpx 28rpx 18rpx;
|
||||
border-bottom: 1rpx solid $color-divider;
|
||||
}
|
||||
|
||||
.notice-sheet-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.notice-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.notice-more-text {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.notice-body {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
padding: 8rpx 28rpx 20rpx;
|
||||
}
|
||||
|
||||
.notice-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
padding: 80rpx 0;
|
||||
}
|
||||
|
||||
.notice-empty-text {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.notice-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
padding: 22rpx 0;
|
||||
border-bottom: 1rpx solid $color-divider;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-dot {
|
||||
flex-shrink: 0;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
background: $color-primary-light;
|
||||
|
||||
&.notice-dot-top {
|
||||
background: #f04438;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-item-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.notice-item-title {
|
||||
font-size: 28rpx;
|
||||
color: $color-text;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.notice-item-time {
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
</style>
|
||||
@@ -280,7 +280,7 @@ function pickDay(cell) {
|
||||
|
||||
onMounted(() => {
|
||||
if (!isLoggedIn()) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
}
|
||||
loadSchedules()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"setting": {
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"minified": false,
|
||||
"uglifyFileName": false,
|
||||
"enhance": true,
|
||||
"urlCheck": false,
|
||||
|
||||
@@ -22,6 +22,8 @@ const NATIVE_RULES = [
|
||||
{ pattern: /\/apps\/erp\/finance\/payable/i, route: '/pages/erp/finance/bill?bill_type=2' },
|
||||
{ pattern: /\/apps\/erp\/finance\/payment/i, route: '/pages/erp/finance/fund' },
|
||||
{ pattern: /\/apps\/erp\/report/i, route: '/pages/erp/report/index' },
|
||||
{ pattern: /\/apps\/crm\/project/i, route: '/pages/crm/project/index' },
|
||||
{ pattern: /客户项目|项目管理|项目列表|crmProject/i, route: '/pages/crm/project/index' },
|
||||
{ pattern: /记事本|笔记|便签|notebook/i, route: '/pages/tools/notepad/index' },
|
||||
{ pattern: /账号管理|密码库|passwordStore|password-store/i, route: '/pages/tools/account/index' },
|
||||
{ pattern: /提醒|reminder/i, route: '/pages/tools/schedule/reminder' },
|
||||
@@ -40,6 +42,49 @@ const NATIVE_RULES = [
|
||||
|
||||
const WEBVIEW_PAGE = '/pages/apps/webview'
|
||||
|
||||
// 常用功能默认展示顺序(用户未自定义前按此顺序排列)
|
||||
export const DEFAULT_QUICK_TITLES = [
|
||||
'考勤打卡',
|
||||
'报销管理',
|
||||
'工作日程',
|
||||
'通讯录',
|
||||
'审批列表',
|
||||
'文档库',
|
||||
'工作日报'
|
||||
]
|
||||
|
||||
// 常用功能标题对应的图标(菜单未配图标时兜底)
|
||||
export const QUICK_TITLE_ICONS = {
|
||||
'考勤打卡': 'alarm-clock',
|
||||
'报销管理': 'receipt',
|
||||
'工作日程': 'calendar-days',
|
||||
'通讯录': 'address-book',
|
||||
'审批列表': 'clipboard-check',
|
||||
'文档库': 'folder-open',
|
||||
'工作日报': 'book'
|
||||
}
|
||||
|
||||
/**
|
||||
* 按默认常用功能顺序排序,未命中的保持原有相对顺序
|
||||
* @param {Array} list 菜单/应用列表
|
||||
* @param {Array<string>} titles 优先顺序
|
||||
*/
|
||||
export function orderQuickMenus(list = [], titles = DEFAULT_QUICK_TITLES) {
|
||||
const items = Array.isArray(list) ? list : []
|
||||
const rank = new Map(titles.map((t, i) => [String(t).trim(), i]))
|
||||
return items
|
||||
.map((item, index) => ({ item, index }))
|
||||
.sort((a, b) => {
|
||||
const ta = a.item && (a.item.title || a.item.name)
|
||||
const tb = b.item && (b.item.title || b.item.name)
|
||||
const ra = rank.has(ta) ? rank.get(ta) : titles.length
|
||||
const rb = rank.has(tb) ? rank.get(tb) : titles.length
|
||||
if (ra !== rb) return ra - rb
|
||||
return a.index - b.index
|
||||
})
|
||||
.map((entry) => entry.item)
|
||||
}
|
||||
|
||||
export const WEB_RULES = [
|
||||
'审批设置',
|
||||
'审批流配置',
|
||||
|
||||
@@ -21,6 +21,14 @@ const rootDir = resolveRootDir()
|
||||
export default defineConfig({
|
||||
base: '/h5/',
|
||||
plugins: [uni()],
|
||||
// 微信小程序的代码压缩器不支持 ES2020 语法(?? / ?.),
|
||||
// 在构建阶段统一降级到 ES2017,避免上传时「代码压缩」报 Unexpected token ?
|
||||
build: {
|
||||
target: ['es2017', 'chrome61', 'safari11', 'firefox60'],
|
||||
},
|
||||
esbuild: {
|
||||
target: 'es2017',
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': rootDir,
|
||||
|
||||
Reference in new issue
Block a user