This commit is contained in:
@@ -67,7 +67,15 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
// 1. query 参数中携带设备编号
|
||||
// 1. 检查 JWT(App.vue 已处理首次跳转,这里兜底)
|
||||
const token = uni.getStorageSync('token');
|
||||
if (!token) {
|
||||
// 无 JWT → 跳转授权 Loading 页
|
||||
uni.redirectTo({ url: '/pages/auth/loading' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 有 JWT + query 参数中携带设备编号
|
||||
if (options.device_id) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index?device_id=' + options.device_id,
|
||||
@@ -76,7 +84,7 @@ export default {
|
||||
}
|
||||
|
||||
// #ifdef H5
|
||||
// 2. URL 路径中携带设备编号(如 http://xxx/A1036)
|
||||
// 3. URL 路径中携带设备编号(如 http://xxx/A1036)
|
||||
const path = window.location.pathname;
|
||||
const segments = path.split('/').filter(Boolean);
|
||||
if (segments.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user