fix(mpuniapp): 支持根路径登录鉴权分发与业务端到端操作闭环
这个提交包含在:
@@ -21,7 +21,7 @@
|
|||||||
function routeOwnerHome() : void {
|
function routeOwnerHome() : void {
|
||||||
if (getAuthToken() != '') {
|
if (getAuthToken() != '') {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/owner/hall/index'
|
url: '/pages/owner/card/index'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,18 @@
|
|||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
routeOwnerHome()
|
routeOwnerHome()
|
||||||
// #endif
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
const hash = window.location.hash
|
||||||
|
if (!hash || hash === '#' || hash === '#/' || hash === '') {
|
||||||
|
if (getAuthToken() != '') {
|
||||||
|
window.location.hash = '#/pages/owner/card/index'
|
||||||
|
} else {
|
||||||
|
window.location.hash = '#/pages/common/login'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
onAppShow((res : OnShowOptions) => {
|
onAppShow((res : OnShowOptions) => {
|
||||||
|
|||||||
@@ -156,6 +156,11 @@ onLoad((options: CardHomePageOptions) => {
|
|||||||
refreshCards(state);
|
refreshCards(state);
|
||||||
applyQuotaHint();
|
applyQuotaHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
refreshCards(state);
|
||||||
|
applyQuotaHint();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -224,6 +224,10 @@ onLoad((options: LeadsPageOptions) => {
|
|||||||
applyLeadsOptions(state, options);
|
applyLeadsOptions(state, options);
|
||||||
refreshLeads(state);
|
refreshLeads(state);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
refreshLeads(state);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -134,6 +134,11 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- Logout action card -->
|
||||||
|
<view class="section-card logout-card" @click="onLogout">
|
||||||
|
<text class="logout-text">{{ t('logout') }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- Error feedback banner -->
|
<!-- Error feedback banner -->
|
||||||
<view v-if="state.errorMessage !== ''" class="error-banner">
|
<view v-if="state.errorMessage !== ''" class="error-banner">
|
||||||
<text class="error-banner-text">{{ state.errorMessage }}</text>
|
<text class="error-banner-text">{{ state.errorMessage }}</text>
|
||||||
@@ -170,7 +175,7 @@ import {
|
|||||||
} from './useProfile.uts';
|
} from './useProfile.uts';
|
||||||
import { OmniLocale } from '../../../common/locale.uts';
|
import { OmniLocale } from '../../../common/locale.uts';
|
||||||
import { fetchCardQuota } from '../../../common/api.uts';
|
import { fetchCardQuota } from '../../../common/api.uts';
|
||||||
import { getTenantId } from '../../../common/request.uts';
|
import { getTenantId, clearAuthToken } from '../../../common/request.uts';
|
||||||
|
|
||||||
type LangOption = {
|
type LangOption = {
|
||||||
code: OmniLocale;
|
code: OmniLocale;
|
||||||
@@ -261,6 +266,23 @@ function onSaveSettings(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onLogout(): void {
|
||||||
|
clearAuthToken();
|
||||||
|
uni.showToast({
|
||||||
|
title: resolveProfileText('logout'),
|
||||||
|
icon: 'none',
|
||||||
|
});
|
||||||
|
// #ifdef H5
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
window.location.hash = '#/pages/common/login';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/common/login',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
const loaded = loadProfileSettings();
|
const loaded = loadProfileSettings();
|
||||||
state.account = loaded.account;
|
state.account = loaded.account;
|
||||||
@@ -536,4 +558,19 @@ onShow(() => {
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logout-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
border-color: #FEE4E2;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-text {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #F04438;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -384,6 +384,8 @@ export function resolveProfileText(key: string): string {
|
|||||||
return isZh ? '偏好设置' : 'Preferences';
|
return isZh ? '偏好设置' : 'Preferences';
|
||||||
case 'languageLabel':
|
case 'languageLabel':
|
||||||
return isZh ? '界面语言' : 'Display Language';
|
return isZh ? '界面语言' : 'Display Language';
|
||||||
|
case 'logout':
|
||||||
|
return isZh ? '退出登录' : 'Log out';
|
||||||
case 'workspaceSection':
|
case 'workspaceSection':
|
||||||
return isZh ? '工作台' : 'Workspace';
|
return isZh ? '工作台' : 'Workspace';
|
||||||
case 'nfcScan':
|
case 'nfcScan':
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ onLoad((options: RadarPageOptions) => {
|
|||||||
applyRadarOptions(state, options);
|
applyRadarOptions(state, options);
|
||||||
refreshTracks(state);
|
refreshTracks(state);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
refreshTracks(state);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户