后退按钮测试

main
wangchenxing 2 years ago
parent 4fbfb1d9a8
commit 709a70c43d

@ -5,10 +5,10 @@ import plugins from './plugins' // plugins
import './permission' // permission import './permission' // permission
// 导入invite.js // 导入invite.js
import invite from './utils/invite' import invite from './utils/invite'
// import VConsole from 'vconsole'; import VConsole from 'vconsole';
// 初始化vConsole // 初始化vConsole
// const vConsole = new VConsole(); const vConsole = new VConsole();
// 安装插件全局弹窗 // 安装插件全局弹窗
Vue.use(invite) Vue.use(invite)
Vue.use(plugins) Vue.use(plugins)

@ -1,12 +1,12 @@
<template> <template>
<view class="zhuye"> <view class="zhuye">
<meta name="viewport" <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <!-- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> -->
<LoadingPage :loading="loading"></LoadingPage> <LoadingPage :loading="loading"></LoadingPage>
<!-- //导航栏 --> <!-- //导航栏 -->
<u-navbar bgColor="#ffffff" :placeholder="true" titleStyle="font-weight:600" title="首页" :autoBack="true"> <u-navbar bgColor="#ffffff" :placeholder="true" titleStyle="font-weight:600" title="首页" :autoBack="false">
<template #left> <template #left>
<image src='../static/back.png' style="width: 36rpx;height: 36rpx;" @click="goback"> <image src='../static/back.png' style="width: 36rpx;height: 36rpx;" @click="goback">
</image> </image>
@ -263,7 +263,37 @@
}, },
methods: { methods: {
goback() { goback() {
this.$router.go(-2)
// this.$router.go(-3)
// window.history.back()
// window.JSBridge.exit();
// 获取当前页面栈
const pages = getCurrentPages();
console.log(pages); // 打印页面栈
// 如果页面栈大于 1,执行返回操作
if (pages.length > 1) {
// uni.navigateBack(1);
window.history.back();
console.log("pages.length",pages.length);
} else {
console.log('已经在首页,无法返回');
window.history.back();
console.log('已执行back');
// this.$router.go(-2)
// console.log('已执行$router');
// uni.navigateBack(1);
// console.log('已执行navigateBack');
// window.JSBridge.exit();
// console.log('已执行exit');
// window.close();
// console.log('已执行close');
}
}, },
getYanLian() { getYanLian() {
backlog().then(res => { backlog().then(res => {

@ -117,7 +117,10 @@ export default {
//解密算法 //解密算法
decodeDes(message) { decodeDes(message) {
console.log('00'); const options = uni.getLaunchOptionsSync(); // 获取启动时的参数
const fromPage = options.path; // 获取来源页面路径(如果有)
const params = options.query; // 获取 URL 中的 query 参数(如果有)
console.log('00+fromPage',fromPage);
console.log(message); console.log(message);
console.log('11'); console.log('11');
//秘钥 //秘钥
@ -185,8 +188,8 @@ export default {
}, },
// 密码登录 // 密码登录
async pwdLogin(cas) { async pwdLogin(cas) {
// this.loginForm.cas = cas; this.loginForm.cas = cas;
this.loginForm.cas = this.decodeDes(cas); // this.loginForm.cas = this.decodeDes(cas);
this.$store this.$store
.dispatch('Login', this.loginForm) .dispatch('Login', this.loginForm)
.then(() => { .then(() => {

@ -7,7 +7,9 @@
height: $u.addUnit($u.getPx(height) + $u.sys().statusBarHeight,'px'), height: $u.addUnit($u.getPx(height) + $u.sys().statusBarHeight,'px'),
}" }"
></view> ></view>
<view :class="[fixed && 'u-navbar--fixed']"> <view>
<!-- :class="[fixed && 'u-navbar--fixed']" -->
<u-status-bar <u-status-bar
v-if="safeAreaInsetTop" v-if="safeAreaInsetTop"
:bgColor="bgColor" :bgColor="bgColor"

Loading…
Cancel
Save