更新若干
This commit is contained in:
1 parent
54c90072fb
commit
5682069553
59 files changed
+3813
-1617
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user