flat: 微调

This commit is contained in:
Apcallover
2025-12-16 20:24:03 +08:00
parent 4a03b4d4cb
commit 80213b18e9
9 changed files with 729 additions and 617 deletions

View File

@@ -14,26 +14,47 @@ const useLocationStore = defineStore("location", () => {
const longitudeVal = ref(null) // 经度
const latitudeVal = ref(null) //纬度
function getLocation() {
function getLocation() { // 获取经纬度两个平台
return new Promise((resole, reject) => {
try {
lightAppJssdk.map.getLocation({
success: function(data) {
longitudeVal.value = Number(data.longitude)
latitudeVal.value = Number(data.latitude)
resole(data)
},
fail: function(data) {
longitudeVal.value = 120.382665
latitudeVal.value = 36.066938
resole({
longitude: 120.382665,
latitude: 36.066938
})
msg('用户位置获取失败')
console.log('失败', data)
}
})
if (lightAppJssdk.map) {
lightAppJssdk.map.getLocation({
success: function(data) {
longitudeVal.value = Number(data.longitude)
latitudeVal.value = Number(data.latitude)
resole(data)
},
fail: function(data) {
longitudeVal.value = 120.382665
latitudeVal.value = 36.066938
resole({
longitude: 120.382665,
latitude: 36.066938
})
msg('用户位置获取失败')
}
})
} else {
uni.getLocation({
type: 'gcj02',
highAccuracyExpireTime: 3000,
isHighAccuracy: true,
success: function(data) {
longitudeVal.value = Number(data.longitude)
latitudeVal.value = Number(data.latitude)
resole(data)
},
fail: function(data) {
longitudeVal.value = 120.382665
latitudeVal.value = 36.066938
resole({
longitude: 120.382665,
latitude: 36.066938
})
msg('用户位置获取失败')
}
});
}
} catch (e) {
longitudeVal.value = 120.382665
latitudeVal.value = 36.066938

View File

@@ -18,6 +18,7 @@ import {
msg,
$api,
} from '../common/globalFunction';
import baseDB from '@/utils/db.js';
// 简历完成度计算
function getResumeCompletionPercentage(resume) {
@@ -125,7 +126,9 @@ const useUserStore = defineStore("user", () => {
// 获取消息列表
useReadMsg().fetchMessages()
// 获取用户信息
return getUserResume()
const resume = await getUserResume()
await baseDB.init(); // 登录成功初始化
return resume
}
const setUserInfo = (values) => {

View File

@@ -34,11 +34,12 @@ const useChatGroupDBStore = defineStore("messageGroup", () => {
const chatSessionID = ref('')
const lastDateRef = ref('')
async function init() {
async function init() { // 初始化数据,有则用,无则更新
// 获取所有数据
setTimeout(async () => {
if (!baseDB.isDBReady) await baseDB.initDB();
const result = await baseDB.db.getAll(tableName.value);
console.log('result', result)
// 1、判断是否有数据没数据请求服务器
if (result.length) {
console.warn('本地数据库存在数据')