For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: 新用户微信授权后直跳信息补充页(默认 parent),profile/edit 嵌入四级地址选择器
Architecture: 修改 login.vue(传参跳过角色选择)+ user-edit.vue(autoParent 模式 + 嵌入 AddressPicker)+ 后端 DTO/Controller/Service 扩展 address 字段
Tech Stack: uni-app Vue 2 + Spring Boot 2.7 + MyBatis-Plus
Files:
cfc-backend/src/main/java/com/etotem/cfc/dto/UpdateUserDTO.javacfc-backend/src/main/java/com/etotem/cfc/controller/UserController.javaModify: cfc-backend/src/main/java/com/etotem/cfc/service/UserService.java
[ ] Step 1: 给 UpdateUserDTO 添加 address 字段
// 在 UpdateUserDTO.java 末尾添加(在 mascot 字段之后)
private String address;
[ ] Step 2: 给 UserController.updateUser 添加 address 参数解析
// 在 UserController.java 的 updateUser 方法中,在 mascot 解析之后、boolean success 之前添加:
if (params.containsKey("address")) dto.setAddress((String) params.get("address"));
[ ] Step 3: 给 UserService.updateUserInfo 添加 address 赋值
// 在 UserService.java 的 updateUserInfo 方法中,在 mascot 处理之后、userMapper.updateById 之前添加:
if (dto.getAddress() != null) {
user.setAddress(dto.getAddress());
}
[ ] Step 4: schema.sql 同步 — users 表添加 address 列
-- 在 CREATE TABLE IF NOT EXISTS users 定义中,在 mascot VARCHAR(20) 行之后添加:
address VARCHAR(500) COMMENT '地址',
[ ] Step 5: 验证编译
cd cfc-backend && mvn clean compile -q
Expected: BUILD SUCCESS
Files:
Modify: cfc-frontend/pages/login/login.vue
[ ] Step 1: 修改 needsRoleSelect 处理逻辑
将 login.vue 中 res.data.needsRoleSelect 为 true 时的跳转从:
if (res.data.needsRoleSelect) {
uni.redirectTo({
url: '/pages/user-edit/user-edit?token=' + res.data.token + '&userId=' + res.data.userId + '&needsRoleSelect=true'
})
}
改为:
if (res.data.needsRoleSelect) {
// 新用户:跳过角色选择,默认 parent,直接进入信息补充页
uni.redirectTo({
url: '/pages/user-edit/user-edit?token=' + res.data.token + '&userId=' + res.data.userId + '&autoParent=true'
})
}
Files:
Modify: cfc-frontend/pages/user-edit/user-edit.vue
[ ] Step 1: 引入 AddressPicker 组件
在 <script> 顶部 import 区域添加:
import AddressPicker from '../../components/address-picker.vue'
在 components 注册中添加:
components: {
AddressPicker
}
在 onLoad 中,第一个 if (options.token && options.userId) 分支内,将:
this.showRoleSelect = options.needsRoleSelect === 'true'
this.isEdit = !this.showRoleSelect
this.isNewUserFlow = options.needsRoleSelect === 'true'
改为:
// autoParent=true 跳过了角色选择,默认 parent 直接进入信息补充页
if (options.autoParent === 'true') {
this.showRoleSelect = false
this.isEdit = true
this.isNewUserFlow = true
this.form.role = 'parent'
} else {
this.showRoleSelect = options.needsRoleSelect === 'true'
this.isEdit = !this.showRoleSelect
}
this.isNewUserFlow = options.autoParent === 'true' || options.needsRoleSelect === 'true'
在 data() 的 form 对象中添加:
address: '',
addressId: null
[ ] Step 4: 表单模板中嵌入 AddressPicker(放在婚姻状态之后、兴趣爱好之前)
<!-- 地址选择(新用户必填) -->
<view class="form-item">
<text class="label">所在地区 <text class="required" v-if="isNewUserFlow">*</text></text>
<AddressPicker v-model="form.addressId" @change="onAddressChange" />
</view>
在 methods 中添加:
onAddressChange(e) {
// AddressPicker 组件通过 v-model 传 addressId,完整地址字符串通过其他事件获取
// 实际 address 显示值由 AddressPicker 内部 computed 提供
}
在 loadUserInfo 方法中,加载已有数据部分添加:
this.form.address = userData.address || ''
在 saveUserInfo 方法的 updateUserInfo({...}) 调用中添加:
address: this.form.address
在 submitRegister 或对应新用户注册的提交方法(搜索 updateUserInfo 调用位置),确保 address 也一并提交。检查 submitTeacherInfo 是否也需要(如果是家长+teacher场景)。
Files:
Modify: cfc-backend/src/main/resources/schema.sql
[ ] Step 1: 确保 address 列在 CREATE TABLE users 中
检查 CREATE TABLE IF NOT EXISTS users 中确认 address 列已添加(see Task 1 Step 4)。
[ ] Step 2: 编译验证
cd cfc-backend && mvn clean compile -q
Expected: BUILD SUCCESS
[ ] Step 3: 前端 LSP 诊断
# 检查 user-edit.vue 和 login.vue 有无语法错误
Expected: 无报错
[ ] Step 1: 检查变更范围
git diff --cached --stat # 确认仅包含目标文件
git status
[ ] Step 2: 提交
git add -A
git commit -m "feat: 首次登录跳过角色选择,直接进入信息补充页(预设parent)+ AddressPicker 四级地址"
git push origin cfclub