Files
Neo-ZQYY/apps/demo-miniprogram/miniprogram/pages/login/login.ts
Neo 779b2f6d52 chore: v1 整理 — 清理历史文件、DDL 合并、文档归档
- 清理 1155 个已删除的历史文件(废弃 prompt_logs、tmp、旧 ops 脚本)
- export/ 数据文件从 git 移除(已在 .gitignore)
- demo-miniprogram 从 tmp/ 移入 apps/,添加 CLAUDE.md 注解
- DDL 合并:完整 schema 定义填充到 db/*/schemas/(从 docs/database/ddl/ 复制)
- 39 个 v1 迁移脚本归档到 db/_archived/migrations_v1_merged/
- 4 个迁移变更类 BD_Manual 文档归档到 docs/database/_archived/
- .gitignore 补充 .vite/ 和 apps/*.zip
- settings.json 添加 effortLevel 默认配置
- scripts/ops/ 新增运维脚本入库

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 00:39:27 +08:00

64 lines
1.8 KiB
TypeScript
Raw 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.
// DEMO 演示版 — 点击登录模拟成功,写入 mock 用户信息后跳转主页
Page({
data: {
agreed: false,
loading: false,
/** 系统状态栏高度px用于自定义导航栏顶部偏移 */
statusBarHeight: 20,
},
onLoad() {
const windowInfo = wx.getWindowInfo()
this.setData({ statusBarHeight: windowInfo.statusBarHeight || 20 })
},
onAgreeChange() {
this.setData({ agreed: !this.data.agreed })
},
async onLogin() {
if (!this.data.agreed) {
wx.showToast({ title: "请先同意用户协议", icon: "none" })
return
}
if (this.data.loading) return
this.setData({ loading: true })
// DEMO模拟登录成功写入 mock 用户信息
const mockToken = "demo_token_" + Date.now()
const mockUser = {
userId: "demo_user_001",
status: "approved",
nickname: "小燕",
role: "coach",
coachLevel: "senior",
storeName: "朗朗桌球·旗舰店",
avatar: "",
}
const app = getApp<IAppOption>()
app.globalData.token = mockToken
app.globalData.refreshToken = "demo_refresh_token"
app.globalData.authUser = mockUser
wx.setStorageSync("token", mockToken)
wx.setStorageSync("refreshToken", "demo_refresh_token")
wx.setStorageSync("userId", mockUser.userId)
wx.setStorageSync("userStatus", mockUser.status)
wx.setStorageSync("userRole", mockUser.role)
wx.setStorageSync("storeName", mockUser.storeName)
wx.setStorageSync("coachLevel", mockUser.coachLevel)
wx.setStorageSync("avatar", mockUser.avatar)
wx.showToast({ title: "登录成功", icon: "success" })
// 500ms 后跳转主页
setTimeout(() => {
this.setData({ loading: false })
wx.reLaunch({ url: "/pages/task-list/task-list" })
}, 500)
},
})