修改登录、打包模块页面
This commit is contained in:
parent
a448958e47
commit
0431271fff
@ -2,6 +2,16 @@
|
||||
* 接口列表文件
|
||||
*/
|
||||
export default {
|
||||
/** 系统(免登录) ↓ **/
|
||||
index: {
|
||||
// 工作台登录码登录:wms_workbench.login_code 命中返回工作台 token(免登录、免鉴权)
|
||||
LoginWorkbenchByCode: {
|
||||
path: "index.LoginWorkbenchByCode",
|
||||
auth: false,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
}
|
||||
},
|
||||
/** 公共 ↓ **/
|
||||
common: {
|
||||
ping: {
|
||||
@ -92,6 +102,28 @@ export default {
|
||||
isSystemApi: true
|
||||
}
|
||||
},
|
||||
/** 工作台 ↓ **/
|
||||
workbench: {
|
||||
list: {
|
||||
path: "workbench.list",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
// 用工作台 token 获取工作台信息(免登录、免鉴权):token 无效/不存在返回 403
|
||||
getWorkbenchInfo: {
|
||||
path: "workbench.getWorkbenchInfo",
|
||||
auth: false,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
bindMember: {
|
||||
path: "workbench.bindMember",
|
||||
auth: false,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
}
|
||||
},
|
||||
storage: {
|
||||
receiving: {
|
||||
getReceivingList: {
|
||||
|
||||
@ -6,7 +6,8 @@ import {
|
||||
import store from '@/core/store'
|
||||
import {
|
||||
getToken,
|
||||
removeToken
|
||||
removeToken,
|
||||
isWorkbenchSession
|
||||
} from '@/core/utils/auth'
|
||||
const router = createRouter({
|
||||
platform: process.env.VUE_APP_PLATFORM,
|
||||
@ -59,6 +60,13 @@ const router = createRouter({
|
||||
//全局路由前置守卫
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const hasToken = getToken();
|
||||
|
||||
// 工作台会话(token = workbenchToken):不做用户态校验,不调用 user.info
|
||||
if (hasToken && isWorkbenchSession()) {
|
||||
console.log('工作台会话放行:', to.path);
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasToken) {
|
||||
console.log("去哪里",to);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { getToken, removeToken } from '@/core/utils/auth'
|
||||
import { getToken, removeToken, isWorkbenchSession } from '@/core/utils/auth'
|
||||
|
||||
export const LOGIN_URL = '/pages/login/index'
|
||||
export const HOME_URL = '/pages/index/index'
|
||||
@ -126,6 +126,11 @@ export async function ensureEntry(store, forceValidate = false) {
|
||||
const token = getToken()
|
||||
const currentRoute = getCurrentRoute()
|
||||
|
||||
// 工作台会话:跳过用户态校验,不调用 user.info;保持当前打包模式页不跳首页
|
||||
if (isWorkbenchSession()) {
|
||||
return { loggedIn: true }
|
||||
}
|
||||
|
||||
if (!token) {
|
||||
if (!currentRoute || !isLoginRoute(currentRoute)) {
|
||||
await goLogin()
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
const TokenKey = 'token'
|
||||
|
||||
const WorkbenchTokenKey = 'workbenchToken'
|
||||
|
||||
export function getToken() {
|
||||
return uni.getStorageSync(TokenKey);
|
||||
}
|
||||
@ -11,4 +13,14 @@ export function setToken(token) {
|
||||
|
||||
export function removeToken() {
|
||||
return uni.setStorageSync(TokenKey,'');
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为工作台会话:全局 token 与工作台 token(workbenchToken)一致
|
||||
* 工作台会话下不做用户态校验,不调用 user.info
|
||||
*/
|
||||
export function isWorkbenchSession() {
|
||||
const token = getToken();
|
||||
const workbenchToken = uni.getStorageSync(WorkbenchTokenKey);
|
||||
return !!token && !!workbenchToken && token === workbenchToken;
|
||||
}
|
||||
4
env.js
4
env.js
@ -1,4 +1,4 @@
|
||||
export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
|
||||
// export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
|
||||
// export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
|
||||
export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
|
||||
export const API_URL = `${BASE_URL}/system` //后台接口域名
|
||||
export const IMG_URL = 'https://ye4s.file.gzxunren.com' //全局网络图片地址变量,css背景图片地址变量在uni.scss
|
||||
|
||||
@ -272,6 +272,13 @@
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/packing/packMode",
|
||||
"style" :
|
||||
{
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/replenishment/replenishShorts",
|
||||
"style" :
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<view class="login-container" :style="bgStyle">
|
||||
<view class="form_box">
|
||||
<view class="header-section">
|
||||
<text class="system-title">PDA仓库管理系统</text>
|
||||
<text class="system-title" @click="handleSystemTitleTap">PDA仓库管理系统</text>
|
||||
</view>
|
||||
|
||||
<view class="login-methods">
|
||||
@ -50,15 +50,29 @@
|
||||
<u-icon name="scan" size="36rpx" color="#19be6b"></u-icon>
|
||||
</view>
|
||||
<view class="scan-login-content">
|
||||
<text class="method-desc">PDA扫描工牌登录</text>
|
||||
<text class="method-desc">PDA扫描登录</text>
|
||||
<u-button
|
||||
type="success"
|
||||
size="mini"
|
||||
text="点击扫描工牌"
|
||||
text="点击扫描"
|
||||
@click.stop="handleManualScan"
|
||||
></u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 工作台登录码登录(免登录直达打包模式):隐藏入口,连续点击5次标题后显示 -->
|
||||
<view v-if="showWorkbenchLogin" class="method-card workbench-login-card">
|
||||
<u--input
|
||||
v-model="workbenchCode"
|
||||
placeholder="请输入工作台登录码"
|
||||
inputAlign="center"
|
||||
clearable
|
||||
border="bottom"
|
||||
:focus="workbenchInputFocus"
|
||||
:customStyle="{ marginBottom: '24rpx' }"
|
||||
@confirm="handleWorkbenchInputConfirm"
|
||||
></u--input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@ -164,6 +178,11 @@ export default {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
workbenchCode: '',
|
||||
workbenchLogining: false, // wblc 登录请求防重入锁
|
||||
workbenchInputFocus: false, // 工作台登录码输入框自动聚焦(从打包模式退出回来时)
|
||||
showWorkbenchLogin: false, // 工作台登录码输入框显隐(隐藏入口:连续点击5次标题切换)
|
||||
workbenchTitleTapCount: 0, // 系统标题连点计数(满5次切换工作台登录码输入框显隐)
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -186,7 +205,37 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
this.scanning = true;
|
||||
this.$store.dispatch('broadcast/resume');
|
||||
// 每次回到本页(reLaunch 重建 / 从其它页面返回)都重新绑定最新回调并确保广播监听
|
||||
this.$store.dispatch('broadcast/setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.$store.dispatch('broadcast/start');
|
||||
// 诊断日志:真机复现时确认接收器是否在监听
|
||||
this.$store.dispatch('broadcast/getStatus').then((status) => {
|
||||
console.log('[Login][bcast] onShow 广播状态:', JSON.stringify(status));
|
||||
});
|
||||
// 兜底:reLaunch 往返时旧页面(如 packMode)onUnload 的 stop 可能晚于本页 start,
|
||||
// 把刚注册的接收器注销掉;延迟复查,若未在监听则重新 start,确保二次扫码可用
|
||||
setTimeout(() => {
|
||||
this.$store.dispatch('broadcast/getStatus').then((status) => {
|
||||
const listening = !!(status && (status.moduleActive || status.isListening));
|
||||
if (!listening) {
|
||||
console.warn('[Login][bcast] 广播未在监听,延迟重启接收器');
|
||||
this.$store.dispatch('broadcast/start');
|
||||
}
|
||||
});
|
||||
}, 1200);
|
||||
// 从打包模式退出回来:自动聚焦可见的“工作台登录码”输入框,
|
||||
// 枪扫内容(键盘模拟)直接落入该框,回车即登录,无需再手动点输入框
|
||||
if (uni.getStorageSync('loginAutoFocusScan') == 1) {
|
||||
uni.removeStorageSync('loginAutoFocusScan');
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.workbenchInputFocus = true;
|
||||
console.log('[Login][focus] 已自动聚焦工作台登录码输入框');
|
||||
}, 400);
|
||||
});
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
this.$store.dispatch('broadcast/stop');
|
||||
@ -517,6 +566,38 @@ export default {
|
||||
togglePasswordVisibility() {
|
||||
this.showPassword = !this.showPassword;
|
||||
},
|
||||
handleSystemTitleTap() {
|
||||
// 隐藏入口:连续点击标题 5 次,切换工作台登录码输入框的显示/隐藏
|
||||
this.workbenchTitleTapCount += 1;
|
||||
if (this.workbenchTitleTapCount >= 5) {
|
||||
this.workbenchTitleTapCount = 0;
|
||||
this.showWorkbenchLogin = !this.showWorkbenchLogin;
|
||||
if (this.showWorkbenchLogin) {
|
||||
console.log('[Login][hidden] 连续点击5次标题,工作台登录码输入框已显示');
|
||||
// 显示后自动聚焦登录码输入框,便于扫码枪/键盘直接输入
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.workbenchInputFocus = true;
|
||||
}, 300);
|
||||
});
|
||||
} else {
|
||||
console.log('[Login][hidden] 连续点击5次标题,工作台登录码输入框已隐藏');
|
||||
this.workbenchInputFocus = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
handleWorkbenchInputConfirm() {
|
||||
// 工作台登录码输入框回车 / 枪扫内容(键盘模拟)落入该框后的统一入口:
|
||||
// 清空后交给 handleBroadcastResult 自动识别(wblc 工作台码 / 工牌 Base64)
|
||||
const code = String(this.workbenchCode || '').trim();
|
||||
if (!code) {
|
||||
console.log('[Login][scan] 工作台输入框内容为空,忽略');
|
||||
return;
|
||||
}
|
||||
this.workbenchCode = '';
|
||||
console.log('[Login][scan] 工作台输入框收到内容 code len=', code.length, ' head=', code.slice(0, 12));
|
||||
this.handleBroadcastResult({ data: code, source: 'keyboard' });
|
||||
},
|
||||
decodeBase64Text(value) {
|
||||
if (!value) return '';
|
||||
if (typeof atob !== 'function') return '';
|
||||
@ -748,10 +829,122 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
isWorkbenchLoginCode(text) {
|
||||
const code = String(text || '').trim();
|
||||
// 工作台登录码:前缀 wblc + 随机段,共 64 位(字母数字)
|
||||
return /^wblc[A-Za-z0-9]+$/i.test(code) && code.length === 64;
|
||||
},
|
||||
handleWorkbenchLogin() {
|
||||
const code = String(this.workbenchCode || '').trim();
|
||||
if (!this.isWorkbenchLoginCode(code)) {
|
||||
uni.showToast({ title: '请输入有效的工作台登录码(wblc 开头,共64位)', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.loginByWorkbenchCode(code);
|
||||
},
|
||||
async loginByWorkbenchCode(loginCode) {
|
||||
try {
|
||||
const code = String(loginCode || '').trim();
|
||||
|
||||
// 防重入:登录请求进行中,忽略重复的广播/点击触发
|
||||
if (this.workbenchLogining) {
|
||||
console.log('[Login][wblc] 登录进行中,忽略重复触发');
|
||||
return;
|
||||
}
|
||||
this.workbenchLogining = true;
|
||||
console.log('[Login][wblc] 开始工作台登录码登录, head=', code.slice(0, 6), ' len=', code.length);
|
||||
|
||||
// 登录请求期间暂停广播,避免期间重复扫码触发并发登录;
|
||||
// 成功跳转 packMode 后由页面卸载自然 stop,失败时在 catch 中 resume 恢复
|
||||
this.$store.dispatch('broadcast/stop');
|
||||
|
||||
// index.LoginWorkbenchByCode(免登录、免鉴权):校验工作台登录码,直接返回工作台 token 与身份
|
||||
const loginRes = await this.$http('index.LoginWorkbenchByCode', {
|
||||
loginCode: code
|
||||
});
|
||||
if (loginRes?.flag === 'failure' || Number(loginRes?.code) === 400 || Number(loginRes?.code) === 403) {
|
||||
throw new Error(loginRes?.message || '工作台不存在或登录码无效');
|
||||
}
|
||||
|
||||
const loginData = (loginRes && typeof loginRes === 'object' && loginRes.data && typeof loginRes.data === 'object')
|
||||
? loginRes.data
|
||||
: loginRes;
|
||||
const token = String(loginData?.token || '').trim() || this.extractToken(loginData);
|
||||
let workbenchId = loginData?.workbench_id ?? loginData?.workbenchId ?? loginData?.id ?? '';
|
||||
let workbenchName = String(loginData?.name || '').trim();
|
||||
if (!token) {
|
||||
throw new Error('工作台登录成功但未返回token');
|
||||
}
|
||||
|
||||
// 该 token 即最终工作台 token(后端已直接返回,无需再走绑定会话)
|
||||
setToken(token);
|
||||
|
||||
// 用工作台 token 拉取完整工作台信息(含 warehouse_id/status/type 等)
|
||||
// 只有 getWorkbenchInfo 返回成功后才会进入打包模块;失败则抛错中断
|
||||
const infoRes = await this.$http('workbench.getWorkbenchInfo', { token });
|
||||
if (infoRes?.flag === 'failure' || Number(infoRes?.code) === 400 || Number(infoRes?.code) === 403) {
|
||||
throw new Error(infoRes?.message || '获取工作台信息失败');
|
||||
}
|
||||
const infoData = (infoRes && typeof infoRes === 'object' && infoRes.data && typeof infoRes.data === 'object')
|
||||
? infoRes.data
|
||||
: infoRes;
|
||||
if (!infoData || typeof infoData !== 'object') {
|
||||
throw new Error('获取工作台信息失败:返回数据无效');
|
||||
}
|
||||
|
||||
const workbenchDetail = {
|
||||
id: infoData?.workbench_id ?? infoData?.workbenchId ?? infoData?.id ?? workbenchId,
|
||||
name: String(infoData?.name || workbenchName),
|
||||
warehouse_id: infoData?.warehouse_id ?? infoData?.warehouseId ?? '',
|
||||
status: infoData?.status ?? '',
|
||||
type: String(infoData?.type || ''),
|
||||
remark: String(infoData?.remark || ''),
|
||||
token
|
||||
};
|
||||
|
||||
workbenchId = workbenchDetail.id;
|
||||
workbenchName = workbenchDetail.name;
|
||||
uni.setStorageSync('workbenchInfo', workbenchDetail);
|
||||
uni.setStorageSync('workbenchToken', token);
|
||||
|
||||
uni.showToast({ title: '工作台登录成功', icon: 'success' });
|
||||
|
||||
// 免登录成功:不进主控,直接进入打包模式占位页
|
||||
// 注意:URL 仅传 workbenchId,中文 workbenchName 通过 storage(workbenchInfo)传递,避免真机 URL 中文乱码
|
||||
const query = `workbenchId=${encodeURIComponent(String(workbenchId))}`;
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: `/pages/packing/packMode?${query}` });
|
||||
}, 600);
|
||||
} catch (error) {
|
||||
this.scanning = true;
|
||||
this.workbenchLogining = false;
|
||||
this.deviceCode = '';
|
||||
this.scanUuid = '';
|
||||
this.currentDevice = null;
|
||||
// 登录失败:恢复广播监听,允许再次扫码
|
||||
this.$store.dispatch('broadcast/resume');
|
||||
console.error('[Login][wblc] 工作台登录失败:', error?.msg || error?.message || error);
|
||||
uni.showToast({
|
||||
title: error?.msg || error?.message || '工作台登录失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
handleBroadcastResult(result) {
|
||||
console.log('[Login][bcast] handleBroadcastResult 触发 scanning=', this.scanning, ' data=', result && result.data);
|
||||
if (!this.scanning || !result || !result.data) return;
|
||||
|
||||
const rawCode = String(result.data || '').trim(); // 扫描原文
|
||||
console.log('[Login][bcast] rawCode len=', rawCode.length, ' head=', rawCode.slice(0, 12));
|
||||
|
||||
// 工作台登录码(wblc 前缀,共 64 位)→ 免登录直达打包模式,不进主控
|
||||
if (this.isWorkbenchLoginCode(rawCode)) {
|
||||
console.log('[Login][bcast] 判定为工作台登录码 -> loginByWorkbenchCode');
|
||||
this.loginByWorkbenchCode(rawCode);
|
||||
return;
|
||||
}
|
||||
console.log('[Login][bcast] 非工作台登录码,按工牌流程处理');
|
||||
|
||||
const parsed = this.parseScanCodeStrict(rawCode); // 仅用于校验与展示
|
||||
if (!parsed.ok) {
|
||||
this.scanning = true;
|
||||
@ -1032,13 +1225,12 @@ export default {
|
||||
}
|
||||
|
||||
.method-desc {
|
||||
margin: 0;
|
||||
margin: 0 40rpx 0 0;
|
||||
}
|
||||
|
||||
.scan-login-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
260
pages/packing/packMode.vue
Normal file
260
pages/packing/packMode.vue
Normal file
@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<view class="pack-mode-page">
|
||||
<!-- 顶部栏 -->
|
||||
<view class="top-bar">
|
||||
<view class="status-bar"></view>
|
||||
<view class="header">
|
||||
<view class="header-left" @click="handleBack">
|
||||
<u-icon name="arrow-left" size="36rpx" color="#303133"></u-icon>
|
||||
<text class="header-left__text">退出</text>
|
||||
</view>
|
||||
<text class="header-title">打包模式</text>
|
||||
<view class="header-right"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<!-- ============ 已绑定态 ============ -->
|
||||
<template v-if="bound">
|
||||
<!-- 工作台绑定状态卡 -->
|
||||
<view class="state-card">
|
||||
<view class="state-badge">
|
||||
<u-icon name="checkmark-circle" size="36rpx" color="#19be6b"></u-icon>
|
||||
<text class="state-badge__text">已绑定 · {{ workbenchName || '工作台' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 打包模式占位提示 -->
|
||||
<view class="placeholder-card">
|
||||
<u-icon name="file-text" size="64rpx" color="#c0c4cc"></u-icon>
|
||||
<text class="placeholder-title">打包模式接入中</text>
|
||||
<text class="placeholder-desc">已绑定工作台。当前为占位页面,实际打包作业流程后续将在此接入。</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- ============ 未绑定态:提示返回登录页 ============ -->
|
||||
<template v-else>
|
||||
<view class="state-card">
|
||||
<view class="state-badge">
|
||||
<u-icon name="info-circle" size="36rpx" color="#909399"></u-icon>
|
||||
<text class="state-badge__text">未绑定工作台</text>
|
||||
</view>
|
||||
<view class="info-block">
|
||||
<view class="info-row">
|
||||
<text class="info-label">提示</text>
|
||||
<text class="info-value">当前未绑定工作台,请返回登录页使用工作台登录码(wblc 开头)登录后进入打包模式。</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="action-area action-area--col">
|
||||
<u-button text="返回登录页" plain @click="handleBack"></u-button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 当前绑定
|
||||
bound: false,
|
||||
workbenchId: '',
|
||||
workbenchName: '',
|
||||
workbenchToken: '',
|
||||
warehouseId: '',
|
||||
workbenchStatus: '',
|
||||
workbenchType: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
maskedToken() {
|
||||
const token = String(this.workbenchToken || '');
|
||||
if (!token) return '';
|
||||
if (token.length <= 12) return token;
|
||||
return `${token.substring(0, 6)}...${token.substring(token.length - 4)}`;
|
||||
},
|
||||
statusText() {
|
||||
if (this.workbenchStatus === 0 || this.workbenchStatus === '0') return '禁用';
|
||||
if (this.workbenchStatus === 1 || this.workbenchStatus === '1') return '启用';
|
||||
return this.workbenchStatus === '' || this.workbenchStatus === null || typeof this.workbenchStatus === 'undefined' ? '--' : String(this.workbenchStatus);
|
||||
},
|
||||
typeText() {
|
||||
if (this.workbenchType === 'personal') return '个人工作台';
|
||||
if (this.workbenchType === 'group') return '团体工作台';
|
||||
return this.workbenchType ? this.workbenchType : '--';
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.loadBound(options);
|
||||
},
|
||||
methods: {
|
||||
// 读取本地已绑定信息(wblc 免登录 / 绑定成功均写入 storage)
|
||||
loadBound(options) {
|
||||
const cached = uni.getStorageSync('workbenchInfo') || {};
|
||||
// 优先使用 storage 中的原始信息(UTF-8),避免真机上 URL 中文参数乱码
|
||||
this.workbenchId = String(cached?.id || options?.workbenchId || '');
|
||||
this.workbenchName = String(cached?.name || options?.workbenchName || '');
|
||||
this.workbenchToken = String(cached?.token || uni.getStorageSync('workbenchToken') || '');
|
||||
this.warehouseId = String(cached?.warehouse_id ?? cached?.warehouseId ?? '');
|
||||
this.workbenchStatus = cached?.status ?? '';
|
||||
this.workbenchType = String(cached?.type || '');
|
||||
this.bound = !!this.workbenchToken;
|
||||
},
|
||||
// 彻底退出打包模式:清除工作台会话与登录态,回到完全未登录状态
|
||||
async handleBack() {
|
||||
uni.removeStorageSync('workbenchToken');
|
||||
uni.removeStorageSync('workbenchInfo');
|
||||
// 标记:回到登录页后自动聚焦“工作台登录码”输入框,方便直接枪扫再次登录
|
||||
uni.setStorageSync('loginAutoFocusScan', 1);
|
||||
try {
|
||||
// logout 内部 clearSession(store) 会清除 token / isLogin / userInfo 等并跳回登录页
|
||||
await this.$store.dispatch('logout');
|
||||
} catch (error) {
|
||||
console.warn('[packMode] 退出打包模式失败,兜底跳转登录页:', error);
|
||||
uni.reLaunch({ url: '/pages/login/index' });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.pack-mode-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
background: #f5f6f7;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
height: var(--status-bar-height, 0px);
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 88rpx;
|
||||
padding: 0 24rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 260rpx;
|
||||
}
|
||||
|
||||
.header-left__text {
|
||||
margin-left: 8rpx;
|
||||
font-size: 34rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
width: 260rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.state-card {
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.state-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.state-badge__text {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.info-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
padding-top: 24rpx;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 26rpx;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 26rpx;
|
||||
color: #303133;
|
||||
text-align: right;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.info-value--mono {
|
||||
font-family: monospace;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.placeholder-card {
|
||||
margin-top: 24rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 64rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.placeholder-title {
|
||||
margin-top: 8rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.placeholder-desc {
|
||||
font-size: 26rpx;
|
||||
line-height: 1.7;
|
||||
color: #909399;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.action-area {
|
||||
margin-top: 48rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user