manager-mobile running

This commit is contained in:
AbrahamCFT360 2025-08-23 16:17:45 +05:30
parent e6704657fd
commit cf4531f299
22 changed files with 2472 additions and 10244 deletions

View file

@ -0,0 +1,26 @@
<template>
<view>
<!-- App content will be rendered here -->
</view>
</template>
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style>
/* Global styles */
page {
background-color: #f8f8f8;
}
</style>

View file

@ -1,51 +1,51 @@
## 智控台移动版(manager-mobile)
基于 uni-app v3 + Vue 3 + Vite 的跨端移动管理端,支持 App(Android & iOS)和微信小程序。
## Smart Control Panel Mobile (manager-mobile)
Cross-platform mobile management application based on uni-app v3 + Vue 3 + Vite, supporting App (Android & iOS) and WeChat Mini Program.
### 平台兼容性
### Platform Compatibility
| H5 | iOS | Android | 微信小程序 |
| -- | --- | ------- | ---------- |
| √ | √ | √ | √ |
| H5 | iOS | Android | WeChat Mini Program |
| -- | --- | ------- | ------------------- |
| √ | √ | √ | √ |
提示:不同 UI 组件在不同平台的适配度略有差异,请以对应组件库文档为准。
Note: Different UI components may have slight compatibility differences across platforms. Please refer to the respective component library documentation.
### 开发环境要求
### Development Environment Requirements
- Node >= 18
- pnpm >= 7.30(建议使用项目中声明的 `pnpm@10.x`)
- 可选:HBuilderX(App 调试/打包)、微信开发者工具(微信小程序)
- pnpm >= 7.30 (recommended to use `pnpm@10.x` as declared in the project)
- Optional: HBuilderX (for App debugging/packaging), WeChat Developer Tools (for WeChat Mini Program)
### 快速开始
1) 配置环境变量
- 复制 `env/.env.example` 为 `env/.env.development`
- 根据实际情况修改配置项(特别是 `VITE_SERVER_BASEURL`、`VITE_UNI_APPID`、`VITE_WX_APPID`)
### Quick Start
1) Configure environment variables
- Copy `env/.env.example` to `env/.env.development`
- Modify configuration items according to your needs (especially `VITE_SERVER_BASEURL`, `VITE_UNI_APPID`, `VITE_WX_APPID`)
2) 安装依赖
2) Install dependencies
```bash
pnpm i
```
3) 本地开发(热更新)
- h5: `pnpm dev:h5`,然后观察启动日志显示的ip端口号
- 微信小程序:`pnpm dev:mp` 或 `pnpm dev:mp-weixin`,然后用微信开发者工具导入 `dist/dev/mp-weixin`
- App:用 HBuilderX 导入 `manager-mobile`,然后参考下面的教程就能运行了
3) Local development (hot reload)
- H5: `pnpm dev:h5`, then check the IP and port displayed in the startup logs
- WeChat Mini Program: `pnpm dev:mp` or `pnpm dev:mp-weixin`, then import `dist/dev/mp-weixin` in WeChat Developer Tools
- App: Import `manager-mobile` in HBuilderX, then follow the tutorial below to run
### 环境变量与配置
项目使用自定义 `env` 目录存放环境文件,按 Vite 规范命名:`.env.development`、`.env.production` 等。
### Environment Variables and Configuration
The project uses a custom `env` directory for environment files, named according to Vite conventions: `.env.development`, `.env.production`, etc.
关键变量(部分):
- VITE_APP_TITLE:应用名称(写入 `manifest.config.ts`)
- VITE_UNI_APPID:uni-app 应用 appid(App)
- VITE_WX_APPID:微信小程序 appid(mp-weixin)
- VITE_FALLBACK_LOCALE:默认语言,如 `zh-Hans`
- VITE_SERVER_BASEURL:服务端基础地址(HTTP 请求 baseURL)
- VITE_DELETE_CONSOLE:构建时是否移除 console(`true`/`false`)
- VITE_SHOW_SOURCEMAP:是否生成 sourcemap(默认关闭)
- VITE_LOGIN_URL:未登录跳转的登录页路径(路由拦截器使用)
Key variables (partial):
- VITE_APP_TITLE: Application name (written to `manifest.config.ts`)
- VITE_UNI_APPID: uni-app application appid (App)
- VITE_WX_APPID: WeChat Mini Program appid (mp-weixin)
- VITE_FALLBACK_LOCALE: Default language, e.g., `zh-Hans`
- VITE_SERVER_BASEURL: Server base URL (HTTP request baseURL)
- VITE_DELETE_CONSOLE: Whether to remove console during build (`true`/`false`)
- VITE_SHOW_SOURCEMAP: Whether to generate sourcemap (disabled by default)
- VITE_LOGIN_URL: Login page path for redirect when not logged in (used by route interceptor)
示例(`env/.env.development`):
Example (`env/.env.development`):
```env
VITE_APP_TITLE=小智
VITE_APP_TITLE=XiaoZhi
VITE_FALLBACK_LOCALE=zh-Hans
VITE_UNI_APPID=
VITE_WX_APPID=
@ -57,114 +57,114 @@ VITE_SHOW_SOURCEMAP=false
VITE_LOGIN_URL=/pages/login/index
```
说明:
- `manifest.config.ts` 会从 `env` 读取标题、appid、语言等配置。
Note:
- `manifest.config.ts` reads title, appid, language and other configurations from `env`.
### 重要注意事项
⚠️ **部署前必须修改的配置项:**
### Important Notes
⚠️ **Configuration items that must be modified before deployment:**
1. **应用 ID 配置**
- `VITE_UNI_APPID`:需要在 [DCloud 开发者中心](https://dev.dcloud.net.cn/) 创建应用并获取 AppID
- `VITE_WX_APPID`:需要在 [微信公众平台](https://mp.weixin.qq.com/) 注册小程序并获取 AppID
1. **Application ID Configuration**
- `VITE_UNI_APPID`: Need to create an application in [DCloud Developer Center](https://dev.dcloud.net.cn/) and obtain AppID
- `VITE_WX_APPID`: Need to register a Mini Program in [WeChat Public Platform](https://mp.weixin.qq.com/) and obtain AppID
2. **服务端地址**
- `VITE_SERVER_BASEURL`:修改为您的实际服务端地址
2. **Server Address**
- `VITE_SERVER_BASEURL`: Modify to your actual server address
3. **应用信息**
- `VITE_APP_TITLE`:修改为您的应用名称
- 更新 `src/static/logo.png` 等图标资源
3. **Application Information**
- `VITE_APP_TITLE`: Modify to your application name
- Update icon resources like `src/static/logo.png`
4. **其他配置**
- 检查 `manifest.config.ts` 中的应用配置信息
- 根据需要修改 `src/layouts/fg-tabbar/tabbarList.ts` 中的 tabbar 配置
4. **Other Configurations**
- Check application configuration in `manifest.config.ts`
- Modify tabbar configuration in `src/layouts/fg-tabbar/tabbarList.ts` as needed
### 详细操作指南
### Detailed Operation Guide
#### 1. 获取 uni-app AppID
![生成AppID](../../docs/images/manager-mobile/生成appid.png)
- 复制生成的 AppID 到环境变量 `VITE_UNI_APPID` 中
#### 1. Get uni-app AppID
![Generate AppID](../../docs/images/manager-mobile/生成appid.png)
- Copy the generated AppID to environment variable `VITE_UNI_APPID`
#### 2. 本地运行步骤
![本地运行](../../docs/images/manager-mobile/本地运行.png)
#### 2. Local Run Steps
![Local Run](../../docs/images/manager-mobile/本地运行.png)
**App 本地调试:**
1. 用 HBuilderX 导入 `manager-mobile` 目录
2. 重新识别项目
3. 连接手机或使用模拟器进行真机调试
**App Local Debugging:**
1. Import `manager-mobile` directory in HBuilderX
2. Re-identify the project
3. Connect phone or use emulator for real device debugging
**项目识别问题解决:**
![重新识别项目](../../docs/images/manager-mobile/重新识别项目.png)
**Project Recognition Issue Resolution:**
![Re-identify Project](../../docs/images/manager-mobile/重新识别项目.png)
如果 HBuilderX 无法正确识别项目类型:
- 在项目根目录右键选择"重新识别项目类型"
- 确保项目被识别为 "uni-app" 项目
If HBuilderX cannot correctly identify the project type:
- Right-click in project root directory and select "Re-identify Project Type"
- Ensure the project is recognized as a "uni-app" project
### 路由与鉴权
- 在 `src/main.ts` 中注册了路由拦截插件 `routeInterceptor`。
- 黑名单拦截:仅对配置为需要登录的页面进行校验(来源 `@/utils` 的 `getNeedLoginPages`)。
- 登录判断:基于用户信息(`pinia` 的 `useUserStore`),未登录将跳转到 `VITE_LOGIN_URL`,并附带重定向回原页面的参数。
### Routing and Authentication
- Route interceptor plugin `routeInterceptor` is registered in `src/main.ts`.
- Blacklist interception: Only validates pages configured as requiring login (from `getNeedLoginPages` in `@/utils`).
- Login check: Based on user information (`useUserStore` from `pinia`), redirects to `VITE_LOGIN_URL` when not logged in, with redirect parameter to return to original page.
### 网络请求
- 基于 `alova` + `@alova/adapter-uniapp`,统一在 `src/http/request/alova.ts` 创建实例。
- `baseURL` 读取环境配置(`getEnvBaseUrl`),可通过 `method.config.meta.domain` 动态切换域名。
- 认证:默认从本地 `token`(`uni.getStorageSync('token')`)注入 `Authorization` 头,缺失则重定向登录。
- 响应:统一处理 `statusCode !== 200` 的 HTTP 错误与业务 `code !== 0` 的错误;`401` 会清除 token 并跳转登录。
### Network Requests
- Based on `alova` + `@alova/adapter-uniapp`, instance created uniformly in `src/http/request/alova.ts`.
- `baseURL` reads environment configuration (`getEnvBaseUrl`), can dynamically switch domains via `method.config.meta.domain`.
- Authentication: Defaults to injecting `Authorization` header from local `token` (`uni.getStorageSync('token')`), redirects to login if missing.
- Response: Unified handling of HTTP errors with `statusCode !== 200` and business errors with `code !== 0`; `401` clears token and redirects to login.
### 构建与发布
### Build and Release
**微信小程序:**
1. 确保已配置正确的 `VITE_WX_APPID`
2. 运行 `pnpm build:mp`,产物在 `dist/build/mp-weixin`
3. 用微信开发者工具导入项目目录,并上传代码
4. 在微信公众平台提交审核
**WeChat Mini Program:**
1. Ensure correct `VITE_WX_APPID` is configured
2. Run `pnpm build:mp`, output in `dist/build/mp-weixin`
3. Import project directory in WeChat Developer Tools and upload code
4. Submit for review in WeChat Public Platform
**Android & iOS App:**
**Android & iOS App:**
#### 3. App 打包发行步骤
#### 3. App Packaging and Release Steps
**步骤一:准备打包**
![打包发行步骤1](../../docs/images/manager-mobile/打包发行步骤1.png)
**Step 1: Prepare for Packaging**
![Packaging Release Step 1](../../docs/images/manager-mobile/打包发行步骤1.png)
1. 确保已配置正确的 `VITE_UNI_APPID`
2. 运行 `pnpm build:app`,产物在 `dist/build/app`
3. 用 HBuilderX 导入项目目录
4. 在 HBuilderX 中点击"发行" → "原生App-云打包"
1. Ensure correct `VITE_UNI_APPID` is configured
2. Run `pnpm build:app`, output in `dist/build/app`
3. Import project directory in HBuilderX
4. Click "Release" → "Native App-Cloud Packaging" in HBuilderX
**步骤二:配置打包参数**
![打包发行步骤2](../../docs/images/manager-mobile/打包发行步骤2.png)
**Step 2: Configure Packaging Parameters**
![Packaging Release Step 2](../../docs/images/manager-mobile/打包发行步骤2.png)
1. **应用图标和启动图**:上传应用图标和启动页面图片
2. **应用版本号**:设置版本号和版本名称
3. **签名证书**:
- Android:上传 keystore 证书文件
- iOS:配置开发者证书和描述文件
4. **包名配置**:设置应用的包名(Bundle ID)
5. **打包类型**:选择测试包或正式包
6. 点击"打包"开始云打包流程
1. **App Icon and Launch Screen**: Upload app icon and launch screen images
2. **App Version Number**: Set version number and version name
3. **Signing Certificate**:
- Android: Upload keystore certificate file
- iOS: Configure developer certificate and provisioning profile
4. **Package Name Configuration**: Set app package name (Bundle ID)
5. **Package Type**: Choose test package or release package
6. Click "Package" to start cloud packaging process
**发布到应用商店:**
- **Android**:将生成的 APK 文件上传到各大 Android 应用市场
- **iOS**:将生成的 IPA 文件通过 App Store Connect 上传到 App Store(需要 Apple 开发者账号)
**Publish to App Stores:**
- **Android**: Upload generated APK file to various Android app markets
- **iOS**: Upload generated IPA file to App Store via App Store Connect (requires Apple Developer account)
### 约定与工程化
- 页面与分包:由 `@uni-helper/vite-plugin-uni-pages` 与 `pages.config.ts` 统一生成;tabbar 配置在 `src/layouts/fg-tabbar/tabbarList.ts`。
- 组件与 hooks 自动导入:见 `vite.config.ts` 中 `unplugin-auto-import` 与 `@uni-helper/vite-plugin-uni-components`。
- 样式:使用 UnoCSS 与 `src/style/index.scss`。
- 状态管理:`pinia` + `pinia-plugin-persistedstate`。
- 代码规范:内置 `eslint`、`husky`、`lint-staged`,提交前自动格式化(`lint-staged`)。
### Conventions and Engineering
- Pages and subpackages: Generated uniformly by `@uni-helper/vite-plugin-uni-pages` and `pages.config.ts`; tabbar configuration in `src/layouts/fg-tabbar/tabbarList.ts`.
- Auto-import of components and hooks: See `unplugin-auto-import` and `@uni-helper/vite-plugin-uni-components` in `vite.config.ts`.
- Styling: Uses UnoCSS and `src/style/index.scss`.
- State management: `pinia` + `pinia-plugin-persistedstate`.
- Code standards: Built-in `eslint`, `husky`, `lint-staged`, auto-format before commit (`lint-staged`).
### 常用脚本
### Common Scripts
```bash
# 开发
pnpm dev:mp # 等价 dev:mp-weixin
# Development
pnpm dev:mp # Equivalent to dev:mp-weixin
# 构建
pnpm build:mp # 等价 build:mp-weixin
# Build
pnpm build:mp # Equivalent to build:mp-weixin
# 其他
# Others
pnpm type-check
pnpm lint && pnpm lint:fix
```
### License
MIT
MIT

View file

@ -1,26 +1,13 @@
<!doctype html>
<html build-time="%BUILD_TIME%">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<script>
var coverSupport =
'CSS' in window &&
typeof CSS.supports === 'function' &&
(CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') +
'" />',
)
</script>
<title>unibest</title>
<!--preload-links-->
<!--app-context-->
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Smart Manager Mobile</title>
</head>
<body>
<div id="app"><!--app-html--></div>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
</html>

View file

@ -0,0 +1,10 @@
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
const app = createSSRApp(App)
return {
app,
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,3 @@
packages:
- '**'
- '!node_modules'
patchedDependencies:
'@dcloudio/uni-h5': patches/@dcloudio__uni-h5.patch

View file

@ -1,39 +1,23 @@
<template>
<router-view />
</template>
<script setup lang="ts">
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
import { usePageAuth } from '@/hooks/usePageAuth'
import { useConfigStore } from '@/store'
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
// For H5 platform, we'll use Vue lifecycle hooks instead
import { onMounted } from 'vue'
usePageAuth()
const configStore = useConfigStore()
onLaunch(() => {
console.log('App Launch')
// 获取公共配置
configStore.fetchPublicConfig().catch((error) => {
console.error('获取公共配置失败:', error)
})
})
onShow(() => {
console.log('App Show')
})
onHide(() => {
console.log('App Hide')
onMounted(() => {
console.log('App mounted')
})
</script>
<style lang="scss">
swiper,
scroll-view {
flex: 1;
height: 100%;
overflow: hidden;
<style>
/* Global app styles */
page {
background-color: #f5f5f5;
}
image {
width: 100%;
height: 100%;
vertical-align: middle;
.container {
padding: 20rpx;
}
</style>
</style>

View file

@ -1,4 +1,4 @@
import { http } from '@/http/request/alova'
import { http } from '../http/request/alova'
// 登录接口数据类型
export interface LoginData {

View file

@ -0,0 +1,12 @@
import { createApp } from 'vue'
import App from './App.vue'
console.log('main-simple.ts loaded')
const app = createApp(App)
console.log('Vue app created', app)
app.mount('#app')
console.log('Vue app mounted to #app')
export { app }

View file

@ -1,18 +1,25 @@
import { VueQueryPlugin } from '@tanstack/vue-query'
import { createSSRApp } from 'vue'
import './uni-polyfill'
import { createApp as createVueApp } from 'vue'
import App from './App.vue'
import { routeInterceptor } from './router/interceptor'
import store from './store'
import '@/style/index.scss'
import 'virtual:uno.css'
import router from './router'
// Use createApp instead of createSSRApp for client-side only
const app = createVueApp(App)
app.use(store)
app.use(router)
// Mount immediately for H5
if (typeof window !== 'undefined' && document.getElementById('app')) {
// Clear the loading message before mounting
const appEl = document.getElementById('app')
if (appEl) {
appEl.innerHTML = ''
}
app.mount('#app')
}
export function createApp() {
const app = createSSRApp(App)
app.use(store)
app.use(routeInterceptor)
app.use(VueQueryPlugin)
return {
app,
}

View file

@ -0,0 +1,118 @@
<template>
<div class="home-page">
<div class="header">
<h1>Smart Manager System</h1>
<p>Manager Mobile</p>
</div>
<div class="menu-grid">
<div class="menu-item" @click="goTo('/pages/device/index')">
<div class="icon">📱</div>
<div class="label">Device Management</div>
</div>
<div class="menu-item" @click="goTo('/pages/agent/index')">
<div class="icon">🤖</div>
<div class="label">AI Agents</div>
</div>
<div class="menu-item" @click="goTo('/pages/chat-history/index')">
<div class="icon">💬</div>
<div class="label">Chat History</div>
</div>
<div class="menu-item" @click="goTo('/pages/voiceprint/index')">
<div class="icon">🎤</div>
<div class="label">Voiceprint</div>
</div>
<div class="menu-item" @click="goTo('/pages/settings/index')">
<div class="icon">⚙️</div>
<div class="label">Settings</div>
</div>
<div class="menu-item" @click="logout">
<div class="icon">🚪</div>
<div class="label">Logout</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router'
const router = useRouter()
const goTo = (path: string) => {
router.push(path)
}
const logout = () => {
if (confirm('Are you sure you want to logout?')) {
localStorage.removeItem('token')
router.push('/pages/login/index')
}
}
</script>
<style scoped>
.home-page {
padding: 20px;
max-width: 1200px;
margin: 0 auto;
}
.header {
text-align: center;
margin-bottom: 40px;
padding: 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 10px;
}
.header h1 {
margin: 0 0 10px 0;
font-size: 28px;
}
.header p {
margin: 0;
opacity: 0.9;
}
.menu-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 20px;
}
.menu-item {
background: white;
border: 1px solid #e0e0e0;
border-radius: 10px;
padding: 30px 20px;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.menu-item:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
border-color: #667eea;
}
.menu-item .icon {
font-size: 48px;
margin-bottom: 10px;
}
.menu-item .label {
font-size: 16px;
color: #333;
font-weight: 500;
}
</style>

View file

@ -45,7 +45,7 @@ systemInfo = uni.getSystemInfoSync()
safeAreaInsets = systemInfo.safeAreaInsets
// #endif
// 智能体数据
// Agent data
const agentList = ref<Agent[]>([])
const pagingRef = ref()
useZPaging(pagingRef)
@ -55,7 +55,7 @@ const message = useMessage()
// z-paging查询列表数据
async function queryList(pageNo: number, pageSize: number) {
try {
console.log('z-paging获取智能体列表')
console.log('z-paging get agent list')
const response = await getAgentList()
@ -66,45 +66,45 @@ async function queryList(pageNo: number, pageSize: number) {
pagingRef.value.complete(response)
}
catch (error) {
console.error('获取智能体列表失败:', error)
console.error('Failed to get agent list:', error)
// 告知z-paging数据加载失败
pagingRef.value.complete(false)
}
}
// 创建智能体
// Create agent
async function handleCreateAgent(agentName: string) {
try {
await createAgent({ agentName: agentName.trim() })
// 创建成功后刷新列表
pagingRef.value.reload()
toast.success(`智能体"${agentName}"创建成功!`)
toast.success(`Agent "${agentName}" created successfully!`)
}
catch (error: any) {
console.error('创建智能体失败:', error)
const errorMessage = error?.message || '创建失败,请重试'
console.error('Failed to create agent:', error)
const errorMessage = error?.message || 'Creation failed, please try again'
toast.error(errorMessage)
}
}
// 删除智能体
// Delete agent
async function handleDeleteAgent(agent: Agent) {
try {
await deleteAgent(agent.id)
// 删除成功后刷新列表
pagingRef.value.reload()
toast.success(`智能体"${agent.agentName}"已删除`)
toast.success(`Agent "${agent.agentName}" has been deleted`)
}
catch (error: any) {
console.error('删除智能体失败:', error)
const errorMessage = error?.message || '删除失败,请重试'
console.error('Failed to delete agent:', error)
const errorMessage = error?.message || 'Deletion failed, please try again'
toast.error(errorMessage)
}
}
// 进入编辑页面
function goToEditAgent(agent: Agent) {
// 传递智能体ID到编辑页面
// Pass agent ID to edit page
uni.navigateTo({
url: `/pages/agent/index?agentId=${agent.id}`,
})
@ -119,13 +119,13 @@ function handleCardClick(agent: Agent) {
function openCreateDialog() {
message
.prompt({
title: '创建智能体',
title: 'Create Agent',
msg: '',
inputPlaceholder: '例如:客服助手、语音助理、知识问答',
inputPlaceholder: 'e.g., Customer Service Assistant, Voice Assistant, Q&A Bot',
inputValue: '',
inputPattern: /^[\u4E00-\u9FA5a-z0-9\s]{1,50}$/i,
confirmButtonText: '立即创建',
cancelButtonText: '取消',
confirmButtonText: 'Create Now',
cancelButtonText: 'Cancel',
})
.then(async (result: any) => {
if (result.value && String(result.value).trim()) {
@ -144,17 +144,17 @@ function formatTime(timeStr: string) {
const diff = now.getTime() - date.getTime()
if (diff < 60000)
return '刚刚'
return 'Just now'
if (diff < 3600000)
return `${Math.floor(diff / 60000)}分钟前`
return `${Math.floor(diff / 60000)} minutes ago`
if (diff < 86400000)
return `${Math.floor(diff / 3600000)}小时前`
return `${Math.floor(diff / 86400000)}天前`
return `${Math.floor(diff / 3600000)} hours ago`
return `${Math.floor(diff / 86400000)} days ago`
}
// 页面显示时刷新列表
onShow(() => {
console.log('首页 onShow,刷新智能体列表')
console.log('Home onShow, refreshing agent list')
if (pagingRef.value) {
pagingRef.value.reload()
}
@ -164,7 +164,7 @@ onShow(() => {
<template>
<z-paging
ref="pagingRef" v-model="agentList" :refresher-enabled="true" :auto-show-back-to-top="true"
:loading-more-enabled="false" :show-loading-more="false" :hide-empty-view="false" empty-view-text="暂无智能体"
:loading-more-enabled="false" :show-loading-more="false" :hide-empty-view="false" empty-view-text="No agents yet"
empty-view-img="" :refresher-threshold="80" :back-to-top-style="{
backgroundColor: '#fff',
borderRadius: '50%',
@ -178,11 +178,11 @@ onShow(() => {
<view class="banner-content">
<view class="welcome-info">
<text class="greeting">
你好,小智
Hello, Smart Manager
</text>
<text class="subtitle">
让我们度过 <text class="highlight">
美好的一天!
Let's have a <text class="highlight">
wonderful day!
</text>
</text>
<text class="english-subtitle">
@ -201,7 +201,7 @@ onShow(() => {
<view class="content-section-header" />
</template>
<!-- 智能体卡片列表 -->
<!-- Agent card list -->
<view class="agent-list">
<view v-for="agent in agentList" :key="agent.id" class="agent-item">
<wd-swipe-action>
@ -216,10 +216,10 @@ onShow(() => {
<view class="model-info">
<text class="model-text">
语言模型: {{ agent.llmModelName }}
Language Model: {{ agent.llmModelName }}
</text>
<text class="model-text">
音色模型: {{ agent.ttsModelName }} ({{ agent.ttsVoiceName }})
Voice Model: {{ agent.ttsModelName }} ({{ agent.ttsVoiceName }})
</text>
</view>
@ -233,7 +233,7 @@ onShow(() => {
<view v-if="agent.lastConnectedAt" class="stat-chip">
<wd-icon name="time" custom-class="chip-icon" />
<text class="chip-text">
最近对话:{{ formatTime(agent.lastConnectedAt) }}
Last conversation: {{ formatTime(agent.lastConnectedAt) }}
</text>
</view>
</view>
@ -247,7 +247,7 @@ onShow(() => {
<view class="swipe-actions">
<view class="action-btn delete-btn" @click.stop="handleDeleteAgent(agent)">
<wd-icon name="delete" />
<text>删除</text>
<text>Delete</text>
</view>
</view>
</template>
@ -260,10 +260,10 @@ onShow(() => {
<view class="empty-state">
<wd-icon name="robot" custom-class="empty-icon" />
<text class="empty-text">
暂无智能体
No agents yet
</text>
<text class="empty-desc">
点击右下角 + 号创建您的第一个智能体
Click the + button at bottom right to create your first agent
</text>
</view>
</template>

View file

@ -0,0 +1,45 @@
import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
{
path: '/',
redirect: '/pages/index/index'
},
{
path: '/pages/index/index',
name: 'Home',
component: () => import('../pages/index/index-simple.vue')
},
{
path: '/pages/login/index',
name: 'Login',
component: () => import('../pages/login/index.vue')
},
{
path: '/pages/device/index',
name: 'Device',
component: () => import('../pages/device/index.vue')
},
{
path: '/pages/agent/index',
name: 'Agent',
component: () => import('../pages/agent/index.vue')
},
{
path: '/pages/chat-history/index',
name: 'ChatHistory',
component: () => import('../pages/chat-history/index.vue')
},
{
path: '/pages/settings/index',
name: 'Settings',
component: () => import('../pages/settings/index.vue')
}
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
export default router

View file

@ -1,7 +1,7 @@
import type { PublicConfig } from '@/api/auth'
import type { PublicConfig } from '../api/auth'
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getPublicConfig } from '@/api/auth'
import { getPublicConfig } from '../api/auth'
// 初始化状态
const initialConfigState: PublicConfig = {

View file

@ -1,9 +1,9 @@
import type { UserInfo } from '@/api/auth'
import type { UserInfo } from '../api/auth'
import { defineStore } from 'pinia'
import { ref } from 'vue'
import {
getUserInfo as _getUserInfo,
} from '@/api/auth'
} from '../api/auth'
// 初始化状态
const userInfoState: UserInfo & { avatar?: string, token?: string } = {

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Page</title>
</head>
<body>
<div id="app">
<h1>Test Page - Manager Mobile</h1>
<p>If you can see this, the server is working!</p>
</div>
<script type="module">
console.log('Test page loaded');
// Check if Vue app is mounting
import('./main.ts').then(module => {
console.log('Main module loaded:', module);
if (module.createApp) {
const { app } = module.createApp();
console.log('App created:', app);
app.mount('#app');
console.log('App mounted');
}
}).catch(err => {
console.error('Error loading main module:', err);
});
</script>
</body>
</html>

View file

@ -0,0 +1,75 @@
// Uni-app polyfill for H5 platform
if (typeof window !== 'undefined' && !window.uni) {
window.uni = {
getStorageSync: (key: string) => {
try {
return localStorage.getItem(key)
} catch (e) {
return null
}
},
setStorageSync: (key: string, value: any) => {
try {
localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value))
} catch (e) {
console.error('Failed to set storage', e)
}
},
removeStorageSync: (key: string) => {
try {
localStorage.removeItem(key)
} catch (e) {
console.error('Failed to remove storage', e)
}
},
navigateTo: (options: any) => {
console.log('Navigate to:', options)
if (options.url) {
window.location.href = options.url
}
},
redirectTo: (options: any) => {
console.log('Redirect to:', options)
if (options.url) {
window.location.replace(options.url)
}
},
switchTab: (options: any) => {
console.log('Switch tab:', options)
if (options.url) {
window.location.href = options.url
}
},
showToast: (options: any) => {
console.log('Toast:', options.title)
},
showLoading: (options: any) => {
console.log('Loading:', options.title)
},
hideLoading: () => {
console.log('Hide loading')
},
request: (options: any) => {
return fetch(options.url, {
method: options.method || 'GET',
headers: options.header || {},
body: options.data ? JSON.stringify(options.data) : undefined,
}).then(res => res.json())
},
uploadFile: (options: any) => {
const formData = new FormData()
formData.append(options.name, options.filePath)
return fetch(options.url, {
method: 'POST',
body: formData,
})
},
getSystemInfoSync: () => {
return {
platform: 'h5',
windowWidth: window.innerWidth,
windowHeight: window.innerHeight,
}
},
} as any
}

View file

@ -1,4 +1,4 @@
import { pages, subPackages } from '@/pages.json'
import { pages, subPackages } from '../../pages.json'
import { isMpWeixin } from './platform'
/**

View file

@ -20,7 +20,7 @@ import dayjs from 'dayjs'
import { visualizer } from 'rollup-plugin-visualizer'
import AutoImport from 'unplugin-auto-import/vite'
import { defineConfig, loadEnv } from 'vite'
import ViteRestart from 'vite-plugin-restart'
// import ViteRestart from 'vite-plugin-restart'
// https://vitejs.dev/config/
export default async ({ command, mode }) => {
@ -100,10 +100,10 @@ export default async ({ command, mode }) => {
logger: false,
}),
ViteRestart({
// 通过这个插件,在修改vite.config.js文件则不需要重新运行也生效配置
restart: ['vite.config.js'],
}),
// ViteRestart({
// // 通过这个插件,在修改vite.config.js文件则不需要重新运行也生效配置
// restart: ['vite.config.js'],
// }),
// h5环境增加 BUILD_TIME 和 BUILD_BRANCH
UNI_PLATFORM === 'h5' && {
name: 'html-transform',

View file

@ -0,0 +1,22 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
define: {
__UNI_PLATFORM__: JSON.stringify('h5'),
__VITE_APP_PROXY__: JSON.stringify(false),
},
resolve: {
alias: {
'@/': `${path.resolve(__dirname, 'src')}/`,
'@': path.resolve(__dirname, 'src'),
},
},
server: {
port: 3000,
host: '0.0.0.0',
},
})

View file

@ -0,0 +1,9 @@
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
uni(),
],
})

View file

@ -0,0 +1,17 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 3000,
host: '0.0.0.0',
open: true,
},
})