From b02d8ed18b2dbf0d128de1eb78a38b7f24dbfcc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=91=A3=E5=93=B2=E5=A5=87?= <13840175730@139.com>
Date: Mon, 16 Mar 2026 13:08:56 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 38 ++++++++++++++++++++++++++-----------
components/scanQR.vue | 1 +
pages/index/index.vue | 44 +++++++++++++++++++++++++++++--------------
pages/me/index.vue | 10 +++++-----
pages/pallet/ps.vue | 4 ++--
5 files changed, 65 insertions(+), 32 deletions(-)
diff --git a/App.vue b/App.vue
index 464268e..3f67d8a 100644
--- a/App.vue
+++ b/App.vue
@@ -25,6 +25,10 @@
const params = new URLSearchParams(query); // 创建一个URLSearchParams对象
ticket=params.get('ticket');
}
+
+ if (!ticket){
+ this.closeWindow()
+ }
// alert(ticket)
if(ticket){
uni.showLoading({
@@ -66,7 +70,6 @@
// }
// });
// }
-
uni.request({
header: {
"Content-Type": "application/json",
@@ -78,9 +81,8 @@
},
method: "POST",
success: res => {
- console.log(res);
+ uni.hideLoading()
if(res.data){
- console.log(res.data)
var data=res.data;
if(data.data){
var datas=data.data;
@@ -93,25 +95,25 @@
uni.switchTab({
url: '/pages/index/index'
});
- }
- else{
+ }else{
uni.showModal({
title: '提示',
- content: '获取登录token失败,请重新登录后进入!',
+ content: '登录失败,请重新登录后进入!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
+ this.closeWindow()
}
});
}
- }
- else{
+ }else{
uni.showModal({
title: '提示',
- content: '获取登录token失败,请重新登录后进入!',
+ content: '登录失败,请重新登录后进入!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
+ this.closeWindow()
}
});
}
@@ -120,10 +122,11 @@
console.log("err",err);
uni.showModal({
title: '提示',
- content: '获取登录token请求失败,请重新登录后进入!',
+ content: '登录请求失败,请重新登录后进入!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
+ this.closeWindow()
}
});
}
@@ -204,7 +207,20 @@
}
}
},
-
+ closeWindow(){
+ if (window.plus) { // 确保在App环境中运行
+ const main = plus.android.runtimeMainActivity(); // Android方式调用退出
+ main.finish(); // Android方式调用退出
+ // 或者使用iOS方式的调用方式...
+ } else {
+ console.log('Not in App environment.'); // 非App环境提示信息
+ setTimeout(function() {
+ uni.redirectTo({
+ url: '/pages/login/index'
+ });
+ }, 2000);
+ }
+ }
}
}
diff --git a/components/scanQR.vue b/components/scanQR.vue
index 41fe49d..bbe5ef6 100644
--- a/components/scanQR.vue
+++ b/components/scanQR.vue
@@ -174,6 +174,7 @@
},
handleSuccess(result) {
+ result=result.replace('\r','').replace('\n')
uni.vibrateShort();
uni.showModal({
title: '扫码结果',
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 1a924ea..1b03d66 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -141,19 +141,19 @@
this.initMenu();
},
onShow() {
- if (!uni.getStorageSync("token")) {
- uni.showToast({
- title: '登录已失效!请您重新登录!',
- duration: 2000,
- icon: "none"
- });
- setTimeout(function() {
- uni.redirectTo({
- url: '/pages/login/index'
- });
- }, 2000);
-
- }
+ // if (!uni.getStorageSync("token")) {
+ // uni.showToast({
+ // title: '登录已失效!请您重新登录!',
+ // duration: 2000,
+ // icon: "none"
+ // });
+ // setTimeout(function() {
+ // uni.redirectTo({
+ // url: '/pages/login/index'
+ // });
+ // }, 2000);
+ //
+ // }
//#ifdef APP-PLUS
@@ -197,7 +197,23 @@
},
// 获取菜单权限
gotoMenu(item){
-
+ const token= uni.getStorageSync("token");
+ if(!token){
+ if (window.plus) { // 确保在App环境中运行
+ const main = plus.android.runtimeMainActivity(); // Android方式调用退出
+ main.finish(); // Android方式调用退出
+ // 或者使用iOS方式的调用方式...
+ } else {
+ console.log('Not in App environment.'); // 非App环境提示信息
+ setTimeout(function() {
+ uni.redirectTo({
+ url: '/pages/login/index'
+ });
+ }, 2000);
+ }
+ return false;
+ }
+
if(item.name=="扫码查询"){
var _that=this,rmbm="";
diff --git a/pages/me/index.vue b/pages/me/index.vue
index 44328cd..453d252 100644
--- a/pages/me/index.vue
+++ b/pages/me/index.vue
@@ -37,9 +37,9 @@
-
+
@@ -226,9 +226,9 @@
uni.removeStorageSync('token');
uni.removeStorageSync('user');
uni.removeStorageSync('bmmc');
- uni.redirectTo({
- url: '/pages/login/index'
- });
+ // uni.redirectTo({
+ // url: '/pages/login/index'
+ // });
},500);
},
setpsd(){
diff --git a/pages/pallet/ps.vue b/pages/pallet/ps.vue
index 144c970..0ca671c 100644
--- a/pages/pallet/ps.vue
+++ b/pages/pallet/ps.vue
@@ -101,13 +101,13 @@
-