feat: 完善人生轨迹详情页功能及微信小程序登录优化
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
# 登录路由跳转修复 Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 修复小程序登录成功后错误进入编辑资料页的问题,确保登录后统一进入爽文生成页面。
|
||||
|
||||
**Architecture:** 移除登录流程中的 `hasProfile` 分支判断,将 `login/index.vue` 和 `splash/index.vue` 中的登录后路由固定指向 `/pages/main/index?tab=script`。编辑资料页面保留,仅通过"我的" tab 主动进入。
|
||||
|
||||
**Tech Stack:** Vue 3, uni-app, JavaScript
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 修复 login/index.vue 登录后跳转逻辑
|
||||
|
||||
**Files:**
|
||||
- Modify: `mini-program/src/pages/login/index.vue:152-158`
|
||||
- Modify: `mini-program/src/pages/login/index.vue:187`
|
||||
- Modify: `mini-program/src/pages/login/index.vue:209`
|
||||
|
||||
**Context:** 当前 `routeAfterLogin` 函数根据 `profileReady` 参数分支:有资料去爽文生成页,无资料去编辑资料页。需要移除该判断,统一跳转至爽文生成页。
|
||||
|
||||
- [ ] **Step 1: 修改 `routeAfterLogin` 函数,移除 `profileReady` 参数和条件分支**
|
||||
|
||||
将:
|
||||
```javascript
|
||||
const routeAfterLogin = (profileReady) => {
|
||||
if (profileReady) {
|
||||
uni.redirectTo({ url: '/pages/main/index?tab=script' })
|
||||
} else {
|
||||
uni.redirectTo({ url: '/pages/onboarding/index' })
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
改为:
|
||||
```javascript
|
||||
const routeAfterLogin = () => {
|
||||
uni.redirectTo({ url: '/pages/main/index?tab=script' })
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 修改 `handleWechatLogin` 中的调用,移除参数**
|
||||
|
||||
将:
|
||||
```javascript
|
||||
routeAfterLogin(result.hasProfile)
|
||||
```
|
||||
|
||||
改为:
|
||||
```javascript
|
||||
routeAfterLogin()
|
||||
```
|
||||
|
||||
- [ ] **Step 3: 修改 `handleLogin` 中的调用,移除参数**
|
||||
|
||||
将:
|
||||
```javascript
|
||||
routeAfterLogin(result.hasProfile)
|
||||
```
|
||||
|
||||
改为:
|
||||
```javascript
|
||||
routeAfterLogin()
|
||||
```
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add mini-program/src/pages/login/index.vue
|
||||
git commit -m "fix(login): remove profile check, always redirect to script page after login"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 2: 修复 splash/index.vue 会话恢复后的跳转逻辑
|
||||
|
||||
**Files:**
|
||||
- Modify: `mini-program/src/pages/splash/index.vue:54-56`
|
||||
|
||||
**Context:** `resolveInitialRoute` 在检测到已登录用户时,会根据 `session.hasProfile` 决定跳转到爽文生成页或编辑资料页。需要移除该分支。
|
||||
|
||||
- [ ] **Step 1: 修改已登录用户的跳转目标**
|
||||
|
||||
将:
|
||||
```javascript
|
||||
if (session.status === store.SESSION_STATUS.AUTHENTICATED) {
|
||||
const target = session.hasProfile ? '/pages/main/index?tab=script' : '/pages/onboarding/index'
|
||||
routeOnce(target, { reason: session.reason, hasProfile: session.hasProfile })
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
改为:
|
||||
```javascript
|
||||
if (session.status === store.SESSION_STATUS.AUTHENTICATED) {
|
||||
routeOnce('/pages/main/index?tab=script', { reason: session.reason })
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add mini-program/src/pages/splash/index.vue
|
||||
git commit -m "fix(splash): remove profile check on session restore, always go to script page"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 3: 验证修复
|
||||
|
||||
**Files:**
|
||||
- Read: `mini-program/src/pages/login/index.vue`
|
||||
- Read: `mini-program/src/pages/splash/index.vue`
|
||||
|
||||
- [ ] **Step 1: 验证 login/index.vue 中无残留的分支逻辑**
|
||||
|
||||
运行:
|
||||
```bash
|
||||
grep -n "onboarding" mini-program/src/pages/login/index.vue
|
||||
```
|
||||
|
||||
预期:无输出(`onboarding` 不再被 `login/index.vue` 引用)
|
||||
|
||||
- [ ] **Step 2: 验证 splash/index.vue 中无残留的分支逻辑**
|
||||
|
||||
运行:
|
||||
```bash
|
||||
grep -n "onboarding" mini-program/src/pages/splash/index.vue
|
||||
```
|
||||
|
||||
预期:无输出(`onboarding` 不再被 `splash/index.vue` 引用)
|
||||
|
||||
- [ ] **Step 3: 确认 `onboarding` 页面本身未被修改**
|
||||
|
||||
运行:
|
||||
```bash
|
||||
git diff --name-only
|
||||
```
|
||||
|
||||
预期:输出不包含 `mini-program/src/pages/onboarding/index.vue`
|
||||
|
||||
- [ ] **Step 4: 最终提交(如需要)**
|
||||
|
||||
```bash
|
||||
git log --oneline -3
|
||||
```
|
||||
|
||||
预期:显示两次提交,分别为 login 和 splash 的修复。
|
||||
|
||||
---
|
||||
|
||||
## Self-Review Checklist
|
||||
|
||||
**1. Spec coverage:**
|
||||
- ✅ `login/index.vue` 的 `routeAfterLogin` 及两处调用 — Task 1
|
||||
- ✅ `splash/index.vue` 的会话恢复路由分支 — Task 2
|
||||
- ✅ `hasProfile` 和 `onboarding` 页面保留不动 — 确认无相关修改
|
||||
- ✅ 测试验证点 — Task 3
|
||||
|
||||
**2. Placeholder scan:**
|
||||
- ✅ 无 "TBD"/"TODO" 等占位符
|
||||
- ✅ 每步均含完整代码和命令
|
||||
- ✅ 无 "类似 Task N" 的引用
|
||||
|
||||
**3. Type consistency:**
|
||||
- ✅ 文件路径和函数名与 spec 及代码库一致
|
||||
Reference in New Issue
Block a user