更新
This commit is contained in:
@@ -78,9 +78,6 @@ class Login extends BaseController {
|
||||
$user = auth('api')->user();
|
||||
|
||||
$user->level = $user->level()->first();
|
||||
$user->social = $user->social()->where('type', $type)->first();
|
||||
$user->store = $user->store()->first();
|
||||
$user->pm = $user->pm()->where('status', 1)->first();
|
||||
$this->data['data'] = $user;
|
||||
return response()->json($this->data);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script>
|
||||
import { setCurrentRoute } from '@/utils/auth.js'
|
||||
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log('App Launch')
|
||||
|
||||
@@ -18,8 +18,8 @@ const config = {
|
||||
{
|
||||
pagePath: "/pages/account/statistics/index",
|
||||
text: "统计",
|
||||
icon: "chart",
|
||||
activeIcon: "chart",
|
||||
icon: "color-filled",
|
||||
activeIcon: "color-filled",
|
||||
badge: 0
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import App from "./App";
|
||||
|
||||
import { createSSRApp } from "vue";
|
||||
|
||||
import boot from './boot'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App);
|
||||
const app = createSSRApp(App)
|
||||
|
||||
app.use(boot)
|
||||
|
||||
return {
|
||||
app,
|
||||
};
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
import { checkLogin, isLogin } from '@/utils/auth.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 记录该页面是否已检查过登录状态
|
||||
_pageAuthChecked: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 页面加载时检查登录状态
|
||||
this.checkAuth()
|
||||
},
|
||||
onShow() {
|
||||
// 页面显示时检查登录状态
|
||||
this.checkAuth()
|
||||
// 页面显示时检查登录状态,但避免重复检查
|
||||
if (!this._pageAuthChecked) {
|
||||
this.checkAuth()
|
||||
this._pageAuthChecked = true
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
// 页面隐藏时重置检查标志,下次显示时重新检查
|
||||
this._pageAuthChecked = false
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
|
||||
@@ -138,7 +138,7 @@ export default {
|
||||
|
||||
// 跳转到首页
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 1500)
|
||||
|
||||
@@ -92,10 +92,24 @@ export function checkLogin() {
|
||||
|
||||
// 未登录,跳转到登录页
|
||||
if (currentRoute !== '/pages/ucenter/login/index') {
|
||||
// 保存当前页面路径,登录后可以返回
|
||||
const pages = getCurrentPages()
|
||||
if (pages && pages.length > 0) {
|
||||
const currentPage = pages[pages.length - 1]
|
||||
try {
|
||||
uni.setStorageSync('beforLoginUrl', {
|
||||
route: currentPage.route,
|
||||
options: currentPage.options
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('保存登录前页面失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user