v4.2 冲刺版+每日推送+支付修复+全量代码评审
## 新增功能 - 冲刺版 ¥49.9/月:完整支付→激活→权益扣减链路 - 每日一题定时推送(@nestjs/schedule,早8点微信订阅消息) - miniprogram-ci 编译上传脚本(scripts/upload-mp.js) ## Bug修复 - 套餐值统一:vip→growth/sprint(interview轮次限制、analyze次数检查) - member/pay 移除开发绕过:改为订单校验后激活 - progress→report 参数名不匹配:id→interviewId - result.vue resume.create() 参数传错(对象→独立参数) - resume.vue analyze请求缺少Authorization header - bank.vue contribution请求缺少Authorization header - member.vue startPay() 缺少try/catch导致网络错误崩溃 - login.vue 调试面板 v-if="true" 生产泄漏 ## 配置 - 微信支付生产证书就位(商户号1113760598) - .env 清理冗余文件(删除.example/.production) - WX_NOTIFY_URL 更新为 zhiyinwx.yzrcloud.cn ## 文档 - PROJECT-STATUS.md v4.1→v4.2,状态全面更新 - DEPLOYMENT.md 新增小程序编译上传章节、清理检查清单
This commit is contained in:
Generated
+12565
-66
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,8 @@
|
||||
"@dcloudio/uni-components": "3.0.0-4060620250520001",
|
||||
"@dcloudio/uni-h5": "3.0.0-4060620250520001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4060620250520001",
|
||||
"@esbuild/linux-x64": "^0.28.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "^4.61.1",
|
||||
"pinia": "^2.1.7",
|
||||
"uqrcodejs": "^4.0.7",
|
||||
"vue": "^3.4.21"
|
||||
@@ -21,6 +23,7 @@
|
||||
"@dcloudio/uni-automator": "3.0.0-4060620250520001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-4060620250520001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-4060620250520001",
|
||||
"miniprogram-ci": "^2.1.31",
|
||||
"sass": "^1.70.0",
|
||||
"typescript": "^5.3.0",
|
||||
"vite": "^5.2.0"
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
const ci = require('miniprogram-ci')
|
||||
const path = require('path')
|
||||
|
||||
const projectPath = path.resolve(__dirname, '../dist/build/mp-weixin')
|
||||
const privateKeyPath = path.resolve('/root/opencode-workspace/微信小程序参数/宇之然AI磁场appid/private.wxf466b3c3bc411ffc.key')
|
||||
const appid = 'wxf466b3c3bc411ffc'
|
||||
|
||||
async function main() {
|
||||
const project = new ci.Project({
|
||||
appid,
|
||||
type: 'miniProgram',
|
||||
projectPath,
|
||||
privateKeyPath,
|
||||
ignores: ['node_modules/**/*'],
|
||||
})
|
||||
|
||||
console.log(`Uploading from: ${projectPath}`)
|
||||
console.log(`AppID: ${appid}`)
|
||||
|
||||
// Dry-run mode for testing — set raw false to actually upload
|
||||
// For testing, we do a preview first
|
||||
try {
|
||||
const previewResult = await ci.preview({
|
||||
project,
|
||||
desc: '预览测试',
|
||||
setting: {
|
||||
es6: true,
|
||||
minify: false,
|
||||
},
|
||||
})
|
||||
console.log('Preview success!')
|
||||
console.log('Preview result:', JSON.stringify(previewResult, null, 2))
|
||||
} catch (err) {
|
||||
console.error('Preview failed:', err.message)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
@@ -51,6 +51,7 @@ export const API_ENDPOINTS = {
|
||||
ANALYZE: {
|
||||
DIAGNOSIS: '/analyze/diagnosis',
|
||||
OPTIMIZE: '/analyze/optimize',
|
||||
SKILLS_GAP: '/analyze/skills-gap',
|
||||
},
|
||||
RESUME: {
|
||||
CREATE: '/resume/create',
|
||||
@@ -71,13 +72,20 @@ export const API_ENDPOINTS = {
|
||||
MEMBER: {
|
||||
PLANS: '/member/plans',
|
||||
STATUS: '/member/status',
|
||||
CREATE_ORDER: '/member/create-order',
|
||||
PAY: '/member/pay',
|
||||
SPRINT_DEDUCT: '/member/sprint/deduct',
|
||||
},
|
||||
DAILY_QUESTION: {
|
||||
TODAY: '/daily-question',
|
||||
BY_POSITION: (position: string) => `/daily-question/position/${position}`,
|
||||
},
|
||||
PAYMENT: {
|
||||
CREATE: '/payment/create',
|
||||
JSAPI: '/payment/jsapi',
|
||||
QUERY: '/payment/query',
|
||||
CHECK: (outTradeNo: string) => `/payment/check/${outTradeNo}`,
|
||||
ACTIVATE: '/payment/activate',
|
||||
},
|
||||
} as const
|
||||
|
||||
const API_HOST = typeof window !== 'undefined' && window.location.hostname !== 'localhost' && window.location.hostname !== '127.0.0.1'
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
{ "path": "pages/member/member", "style": { "navigationBarTitleText": "会员中心" } },
|
||||
{ "path": "pages/progress/progress", "style": { "navigationBarTitleText": "进步轨迹" } },
|
||||
{ "path": "pages/contribute/contribute", "style": { "navigationBarTitleText": "面经分享" } },
|
||||
{ "path": "pages/company-bank/bank", "style": { "navigationBarTitleText": "公司真题库" } },
|
||||
{ "path": "pages/login/login", "style": { "navigationBarTitleText": "登录" } },
|
||||
{ "path": "pages/history/history", "style": { "navigationBarTitleText": "面试记录" } },
|
||||
{ "path": "pages/user/user", "style": { "navigationBarTitleText": "我的" } },
|
||||
|
||||
@@ -1,406 +1,406 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="hero">
|
||||
<text class="hero-title">管理后台</text>
|
||||
<text class="hero-sub" v-if="!verified">使用管理员账号点击下方按钮验证</text>
|
||||
<text class="hero-sub" v-else>欢迎回来,{{ adminName }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 登录 -->
|
||||
<view class="login-area" v-if="!verified">
|
||||
<button class="btn-verify" @click="doVerify">验证管理员身份</button>
|
||||
</view>
|
||||
|
||||
<!-- 管理后台 -->
|
||||
<view class="body" v-if="verified">
|
||||
<view class="tabs">
|
||||
<text class="tab" :class="{ active: tab === 'overview' }" @click="switchTab('overview')">概览</text>
|
||||
<text class="tab" :class="{ active: tab === 'users' }" @click="switchTab('users')">用户管理</text>
|
||||
<text class="tab" :class="{ active: tab === 'interviews' }" @click="switchTab('interviews')">面试记录</text>
|
||||
<text class="tab" :class="{ active: tab === 'orders' }" @click="switchTab('orders')">订单</text>
|
||||
<text class="tab" :class="{ active: tab === 'admins' }" @click="switchTab('admins')">管理员</text>
|
||||
<text class="tab" :class="{ active: tab === 'config' }" @click="switchTab('config')">配置</text>
|
||||
</view>
|
||||
|
||||
<!-- 概览 -->
|
||||
<view v-if="tab === 'overview' && !loading" class="overview">
|
||||
<view class="stat-cards">
|
||||
<view class="stat-card">
|
||||
<text class="stat-num">{{ overview.userCount }}</text>
|
||||
<text class="stat-label">总用户</text>
|
||||
<text class="stat-sub">今日 +{{ overview.todayUsers }}</text>
|
||||
</view>
|
||||
<view class="stat-card">
|
||||
<text class="stat-num">{{ overview.interviewCount }}</text>
|
||||
<text class="stat-label">总面试</text>
|
||||
<text class="stat-sub">今日 +{{ overview.todayInterviews }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户 -->
|
||||
<view v-if="tab === 'users'" class="section">
|
||||
<view class="search-bar">
|
||||
<input v-model="userKeyword" placeholder="搜索手机号/昵称" class="search-input" @confirm="loadUsers" />
|
||||
<button class="search-btn" @click="loadUsers">搜索</button>
|
||||
</view>
|
||||
<view class="user-list" v-if="!usersLoading">
|
||||
<view class="user-row" v-for="u in users" :key="u._id">
|
||||
<text class="user-phone">{{ u.phone || '--' }}</text>
|
||||
<text class="user-name">{{ u.nickname || '--' }}</text>
|
||||
<text class="user-plan" :class="{ vip: u.plan === 'vip' }">{{ u.plan === 'vip' ? '会员' : '免费' }}</text>
|
||||
<text class="user-remaining">剩{{ u.remaining || 0 }}次</text>
|
||||
<text class="user-vip-btn" v-if="u.plan !== 'vip'" @click="setVip(u._id)">设为会员</text>
|
||||
</view>
|
||||
<text class="load-more" v-if="usersTotal > users.length" @click="loadMoreUsers">加载更多</text>
|
||||
</view>
|
||||
<text class="loading-text" v-if="usersLoading">加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 面试 -->
|
||||
<view v-if="tab === 'interviews'" class="section">
|
||||
<view class="iv-list" v-if="!ivLoading">
|
||||
<view class="iv-row" v-for="iv in interviews" :key="iv._id">
|
||||
<text class="iv-pos">{{ iv.position }}</text>
|
||||
<text class="iv-user">{{ iv.userId?.phone || iv.userId?.nickname || '--' }}</text>
|
||||
<text class="iv-status" :class="{ done: iv.status === 'completed' }">{{ iv.status === 'completed' ? '已完成' : '进行中' }}</text>
|
||||
<text class="iv-questions">{{ iv.questionCount || 0 }}题</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="loading-text" v-if="ivLoading">加载中...</text>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- 订单 -->
|
||||
<view v-if="tab === 'orders'" class="section">
|
||||
<view class="tabs in-tab">
|
||||
<text class="tab" :class="{ active: orderFilter === '' }" @click="orderFilter='';loadOrders()">全部</text>
|
||||
<text class="tab" :class="{ active: orderFilter === 'pending' }" @click="orderFilter='pending';loadOrders()">待支付</text>
|
||||
<text class="tab" :class="{ active: orderFilter === 'success' }" @click="orderFilter='success';loadOrders()">已支付</text>
|
||||
<text class="tab" :class="{ active: orderFilter === 'refunded' }" @click="orderFilter='refunded';loadOrders()">已退款</text>
|
||||
</view>
|
||||
<view class="order-list" v-if="!orderLoading">
|
||||
<view class="order-row" v-for="o in orders" :key="o._id">
|
||||
<view class="order-info">
|
||||
<text class="order-id">订单号: {{ o.outTradeNo }}</text>
|
||||
<text class="order-user">用户: {{ o.userPhone || o.userId.slice(-6) }}</text>
|
||||
</view>
|
||||
<view class="order-meta">
|
||||
<text class="order-amount">¥{{ (o.amount / 100).toFixed(1) }}</text>
|
||||
<view class="order-status" :class="o.status === 'success' ? 'paid' : o.status === 'refunded' ? 'refund' : 'pend'">
|
||||
{{ o.status === 'success' ? '已支付' : o.status === 'refunded' ? '已退款' : '待支付' }}
|
||||
</view>
|
||||
<text class="order-time">{{ o.createdAt ? o.createdAt.slice(0,16).replace('T',' ') : '--' }}</text>
|
||||
<view class="order-actions" v-if="o.status === 'pending'">
|
||||
<text class="sync-btn" @click="syncOrder(o.outTradeNo)">同步</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="load-more" v-if="ordersTotal > orders.length" @click="loadMoreOrders">加载更多</text>
|
||||
<text class="empty-text" v-if="orders.length === 0 && !orderLoading">暂无订单</text>
|
||||
</view>
|
||||
<text class="loading-text" v-if="orderLoading">加载中...</text>
|
||||
</view>
|
||||
<!-- 套餐配置 -->
|
||||
<view v-if="tab === 'config'" class="section">
|
||||
<view class="config-card" v-if="!cfgLoading">
|
||||
<view class="cfg-title">面试限制</view>
|
||||
<view class="cfg-row"><text>免费版每场最大轮次</text><text class="cfg-val">{{ memberConfig.interview.maxRoundsFree }}</text></view>
|
||||
<view class="cfg-row"><text>会员每场最大轮次</text><text class="cfg-val">{{ memberConfig.interview.maxRoundsVip }}</text></view>
|
||||
<view class="cfg-row"><text>免费版每日面试次数</text><text class="cfg-val">{{ memberConfig.interview.dailyFreeLimit }}</text></view>
|
||||
</view>
|
||||
<view class="config-card" v-if="!cfgLoading">
|
||||
<view class="cfg-title">诊断与优化限制</view>
|
||||
<view class="cfg-row"><text>免费版每日诊断次数</text><text class="cfg-val">{{ memberConfig.diagnosis.dailyFreeLimit }}</text></view>
|
||||
<view class="cfg-row"><text>免费版每日优化次数</text><text class="cfg-val">{{ memberConfig.optimize.dailyFreeLimit }}</text></view>
|
||||
</view>
|
||||
<view class="config-card" v-if="!cfgLoading">
|
||||
<view class="cfg-title">价格</view>
|
||||
<view class="cfg-row"><text>月度会员</text><text class="cfg-val">¥{{ (memberConfig.price.monthly / 100).toFixed(0) }}</text></view>
|
||||
</view>
|
||||
<view class="empty-text" v-if="cfgLoading">加载中...</view>
|
||||
</view>
|
||||
<!-- 管理员 -->
|
||||
<view v-if="tab === 'admins'" class="section">
|
||||
<view class="search-bar">
|
||||
<input v-model="adminKeyword" placeholder="搜索用户ID或手机号设为管理员" class="search-input" @confirm="searchAdmin" />
|
||||
<button class="search-btn" @click="searchAdmin">搜索</button>
|
||||
</view>
|
||||
<view class="section-label">当前管理员</view>
|
||||
<view class="user-list">
|
||||
<view class="admin-row" v-for="a in adminList" :key="a._id">
|
||||
<text class="admin-phone">{{ a.phone || '--' }}</text>
|
||||
<text class="admin-name">{{ a.nickname || '--' }}</text>
|
||||
<text class="admin-badge" v-if="a.isSystemAdmin">系统</text>
|
||||
</view>
|
||||
<text class="empty-text" v-if="adminList.length === 0">暂无管理员</text>
|
||||
</view>
|
||||
<view class="section-label" v-if="searchResult">搜索结果</view>
|
||||
<view class="user-list" v-if="searchResult">
|
||||
<view class="admin-row">
|
||||
<text class="admin-phone">{{ searchResult.phone || '--' }}</text>
|
||||
<text class="admin-name">{{ searchResult.nickname || '--' }}</text>
|
||||
<text class="admin-set-btn" v-if="searchResult.role !== 'admin'" @click="setAdmin(searchResult._id)">设为管理员</text>
|
||||
<text class="admin-set-btn done" v-else>已是管理员</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { api } from '../../config'
|
||||
|
||||
const verified = ref(false)
|
||||
const adminName = ref('')
|
||||
const tab = ref('overview')
|
||||
const loading = ref(false)
|
||||
const usersLoading = ref(false)
|
||||
const ivLoading = ref(false)
|
||||
const userKeyword = ref('')
|
||||
const usersPage = ref(1)
|
||||
|
||||
const overview = ref({ userCount: 0, interviewCount: 0, todayUsers: 0, todayInterviews: 0 })
|
||||
const users = ref([])
|
||||
const usersTotal = ref(0)
|
||||
const interviews = ref([])
|
||||
const adminKeyword = ref('')
|
||||
const adminList = ref([])
|
||||
const searchResult = ref(null)
|
||||
const memberConfig = ref({ interview: { maxRoundsFree: 5, maxRoundsVip: 10, dailyFreeLimit: 3 }, diagnosis: { dailyFreeLimit: 2 }, optimize: { dailyFreeLimit: 2 }, price: { monthly: 2900 } })
|
||||
const cfgLoading = ref(false)
|
||||
const orders = ref([])
|
||||
const ordersTotal = ref(0)
|
||||
const ordersPage = ref(1)
|
||||
const orderLoading = ref(false)
|
||||
const orderFilter = ref('')
|
||||
|
||||
const token = () => uni.getStorageSync('token') || ''
|
||||
|
||||
const apiAdmin = (path, opts = {}) => {
|
||||
return uni.request({
|
||||
url: api('/admin' + path),
|
||||
method: opts.method || 'GET',
|
||||
header: { 'Authorization': `Bearer ${token()}`, 'Content-Type': 'application/json', ...opts.headers },
|
||||
data: opts.body || opts.data,
|
||||
})
|
||||
}
|
||||
|
||||
const doVerify = async () => {
|
||||
const t = token()
|
||||
if (!t) { uni.navigateTo({ url: '/pages/login/login' }); return }
|
||||
try {
|
||||
const res = await apiAdmin('/check')
|
||||
if (res.statusCode === 200 && res.data?.isAdmin) {
|
||||
adminName.value = '管理员'
|
||||
verified.value = true
|
||||
loadOverview()
|
||||
} else throw new Error('无管理员权限')
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '当前账号非管理员,无权限访问', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
const loadOverview = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await apiAdmin('/overview')
|
||||
if (res.statusCode === 200) overview.value = res.data
|
||||
} catch (e) { console.error(e) }
|
||||
finally { loading.value = false }
|
||||
}
|
||||
|
||||
const switchTab = (t) => {
|
||||
tab.value = t
|
||||
if (t === 'users' && users.value.length === 0) loadUsers()
|
||||
if (t === 'interviews' && interviews.value.length === 0) loadInterviews()
|
||||
if (t === 'admins' && adminList.value.length === 0) loadAdmins()
|
||||
if (t === 'config') loadConfig()
|
||||
if (t === 'orders') loadOrders()
|
||||
}
|
||||
|
||||
const loadUsers = async () => {
|
||||
usersLoading.value = true
|
||||
usersPage.value = 1
|
||||
try {
|
||||
const res = await apiAdmin('/users?keyword=' + encodeURIComponent(userKeyword.value) + '&page=1&limit=20')
|
||||
if (res.statusCode === 200) { users.value = res.data.users || []; usersTotal.value = res.data.total || 0 }
|
||||
} catch (e) { console.error(e) }
|
||||
finally { usersLoading.value = false }
|
||||
}
|
||||
|
||||
const loadMoreUsers = async () => {
|
||||
usersPage.value++
|
||||
try {
|
||||
const res = await apiAdmin('/users?keyword=' + encodeURIComponent(userKeyword.value) + '&page=' + usersPage.value + '&limit=20')
|
||||
if (res.statusCode === 200) users.value = [...users.value, ...(res.data.users || [])]
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
const loadInterviews = async () => {
|
||||
ivLoading.value = true
|
||||
try {
|
||||
const res = await apiAdmin('/interviews?page=1&limit=20')
|
||||
if (res.statusCode === 200) interviews.value = res.data.interviews || []
|
||||
} catch (e) { console.error(e) }
|
||||
finally { ivLoading.value = false }
|
||||
}
|
||||
|
||||
const loadConfig = async () => {
|
||||
cfgLoading.value = true
|
||||
try {
|
||||
const res = await apiAdmin('/config')
|
||||
if (res.statusCode === 200) memberConfig.value = res.data
|
||||
} catch(e) { console.error(e) }
|
||||
finally { cfgLoading.value = false }
|
||||
}
|
||||
|
||||
const loadOrders = async () => {
|
||||
orderLoading.value = true
|
||||
ordersPage.value = 1
|
||||
try {
|
||||
let url = '/orders?page=1&limit=20'
|
||||
if (orderFilter.value) url += '&status=' + orderFilter.value
|
||||
const res = await apiAdmin(url)
|
||||
if (res.statusCode === 200) { orders.value = res.data.orders || []; ordersTotal.value = res.data.total || 0 }
|
||||
} catch(e) { console.error(e) }
|
||||
finally { orderLoading.value = false }
|
||||
}
|
||||
|
||||
const loadMoreOrders = async () => {
|
||||
ordersPage.value++
|
||||
let url = '/orders?page=' + ordersPage.value + '&limit=20'
|
||||
if (orderFilter.value) url += '&status=' + orderFilter.value
|
||||
try {
|
||||
const res = await apiAdmin(url)
|
||||
if (res.statusCode === 200) orders.value = [...orders.value, ...(res.data.orders || [])]
|
||||
} catch(e) { console.error(e) }
|
||||
}
|
||||
|
||||
const syncOrder = async (outTradeNo) => {
|
||||
uni.showToast({ title: '同步中...', icon: 'none' })
|
||||
try {
|
||||
const res = await apiAdmin('/order/sync', { method: 'POST', data: { outTradeNo } })
|
||||
if (res.statusCode === 200) {
|
||||
uni.showToast({ title: '同步完成', icon: 'success' })
|
||||
loadOrders()
|
||||
} else { uni.showToast({ title: '同步失败', icon: 'none' }) }
|
||||
} catch { uni.showToast({ title: '同步失败', icon: 'none' }) }
|
||||
}
|
||||
|
||||
const loadAdmins = async () => {
|
||||
try {
|
||||
const res = await apiAdmin('/admins')
|
||||
if (res.statusCode === 200) adminList.value = res.data.admins || []
|
||||
} catch(e) { console.error(e) }
|
||||
}
|
||||
|
||||
const searchAdmin = async () => {
|
||||
if (!adminKeyword.value.trim()) return
|
||||
try {
|
||||
const res = await apiAdmin('/users?keyword=' + encodeURIComponent(adminKeyword.value) + '&limit=1')
|
||||
if (res.statusCode === 200 && res.data.users?.length > 0) {
|
||||
searchResult.value = res.data.users[0]
|
||||
} else {
|
||||
uni.showToast({ title: '未找到该用户', icon: 'none' })
|
||||
searchResult.value = null
|
||||
}
|
||||
} catch { searchResult.value = null }
|
||||
}
|
||||
|
||||
const setAdmin = async (targetUserId) => {
|
||||
uni.showModal({
|
||||
title: '设为管理员', content: '确定将该用户设为管理员?', success: async (r) => {
|
||||
if (!r.confirm) return
|
||||
try {
|
||||
const res = await apiAdmin('/set-admin', { method: 'POST', data: { userId: targetUserId } })
|
||||
if (res.statusCode === 200) {
|
||||
uni.showToast({ title: '已设为管理员', icon: 'success' })
|
||||
searchResult.value = null
|
||||
adminKeyword.value = ''
|
||||
loadAdmins()
|
||||
} else throw new Error()
|
||||
} catch { uni.showToast({ title: '操作失败', icon: 'none' }) }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const setVip = async (targetUserId) => {
|
||||
uni.showModal({
|
||||
title: '设为会员', content: '确定将该用户升级为月度会员?', success: async (r) => {
|
||||
if (!r.confirm) return
|
||||
try {
|
||||
const res = await apiAdmin('/set-vip', { method: 'POST', data: { userId: targetUserId } })
|
||||
if (res.statusCode === 200) {
|
||||
uni.showToast({ title: '已设为会员', icon: 'success' })
|
||||
loadUsers()
|
||||
} else throw new Error()
|
||||
} catch { uni.showToast({ title: '操作失败', icon: 'none' }) }
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { background: var(--color-bg); min-height: 100vh; }
|
||||
.hero { background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-mid), var(--color-gradient-end)); padding: 48rpx 32rpx 72rpx; border-radius: 0 0 48rpx 48rpx; }
|
||||
.hero-title { font-size: 40rpx; font-weight: 700; color: #FFF; }
|
||||
.hero-sub { font-size: 22rpx; color: rgba(255,255,255,0.7); margin-top: 8rpx; display: block; }
|
||||
.login-area { padding: 32rpx; margin-top: -40rpx; display: flex; flex-direction: column; gap: 16rpx; }
|
||||
.admin-input { height: 72rpx; background: #FFF; border: 2rpx solid var(--color-border); border-radius: var(--radius-sm); padding: 0 20rpx; font-size: 24rpx; }
|
||||
.btn-verify { height: 72rpx; background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-mid)); color: #FFF; border-radius: var(--radius-sm); font-size: 26rpx; border: none; }
|
||||
.body { padding: 20rpx 32rpx 48rpx; margin-top: -40rpx; }
|
||||
.tabs { display: flex; gap: 8rpx; background: #FFF; border-radius: var(--radius-md); padding: 6rpx; margin-bottom: 20rpx; }
|
||||
.tab { flex: 1; text-align: center; padding: 14rpx; font-size: 24rpx; color: var(--color-text-secondary); border-radius: var(--radius-sm); }
|
||||
.tab.active { background: var(--color-primary); color: #FFF; font-weight: 600; }
|
||||
.stat-cards { display: flex; gap: 16rpx; }
|
||||
.stat-card { flex: 1; background: #FFF; border-radius: var(--radius-lg); padding: 28rpx; text-align: center; box-shadow: var(--shadow-sm); }
|
||||
.stat-num { font-size: 48rpx; font-weight: 800; color: var(--color-primary); display: block; }
|
||||
.stat-label { font-size: 22rpx; color: var(--color-text-secondary); margin-top: 8rpx; display: block; }
|
||||
.stat-sub { font-size: 20rpx; color: var(--color-success); margin-top: 4rpx; display: block; }
|
||||
.search-bar { display: flex; gap: 12rpx; margin-bottom: 16rpx; }
|
||||
.search-input { flex: 1; height: 64rpx; background: #FFF; border: 2rpx solid var(--color-border); border-radius: var(--radius-sm); padding: 0 16rpx; font-size: 24rpx; }
|
||||
.search-btn { height: 64rpx; padding: 0 24rpx; background: var(--color-primary); color: #FFF; border-radius: var(--radius-sm); font-size: 24rpx; border: none; }
|
||||
.user-row { background: #FFF; padding: 20rpx; border-radius: var(--radius-sm); margin-bottom: 8rpx; display: flex; flex-wrap: wrap; gap: 8rpx; }
|
||||
.user-phone { font-size: 24rpx; font-weight: 600; color: var(--color-text); }
|
||||
.user-name { font-size: 22rpx; color: var(--color-text-secondary); }
|
||||
.user-plan { font-size: 20rpx; background: #EEF2FF; color: var(--color-primary); padding: 2rpx 12rpx; border-radius: var(--radius-round); }
|
||||
.user-remaining { font-size: 20rpx; color: var(--color-text-tertiary); }
|
||||
.loading-text { text-align: center; padding: 40rpx; color: var(--color-text-tertiary); font-size: 24rpx; }
|
||||
.load-more { text-align: center; padding: 20rpx; color: var(--color-primary); font-size: 24rpx; display: block; }
|
||||
.iv-row { background: #FFF; padding: 20rpx; border-radius: var(--radius-sm); margin-bottom: 8rpx; display: flex; flex-wrap: wrap; gap: 8rpx; align-items: center; }
|
||||
.iv-pos { font-size: 24rpx; font-weight: 600; color: var(--color-text); }
|
||||
.iv-user { font-size: 22rpx; color: var(--color-text-secondary); }
|
||||
.iv-status { font-size: 20rpx; background: #FFF7ED; color: var(--color-warning); padding: 2rpx 12rpx; border-radius: var(--radius-round); }
|
||||
.iv-status.done { background: #ECFDF5; color: var(--color-success); }
|
||||
.iv-questions { font-size: 20rpx; color: var(--color-text-tertiary); }
|
||||
.section-label { font-size: 24rpx; font-weight: 600; color: var(--color-text); margin-bottom: 12rpx; margin-top: 12rpx; }
|
||||
.admin-row { background: #FFF; padding: 20rpx; border-radius: var(--radius-sm); margin-bottom: 8rpx; display: flex; flex-wrap: wrap; gap: 8rpx; align-items: center; }
|
||||
.admin-phone { font-size: 24rpx; font-weight: 600; color: var(--color-text); }
|
||||
.admin-name { font-size: 22rpx; color: var(--color-text-secondary); flex: 1; }
|
||||
.admin-set-btn { font-size: 22rpx; color: var(--color-primary); padding: 4rpx 16rpx; border: 2rpx solid var(--color-primary); border-radius: var(--radius-round); }
|
||||
.admin-set-btn.done { color: var(--color-success); border-color: var(--color-success); }
|
||||
.admin-badge { font-size: 18rpx; background: var(--color-primary); color: #FFF; padding: 2rpx 10rpx; border-radius: var(--radius-round); }
|
||||
.empty-text { text-align: center; padding: 20rpx; color: var(--color-text-tertiary); font-size: 22rpx; display: block; }
|
||||
.order-list { display: flex; flex-direction: column; gap: 8rpx; }
|
||||
.order-row { background: #FFF; border-radius: var(--radius-sm); padding: 16rpx; }
|
||||
.order-info { display: flex; justify-content: space-between; margin-bottom: 8rpx; }
|
||||
.order-id { font-size: 22rpx; color: var(--color-text); font-weight: 500; }
|
||||
.order-user { font-size: 20rpx; color: var(--color-text-tertiary); }
|
||||
.order-meta { display: flex; align-items: center; gap: 12rpx; }
|
||||
.order-amount { font-size: 28rpx; font-weight: 700; color: var(--color-primary); }
|
||||
.order-status { font-size: 20rpx; padding: 2rpx 12rpx; border-radius: var(--radius-round); }
|
||||
.order-status.paid { background: #ECFDF5; color: var(--color-success); }
|
||||
.order-status.refund { background: #FEF3C7; color: var(--color-warning); }
|
||||
.order-status.pend { background: #F3F4F6; color: var(--color-text-tertiary); }
|
||||
.order-time { font-size: 20rpx; color: var(--color-text-tertiary); flex: 1; text-align: right; }
|
||||
.order-actions { }
|
||||
.sync-btn { font-size: 20rpx; color: var(--color-primary); padding: 4rpx 12rpx; border: 2rpx solid var(--color-primary); border-radius: var(--radius-round); }
|
||||
.config-card { background: #FFF; border-radius: var(--radius-sm); padding: 20rpx; margin-bottom: 12rpx; }
|
||||
.cfg-title { font-size: 24rpx; font-weight: 600; color: var(--color-text); margin-bottom: 12rpx; }
|
||||
.cfg-row { display: flex; justify-content: space-between; padding: 8rpx 0; font-size: 22rpx; color: var(--color-text-secondary); }
|
||||
.cfg-val { font-weight: 600; color: var(--color-primary); }
|
||||
</style>
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="hero">
|
||||
<text class="hero-title">管理后台</text>
|
||||
<text class="hero-sub" v-if="!verified">使用管理员账号点击下方按钮验证</text>
|
||||
<text class="hero-sub" v-else>欢迎回来,{{ adminName }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 登录 -->
|
||||
<view class="login-area" v-if="!verified">
|
||||
<button class="btn-verify" @click="doVerify">验证管理员身份</button>
|
||||
</view>
|
||||
|
||||
<!-- 管理后台 -->
|
||||
<view class="body" v-if="verified">
|
||||
<view class="tabs">
|
||||
<text class="tab" :class="{ active: tab === 'overview' }" @click="switchTab('overview')">概览</text>
|
||||
<text class="tab" :class="{ active: tab === 'users' }" @click="switchTab('users')">用户管理</text>
|
||||
<text class="tab" :class="{ active: tab === 'interviews' }" @click="switchTab('interviews')">面试记录</text>
|
||||
<text class="tab" :class="{ active: tab === 'orders' }" @click="switchTab('orders')">订单</text>
|
||||
<text class="tab" :class="{ active: tab === 'admins' }" @click="switchTab('admins')">管理员</text>
|
||||
<text class="tab" :class="{ active: tab === 'config' }" @click="switchTab('config')">配置</text>
|
||||
</view>
|
||||
|
||||
<!-- 概览 -->
|
||||
<view v-if="tab === 'overview' && !loading" class="overview">
|
||||
<view class="stat-cards">
|
||||
<view class="stat-card">
|
||||
<text class="stat-num">{{ overview.userCount }}</text>
|
||||
<text class="stat-label">总用户</text>
|
||||
<text class="stat-sub">今日 +{{ overview.todayUsers }}</text>
|
||||
</view>
|
||||
<view class="stat-card">
|
||||
<text class="stat-num">{{ overview.interviewCount }}</text>
|
||||
<text class="stat-label">总面试</text>
|
||||
<text class="stat-sub">今日 +{{ overview.todayInterviews }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户 -->
|
||||
<view v-if="tab === 'users'" class="section">
|
||||
<view class="search-bar">
|
||||
<input v-model="userKeyword" placeholder="搜索手机号/昵称" class="search-input" @confirm="loadUsers" />
|
||||
<button class="search-btn" @click="loadUsers">搜索</button>
|
||||
</view>
|
||||
<view class="user-list" v-if="!usersLoading">
|
||||
<view class="user-row" v-for="u in users" :key="u._id">
|
||||
<text class="user-phone">{{ u.phone || '--' }}</text>
|
||||
<text class="user-name">{{ u.nickname || '--' }}</text>
|
||||
<text class="user-plan" :class="{ vip: u.plan === 'vip' }">{{ u.plan === 'vip' ? '会员' : '免费' }}</text>
|
||||
<text class="user-remaining">剩{{ u.remaining || 0 }}次</text>
|
||||
<text class="user-vip-btn" v-if="u.plan !== 'vip'" @click="setVip(u._id)">设为会员</text>
|
||||
</view>
|
||||
<text class="load-more" v-if="usersTotal > users.length" @click="loadMoreUsers">加载更多</text>
|
||||
</view>
|
||||
<text class="loading-text" v-if="usersLoading">加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 面试 -->
|
||||
<view v-if="tab === 'interviews'" class="section">
|
||||
<view class="iv-list" v-if="!ivLoading">
|
||||
<view class="iv-row" v-for="iv in interviews" :key="iv._id">
|
||||
<text class="iv-pos">{{ iv.position }}</text>
|
||||
<text class="iv-user">{{ iv.userId?.phone || iv.userId?.nickname || '--' }}</text>
|
||||
<text class="iv-status" :class="{ done: iv.status === 'completed' }">{{ iv.status === 'completed' ? '已完成' : '进行中' }}</text>
|
||||
<text class="iv-questions">{{ iv.questionCount || 0 }}题</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="loading-text" v-if="ivLoading">加载中...</text>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- 订单 -->
|
||||
<view v-if="tab === 'orders'" class="section">
|
||||
<view class="tabs in-tab">
|
||||
<text class="tab" :class="{ active: orderFilter === '' }" @click="orderFilter='';loadOrders()">全部</text>
|
||||
<text class="tab" :class="{ active: orderFilter === 'pending' }" @click="orderFilter='pending';loadOrders()">待支付</text>
|
||||
<text class="tab" :class="{ active: orderFilter === 'success' }" @click="orderFilter='success';loadOrders()">已支付</text>
|
||||
<text class="tab" :class="{ active: orderFilter === 'refunded' }" @click="orderFilter='refunded';loadOrders()">已退款</text>
|
||||
</view>
|
||||
<view class="order-list" v-if="!orderLoading">
|
||||
<view class="order-row" v-for="o in orders" :key="o._id">
|
||||
<view class="order-info">
|
||||
<text class="order-id">订单号: {{ o.outTradeNo }}</text>
|
||||
<text class="order-user">用户: {{ o.userPhone || o.userId.slice(-6) }}</text>
|
||||
</view>
|
||||
<view class="order-meta">
|
||||
<text class="order-amount">¥{{ (o.amount / 100).toFixed(1) }}</text>
|
||||
<view class="order-status" :class="o.status === 'success' ? 'paid' : o.status === 'refunded' ? 'refund' : 'pend'">
|
||||
{{ o.status === 'success' ? '已支付' : o.status === 'refunded' ? '已退款' : '待支付' }}
|
||||
</view>
|
||||
<text class="order-time">{{ o.createdAt ? o.createdAt.slice(0,16).replace('T',' ') : '--' }}</text>
|
||||
<view class="order-actions" v-if="o.status === 'pending'">
|
||||
<text class="sync-btn" @click="syncOrder(o.outTradeNo)">同步</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="load-more" v-if="ordersTotal > orders.length" @click="loadMoreOrders">加载更多</text>
|
||||
<text class="empty-text" v-if="orders.length === 0 && !orderLoading">暂无订单</text>
|
||||
</view>
|
||||
<text class="loading-text" v-if="orderLoading">加载中...</text>
|
||||
</view>
|
||||
<!-- 套餐配置 -->
|
||||
<view v-if="tab === 'config'" class="section">
|
||||
<view class="config-card" v-if="!cfgLoading">
|
||||
<view class="cfg-title">面试限制</view>
|
||||
<view class="cfg-row"><text>免费版每场最大轮次</text><text class="cfg-val">{{ memberConfig.interview.maxRoundsFree }}</text></view>
|
||||
<view class="cfg-row"><text>会员每场最大轮次</text><text class="cfg-val">{{ memberConfig.interview.maxRoundsVip }}</text></view>
|
||||
<view class="cfg-row"><text>免费版每日面试次数</text><text class="cfg-val">{{ memberConfig.interview.dailyFreeLimit }}</text></view>
|
||||
</view>
|
||||
<view class="config-card" v-if="!cfgLoading">
|
||||
<view class="cfg-title">诊断与优化限制</view>
|
||||
<view class="cfg-row"><text>免费版每日诊断次数</text><text class="cfg-val">{{ memberConfig.diagnosis.dailyFreeLimit }}</text></view>
|
||||
<view class="cfg-row"><text>免费版每日优化次数</text><text class="cfg-val">{{ memberConfig.optimize.dailyFreeLimit }}</text></view>
|
||||
</view>
|
||||
<view class="config-card" v-if="!cfgLoading">
|
||||
<view class="cfg-title">价格</view>
|
||||
<view class="cfg-row"><text>月度会员</text><text class="cfg-val">¥{{ (memberConfig.price.monthly / 100).toFixed(0) }}</text></view>
|
||||
</view>
|
||||
<view class="empty-text" v-if="cfgLoading">加载中...</view>
|
||||
</view>
|
||||
<!-- 管理员 -->
|
||||
<view v-if="tab === 'admins'" class="section">
|
||||
<view class="search-bar">
|
||||
<input v-model="adminKeyword" placeholder="搜索用户ID或手机号设为管理员" class="search-input" @confirm="searchAdmin" />
|
||||
<button class="search-btn" @click="searchAdmin">搜索</button>
|
||||
</view>
|
||||
<view class="section-label">当前管理员</view>
|
||||
<view class="user-list">
|
||||
<view class="admin-row" v-for="a in adminList" :key="a._id">
|
||||
<text class="admin-phone">{{ a.phone || '--' }}</text>
|
||||
<text class="admin-name">{{ a.nickname || '--' }}</text>
|
||||
<text class="admin-badge" v-if="a.isSystemAdmin">系统</text>
|
||||
</view>
|
||||
<text class="empty-text" v-if="adminList.length === 0">暂无管理员</text>
|
||||
</view>
|
||||
<view class="section-label" v-if="searchResult">搜索结果</view>
|
||||
<view class="user-list" v-if="searchResult">
|
||||
<view class="admin-row">
|
||||
<text class="admin-phone">{{ searchResult.phone || '--' }}</text>
|
||||
<text class="admin-name">{{ searchResult.nickname || '--' }}</text>
|
||||
<text class="admin-set-btn" v-if="searchResult.role !== 'admin'" @click="setAdmin(searchResult._id)">设为管理员</text>
|
||||
<text class="admin-set-btn done" v-else>已是管理员</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { api } from '../../config'
|
||||
|
||||
const verified = ref(false)
|
||||
const adminName = ref('')
|
||||
const tab = ref('overview')
|
||||
const loading = ref(false)
|
||||
const usersLoading = ref(false)
|
||||
const ivLoading = ref(false)
|
||||
const userKeyword = ref('')
|
||||
const usersPage = ref(1)
|
||||
|
||||
const overview = ref({ userCount: 0, interviewCount: 0, todayUsers: 0, todayInterviews: 0 })
|
||||
const users = ref([])
|
||||
const usersTotal = ref(0)
|
||||
const interviews = ref([])
|
||||
const adminKeyword = ref('')
|
||||
const adminList = ref([])
|
||||
const searchResult = ref(null)
|
||||
const memberConfig = ref({ interview: { maxRoundsFree: 5, maxRoundsVip: 10, dailyFreeLimit: 3 }, diagnosis: { dailyFreeLimit: 2 }, optimize: { dailyFreeLimit: 2 }, price: { monthly: 2900 } })
|
||||
const cfgLoading = ref(false)
|
||||
const orders = ref([])
|
||||
const ordersTotal = ref(0)
|
||||
const ordersPage = ref(1)
|
||||
const orderLoading = ref(false)
|
||||
const orderFilter = ref('')
|
||||
|
||||
const token = () => uni.getStorageSync('token') || ''
|
||||
|
||||
const apiAdmin = (path, opts = {}) => {
|
||||
return uni.request({
|
||||
url: api('/admin' + path),
|
||||
method: opts.method || 'GET',
|
||||
header: { 'Authorization': `Bearer ${token()}`, 'Content-Type': 'application/json', ...opts.headers },
|
||||
data: opts.body || opts.data,
|
||||
})
|
||||
}
|
||||
|
||||
const doVerify = async () => {
|
||||
const t = token()
|
||||
if (!t) { uni.navigateTo({ url: '/pages/login/login' }); return }
|
||||
try {
|
||||
const res = await apiAdmin('/check')
|
||||
if (res.statusCode === 200 && res.data?.isAdmin) {
|
||||
adminName.value = '管理员'
|
||||
verified.value = true
|
||||
loadOverview()
|
||||
} else throw new Error('无管理员权限')
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '当前账号非管理员,无权限访问', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
const loadOverview = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await apiAdmin('/overview')
|
||||
if (res.statusCode === 200) overview.value = res.data
|
||||
} catch (e) { console.error(e) }
|
||||
finally { loading.value = false }
|
||||
}
|
||||
|
||||
const switchTab = (t) => {
|
||||
tab.value = t
|
||||
if (t === 'users' && users.value.length === 0) loadUsers()
|
||||
if (t === 'interviews' && interviews.value.length === 0) loadInterviews()
|
||||
if (t === 'admins' && adminList.value.length === 0) loadAdmins()
|
||||
if (t === 'config') loadConfig()
|
||||
if (t === 'orders') loadOrders()
|
||||
}
|
||||
|
||||
const loadUsers = async () => {
|
||||
usersLoading.value = true
|
||||
usersPage.value = 1
|
||||
try {
|
||||
const res = await apiAdmin('/users?keyword=' + encodeURIComponent(userKeyword.value) + '&page=1&limit=20')
|
||||
if (res.statusCode === 200) { users.value = res.data.users || []; usersTotal.value = res.data.total || 0 }
|
||||
} catch (e) { console.error(e) }
|
||||
finally { usersLoading.value = false }
|
||||
}
|
||||
|
||||
const loadMoreUsers = async () => {
|
||||
usersPage.value++
|
||||
try {
|
||||
const res = await apiAdmin('/users?keyword=' + encodeURIComponent(userKeyword.value) + '&page=' + usersPage.value + '&limit=20')
|
||||
if (res.statusCode === 200) users.value = [...users.value, ...(res.data.users || [])]
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
const loadInterviews = async () => {
|
||||
ivLoading.value = true
|
||||
try {
|
||||
const res = await apiAdmin('/interviews?page=1&limit=20')
|
||||
if (res.statusCode === 200) interviews.value = res.data.interviews || []
|
||||
} catch (e) { console.error(e) }
|
||||
finally { ivLoading.value = false }
|
||||
}
|
||||
|
||||
const loadConfig = async () => {
|
||||
cfgLoading.value = true
|
||||
try {
|
||||
const res = await apiAdmin('/config')
|
||||
if (res.statusCode === 200) memberConfig.value = res.data
|
||||
} catch(e) { console.error(e) }
|
||||
finally { cfgLoading.value = false }
|
||||
}
|
||||
|
||||
const loadOrders = async () => {
|
||||
orderLoading.value = true
|
||||
ordersPage.value = 1
|
||||
try {
|
||||
let url = '/orders?page=1&limit=20'
|
||||
if (orderFilter.value) url += '&status=' + orderFilter.value
|
||||
const res = await apiAdmin(url)
|
||||
if (res.statusCode === 200) { orders.value = res.data.orders || []; ordersTotal.value = res.data.total || 0 }
|
||||
} catch(e) { console.error(e) }
|
||||
finally { orderLoading.value = false }
|
||||
}
|
||||
|
||||
const loadMoreOrders = async () => {
|
||||
ordersPage.value++
|
||||
let url = '/orders?page=' + ordersPage.value + '&limit=20'
|
||||
if (orderFilter.value) url += '&status=' + orderFilter.value
|
||||
try {
|
||||
const res = await apiAdmin(url)
|
||||
if (res.statusCode === 200) orders.value = [...orders.value, ...(res.data.orders || [])]
|
||||
} catch(e) { console.error(e) }
|
||||
}
|
||||
|
||||
const syncOrder = async (outTradeNo) => {
|
||||
uni.showToast({ title: '同步中...', icon: 'none' })
|
||||
try {
|
||||
const res = await apiAdmin('/order/sync', { method: 'POST', data: { outTradeNo } })
|
||||
if (res.statusCode === 200) {
|
||||
uni.showToast({ title: '同步完成', icon: 'success' })
|
||||
loadOrders()
|
||||
} else { uni.showToast({ title: '同步失败', icon: 'none' }) }
|
||||
} catch { uni.showToast({ title: '同步失败', icon: 'none' }) }
|
||||
}
|
||||
|
||||
const loadAdmins = async () => {
|
||||
try {
|
||||
const res = await apiAdmin('/admins')
|
||||
if (res.statusCode === 200) adminList.value = res.data.admins || []
|
||||
} catch(e) { console.error(e) }
|
||||
}
|
||||
|
||||
const searchAdmin = async () => {
|
||||
if (!adminKeyword.value.trim()) return
|
||||
try {
|
||||
const res = await apiAdmin('/users?keyword=' + encodeURIComponent(adminKeyword.value) + '&limit=1')
|
||||
if (res.statusCode === 200 && res.data.users?.length > 0) {
|
||||
searchResult.value = res.data.users[0]
|
||||
} else {
|
||||
uni.showToast({ title: '未找到该用户', icon: 'none' })
|
||||
searchResult.value = null
|
||||
}
|
||||
} catch { searchResult.value = null }
|
||||
}
|
||||
|
||||
const setAdmin = async (targetUserId) => {
|
||||
uni.showModal({
|
||||
title: '设为管理员', content: '确定将该用户设为管理员?', success: async (r) => {
|
||||
if (!r.confirm) return
|
||||
try {
|
||||
const res = await apiAdmin('/set-admin', { method: 'POST', data: { userId: targetUserId } })
|
||||
if (res.statusCode === 200) {
|
||||
uni.showToast({ title: '已设为管理员', icon: 'success' })
|
||||
searchResult.value = null
|
||||
adminKeyword.value = ''
|
||||
loadAdmins()
|
||||
} else throw new Error()
|
||||
} catch { uni.showToast({ title: '操作失败', icon: 'none' }) }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const setVip = async (targetUserId) => {
|
||||
uni.showModal({
|
||||
title: '设为会员', content: '确定将该用户升级为月度会员?', success: async (r) => {
|
||||
if (!r.confirm) return
|
||||
try {
|
||||
const res = await apiAdmin('/set-vip', { method: 'POST', data: { userId: targetUserId } })
|
||||
if (res.statusCode === 200) {
|
||||
uni.showToast({ title: '已设为会员', icon: 'success' })
|
||||
loadUsers()
|
||||
} else throw new Error()
|
||||
} catch { uni.showToast({ title: '操作失败', icon: 'none' }) }
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { background: var(--color-bg); min-height: 100vh; }
|
||||
.hero { background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-mid), var(--color-gradient-end)); padding: 48rpx 32rpx 72rpx; border-radius: 0 0 48rpx 48rpx; }
|
||||
.hero-title { font-size: 40rpx; font-weight: 700; color: #FFF; }
|
||||
.hero-sub { font-size: 22rpx; color: rgba(255,255,255,0.7); margin-top: 8rpx; display: block; }
|
||||
.login-area { padding: 32rpx; margin-top: -40rpx; display: flex; flex-direction: column; gap: 16rpx; }
|
||||
.admin-input { height: 72rpx; background: #FFF; border: 2rpx solid var(--color-border); border-radius: var(--radius-sm); padding: 0 20rpx; font-size: 24rpx; }
|
||||
.btn-verify { height: 72rpx; background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-mid)); color: #FFF; border-radius: var(--radius-sm); font-size: 26rpx; border: none; }
|
||||
.body { padding: 20rpx 32rpx 48rpx; margin-top: -40rpx; }
|
||||
.tabs { display: flex; gap: 8rpx; background: #FFF; border-radius: var(--radius-md); padding: 6rpx; margin-bottom: 20rpx; }
|
||||
.tab { flex: 1; text-align: center; padding: 14rpx; font-size: 24rpx; color: var(--color-text-secondary); border-radius: var(--radius-sm); }
|
||||
.tab.active { background: var(--color-primary); color: #FFF; font-weight: 600; }
|
||||
.stat-cards { display: flex; gap: 16rpx; }
|
||||
.stat-card { flex: 1; background: #FFF; border-radius: var(--radius-lg); padding: 28rpx; text-align: center; box-shadow: var(--shadow-sm); }
|
||||
.stat-num { font-size: 48rpx; font-weight: 800; color: var(--color-primary); display: block; }
|
||||
.stat-label { font-size: 22rpx; color: var(--color-text-secondary); margin-top: 8rpx; display: block; }
|
||||
.stat-sub { font-size: 20rpx; color: var(--color-success); margin-top: 4rpx; display: block; }
|
||||
.search-bar { display: flex; gap: 12rpx; margin-bottom: 16rpx; }
|
||||
.search-input { flex: 1; height: 64rpx; background: #FFF; border: 2rpx solid var(--color-border); border-radius: var(--radius-sm); padding: 0 16rpx; font-size: 24rpx; }
|
||||
.search-btn { height: 64rpx; padding: 0 24rpx; background: var(--color-primary); color: #FFF; border-radius: var(--radius-sm); font-size: 24rpx; border: none; }
|
||||
.user-row { background: #FFF; padding: 20rpx; border-radius: var(--radius-sm); margin-bottom: 8rpx; display: flex; flex-wrap: wrap; gap: 8rpx; }
|
||||
.user-phone { font-size: 24rpx; font-weight: 600; color: var(--color-text); }
|
||||
.user-name { font-size: 22rpx; color: var(--color-text-secondary); }
|
||||
.user-plan { font-size: 20rpx; background: #EEF2FF; color: var(--color-primary); padding: 2rpx 12rpx; border-radius: var(--radius-round); }
|
||||
.user-remaining { font-size: 20rpx; color: var(--color-text-tertiary); }
|
||||
.loading-text { text-align: center; padding: 40rpx; color: var(--color-text-tertiary); font-size: 24rpx; }
|
||||
.load-more { text-align: center; padding: 20rpx; color: var(--color-primary); font-size: 24rpx; display: block; }
|
||||
.iv-row { background: #FFF; padding: 20rpx; border-radius: var(--radius-sm); margin-bottom: 8rpx; display: flex; flex-wrap: wrap; gap: 8rpx; align-items: center; }
|
||||
.iv-pos { font-size: 24rpx; font-weight: 600; color: var(--color-text); }
|
||||
.iv-user { font-size: 22rpx; color: var(--color-text-secondary); }
|
||||
.iv-status { font-size: 20rpx; background: #FFF7ED; color: var(--color-warning); padding: 2rpx 12rpx; border-radius: var(--radius-round); }
|
||||
.iv-status.done { background: #ECFDF5; color: var(--color-success); }
|
||||
.iv-questions { font-size: 20rpx; color: var(--color-text-tertiary); }
|
||||
.section-label { font-size: 24rpx; font-weight: 600; color: var(--color-text); margin-bottom: 12rpx; margin-top: 12rpx; }
|
||||
.admin-row { background: #FFF; padding: 20rpx; border-radius: var(--radius-sm); margin-bottom: 8rpx; display: flex; flex-wrap: wrap; gap: 8rpx; align-items: center; }
|
||||
.admin-phone { font-size: 24rpx; font-weight: 600; color: var(--color-text); }
|
||||
.admin-name { font-size: 22rpx; color: var(--color-text-secondary); flex: 1; }
|
||||
.admin-set-btn { font-size: 22rpx; color: var(--color-primary); padding: 4rpx 16rpx; border: 2rpx solid var(--color-primary); border-radius: var(--radius-round); }
|
||||
.admin-set-btn.done { color: var(--color-success); border-color: var(--color-success); }
|
||||
.admin-badge { font-size: 18rpx; background: var(--color-primary); color: #FFF; padding: 2rpx 10rpx; border-radius: var(--radius-round); }
|
||||
.empty-text { text-align: center; padding: 20rpx; color: var(--color-text-tertiary); font-size: 22rpx; display: block; }
|
||||
.order-list { display: flex; flex-direction: column; gap: 8rpx; }
|
||||
.order-row { background: #FFF; border-radius: var(--radius-sm); padding: 16rpx; }
|
||||
.order-info { display: flex; justify-content: space-between; margin-bottom: 8rpx; }
|
||||
.order-id { font-size: 22rpx; color: var(--color-text); font-weight: 500; }
|
||||
.order-user { font-size: 20rpx; color: var(--color-text-tertiary); }
|
||||
.order-meta { display: flex; align-items: center; gap: 12rpx; }
|
||||
.order-amount { font-size: 28rpx; font-weight: 700; color: var(--color-primary); }
|
||||
.order-status { font-size: 20rpx; padding: 2rpx 12rpx; border-radius: var(--radius-round); }
|
||||
.order-status.paid { background: #ECFDF5; color: var(--color-success); }
|
||||
.order-status.refund { background: #FEF3C7; color: var(--color-warning); }
|
||||
.order-status.pend { background: #F3F4F6; color: var(--color-text-tertiary); }
|
||||
.order-time { font-size: 20rpx; color: var(--color-text-tertiary); flex: 1; text-align: right; }
|
||||
.order-actions { }
|
||||
.sync-btn { font-size: 20rpx; color: var(--color-primary); padding: 4rpx 12rpx; border: 2rpx solid var(--color-primary); border-radius: var(--radius-round); }
|
||||
.config-card { background: #FFF; border-radius: var(--radius-sm); padding: 20rpx; margin-bottom: 12rpx; }
|
||||
.cfg-title { font-size: 24rpx; font-weight: 600; color: var(--color-text); margin-bottom: 12rpx; }
|
||||
.cfg-row { display: flex; justify-content: space-between; padding: 8rpx 0; font-size: 22rpx; color: var(--color-text-secondary); }
|
||||
.cfg-val { font-weight: 600; color: var(--color-primary); }
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-bar">
|
||||
<input class="search-input" v-model="keyword" placeholder="搜索公司名称..." @confirm="searchCompany" />
|
||||
<button class="search-btn" @tap="searchCompany">搜索</button>
|
||||
</view>
|
||||
|
||||
<!-- 热门公司 -->
|
||||
<view class="section" v-if="!searching">
|
||||
<view class="section-title">热门公司题库</view>
|
||||
<view class="company-grid">
|
||||
<view
|
||||
class="company-card"
|
||||
v-for="c in hotCompanies"
|
||||
:key="c.name"
|
||||
@tap="selectCompany(c.name)"
|
||||
>
|
||||
<view class="company-name">{{ c.name }}</view>
|
||||
<view class="company-count">{{ c.positions }} 个岗位</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果:岗位列表 -->
|
||||
<view class="section" v-if="selectedCompany && !loadingPositions">
|
||||
<view class="section-title-row">
|
||||
<text class="section-title">{{ selectedCompany }} - 岗位列表</text>
|
||||
<text class="back-link" @tap="selectedCompany = ''">返回</text>
|
||||
</view>
|
||||
<view class="position-list">
|
||||
<view
|
||||
class="position-item"
|
||||
v-for="p in positions"
|
||||
:key="p.position"
|
||||
@tap="selectPosition(p.position)"
|
||||
>
|
||||
<view class="position-name">{{ p.position }}</view>
|
||||
<view class="position-meta">{{ p.questionCount }} 题 · {{ p.contributionCount }} 人贡献</view>
|
||||
</view>
|
||||
<view class="empty-state" v-if="positions.length === 0">
|
||||
<text>暂无该公司的面经数据</text>
|
||||
<text class="sub-text">成为第一个贡献者吧!</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 题目列表 -->
|
||||
<view class="section" v-if="selectedPosition && !loadingQuestions">
|
||||
<view class="section-title-row">
|
||||
<text class="section-title">{{ selectedCompany }} · {{ selectedPosition }}</text>
|
||||
<text class="back-link" @tap="selectedPosition = ''">返回</text>
|
||||
</view>
|
||||
<view class="question-list">
|
||||
<view class="question-item" v-for="(q, i) in questions" :key="i">
|
||||
<view class="q-header">
|
||||
<text class="q-num">#{{ i + 1 }}</text>
|
||||
<text class="q-tag">{{ q.type === 'technical' ? '技术' : '行为' }}</text>
|
||||
<text class="q-diff">{{ difficultyLabel(q.difficulty) }}</text>
|
||||
<text class="q-freq">{{ q.frequency }} 次提及</text>
|
||||
</view>
|
||||
<view class="q-content">{{ q.content }}</view>
|
||||
<view class="q-tags" v-if="q.tags && q.tags.length">
|
||||
<text class="tag" v-for="t in q.tags" :key="t">{{ t }}</text>
|
||||
</view>
|
||||
<view class="q-answer" v-if="q.referenceAnswer">
|
||||
<text class="answer-label">参考思路:</text>
|
||||
<text class="answer-text">{{ q.referenceAnswer }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="empty-state" v-if="questions.length === 0">
|
||||
<text>暂无题目数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载态 -->
|
||||
<view class="loading" v-if="loadingPositions || loadingQuestions">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { api } from '../../config'
|
||||
|
||||
const HOT_COMPANIES = [
|
||||
{ name: '腾讯', positions: 5 },
|
||||
{ name: '字节跳动', positions: 4 },
|
||||
{ name: '阿里巴巴', positions: 5 },
|
||||
{ name: '美团', positions: 3 },
|
||||
{ name: '百度', positions: 4 },
|
||||
{ name: '京东', positions: 3 },
|
||||
{ name: '网易', positions: 3 },
|
||||
{ name: '小红书', positions: 2 },
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
keyword: '',
|
||||
searching: false,
|
||||
hotCompanies: HOT_COMPANIES,
|
||||
selectedCompany: '',
|
||||
selectedPosition: '',
|
||||
positions: [],
|
||||
questions: [],
|
||||
loadingPositions: false,
|
||||
loadingQuestions: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
difficultyLabel(d) {
|
||||
const map = { junior: '简单', medium: '中等', senior: '困难' }
|
||||
return map[d] || d || '中等'
|
||||
},
|
||||
async searchCompany() {
|
||||
const kw = this.keyword.trim()
|
||||
if (!kw) return
|
||||
this.selectedCompany = kw
|
||||
this.selectedPosition = ''
|
||||
await this.loadPositions(kw)
|
||||
},
|
||||
async selectCompany(name) {
|
||||
this.selectedCompany = name
|
||||
this.keyword = name
|
||||
this.selectedPosition = ''
|
||||
await this.loadPositions(name)
|
||||
},
|
||||
async loadPositions(company) {
|
||||
this.loadingPositions = true
|
||||
const token = uni.getStorageSync('token') || ''
|
||||
const header = token ? { 'Authorization': `Bearer ${token}` } : {}
|
||||
try {
|
||||
const res = await uni.request({ url: api(`/contribution/company/${encodeURIComponent(company)}`), method: 'GET', header })
|
||||
this.positions = res.data || []
|
||||
} catch (e) {
|
||||
this.positions = []
|
||||
}
|
||||
this.loadingPositions = false
|
||||
},
|
||||
async selectPosition(position) {
|
||||
this.selectedPosition = position
|
||||
await this.loadQuestions(this.selectedCompany, position)
|
||||
},
|
||||
async loadQuestions(company, position) {
|
||||
this.loadingQuestions = true
|
||||
const token = uni.getStorageSync('token') || ''
|
||||
const header = token ? { 'Authorization': `Bearer ${token}` } : {}
|
||||
try {
|
||||
const res = await uni.request({
|
||||
url: api(`/contribution/company/${encodeURIComponent(company)}/position/${encodeURIComponent(position)}`),
|
||||
method: 'GET',
|
||||
header,
|
||||
})
|
||||
this.questions = res.data?.questions || []
|
||||
} catch (e) {
|
||||
this.questions = []
|
||||
}
|
||||
this.loadingQuestions = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { padding: 20rpx; min-height: 100vh; background: #f5f6f7; }
|
||||
.search-bar { display: flex; gap: 20rpx; margin-bottom: 30rpx; }
|
||||
.search-input { flex: 1; height: 80rpx; background: #fff; border-radius: 40rpx; padding: 0 30rpx; font-size: 28rpx; }
|
||||
.search-btn { height: 80rpx; line-height: 80rpx; padding: 0 40rpx; background: #4F46E5; color: #fff; border-radius: 40rpx; font-size: 28rpx; }
|
||||
.section { margin-bottom: 30rpx; background: #fff; border-radius: 16rpx; padding: 30rpx; }
|
||||
.section-title { font-size: 32rpx; font-weight: 600; margin-bottom: 20rpx; display: block; }
|
||||
.section-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20rpx; }
|
||||
.back-link { color: #4F46E5; font-size: 26rpx; }
|
||||
.company-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20rpx; }
|
||||
.company-card { background: #F3F0FF; border-radius: 12rpx; padding: 24rpx; text-align: center; }
|
||||
.company-name { font-size: 28rpx; font-weight: 500; color: #333; }
|
||||
.company-count { font-size: 22rpx; color: #999; margin-top: 8rpx; }
|
||||
.position-item { padding: 24rpx; border-bottom: 1rpx solid #f0f0f0; }
|
||||
.position-name { font-size: 28rpx; font-weight: 500; color: #333; }
|
||||
.position-meta { font-size: 24rpx; color: #999; margin-top: 8rpx; }
|
||||
.question-item { padding: 24rpx; border-bottom: 1rpx solid #f0f0f0; }
|
||||
.q-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 12rpx; }
|
||||
.q-num { font-size: 24rpx; color: #4F46E5; font-weight: 600; }
|
||||
.q-tag { font-size: 22rpx; background: #E8F5E9; color: #2E7D32; padding: 2rpx 12rpx; border-radius: 6rpx; }
|
||||
.q-diff { font-size: 22rpx; background: #FFF3E0; color: #E65100; padding: 2rpx 12rpx; border-radius: 6rpx; }
|
||||
.q-freq { font-size: 22rpx; color: #999; margin-left: auto; }
|
||||
.q-content { font-size: 28rpx; color: #333; line-height: 1.6; }
|
||||
.q-tags { display: flex; flex-wrap: wrap; gap: 8rpx; margin-top: 12rpx; }
|
||||
.tag { font-size: 22rpx; background: #F3F0FF; color: #4F46E5; padding: 4rpx 16rpx; border-radius: 20rpx; }
|
||||
.q-answer { margin-top: 16rpx; padding: 16rpx; background: #F8F9FA; border-radius: 8rpx; }
|
||||
.answer-label { font-size: 24rpx; color: #4F46E5; font-weight: 500; }
|
||||
.answer-text { font-size: 26rpx; color: #555; line-height: 1.6; }
|
||||
.empty-state { text-align: center; padding: 60rpx 0; color: #999; font-size: 28rpx; }
|
||||
.sub-text { display: block; margin-top: 12rpx; font-size: 24rpx; color: #bbb; }
|
||||
.loading { text-align: center; padding: 60rpx; color: #999; }
|
||||
</style>
|
||||
@@ -46,6 +46,22 @@
|
||||
<text class="fs-brief">分享经验 · 共建题库 · 帮更多人</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="feature-secondary">
|
||||
<view class="fs-card card" @click="goBank">
|
||||
<view class="fs-top">
|
||||
<view class="fs-icon fs-progress"><text class="fs-emoji">📚</text></view>
|
||||
<text class="fs-name">公司真题库</text>
|
||||
</view>
|
||||
<text class="fs-brief">大厂真题 · 岗位分类 · 参考思路</text>
|
||||
</view>
|
||||
<view class="fs-card card" @click="goInternship">
|
||||
<view class="fs-top">
|
||||
<view class="fs-icon fs-contribute"><text class="fs-emoji">🔍</text></view>
|
||||
<text class="fs-name">实习搜索</text>
|
||||
</view>
|
||||
<text class="fs-brief">热门实习 · 一键搜索 · 精准匹配</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -153,6 +169,8 @@ const goProfile = () => uni.switchTab({ url: '/pages/user/user' })
|
||||
const goInterview = () => uni.navigateTo({ url: '/pages/interview/interview' })
|
||||
const goProgress = () => uni.navigateTo({ url: '/pages/progress/progress' })
|
||||
const goContribute = () => uni.navigateTo({ url: '/pages/contribute/contribute' })
|
||||
const goBank = () => uni.navigateTo({ url: '/pages/company-bank/bank' })
|
||||
const goInternship = () => uni.navigateTo({ url: '/pages/internship/internship' })
|
||||
|
||||
const startInterview = (pos) => uni.navigateTo({ url: `/pages/interview/interview?position=${encodeURIComponent(pos.name)}` })
|
||||
</script>
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
|
||||
<!-- 验证码登录 -->
|
||||
<view v-else>
|
||||
<!-- 调试信息(发布前删掉) -->
|
||||
<view class="debug-info" v-if="true">debug: emailSent={{emailSent}} cooldown={{cooldown}}</view>
|
||||
<view class="field">
|
||||
<text class="field-label">邮箱</text>
|
||||
<view class="inline-row">
|
||||
|
||||
@@ -10,17 +10,13 @@
|
||||
|
||||
<view class="plans">
|
||||
<!-- 免费版 -->
|
||||
<view class="plan-card free" :class="{ active: isLoggedIn && plan === 'free' }">
|
||||
<view class="plan-card free" :class="{ active: plan === 'free' && isLoggedIn }">
|
||||
<view class="plan-header">
|
||||
<text class="plan-name">免费版</text>
|
||||
<view class="plan-price"><text class="price-num">免费</text></view>
|
||||
</view>
|
||||
<view class="plan-features">
|
||||
<text class="feat">✓ 每日 {{ limits.interview.dailyFreeLimit || 3 }} 次 AI 模拟面试</text>
|
||||
<text class="feat">✓ 每场最多 {{ limits.interview.maxRoundsFree || 5 }} 轮 AI 对话</text>
|
||||
<text class="feat">✓ 基础面试报告</text>
|
||||
<text class="feat">✓ 简历诊断</text>
|
||||
<text class="feat">✓ 简历优化</text>
|
||||
<text class="feat" v-for="f in freeFeatures" :key="f">✓ {{ f }}</text>
|
||||
</view>
|
||||
<view class="plan-status" v-if="isLoggedIn && plan === 'free'">当前使用</view>
|
||||
<view class="plan-status hint" v-else-if="!isLoggedIn">注册即用</view>
|
||||
@@ -31,47 +27,62 @@
|
||||
<view class="plan-badge">⭐ 推荐</view>
|
||||
<view class="plan-header">
|
||||
<text class="plan-name">成长版</text>
|
||||
<text class="plan-price"><text class="price-num">{{ priceText }}</text><text class="price-unit" v-if="plan !== 'growth' || !isLoggedIn">/月</text></text>
|
||||
<text class="plan-price"><text class="price-num">{{ growthPriceText }}</text><text class="price-unit">/月</text></text>
|
||||
</view>
|
||||
<view class="plan-features">
|
||||
<text class="feat">✓ 免费版全部权益</text>
|
||||
<text class="feat">✓ 无限面试次数</text>
|
||||
<text class="feat">✓ 每场最多 {{ limits.interview.maxRoundsVip || 10 }} 轮 AI 对话</text>
|
||||
<text class="feat">✓ 详细面试报告(四维评分)</text>
|
||||
<text class="feat">✓ 进步轨迹雷达图 + 打卡</text>
|
||||
<text class="feat">✓ 参考回答思路</text>
|
||||
<text class="feat">✓ 公司真题库</text>
|
||||
<text class="feat" v-for="f in growthFeatures" :key="f">✓ {{ f }}</text>
|
||||
</view>
|
||||
<view class="plan-action" v-if="!isLoggedIn" @click="goLogin">登录后开通</view>
|
||||
<view class="plan-action owned" v-else-if="plan === 'growth'">✅ 已开通</view>
|
||||
<view class="plan-action" v-else @click="startPay">{{ priceText }} 立即开通</view>
|
||||
<view class="plan-action owned" v-else-if="plan !== 'free'">✅ 已开通</view>
|
||||
<view class="plan-action" v-else @click="startPay('growth')">{{ growthPriceText }} 立即开通</view>
|
||||
</view>
|
||||
|
||||
<!-- 冲刺版 -->
|
||||
<view class="plan-card sprint" :class="{ active: plan === 'sprint' && isLoggedIn }">
|
||||
<view class="plan-badge sprint-badge">🚀 冲刺</view>
|
||||
<view class="plan-header">
|
||||
<text class="plan-name">冲刺版</text>
|
||||
<text class="plan-price"><text class="price-num price-sprint">¥49.9</text><text class="price-unit">/月</text></text>
|
||||
</view>
|
||||
<view class="plan-features">
|
||||
<text class="feat" v-for="f in sprintFeatures" :key="f">✓ {{ f }}</text>
|
||||
</view>
|
||||
<view class="plan-action" v-if="!isLoggedIn" @click="goLogin">登录后开通</view>
|
||||
<view class="plan-action owned" v-else-if="plan === 'sprint'">✅ 已开通</view>
|
||||
<view class="plan-action" v-else-if="plan === 'growth'" @click="startPay('sprint')">升级至冲刺版</view>
|
||||
<view class="plan-action" v-else @click="startPay('sprint')">¥49.9/月 立即开通</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 支付弹窗 -->
|
||||
<view class="modal-overlay" v-if="showPayModal" @click="showPayModal = false">
|
||||
<view class="modal-overlay" v-if="showPayModal" @click="cancelPay">
|
||||
<view class="modal-content" @click.stop>
|
||||
<!-- 二维码支付(H5) -->
|
||||
<template v-if="!isMp && payCodeUrl">
|
||||
<template v-if="payLoading">
|
||||
<text class="modal-title">正在创建支付...</text>
|
||||
</template>
|
||||
<template v-else-if="!isMp && payCodeUrl">
|
||||
<text class="modal-title">微信扫码支付</text>
|
||||
<canvas canvas-id="payQrcode" class="qr-canvas"></canvas>
|
||||
<text class="modal-hint">请用微信扫码完成支付</text>
|
||||
<text class="modal-close" @click="showPayModal = false">取消支付</text>
|
||||
<text class="modal-hint">支付成功后将自动跳转</text>
|
||||
<text class="modal-close" @click="cancelPay">取消支付</text>
|
||||
</template>
|
||||
<!-- JSAPI 支付(小程序) -->
|
||||
<template v-if="isMp">
|
||||
<template v-else-if="isMp && !payLoading">
|
||||
<text class="modal-title">微信支付</text>
|
||||
<text class="modal-hint">即将调起微信支付...</text>
|
||||
</template>
|
||||
<!-- 加载中 -->
|
||||
<text class="modal-title" v-if="!payCodeUrl && !isMp">正在创建支付...</text>
|
||||
<template v-if="payError">
|
||||
<text class="modal-title pay-error">支付异常</text>
|
||||
<text class="modal-hint">{{ payError }}</text>
|
||||
<text class="modal-close" @click="cancelPay">关闭</text>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 成功提示 -->
|
||||
<!-- 支付中提示 -->
|
||||
<view class="pay-success" v-if="paySuccess">
|
||||
<text class="success-icon">🎉</text>
|
||||
<text class="success-text">开通成功!成长版已生效</text>
|
||||
<text class="success-text">开通成功!{{ payingPlanName }}已生效</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -88,13 +99,21 @@ const currentPlanName = ref('免费版')
|
||||
const paySuccess = ref(false)
|
||||
const showPayModal = ref(false)
|
||||
const payCodeUrl = ref('')
|
||||
const priceText = ref('¥19.9')
|
||||
const limits = ref({
|
||||
interview: { dailyFreeLimit: 3, maxRoundsFree: 5, maxRoundsVip: 10 },
|
||||
diagnosis: { dailyFreeLimit: 2 },
|
||||
optimize: { dailyFreeLimit: 2 },
|
||||
price: { monthly: 1990 },
|
||||
})
|
||||
const payLoading = ref(false)
|
||||
const payError = ref('')
|
||||
const payingPlanName = ref('')
|
||||
const payingPlan = ref('')
|
||||
const growthPriceText = ref('¥19.9')
|
||||
const currentOutTradeNo = ref('')
|
||||
const freeFeatures = ['每日 2 次 AI 模拟面试', '基础面试报告', '通用题库随机出题', '简历诊断(限 3 次)']
|
||||
const growthFeatures = [
|
||||
'免费版全部权益', '无限面试次数', '详细面试报告(四维评分)',
|
||||
'进步轨迹雷达图 + 打卡', '每日一题推送', '参考回答思路', '公司真题库',
|
||||
]
|
||||
const sprintFeatures = [
|
||||
'成长版全部权益', 'AI 语音分析(语气词/语速检测)', '技能缺口分析报告',
|
||||
'学习路径推荐', '真人导师 1v1 点评(每月 1 次)', '简历精修(每月 1 次)', '内推优先',
|
||||
]
|
||||
|
||||
const token = () => uni.getStorageSync('token') || ''
|
||||
|
||||
@@ -117,58 +136,88 @@ onMounted(async () => {
|
||||
plan.value = d.plan || 'free'
|
||||
currentPlanName.value = d.planName || '免费版'
|
||||
}
|
||||
if (lres.statusCode === 200 && lres.data) {
|
||||
const d = lres.data
|
||||
if (d.interview) limits.value.interview = d.interview
|
||||
if (d.diagnosis) limits.value.diagnosis = d.diagnosis
|
||||
if (d.optimize) limits.value.optimize = d.optimize
|
||||
if (d.price) {
|
||||
limits.value.price = d.price
|
||||
priceText.value = `¥${(d.price.monthly / 100).toFixed(1)}`
|
||||
}
|
||||
if (lres.statusCode === 200 && lres.data?.price) {
|
||||
const p = lres.data.price
|
||||
growthPriceText.value = `¥${(p.monthly / 100).toFixed(1)}`
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
})
|
||||
|
||||
const goLogin = () => uni.navigateTo({ url: '/pages/login/login' })
|
||||
|
||||
const cancelPay = () => {
|
||||
showPayModal.value = false
|
||||
payCodeUrl.value = ''
|
||||
payLoading.value = false
|
||||
payError.value = ''
|
||||
}
|
||||
|
||||
/** 创建支付订单 */
|
||||
const startPay = async () => {
|
||||
const startPay = async (selectedPlan) => {
|
||||
const t = token()
|
||||
if (!t) { uni.showToast({ title: '请先登录', icon: 'none' }); return }
|
||||
showPayModal.value = true
|
||||
|
||||
try {
|
||||
if (isMp.value) {
|
||||
// 小程序:JSAPI 支付
|
||||
payingPlan.value = selectedPlan
|
||||
// #ifdef MP-WEIXIN
|
||||
payingPlanName.value = selectedPlan === 'sprint' ? '冲刺版' : '成长版'
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
payingPlanName.value = selectedPlan === 'sprint' ? '冲刺版' : '成长版'
|
||||
// #endif
|
||||
|
||||
showPayModal.value = true
|
||||
payLoading.value = true
|
||||
payError.value = ''
|
||||
|
||||
const planLabel = selectedPlan || 'growth'
|
||||
|
||||
if (isMp.value) {
|
||||
// 小程序:JSAPI 支付
|
||||
try {
|
||||
const res = await uni.request({
|
||||
url: api('/payment/jsapi'), method: 'POST',
|
||||
data: { plan: planLabel },
|
||||
header: { 'Authorization': `Bearer ${t}`, 'Content-Type': 'application/json' },
|
||||
})
|
||||
payLoading.value = false
|
||||
|
||||
if (res.statusCode === 200 && res.data?.payParams) {
|
||||
const pp = res.data.payParams
|
||||
currentOutTradeNo.value = res.data.outTradeNo || ''
|
||||
// 调起微信支付
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: pp.timeStamp,
|
||||
nonceStr: pp.nonceStr,
|
||||
package: pp.package,
|
||||
signType: pp.signType,
|
||||
signType: pp.signType || 'RSA',
|
||||
paySign: pp.paySign,
|
||||
success: () => checkPayResult(),
|
||||
fail: () => { showPayModal.value = false; uni.showToast({ title: '支付取消', icon: 'none' }) },
|
||||
success: () => pollPayResult(res.data.prepayId, planLabel),
|
||||
fail: (err) => { payError.value = '支付取消或失败'; uni.showToast({ title: '支付取消', icon: 'none' }) },
|
||||
})
|
||||
} else {
|
||||
showPayModal.value = false
|
||||
payLoading.value = false
|
||||
payError.value = res.data?.message || '创建订单失败'
|
||||
uni.showToast({ title: '创建订单失败', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
// H5:Native 二维码支付
|
||||
} catch (e) {
|
||||
payLoading.value = false
|
||||
payError.value = '网络错误,请重试'
|
||||
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
// H5:二维码支付
|
||||
try {
|
||||
const res = await uni.request({
|
||||
url: api('/payment/create'), method: 'POST',
|
||||
data: { plan: planLabel },
|
||||
header: { 'Authorization': `Bearer ${t}`, 'Content-Type': 'application/json' },
|
||||
})
|
||||
payLoading.value = false
|
||||
|
||||
if (res.statusCode === 200 && res.data?.codeUrl) {
|
||||
payCodeUrl.value = res.data.codeUrl
|
||||
currentOutTradeNo.value = res.data.outTradeNo
|
||||
nextTick(() => {
|
||||
try {
|
||||
const ctx = uni.createCanvasContext('payQrcode')
|
||||
@@ -182,35 +231,71 @@ const startPay = async () => {
|
||||
uqrcode.drawCanvas(ctx)
|
||||
} catch(e) { console.error('二维码生成失败', e) }
|
||||
})
|
||||
// 轮询支付结果
|
||||
pollPayResult(res.data.outTradeNo, planLabel)
|
||||
} else {
|
||||
showPayModal.value = false
|
||||
payError.value = res.data?.message || '支付服务暂不可用'
|
||||
uni.showToast({ title: '支付服务暂不可用', icon: 'none' })
|
||||
}
|
||||
} catch (e) {
|
||||
payLoading.value = false
|
||||
payError.value = '网络错误,请重试'
|
||||
uni.showToast({ title: '网络错误', icon: 'none' })
|
||||
}
|
||||
} catch (e) {
|
||||
showPayModal.value = false
|
||||
uni.showToast({ title: '支付服务暂不可用', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
/** 支付成功后查询并更新状态 */
|
||||
const checkPayResult = async () => {
|
||||
uni.showLoading({ title: '查询支付结果...' })
|
||||
/** 轮询订单状态 */
|
||||
const pollPayResult = async (outTradeNo, selectedPlan) => {
|
||||
if (!outTradeNo) return
|
||||
const maxAttempts = 30
|
||||
let attempts = 0
|
||||
|
||||
const poll = async () => {
|
||||
attempts++
|
||||
try {
|
||||
const res = await uni.request({
|
||||
url: api(`/payment/check/${outTradeNo}`), method: 'GET',
|
||||
header: { 'Authorization': `Bearer ${token()}` },
|
||||
})
|
||||
if (res.statusCode === 200 && res.data?.status === 'success') {
|
||||
// 支付成功,激活套餐
|
||||
await activatePlan(outTradeNo, selectedPlan)
|
||||
return
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
|
||||
if (attempts < maxAttempts) {
|
||||
setTimeout(poll, 2000)
|
||||
} else {
|
||||
payError.value = '支付结果查询超时,请联系客服'
|
||||
uni.showToast({ title: '支付查询超时', icon: 'none' })
|
||||
}
|
||||
}
|
||||
setTimeout(poll, 2000)
|
||||
}
|
||||
|
||||
/** 激活套餐 */
|
||||
const activatePlan = async (outTradeNo, selectedPlan) => {
|
||||
try {
|
||||
await new Promise(r => setTimeout(r, 2000))
|
||||
const res = await uni.request({ url: api('/member/pay'), method: 'POST', header: { 'Authorization': `Bearer ${token()}`, 'Content-Type': 'application/json' } })
|
||||
const res = await uni.request({
|
||||
url: api('/payment/activate'), method: 'POST',
|
||||
data: { outTradeNo },
|
||||
header: { 'Authorization': `Bearer ${token()}`, 'Content-Type': 'application/json' },
|
||||
})
|
||||
if (res.statusCode === 200 && res.data?.success) {
|
||||
paySuccess.value = true
|
||||
showPayModal.value = false
|
||||
plan.value = 'growth'
|
||||
currentPlanName.value = '成长版'
|
||||
uni.hideLoading()
|
||||
plan.value = selectedPlan === 'sprint' ? 'sprint' : 'growth'
|
||||
currentPlanName.value = selectedPlan === 'sprint' ? '冲刺版' : '成长版'
|
||||
uni.showToast({ title: '🎉 开通成功!', icon: 'success' })
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '支付未完成,请稍后重试', icon: 'none' })
|
||||
uni.showToast({ title: res.data?.message || '激活失败', icon: 'none' })
|
||||
}
|
||||
} catch { uni.hideLoading(); uni.showToast({ title: '查询失败', icon: 'none' }) }
|
||||
} catch (e) {
|
||||
payError.value = '激活失败,请联系客服'
|
||||
uni.showToast({ title: '激活失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -222,12 +307,15 @@ const checkPayResult = async () => {
|
||||
.plans { padding: 0 32rpx; margin-top: -40rpx; display: flex; flex-direction: column; gap: 24rpx; }
|
||||
.plan-card { background: #FFFFFF; border-radius: var(--radius-xl); padding: 32rpx; box-shadow: var(--shadow-sm); position: relative; }
|
||||
.plan-card.growth { border: 2rpx solid var(--color-primary); }
|
||||
.plan-card.sprint { border: 2rpx solid #F59E0B; }
|
||||
.plan-card.active { border-color: var(--color-primary); }
|
||||
.plan-badge { position: absolute; top: -12rpx; right: 24rpx; background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-mid)); color: #FFF; font-size: 20rpx; padding: 4rpx 20rpx; border-radius: var(--radius-round); font-weight: 600; }
|
||||
.sprint-badge { background: linear-gradient(135deg, #F59E0B, #F97316); }
|
||||
.plan-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20rpx; }
|
||||
.plan-name { font-size: 30rpx; font-weight: 700; color: var(--color-text); }
|
||||
.price-num { font-size: 44rpx; font-weight: 800; color: var(--color-primary); }
|
||||
.price-unit { font-size: 22rpx; color: var(--color-text-tertiary); }
|
||||
.price-sprint { color: #D97706; }
|
||||
.plan-features { display: flex; flex-direction: column; gap: 10rpx; margin-bottom: 24rpx; }
|
||||
.feat { font-size: 24rpx; color: var(--color-text-secondary); }
|
||||
.plan-status { text-align: center; background: #F3F4F6; padding: 14rpx; border-radius: var(--radius-sm); font-size: 24rpx; color: var(--color-text-secondary); }
|
||||
@@ -242,7 +330,8 @@ const checkPayResult = async () => {
|
||||
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
|
||||
.modal-content { background: #FFF; border-radius: var(--radius-xl); padding: 40rpx; width: 70%; display: flex; flex-direction: column; align-items: center; gap: 20rpx; }
|
||||
.modal-title { font-size: 28rpx; font-weight: 600; color: var(--color-text); }
|
||||
.pay-error { color: var(--color-error); }
|
||||
.qr-canvas { width: 400rpx; height: 400rpx; background: #FFF; border-radius: var(--radius-md); }
|
||||
.modal-hint { font-size: 22rpx; color: var(--color-text-tertiary); }
|
||||
.modal-close { font-size: 22rpx; color: var(--color-text-tertiary); padding: 8rpx; }
|
||||
</style>
|
||||
</style>
|
||||
@@ -48,6 +48,38 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 技能缺口分析 -->
|
||||
<view class="section" v-if="skillsGap">
|
||||
<view class="section-header">
|
||||
<text class="section-title">技能缺口</text>
|
||||
<text class="section-desc">{{ skillsGap.assessment }}</text>
|
||||
</view>
|
||||
<view class="gap-card card">
|
||||
<view class="gap-item" v-for="g in skillsGap.gaps" :key="g.dimension">
|
||||
<view class="gap-header">
|
||||
<text class="gap-name">{{ g.dimension }}</text>
|
||||
<text class="gap-badge" :class="g.level === '严重不足' ? 'badge-danger' : g.level === '需提升' ? 'badge-warn' : 'badge-ok'">{{ g.level }}</text>
|
||||
</view>
|
||||
<view class="gap-bar-bg">
|
||||
<view class="gap-bar-fill" :style="{ width: (g.currentScore / g.targetScore * 100) + '%' }"></view>
|
||||
<view class="gap-target" :style="{ left: '100%' }">▎</view>
|
||||
</view>
|
||||
<view class="gap-info">
|
||||
<text class="gap-score">当前 {{ g.currentScore }}分</text>
|
||||
<text class="gap-target-text">目标 {{ g.targetScore }}分</text>
|
||||
<text class="gap-diff" v-if="g.gap > 0">差 {{ g.gap }}分</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="gap-suggestions" v-if="skillsGap.suggestions.length">
|
||||
<text class="gap-suggest-title">提升建议</text>
|
||||
<view class="suggest-item" v-for="s in skillsGap.suggestions" :key="s.dimension">
|
||||
<text class="suggest-dim">{{ s.dimension }}:</text>
|
||||
<text class="suggest-tip">{{ s.tip }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 打卡日历 -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
@@ -106,6 +138,7 @@ import { api } from '../../config'
|
||||
|
||||
const stats = ref({ completedInterviews: 0, avgScore: 0, streak: 0 })
|
||||
const progress = ref({ dimensions: {}, interviews: [], recentScores: [] })
|
||||
const skillsGap = ref(null)
|
||||
const dimensions = ref([
|
||||
{ key: 'logic', label: '逻辑思维', value: 0, color: 'linear-gradient(90deg, #6366F1, #818CF8)' },
|
||||
{ key: 'expression', label: '表达能力', value: 0, color: 'linear-gradient(90deg, #10B981, #34D399)' },
|
||||
@@ -138,6 +171,15 @@ onMounted(async () => {
|
||||
}
|
||||
} catch (e) { console.error(e) }
|
||||
|
||||
try {
|
||||
const gapRes = await uni.request({
|
||||
url: api('/analyze/skills-gap'), method: 'POST',
|
||||
header: { 'Authorization': `Bearer ${t}`, 'Content-Type': 'application/json' },
|
||||
data: {},
|
||||
})
|
||||
if (gapRes.statusCode === 200) skillsGap.value = gapRes.data
|
||||
} catch (e) { /* skills gap not available */ }
|
||||
|
||||
try {
|
||||
// Load stats
|
||||
const sres = await uni.request({
|
||||
@@ -173,7 +215,7 @@ const formatDate = (d) => {
|
||||
return `${date.getMonth() + 1}/${date.getDate()} ${date.getHours()}:${String(date.getMinutes()).padStart(2, '0')}`
|
||||
}
|
||||
const scoreClass = (s) => s >= 80 ? 'score-high' : s >= 60 ? 'score-mid' : 'score-low'
|
||||
const viewReport = (id) => uni.navigateTo({ url: `/pages/report/report?id=${id}` })
|
||||
const viewReport = (id) => uni.navigateTo({ url: `/pages/report/report?interviewId=${id}` })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -208,6 +250,24 @@ const viewReport = (id) => uni.navigateTo({ url: `/pages/report/report?id=${id}`
|
||||
.dim-bar-bg { height: 16rpx; background: #F3F4F6; border-radius: 8rpx; overflow: hidden; }
|
||||
.dim-bar-fill { height: 100%; border-radius: 8rpx; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
|
||||
|
||||
.gap-card { padding: 32rpx; border-radius: var(--radius-xl); }
|
||||
.gap-item { margin-bottom: 24rpx; }
|
||||
.gap-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8rpx; }
|
||||
.gap-name { font-size: 24rpx; font-weight: 600; color: var(--color-text); }
|
||||
.gap-badge { font-size: 20rpx; font-weight: 600; padding: 2rpx 12rpx; border-radius: 20rpx; }
|
||||
.badge-danger { background: #FEE2E2; color: #DC2626; }
|
||||
.badge-warn { background: #FEF3C7; color: #D97706; }
|
||||
.badge-ok { background: #D1FAE5; color: #059669; }
|
||||
.gap-bar-bg { height: 20rpx; background: #F3F4F6; border-radius: 10rpx; position: relative; overflow: visible; }
|
||||
.gap-bar-fill { height: 100%; border-radius: 10rpx; background: linear-gradient(90deg, #EF4444, #F59E0B, #10B981); transition: width 0.8s ease; }
|
||||
.gap-target { position: absolute; top: -4rpx; font-size: 28rpx; color: #6366F1; }
|
||||
.gap-info { display: flex; gap: 16rpx; margin-top: 6rpx; font-size: 20rpx; color: var(--color-text-tertiary); }
|
||||
.gap-diff { color: #EF4444; font-weight: 600; }
|
||||
.gap-suggestions { margin-top: 24rpx; padding-top: 20rpx; border-top: 1rpx solid var(--color-border); }
|
||||
.gap-suggest-title { font-size: 24rpx; font-weight: 700; color: var(--color-text); margin-bottom: 12rpx; display: block; }
|
||||
.suggest-item { font-size: 22rpx; color: var(--color-text-secondary); line-height: 1.6; margin-bottom: 8rpx; }
|
||||
.suggest-dim { font-weight: 600; color: var(--color-primary); }
|
||||
|
||||
.streak-card { padding: 24rpx; border-radius: var(--radius-xl); }
|
||||
.streak-grid { display: flex; justify-content: space-around; }
|
||||
.streak-day { display: flex; flex-direction: column; align-items: center; gap: 6rpx; }
|
||||
|
||||
@@ -159,7 +159,7 @@ async function saveResult() {
|
||||
targetPosition: position.value,
|
||||
type: isOptimize.value ? 'optimize' : 'diagnosis',
|
||||
};
|
||||
const res = await api.resume.create(payload);
|
||||
const res = await api.resume.create(payload.title, payload.originalContent, payload.targetPosition);
|
||||
resultId.value = res._id || res.id;
|
||||
saved.value = true;
|
||||
uni.showToast({ title: '保存成功', icon: 'success' });
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { api } from '../../config'
|
||||
|
||||
@@ -206,9 +206,11 @@ const selectResume = (r) => {
|
||||
const submitDiagnose = async () => {
|
||||
const content = getContent()
|
||||
if (!content) { uni.showToast({ title: '请先输入简历内容', icon: 'none' }); return }
|
||||
const token = uni.getStorageSync('token')
|
||||
if (!token) { uni.showToast({ title: '请先登录', icon: 'none' }); return }
|
||||
analyzing.value = true; result.value = null
|
||||
try {
|
||||
const res = await uni.request({ url: api('/analyze/diagnosis'), method: 'POST', header: { 'Content-Type': 'application/json' }, data: { content } })
|
||||
const res = await uni.request({ url: api('/analyze/diagnosis'), method: 'POST', header: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }, data: { content } })
|
||||
if (res.statusCode === 200) { result.value = res.data; resultType.value = 'diagnosis' }
|
||||
} catch { uni.showToast({ title: '诊断失败', icon: 'none' }) }
|
||||
finally { analyzing.value = false }
|
||||
@@ -217,10 +219,12 @@ const submitDiagnose = async () => {
|
||||
const submitOptimize = async () => {
|
||||
const content = getContent()
|
||||
if (!content) { uni.showToast({ title: '请先输入简历内容', icon: 'none' }); return }
|
||||
const token = uni.getStorageSync('token')
|
||||
if (!token) { uni.showToast({ title: '请先登录', icon: 'none' }); return }
|
||||
analyzing.value = true; result.value = null
|
||||
try {
|
||||
const direction = targetPosition.value || '通用岗位'
|
||||
const res = await uni.request({ url: api('/analyze/optimize'), method: 'POST', header: { 'Content-Type': 'application/json' }, data: { content, direction } })
|
||||
const res = await uni.request({ url: api('/analyze/optimize'), method: 'POST', header: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }, data: { content, direction } })
|
||||
if (res.statusCode === 200) { result.value = res.data; resultType.value = 'optimize' }
|
||||
} catch { uni.showToast({ title: '优化失败', icon: 'none' }) }
|
||||
finally { analyzing.value = false }
|
||||
|
||||
+178
-178
@@ -1,178 +1,178 @@
|
||||
<template>
|
||||
<view class="page fade-in">
|
||||
<!-- 个人中心 -->
|
||||
<view class="header" v-if="isLoggedIn">
|
||||
<view class="profile-section">
|
||||
<image class="avatar" :src="userInfo.avatar || '/static/avatar-default.svg'" mode="aspectFill" />
|
||||
<view class="profile-info">
|
||||
<text class="nickname">{{ userInfo.nickname || '未设置昵称' }}</text>
|
||||
<view class="plan-badge">{{ userInfo.plan || '免费版' }}</view>
|
||||
</view>
|
||||
<text class="header-arrow">›</text>
|
||||
</view>
|
||||
<view class="stats-bar">
|
||||
<view class="stat">
|
||||
<text class="stat-num">{{ stats.interviewCount || 0 }}</text>
|
||||
<text class="stat-label">模拟面试</text>
|
||||
</view>
|
||||
<view class="stat-divider"></view>
|
||||
<view class="stat">
|
||||
<text class="stat-num">{{ stats.avgScore || '--' }}</text>
|
||||
<text class="stat-label">平均得分</text>
|
||||
</view>
|
||||
<view class="stat-divider"></view>
|
||||
<view class="stat">
|
||||
<text class="stat-num">{{ stats.completedCount || 0 }}</text>
|
||||
<text class="stat-label">已完成</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="header header-guest" v-else @click="goLogin">
|
||||
<view class="guest-box">
|
||||
<view class="guest-avatar"><text class="guest-icon">👤</text></view>
|
||||
<view class="guest-info">
|
||||
<text class="guest-name">未登录 / 点击登录</text>
|
||||
<text class="guest-hint">登录后体验全部功能</text>
|
||||
</view>
|
||||
<text class="header-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 菜单列表 -->
|
||||
<view class="menu-area">
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="requireLogin(goHistory, '面试记录')">
|
||||
<view class="menu-icon-wrap wrap-blue"><text class="menu-icon">📋</text></view>
|
||||
<text class="menu-text">面试记录</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" @click="goVip">
|
||||
<view class="menu-icon-wrap wrap-purple"><text class="menu-icon">💎</text></view>
|
||||
<text class="menu-text">会员中心</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" @click="requireLogin(goResume, '我的简历')">
|
||||
<view class="menu-icon-wrap wrap-green"><text class="menu-icon">📄</text></view>
|
||||
<text class="menu-text">我的简历</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="goAbout">
|
||||
<view class="menu-icon-wrap wrap-gray"><text class="menu-icon">ℹ️</text></view>
|
||||
<text class="menu-text">关于</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" v-if="isAdmin" @click="goAdmin">
|
||||
<view class="menu-icon-wrap wrap-gray"><text class="menu-icon">⚙️</text></view>
|
||||
<text class="menu-text">管理后台</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout-wrap" v-if="isLoggedIn">
|
||||
<button class="logout-btn" @click="doLogout">退出登录</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { api } from '../../config'
|
||||
|
||||
const userInfo = ref({})
|
||||
const isAdmin = ref(false)
|
||||
const stats = ref({ interviewCount: 0, avgScore: '--', completedCount: 0 })
|
||||
const token = ref('')
|
||||
|
||||
const isLoggedIn = computed(() => !!token.value)
|
||||
|
||||
onMounted(() => {
|
||||
token.value = uni.getStorageSync('token') || ''
|
||||
if (!token.value) return
|
||||
try { const s = uni.getStorageSync('userInfo'); if (s) userInfo.value = JSON.parse(s) } catch(e) {}
|
||||
loadStats()
|
||||
checkAdmin()
|
||||
})
|
||||
|
||||
const loadStats = async () => {
|
||||
try {
|
||||
const res = await uni.request({ url: api('/interview/stats/mine'), method: 'GET', header: { 'Authorization': `Bearer ${token.value}` } })
|
||||
if (res.statusCode === 200) stats.value = res.data
|
||||
} catch(e) { console.error(e) }
|
||||
}
|
||||
|
||||
const requireLogin = (action, name) => {
|
||||
if (isLoggedIn.value) { action(); return }
|
||||
uni.showModal({
|
||||
title: '请先登录',
|
||||
content: `需要登录后才能使用${name}功能`,
|
||||
confirmText: '去登录',
|
||||
success: (r) => { if (r.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
|
||||
})
|
||||
}
|
||||
|
||||
const checkAdmin = () => {
|
||||
isAdmin.value = userInfo.value.role === 'admin'
|
||||
}
|
||||
|
||||
const goLogin = () => uni.navigateTo({ url: '/pages/login/login' })
|
||||
const goHistory = () => uni.switchTab({ url: '/pages/history/history' })
|
||||
const goVip = () => uni.navigateTo({ url: '/pages/member/member' })
|
||||
const goResume = () => uni.navigateTo({ url: '/pages/resume/resume' })
|
||||
const goAdmin = () => uni.navigateTo({ url: '/pages/admin/admin' })
|
||||
const goAbout = () => uni.navigateTo({ url: '/pages/about/about' })
|
||||
|
||||
const doLogout = () => {
|
||||
uni.showModal({
|
||||
title: '退出登录', content: '确定要退出登录吗?',
|
||||
success: (r) => { if (r.confirm) { uni.removeStorageSync('token'); uni.removeStorageSync('userInfo'); token.value = '' } }
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { height: 100%; overflow-y: auto; background: var(--color-bg); }
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, var(--color-gradient-start) 0%, var(--color-gradient-mid) 50%, var(--color-gradient-end) 100%);
|
||||
padding: 48rpx 32rpx 72rpx; border-radius: 0 0 48rpx 48rpx; min-height: 90rpx;
|
||||
}
|
||||
.profile-section { display: flex; align-items: center; margin-bottom: 36rpx; }
|
||||
.avatar { width: 104rpx; height: 104rpx; border-radius: 50%; margin-right: 24rpx; border: 3rpx solid rgba(255,255,255,0.4); flex-shrink: 0; }
|
||||
.profile-info { flex: 1; display: flex; flex-direction: column; }
|
||||
.nickname { font-size: 34rpx; font-weight: 700; color: #FFFFFF; }
|
||||
.plan-badge { font-size: 20rpx; color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.2); padding: 4rpx 14rpx; border-radius: 8rpx; align-self: flex-start; margin-top: 8rpx; }
|
||||
.header-arrow { font-size: 36rpx; color: rgba(255,255,255,0.5); }
|
||||
.stats-bar { display: flex; align-items: center; background: rgba(255,255,255,0.15); border-radius: var(--radius-lg); padding: 24rpx 0; }
|
||||
.stat { flex: 1; display: flex; flex-direction: column; align-items: center; }
|
||||
.stat-num { font-size: 34rpx; font-weight: 700; color: #FFFFFF; }
|
||||
.stat-label { font-size: 20rpx; color: rgba(255,255,255,0.7); margin-top: 6rpx; }
|
||||
.stat-divider { width: 1rpx; height: 44rpx; background: rgba(255,255,255,0.2); }
|
||||
|
||||
.header-guest { padding: 36rpx 32rpx 72rpx; min-height: 90rpx; }
|
||||
.guest-box { display: flex; align-items: center; }
|
||||
.guest-avatar { width: 96rpx; height: 96rpx; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; margin-right: 24rpx; flex-shrink: 0; }
|
||||
.guest-icon { font-size: 40rpx; }
|
||||
.guest-info { flex: 1; }
|
||||
.guest-name { font-size: 30rpx; font-weight: 600; color: #FFFFFF; }
|
||||
.guest-hint { font-size: 22rpx; color: rgba(255,255,255,0.7); margin-top: 4rpx; }
|
||||
|
||||
.menu-area { padding: 0 32rpx 32rpx; margin-top: -40rpx; }
|
||||
.menu-group { background: #FFFFFF; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24rpx; box-shadow: var(--shadow-sm); }
|
||||
.menu-item { display: flex; align-items: center; padding: 28rpx 32rpx; border-bottom: 1rpx solid var(--color-border); }
|
||||
.menu-item:last-child { border-bottom: none; }
|
||||
.menu-item:active { background: #F9FAFB; }
|
||||
.menu-icon-wrap { width: 60rpx; height: 60rpx; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin-right: 20rpx; flex-shrink: 0; }
|
||||
.menu-icon { font-size: 28rpx; }
|
||||
.menu-text { flex: 1; font-size: 28rpx; color: var(--color-text); font-weight: 500; }
|
||||
.menu-arrow { font-size: 32rpx; color: #D1D5DB; }
|
||||
.wrap-blue { background: #EEF2FF; }
|
||||
.wrap-purple { background: #F5F3FF; }
|
||||
.wrap-green { background: #ECFDF5; }
|
||||
.wrap-gray { background: #F3F4F6; }
|
||||
.logout-wrap { margin-top: 8rpx; }
|
||||
.logout-btn { background: #FFFFFF; color: var(--color-error); font-size: 28rpx; font-weight: 500; border-radius: var(--radius-md); height: 88rpx; line-height: 88rpx; border: 2rpx solid #FECACA; }
|
||||
.logout-btn:active { background: #FEF2F2; transform: scale(0.96); }
|
||||
</style>
|
||||
<template>
|
||||
<view class="page fade-in">
|
||||
<!-- 个人中心 -->
|
||||
<view class="header" v-if="isLoggedIn">
|
||||
<view class="profile-section">
|
||||
<image class="avatar" :src="userInfo.avatar || '/static/avatar-default.svg'" mode="aspectFill" />
|
||||
<view class="profile-info">
|
||||
<text class="nickname">{{ userInfo.nickname || '未设置昵称' }}</text>
|
||||
<view class="plan-badge">{{ userInfo.plan || '免费版' }}</view>
|
||||
</view>
|
||||
<text class="header-arrow">›</text>
|
||||
</view>
|
||||
<view class="stats-bar">
|
||||
<view class="stat">
|
||||
<text class="stat-num">{{ stats.interviewCount || 0 }}</text>
|
||||
<text class="stat-label">模拟面试</text>
|
||||
</view>
|
||||
<view class="stat-divider"></view>
|
||||
<view class="stat">
|
||||
<text class="stat-num">{{ stats.avgScore || '--' }}</text>
|
||||
<text class="stat-label">平均得分</text>
|
||||
</view>
|
||||
<view class="stat-divider"></view>
|
||||
<view class="stat">
|
||||
<text class="stat-num">{{ stats.completedCount || 0 }}</text>
|
||||
<text class="stat-label">已完成</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="header header-guest" v-else @click="goLogin">
|
||||
<view class="guest-box">
|
||||
<view class="guest-avatar"><text class="guest-icon">👤</text></view>
|
||||
<view class="guest-info">
|
||||
<text class="guest-name">未登录 / 点击登录</text>
|
||||
<text class="guest-hint">登录后体验全部功能</text>
|
||||
</view>
|
||||
<text class="header-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 菜单列表 -->
|
||||
<view class="menu-area">
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="requireLogin(goHistory, '面试记录')">
|
||||
<view class="menu-icon-wrap wrap-blue"><text class="menu-icon">📋</text></view>
|
||||
<text class="menu-text">面试记录</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" @click="goVip">
|
||||
<view class="menu-icon-wrap wrap-purple"><text class="menu-icon">💎</text></view>
|
||||
<text class="menu-text">会员中心</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" @click="requireLogin(goResume, '我的简历')">
|
||||
<view class="menu-icon-wrap wrap-green"><text class="menu-icon">📄</text></view>
|
||||
<text class="menu-text">我的简历</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @click="goAbout">
|
||||
<view class="menu-icon-wrap wrap-gray"><text class="menu-icon">ℹ️</text></view>
|
||||
<text class="menu-text">关于</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" v-if="isAdmin" @click="goAdmin">
|
||||
<view class="menu-icon-wrap wrap-gray"><text class="menu-icon">⚙️</text></view>
|
||||
<text class="menu-text">管理后台</text>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout-wrap" v-if="isLoggedIn">
|
||||
<button class="logout-btn" @click="doLogout">退出登录</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { api } from '../../config'
|
||||
|
||||
const userInfo = ref({})
|
||||
const isAdmin = ref(false)
|
||||
const stats = ref({ interviewCount: 0, avgScore: '--', completedCount: 0 })
|
||||
const token = ref('')
|
||||
|
||||
const isLoggedIn = computed(() => !!token.value)
|
||||
|
||||
onMounted(() => {
|
||||
token.value = uni.getStorageSync('token') || ''
|
||||
if (!token.value) return
|
||||
try { const s = uni.getStorageSync('userInfo'); if (s) userInfo.value = JSON.parse(s) } catch(e) {}
|
||||
loadStats()
|
||||
checkAdmin()
|
||||
})
|
||||
|
||||
const loadStats = async () => {
|
||||
try {
|
||||
const res = await uni.request({ url: api('/interview/stats/mine'), method: 'GET', header: { 'Authorization': `Bearer ${token.value}` } })
|
||||
if (res.statusCode === 200) stats.value = res.data
|
||||
} catch(e) { console.error(e) }
|
||||
}
|
||||
|
||||
const requireLogin = (action, name) => {
|
||||
if (isLoggedIn.value) { action(); return }
|
||||
uni.showModal({
|
||||
title: '请先登录',
|
||||
content: `需要登录后才能使用${name}功能`,
|
||||
confirmText: '去登录',
|
||||
success: (r) => { if (r.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
|
||||
})
|
||||
}
|
||||
|
||||
const checkAdmin = () => {
|
||||
isAdmin.value = userInfo.value.role === 'admin'
|
||||
}
|
||||
|
||||
const goLogin = () => uni.navigateTo({ url: '/pages/login/login' })
|
||||
const goHistory = () => uni.switchTab({ url: '/pages/history/history' })
|
||||
const goVip = () => uni.navigateTo({ url: '/pages/member/member' })
|
||||
const goResume = () => uni.navigateTo({ url: '/pages/resume/resume' })
|
||||
const goAdmin = () => uni.navigateTo({ url: '/pages/admin/admin' })
|
||||
const goAbout = () => uni.navigateTo({ url: '/pages/about/about' })
|
||||
|
||||
const doLogout = () => {
|
||||
uni.showModal({
|
||||
title: '退出登录', content: '确定要退出登录吗?',
|
||||
success: (r) => { if (r.confirm) { uni.removeStorageSync('token'); uni.removeStorageSync('userInfo'); token.value = '' } }
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { height: 100%; overflow-y: auto; background: var(--color-bg); }
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, var(--color-gradient-start) 0%, var(--color-gradient-mid) 50%, var(--color-gradient-end) 100%);
|
||||
padding: 48rpx 32rpx 72rpx; border-radius: 0 0 48rpx 48rpx; min-height: 90rpx;
|
||||
}
|
||||
.profile-section { display: flex; align-items: center; margin-bottom: 36rpx; }
|
||||
.avatar { width: 104rpx; height: 104rpx; border-radius: 50%; margin-right: 24rpx; border: 3rpx solid rgba(255,255,255,0.4); flex-shrink: 0; }
|
||||
.profile-info { flex: 1; display: flex; flex-direction: column; }
|
||||
.nickname { font-size: 34rpx; font-weight: 700; color: #FFFFFF; }
|
||||
.plan-badge { font-size: 20rpx; color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.2); padding: 4rpx 14rpx; border-radius: 8rpx; align-self: flex-start; margin-top: 8rpx; }
|
||||
.header-arrow { font-size: 36rpx; color: rgba(255,255,255,0.5); }
|
||||
.stats-bar { display: flex; align-items: center; background: rgba(255,255,255,0.15); border-radius: var(--radius-lg); padding: 24rpx 0; }
|
||||
.stat { flex: 1; display: flex; flex-direction: column; align-items: center; }
|
||||
.stat-num { font-size: 34rpx; font-weight: 700; color: #FFFFFF; }
|
||||
.stat-label { font-size: 20rpx; color: rgba(255,255,255,0.7); margin-top: 6rpx; }
|
||||
.stat-divider { width: 1rpx; height: 44rpx; background: rgba(255,255,255,0.2); }
|
||||
|
||||
.header-guest { padding: 36rpx 32rpx 72rpx; min-height: 90rpx; }
|
||||
.guest-box { display: flex; align-items: center; }
|
||||
.guest-avatar { width: 96rpx; height: 96rpx; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; margin-right: 24rpx; flex-shrink: 0; }
|
||||
.guest-icon { font-size: 40rpx; }
|
||||
.guest-info { flex: 1; }
|
||||
.guest-name { font-size: 30rpx; font-weight: 600; color: #FFFFFF; }
|
||||
.guest-hint { font-size: 22rpx; color: rgba(255,255,255,0.7); margin-top: 4rpx; }
|
||||
|
||||
.menu-area { padding: 0 32rpx 32rpx; margin-top: -40rpx; }
|
||||
.menu-group { background: #FFFFFF; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24rpx; box-shadow: var(--shadow-sm); }
|
||||
.menu-item { display: flex; align-items: center; padding: 28rpx 32rpx; border-bottom: 1rpx solid var(--color-border); }
|
||||
.menu-item:last-child { border-bottom: none; }
|
||||
.menu-item:active { background: #F9FAFB; }
|
||||
.menu-icon-wrap { width: 60rpx; height: 60rpx; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin-right: 20rpx; flex-shrink: 0; }
|
||||
.menu-icon { font-size: 28rpx; }
|
||||
.menu-text { flex: 1; font-size: 28rpx; color: var(--color-text); font-weight: 500; }
|
||||
.menu-arrow { font-size: 32rpx; color: #D1D5DB; }
|
||||
.wrap-blue { background: #EEF2FF; }
|
||||
.wrap-purple { background: #F5F3FF; }
|
||||
.wrap-green { background: #ECFDF5; }
|
||||
.wrap-gray { background: #F3F4F6; }
|
||||
.logout-wrap { margin-top: 8rpx; }
|
||||
.logout-btn { background: #FFFFFF; color: var(--color-error); font-size: 28rpx; font-weight: 500; border-radius: var(--radius-md); height: 88rpx; line-height: 88rpx; border: 2rpx solid #FECACA; }
|
||||
.logout-btn:active { background: #FEF2F2; transform: scale(0.96); }
|
||||
</style>
|
||||
|
||||
@@ -40,8 +40,10 @@ export const apiService = {
|
||||
stats: () => request(API_ENDPOINTS.INTERVIEW.STATS, 'GET', undefined, true),
|
||||
},
|
||||
analyze: {
|
||||
diagnosis: (content: string) => request(API_ENDPOINTS.ANALYZE.DIAGNOSIS, 'POST', { content }),
|
||||
optimize: (content: string, direction: string) => request(API_ENDPOINTS.ANALYZE.OPTIMIZE, 'POST', { content, direction }),
|
||||
diagnosis: (content: string) => request(API_ENDPOINTS.ANALYZE.DIAGNOSIS, 'POST', { content }, true),
|
||||
optimize: (content: string, direction: string) => request(API_ENDPOINTS.ANALYZE.OPTIMIZE, 'POST', { content, direction }, true),
|
||||
skillsGap: (targetPosition?: string) =>
|
||||
request(API_ENDPOINTS.ANALYZE.SKILLS_GAP, 'POST', { targetPosition }, true),
|
||||
},
|
||||
resume: {
|
||||
create: (title: string, content: string, targetPosition?: string) =>
|
||||
@@ -49,6 +51,38 @@ export const apiService = {
|
||||
list: () => request(API_ENDPOINTS.RESUME.LIST, 'GET', undefined, true),
|
||||
delete: (id: string) => request(API_ENDPOINTS.RESUME.DELETE(id), 'DELETE', undefined, true),
|
||||
},
|
||||
progress: {
|
||||
get: () => request(API_ENDPOINTS.PROGRESS.GET, 'GET', undefined, true),
|
||||
stats: () => request(API_ENDPOINTS.PROGRESS.STATS, 'GET', undefined, true),
|
||||
},
|
||||
contribution: {
|
||||
create: (data: any) => request(API_ENDPOINTS.CONTRIBUTION.CREATE, 'POST', data, true),
|
||||
my: () => request(API_ENDPOINTS.CONTRIBUTION.MY, 'GET', undefined, true),
|
||||
bank: (company: string, position: string) =>
|
||||
request(API_ENDPOINTS.CONTRIBUTION.BANK(company, position), 'GET', undefined, true),
|
||||
company: (company: string) =>
|
||||
request(API_ENDPOINTS.CONTRIBUTION.COMPANY(company), 'GET', undefined, true),
|
||||
},
|
||||
member: {
|
||||
plans: () => request(API_ENDPOINTS.MEMBER.PLANS, 'GET', undefined),
|
||||
status: () => request(API_ENDPOINTS.MEMBER.STATUS, 'GET', undefined, true),
|
||||
pay: (outTradeNo: string) => request(API_ENDPOINTS.MEMBER.PAY, 'POST', { outTradeNo }, true),
|
||||
sprintDeduct: () => request(API_ENDPOINTS.MEMBER.SPRINT_DEDUCT, 'POST', undefined, true),
|
||||
},
|
||||
payment: {
|
||||
create: (plan: string) => request(API_ENDPOINTS.PAYMENT.CREATE, 'POST', { plan }, true),
|
||||
jsapi: (plan: string) => request(API_ENDPOINTS.PAYMENT.JSAPI, 'POST', { plan }, true),
|
||||
check: (outTradeNo: string) => request(API_ENDPOINTS.PAYMENT.CHECK(outTradeNo), 'GET', undefined, true),
|
||||
activate: (outTradeNo: string) => request(API_ENDPOINTS.PAYMENT.ACTIVATE, 'POST', { outTradeNo }, true),
|
||||
},
|
||||
dailyQuestion: {
|
||||
today: (position?: string) => {
|
||||
const query = position ? `?position=${encodeURIComponent(position)}` : ''
|
||||
return request(API_ENDPOINTS.DAILY_QUESTION.TODAY + query, 'GET', undefined, true)
|
||||
},
|
||||
byPosition: (position: string) =>
|
||||
request(API_ENDPOINTS.DAILY_QUESTION.BY_POSITION(position), 'GET', undefined, true),
|
||||
},
|
||||
}
|
||||
|
||||
export default apiService
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import { defineConfig } from "vite";
|
||||
export default defineConfig({server:{port:8888,strictPort:true}});
|
||||
import { defineConfig } from "vite";
|
||||
export default defineConfig({server:{port:8888,strictPort:true}});
|
||||
|
||||
Reference in New Issue
Block a user