fix: 首页UI重构设计

This commit is contained in:
2026-01-12 12:36:50 +08:00
parent 1251897013
commit 2a294898ec
13 changed files with 706 additions and 161 deletions

52
App.vue
View File

@@ -1,11 +1,14 @@
<script>
import {
getVersion
getVersion,
getSystemConfig
} from './request/api/api'
import { webSocketManager } from '@/utils/ws/websocket.js';
import { ChatManager } from '@/store/chat/chat.js';
import {checkDev} from "@/utils/utils";
import {bindUserApi} from "@/request/api/salesperson";
import { silentLogin } from '@/utils/login.js';
import { isGuestMode } from '@/common/utils/auth.js';
export default {
// //初始化状态-如果登录过,保持登录状态
onLaunch: async function() {
@@ -31,7 +34,54 @@
// 存储当前版本,也可以使用globalData
uni.setStorageSync('isShow_envVersion', isShow)
// 检查是否已登录,如果未登录才检查配置并决定是否静默登录
const token = uni.getStorageSync('token');
const userInfo = uni.getStorageSync('userinfo');
if (!token || !userInfo) {
// 未登录,获取系统配置,判断是否需要静默登录
try {
const configRes = await getSystemConfig({
method: "get",
data: {
store_id: uni.getStorageSync('store_id') || '11001'
}
});
// 根据配置决定是否静默登录
// 注意:需要根据实际接口返回格式解析 need_login 字段
const isGuest = isGuestMode();
let needLogin = true; // 默认需要登录页
if (isGuest && (configRes.data.code === 0 || configRes.data.code === '0')) {
// 新格式:从 result 中获取
const configData = configRes.data.result || {};
needLogin = configData.need_login !== false; // false 表示静默登录
} else if (!isGuest && (configRes.data.errcode === 0 || configRes.data.errcode === '0')) {
// 旧格式:从 data 中获取
const configData = configRes.data.data || {};
needLogin = configData.need_login !== false; // false 表示静默登录
}
// 如果配置为静默登录need_login: false直接执行静默登录
if (!needLogin) {
// 执行静默登录(不显示提示,不跳转)
silentLogin().then((loginResult) => {
if (loginResult.success) {
console.log('静默登录成功');
} else {
console.error('静默登录失败:', loginResult.message);
}
}).catch((error) => {
console.error('静默登录异常:', error);
});
}
// 如果配置为需要登录页need_login: true不执行任何操作等待用户手动登录
} catch (error) {
// 配置接口调用失败,不影响应用启动,仅记录日志
console.error('获取系统配置失败:', error);
}
}
console.log('获取更新机制', uni.canIUse('getUpdateManager'))
// 获取小程序更新机制兼容