From 16e9746e5da1ac0485fde18e71fb7bf8ee376d42 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 19 Jan 2026 11:38:00 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/jagzwxm/ja_web
---
uniapps/work-app/src/pages/login/index.vue | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/uniapps/work-app/src/pages/login/index.vue b/uniapps/work-app/src/pages/login/index.vue
index 7158d87..cdf88ae 100644
--- a/uniapps/work-app/src/pages/login/index.vue
+++ b/uniapps/work-app/src/pages/login/index.vue
@@ -44,7 +44,8 @@
import { getAssetsImage } from "@/utils/index.js";
import md5 from "js-md5";
import { loginByUsername } from "@/api/user/index.js";
-import { useUserStore } from "@/store/index.js";
+import { useUserStore, useLocationStore } from "@/store/index.js";
+import locationUtil from "@/utils/location.js";
import websocketService from "@/utils/websocket.js";
import { HOME_PATH, LOGIN_PATH, removeQueryString } from "@/router";
@@ -56,6 +57,7 @@
const agreed = ref(true);
const userStore = useUserStore();
+const locationStore = useLocationStore();
const loginForm = ref({
username: "",
password: "",
@@ -135,8 +137,22 @@
userInfo.key,
userInfo.code
);
- userStore.setUserInfo(res.data.data);
- console.log('登录成功,WebSocket连接将由全局钩子统一管理');
+ userStore.setUserInfo(res.data.data);
+ // 请求位置权限并初始化位置服务
+ try {
+ // 请求位置权限
+ const hasPermission = await locationUtil.requestLocationPermission();
+ if (hasPermission) {
+ console.log('获取位置权限成功');
+ // 初始化位置服务
+ await locationStore.initLocationService();
+ } else {
+ console.log('获取位置权限失败');
+ }
+ } catch (error) {
+ console.error('处理位置服务失败:', error);
+ }
+
uni.reLaunch({
url: "/pages/work/index",
});
--
Gitblit v1.9.3