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>
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import { request } from "../../utils/request"
|
||||
|
||||
Page({
|
||||
data: {
|
||||
statusBarHeight: 0,
|
||||
loading: true,
|
||||
status: "pending" as "pending" | "rejected",
|
||||
application: null as null | {
|
||||
id: number
|
||||
site_code: string
|
||||
role_type: string
|
||||
phone: string
|
||||
status: string
|
||||
reject_reason: string | null
|
||||
created_at: string
|
||||
},
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
const { statusBarHeight } = wx.getWindowInfo()
|
||||
this.setData({ statusBarHeight })
|
||||
this.fetchStatus()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.fetchStatus()
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
this.fetchStatus().finally(() => {
|
||||
wx.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
|
||||
async fetchStatus() {
|
||||
try {
|
||||
const data = await request({
|
||||
url: "/api/xcx/me",
|
||||
method: "GET",
|
||||
needAuth: true,
|
||||
})
|
||||
|
||||
// 同步 globalData 和 Storage
|
||||
const app = getApp<IAppOption>()
|
||||
app.globalData.authUser = {
|
||||
userId: data.user_id,
|
||||
status: data.status,
|
||||
nickname: data.nickname,
|
||||
}
|
||||
wx.setStorageSync("userId", data.user_id)
|
||||
wx.setStorageSync("userStatus", data.status)
|
||||
|
||||
// 已通过 → 跳转主页
|
||||
if (data.status === "approved") {
|
||||
wx.reLaunch({ url: "/pages/mvp/mvp" })
|
||||
return
|
||||
}
|
||||
|
||||
// 已禁用 → 跳转无权限页
|
||||
if (data.status === "disabled") {
|
||||
wx.reLaunch({ url: "/pages/no-permission/no-permission" })
|
||||
return
|
||||
}
|
||||
|
||||
// 已拒绝 → 跳转无权限页
|
||||
if (data.status === "rejected") {
|
||||
wx.reLaunch({ url: "/pages/no-permission/no-permission" })
|
||||
return
|
||||
}
|
||||
|
||||
// 全新用户(尚未提交申请)→ 跳回申请页
|
||||
if (data.status === "new") {
|
||||
wx.reLaunch({ url: "/pages/apply/apply" })
|
||||
return
|
||||
}
|
||||
|
||||
this.setData({
|
||||
loading: false,
|
||||
status: data.status,
|
||||
application: data.latest_application || null,
|
||||
})
|
||||
} catch (err: any) {
|
||||
this.setData({ loading: false })
|
||||
wx.showToast({ title: "获取状态失败", icon: "none" })
|
||||
}
|
||||
},
|
||||
|
||||
onSwitchAccount() {
|
||||
const app = getApp<IAppOption>()
|
||||
app.globalData.token = undefined
|
||||
app.globalData.refreshToken = undefined
|
||||
app.globalData.authUser = undefined
|
||||
wx.removeStorageSync("token")
|
||||
wx.removeStorageSync("refreshToken")
|
||||
wx.removeStorageSync("userId")
|
||||
wx.removeStorageSync("userStatus")
|
||||
wx.reLaunch({ url: "/pages/login/login" })
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user