|
|
hace 1 año | |
|---|---|---|
| .. | ||
| src | hace 1 año | |
| .gitignore | hace 1 año | |
| PROJECT_OVERVIEW.md | hace 1 año | |
| README.md | hace 1 año | |
| eslint.config.cjs | hace 1 año | |
| index.html | hace 1 año | |
| package.json | hace 1 año | |
| shims-uni.d.ts | hace 1 año | |
| vite.config.js | hace 1 año | |
基于 UniApp + Vue3 + uView-plus 的跨平台智慧校园应用。
src/
├── pages/ # 页面目录
│ ├── index/ # 首页
│ ├── workbench/ # 办公中心
│ └── profile/ # 我的
├── utils/ # 工具函数
│ ├── request.js # API请求工具
│ ├── sse.js # SSE实时数据工具
│ └── device.js # 设备兼容性工具
├── static/ # 静态资源
├── App.vue # 应用入口
├── main.js # 项目入口
├── pages.json # 页面配置
└── uni.scss # 全局样式
# 安装依赖
npm install
# H5开发
npm run dev:h5
# 微信小程序开发
npm run dev:mp-weixin
# Android开发
npm run dev:app-android
# iOS开发
npm run dev:app-ios
# 代码检查
npm run lint
# 代码自动修复
npm run lint:fix
# H5构建
npm run build:h5
# 微信小程序构建
npm run build:mp-weixin
# App构建
npm run build:app
pages/ 目录components/ 目录utils/ 目录static/ 目录import { api, storage } from '@/utils/request';
// 发起请求
const data = await api.getUserInfo();
// 设置缓存(30分钟过期)
storage.set('userInfo', data, 30 * 60);
// 获取缓存
const cachedData = storage.get('userInfo');
import { messageManager } from '@/utils/sse';
// 连接实时消息
messageManager.connect('userId123');
// 订阅消息
messageManager.subscribe('notification', (data) => {
console.log('收到通知:', data);
});
// 断开连接
messageManager.disconnect();
import { deviceUtils, adaptUtils } from '@/utils/device';
// 检测设备类型
const deviceType = deviceUtils.getDeviceType();
// 获取安全区域样式
const safeAreaStyle = adaptUtils.getSafeAreaStyle();
// 判断是否为低端设备
const isLowEnd = deviceUtils.isLowEndDevice();
utils/request.js 中配置正确的后端 API 地址manifest.json 中配置相应权限