Files
mokeeText/memory/session-20260624-3.md
2026-07-15 16:08:17 +08:00

47 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: session-20260624-3
description: 2026-06-24 第3次会话 — 修复 UserChip Widget 集成问题,对齐 control-web 成功模式
metadata:
type: session
date: 2026-06-24
sessionNumber: 3
startTime: 2026-06-24T03:35:00+08:00
---
# 2026-06-24 第3次会话
## 会话摘要
用户反馈登录后页面右上角 UserChip Widget 不显示。通过对比正常工作的 control-web 项目,发现 3 个差异,逐一修复后重新构建部署。
## 关键操作
### UserChip Widget 问题诊断
- **做了什么**: 对比 `E:\AI\claude\new\deployServer\control-web`(正常)和当前 mokeeText异常的 Widget 接入代码
- **发现的差异**:
1. 🔴 `main.js``window.process = { env: {} }` 和 widget 加载被 `if (hostname !== 'localhost')` 包裹control-web 是无条件执行
2. 🔴 `App.vue``#mokee-user-chip` 使用自闭合 `<div ... />`control-web 是正常闭合 `<div ...></div>`
3. 🟡 `App.vue` 使用 `v-if/v-else` 条件渲染 widget 占位 divcontrol-web 始终渲染
4. 🟡 `router.js` 登录重定向缺少 `redirect` 参数
- **结果**: 全部对齐到 control-web 的成功模式
### 代码修改3 个文件)
-`src/main.js` — 移除条件判断,无条件执行 polyfill + widget 加载
-`src/App.vue` — 正常闭合标签 + 始终渲染 widget 占位 + 移除 mock 头像
-`src/router.js` — 添加 `WEBSITE_URL` + `redirect` 参数到登录跳转
### 构建部署
-`npx vite build` — 构建成功,生成 `index-D7pnBl5K.js` + `index-CH4J61s9.css`
- ✅ SFTP 上传到 101.132.183.138 `/data/mokee/mokeetext/static/dist/`
-`docker compose up -d --build frontend` — 重建并重启前端容器
- ✅ 验证容器运行正常nginx 返回新 index.htmlJS 包含正确代码
## 重要信息
- control-web 参考项目路径: `E:\AI\claude\new\deployServer\control-web`
- control-web 使用 `createWebHashHistory`mokeeText 使用 `createWebHistory`(保持不变)
- 生产服务器: 101.132.183.138 root/mokee2016.
- 生产地址: https://mokeetext.zgitm.com
## 待处理
- [ ] 用户验证线上 Widget 是否正常显示
- [ ] 如有问题查看浏览器控制台错误