19 Commits

Author SHA1 Message Date
yuzhiran e9036d2979 test: 意见反馈浏览器端功能测试 + service populate 保护
Playwright 测试 (api.browser.spec.ts):
- POST /api/feedback 401 (无 token)
- POST /api/feedback 400 (空内容)
- POST /api/feedback 201 (有效数据)
- GET /api/feedback 403 (非管理员)
- GET /api/feedback 200 (管理员)

测试通过用读写 .env 获取 JWT_SECRET 签名 token

fix: findAll 增加 populate try/catch 防止用户被删除后列表崩溃
2026-07-06 11:45:34 +08:00
yuzhiran 4180eae944 feat: 意见反馈功能
新增完整反馈闭环:
- 后端: Feedback 模块 (schema+service+controller+module)
  - POST /api/feedback (用户提交)
  - GET /api/feedback (管理员列表)
  - PATCH /api/feedback/:id/resolve (管理员标记已处理)
- 前端: pages/feedback/feedback.vue
  - 三种反馈类型: 问题反馈/改进建议/点赞鼓励
  - 文本输入 + 联系方式选填
  - 提交后显示成功提示
- 用户页新增'意见反馈'菜单入口
- 管理后台可通过 API 查看和管理反馈
2026-07-06 11:13:08 +08:00
yuzhiran 4e4e1ca271 ux: 无有效语音时友好提示
onStop 时:
- 识别文字 >=2 字: 自动发送 (正常流程)
- 识别文字 =1 字: toast '语音过短,请重试'
- 无识别文字: toast '未检测到语音,请重试'
2026-07-05 20:32:29 +08:00
yuzhiran 50bb3c45ed ux: 录音改为点击开始/点击结束
- 移除长按交互 (touchstart/touchend/mousedown/mouseup)
- 改为单击 toggle: 点击🎤开始录音, 再点击结束录音
- 按钮默认只显示🎤, 录音中显示🔴+秒数
- 下方提示改为'点击结束'
- 录音开始时清空 inputText
- 移除 suppressAutoSend 标志 (点击结束都是有意操作)
2026-07-05 19:41:21 +08:00
yuzhiran db1b3baa60 fix: 录音UX + 发送按钮录音中禁用
- 发送按钮录音中禁用 (disabled: isRecording)
- sendAnswer() 加 isRecording 守卫
- 麦克风按钮录音时下方显示'松开结束'提示
- 默认标签改为'按住'
2026-07-05 19:19:16 +08:00
yuzhiran df7d51d888 refactor: 录音换成微信同声传译插件
替换整个录音+ASR流程:
- 移除 uni.getRecorderManager() + 后端上传 ASR 方案
- 接入 WechatSI 插件 getRecordRecognitionManager()
- start() 一次性完成录音+实时流式识别
- onRecognize 实时回填 inputText (用户可见)
- onStop 自动调用 sendAnswer(),无需手动点击发送
- 移除 asrLoading/skipAsr/recorderStarted/pendingStop 状态

效果: 8步→3步, 延时2-10s→~500ms, 不再有录音格式兼容问题

注意: 需在 mp.weixin.qq.com 后台添加同声传译插件(插件ID: wx069ba97219f66d99)
2026-07-05 18:44:54 +08:00
yuzhiran 462884a321 fix: recorderStart 异步竞争条件
微信 RecorderManager.start() 是异步的,onStart 回调触发前
调用 stop() 会报 'operateRecorder:fail recorder not start'。

- 增加 recorderStarted 标志,onStart 时置 true
- 增加 pendingStop 标志,stop() 在 start 前被调用时延迟执行
- onError 时全面清理 pendingStop/recorderStarted/skipAsr 状态
2026-07-05 18:06:17 +08:00
yuzhiran 48354e634b fix: 录音可靠性修复 + ASR 后端优化
前端:
- recorder.onError 时重置 recorder = null,避免错误后录音永久失效
- 增加 asrLoading 状态,ASR 处理中输入框 disabled 并显示'语音识别中...'
- 增加 skipAsr 标志,<1s 的录音跳过 ASR 上传
- uploadFile 增加 30s timeout

后端:
- ASR: OpenAI 失败后 fallback 到本地 whisper,日志级别降为 warn
- try/catch/finally 重构,确保临时文件在所有路径都清理
- OpenAI 和 whisper 结果分别 try,互不影响
2026-07-05 17:45:03 +08:00
yuzhiran 8152278b86 fix: 录音格式改回 aac + 对话 UX 优化
录音:
- 从 mp3/16kHz/48kbps 改回原始工作配置 aac/22050Hz/16kbps
  (mp3 和 48kbps 在部分微信版本兼容不佳)
- 增加 recordingDuration ref 显示录音秒数
- onError 增加 JSON.stringify 打印详细错误原因
- 增加权限被拒的判断提示

UX 优化:
- 每条消息增加角色头像 (🤖 AI / 👤 用户)
- 增加 msg-body 容器 + msg-label 角色标签 (面试官/我)
- 对话布局改为左侧头像+气泡+名称,右侧用户头像+气泡
- msg-body max-width:70% 限制气泡宽度
- 麦克风按钮放大(80rpx),增加文字标签「按住」/「Ns」
- 录音时禁用输入框(isRecording 时 textarea disabled)
2026-07-05 17:00:29 +08:00
yuzhiran b38b38d0c8 fix: 录音 - 移除 uni.authorize + 修复 encodeBitRate 越界
录音按住松手无效根因有两处:

1. encodeBitRate:128000 对 sampleRate:16000 越界(微信规定16000Hz
  下 encodeBitRate 必须在 24000~96000 之间),导致 recorder.start()
  立即触发 onError,修改为 encodeBitRate:48000

2. uni.authorize 异步回调延迟 recorder.start(),用户松手时
  stopRecord 已执行但 recorder 尚未开始录,且之前的 recordingStarted
  守卫跳过 stopRecord 后 authorize 回调又启动录音无法停止。
  解决方案: 直接调 recorder.start(),不再前置 uni.authorize。
  微信会在需要时自动弹录音权限窗。

format 从 wav 改为 mp3(mp3 在微信各平台兼容性更好),
后端 ffmpeg 会自动转码为 wav 后再送 whisper。
2026-07-05 14:14:45 +08:00
yuzhiran 07b81f57a6 fix: 面试创建时机 + 录音开始状态守卫
问题1(录音失败): recorder.start() 在 uni.authorize 异步回调里调用,
用户松手触发 stopRecord 时录音还没实际开始,调 recorder.stop() 报错。
修复: 增加 recordingStarted 标记,onsStart 回调设为 true,stopRecord
检查该标记,若录音未开始直接跳过。

问题2(开始被当答案):
- onMounted 不再自动调用 startInterview() 创建面试,等待用户首次发送
- greeting 文案改为准备好后发送任意消息,我会立即开始面试并给出第一个问题
- sendAnswer 首次发送: 用户消息仅显示在本地对话中,调用 startInterview()
  创建面试并追加第一个问题,不提交答案到 /interview/{id}/answer
- startInterview 不再替换 messages,改为 push AI 消息追加到现有对话
- selectPosition 同理,不再立即 startInterview,等用户发消息
2026-07-05 13:38:20 +08:00
yuzhiran 1422c04b2c fix: sendAnswer await startInterview + stopRecord guard
- sendAnswer: await startInterview() 后再发答案,避免面试还没创建
  就把用户输入 '你好' 当成答案提交给空 interviewId
- stopRecord: 加 !isRecording.value 守卫,防止 user touchend 在
  uni.authorize success 回调之前触发 recorder.stop() 导致报错
2026-07-05 13:04:40 +08:00
yuzhiran 656dfabb29 fix: interview 录音改为长按按住录音松开提交
startRecord 先同步设 isRecording=true 再异步 uni.authorize,避免
touchend 在 authorize success 回调前就触发 stopRecord 导致录音没
来得及开始就被停止。
移除冗余 doStartRecorder 函数,inline 到 authorize success 回调中。
stopRecord 不再检查 isRecording 守卫(可能已被 startRecord 设为 true),
直接 recorder.stop()。
2026-07-05 09:32:36 +08:00
yuzhiran fe688096a4 fix: interview 页面 22x ReferenceError + 引力值明细追加余额栏
interview.vue: 上次会话修改时丢失了 timerSeconds/timerInterval 两个 let 声明
(它们在 git 历史里 d8a7872 时本和 onMounted 同段定义),导致页面渲染时
20+ 次 'ReferenceError: timerSeconds is not defined' 刷屏、对话框/计时器
被白屏错误覆盖。补回两行声明即可还原,无其它改动。

user.vue: 引力值明细每行除金额外追加变动后「余额 N」尾列(schema 中 balance
字段已记录,仅前端未展示)。.detail-item-right 容器纵向堆叠金额+小字余额。
2026-07-05 08:59:02 +08:00
yuzhiran 31703af4f2 fix: mp-weixin 录音失败 - 权限声明+authorize+移除TS注解+空音频守卫
- interview.vue: 移除 `let recorder: any` TS 类型注解(小程序构建器不解析 TS,上次修改直接破坏构建从未部署)
- interview.vue: 合并两个 onMounted 调用,删除凭空引入的 refreshState() 未定义函数引用
- interview.vue: startRecord 增加 uni.authorize scope.record 权限预请求,拒绝时引导 openSetting
- interview.vue: recorder.start 改 wav/16kHz/128kbps(旧 aac/22050/16kbps 产生全 0 损坏文件)
- manifest.json: mp-weixin.permission 增加 scope.record 录音权限声明
- tts.controller.ts: ASR 拒绝 <500B 空音频文件,避免 whisper 调 ffmpeg 解码失败刷错日志
2026-07-05 01:57:24 +08:00
yuzhiran 4023c789b1 docs: update deployment v1.0.22 + fix changelog (v4.11) 2026-07-04 13:19:35 +08:00
yuzhiran a9c6b03c67 fix: ASR audio format conversion + share.vue deduplicate share creation
- TTS /tts/asr: convert non-WAV (AAC/MP3) to WAV before whisper transcription
- share.vue: only create share record if no cached shareCode exists
  (prevents duplicate share records on every page load)
2026-07-04 13:13:32 +08:00
yuzhiran d8e8bcc9a0 docs: update deploy version to v1.0.22 2026-07-04 11:18:05 +08:00
yuzhiran 2230a95b45 feat: gravity transaction logging + user-facing history popup
- New GravityTransaction schema tracks all gravity changes (registration,
  interview/optimize/download deduction, purchase, monthly topup, migration)
- GravityTopUpService: bulk log for monthly VIP topup
- PaymentController.activateMembership: log plan_set transactions
- QuotaService: add logTransaction, wire into all gravity-modifying methods
- UserService: log registration grants (phone/wx/email/password)
- GET /user/gravity-transactions?page=&limit= API
- Frontend: user.vue '明细' button + paginated popup
- Docs: update PROJECT-STATUS v4.10, FEATURE-LIST, DEPLOYMENT
2026-07-04 11:12:55 +08:00
25 changed files with 749 additions and 133 deletions
+4
View File
@@ -9,6 +9,7 @@ import { APP_GUARD } from '@nestjs/core'
import { JwtStrategy } from './common/strategies/jwt.strategy'
import { JwtAuthGuard } from './common/guards/jwt-auth.guard'
import { AiModule } from './modules/ai/ai.module'
import { FeedbackModule } from './modules/feedback/feedback.module'
import { UserModule } from './modules/user/user.module'
import { InterviewModule } from './modules/interview/interview.module'
import { ResumeModule } from './modules/resume/resume.module'
@@ -25,6 +26,7 @@ import { DailyQuestionModule } from './modules/daily-question/daily-question.mod
import { ScheduleModule } from './modules/schedule/schedule.module'
import { TtsModule } from './modules/tts/tts.module'
import { PricingModule } from './modules/schemas/pricing.module'
import { GravityTransactionModule } from './modules/schemas/gravity-transaction.module'
import { ShareModule } from './modules/share/share.module'
import { InterviewReviewModule } from './modules/interview-review/interview-review.module'
import { CareerAdviceModule } from './modules/career-advice/career-advice.module'
@@ -46,6 +48,7 @@ const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/zhiyin
}]),
NestScheduleModule.forRoot(),
UserModule,
FeedbackModule,
AiModule,
InterviewModule,
AnalyzeModule,
@@ -66,6 +69,7 @@ const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/zhiyin
InterviewReviewModule,
CareerAdviceModule,
VirtualPaymentModule,
GravityTransactionModule,
],
providers: [
JwtStrategy,
@@ -0,0 +1,31 @@
import { Controller, Post, Get, Patch, Param, Body, Query, UseGuards, HttpException, HttpStatus } from '@nestjs/common'
import { FeedbackService } from './feedback.service'
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard'
import { AdminGuard } from '../../common/guards/admin.guard'
import { CurrentUser } from '../../common/decorators/current-user.decorator'
@Controller('feedback')
export class FeedbackController {
constructor(private service: FeedbackService) {}
@UseGuards(JwtAuthGuard)
@Post()
async create(@CurrentUser('userId') userId: string, @Body() body: { type?: string; content: string; contact?: string }) {
if (!body.content || body.content.length < 2) {
throw new HttpException('请填写反馈内容', HttpStatus.BAD_REQUEST)
}
return this.service.create({ userId, type: body.type || 'suggestion', content: body.content, contact: body.contact })
}
@UseGuards(JwtAuthGuard, AdminGuard)
@Get()
async list(@Query('page') page?: string, @Query('limit') limit?: string) {
return this.service.findAll(Number(page) || 1, Number(limit) || 20)
}
@UseGuards(JwtAuthGuard, AdminGuard)
@Patch(':id/resolve')
async resolve(@Param('id') id: string) {
return this.service.markResolved(id)
}
}
@@ -0,0 +1,13 @@
import { Module } from '@nestjs/common'
import { MongooseModule } from '@nestjs/mongoose'
import { FeedbackController } from './feedback.controller'
import { FeedbackService } from './feedback.service'
import { Feedback, FeedbackSchema } from './feedback.schema'
@Module({
imports: [MongooseModule.forFeature([{ name: Feedback.name, schema: FeedbackSchema }])],
controllers: [FeedbackController],
providers: [FeedbackService],
exports: [FeedbackService],
})
export class FeedbackModule {}
@@ -0,0 +1,24 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
import { Document, Types } from 'mongoose'
export type FeedbackDocument = Feedback & Document
@Schema({ timestamps: true })
export class Feedback {
@Prop({ type: Types.ObjectId, ref: 'User', required: true })
userId: Types.ObjectId
@Prop({ default: 'suggestion' })
type: string
@Prop({ required: true })
content: string
@Prop({ default: '' })
contact: string
@Prop({ default: 'pending' })
status: string
}
export const FeedbackSchema = SchemaFactory.createForClass(Feedback)
@@ -0,0 +1,28 @@
import { Injectable } from '@nestjs/common'
import { InjectModel } from '@nestjs/mongoose'
import { Model } from 'mongoose'
import { Feedback } from './feedback.schema'
@Injectable()
export class FeedbackService {
constructor(@InjectModel(Feedback.name) private model: Model<Feedback>) {}
async create(data: { userId: string; type: string; content: string; contact?: string }) {
return this.model.create(data)
}
async findAll(page = 1, limit = 20) {
const skip = (page - 1) * limit
const items = await this.model.find().sort({ createdAt: -1 }).skip(skip).limit(limit).lean()
let populated: any[] = items
try {
populated = await this.model.populate(items, { path: 'userId', select: 'nickname phone email' })
} catch {}
const total = await this.model.countDocuments()
return { items: populated, total, page, limit }
}
async markResolved(id: string) {
return this.model.findByIdAndUpdate(id, { status: 'resolved' }, { new: true })
}
}
@@ -51,6 +51,7 @@ describe('PaymentController', () => {
providers: [
{ provide: getModelToken('User'), useValue: mockUserModel },
{ provide: getModelToken('PaymentOrder'), useValue: mockOrderModel },
{ provide: getModelToken('GravityTransaction'), useValue: { create: jest.fn() } },
{ provide: WechatPayService, useValue: mockWechatPay },
{ provide: QuotaService, useValue: mockQuotaService },
{ provide: PricingService, useValue: mockPricingService },
@@ -9,6 +9,7 @@ import { WechatPayService } from './wechat-pay.service'
import { QuotaService } from '../user/quota.service'
import { PricingService } from '../schemas/pricing.service'
import { Public } from '../../common/decorators/public.decorator'
import { GravityTransaction } from '../schemas/gravity-transaction.schema'
@Controller('payment')
export class PaymentController {
@@ -17,6 +18,7 @@ export class PaymentController {
constructor(
@InjectModel(User.name) private userModel: Model<UserDocument>,
@InjectModel(PaymentOrder.name) private orderModel: Model<PaymentOrderDocument>,
@InjectModel(GravityTransaction.name) private gravityTxModel: Model<GravityTransaction>,
private wechatPay: WechatPayService,
private quotaService: QuotaService,
private pricingService: PricingService,
@@ -226,6 +228,14 @@ export class PaymentController {
user.gravity = planCfg.gravityPerMonth
user.freeOptimizeUsed = 3
await user.save()
await this.gravityTxModel.create({
userId: order.userId,
amount: planCfg.gravityPerMonth,
balance: planCfg.gravityPerMonth,
type: 'plan_set',
description: `开通${isSprint ? '冲刺版' : '成长版'}会员,获得 ${planCfg.gravityPerMonth} 引力值`,
refId: order.outTradeNo,
})
}
private async activateProduct(order: PaymentOrderDocument) {
@@ -4,6 +4,7 @@ import { InjectModel } from '@nestjs/mongoose'
import { Model } from 'mongoose'
import { User, UserDocument } from '../user/user.schema'
import { PricingService } from '../schemas/pricing.service'
import { GravityTransaction } from '../schemas/gravity-transaction.schema'
@Injectable()
export class GravityTopUpService {
@@ -11,9 +12,24 @@ export class GravityTopUpService {
constructor(
@InjectModel(User.name) private userModel: Model<UserDocument>,
@InjectModel(GravityTransaction.name) private gravityTxModel: Model<GravityTransaction>,
private pricingService: PricingService,
) {}
private async logBulkTopUp(userIds: string[], amount: number, type: string) {
const users = await this.userModel.find({ _id: { $in: userIds } }).select('gravity').exec()
const docs = users.map(u => ({
userId: u._id.toString(),
amount,
balance: u.gravity,
type,
description: `月度补给 ${amount} 引力值`,
}))
if (docs.length > 0) {
await this.gravityTxModel.insertMany(docs)
}
}
@Cron(CronExpression.EVERY_DAY_AT_2AM)
async topUpVipGravity() {
this.logger.log('Topping up gravity for active VIP members...')
@@ -22,28 +38,32 @@ export class GravityTopUpService {
// 成长版 —— vipExpireAt 未过期
const growthPlan = pricing.plans.growth
const growthResult = await this.userModel.updateMany(
{
plan: 'growth',
vipExpireAt: { $gt: now },
},
{ $inc: { gravity: growthPlan.gravityPerMonth } },
).exec()
if (growthResult.modifiedCount > 0) {
this.logger.log(`Growth plan: topped up ${growthResult.modifiedCount} users with ${growthPlan.gravityPerMonth} gravity each`)
const growthUsers = await this.userModel.find(
{ plan: 'growth', vipExpireAt: { $gt: now } },
).select('_id').exec()
const growthIds = growthUsers.map(u => u._id.toString())
if (growthIds.length > 0) {
await this.userModel.updateMany(
{ _id: { $in: growthIds } },
{ $inc: { gravity: growthPlan.gravityPerMonth } },
).exec()
await this.logBulkTopUp(growthIds, growthPlan.gravityPerMonth, 'monthly_topup')
this.logger.log(`Growth plan: topped up ${growthIds.length} users with ${growthPlan.gravityPerMonth} gravity each`)
}
// 冲刺版 —— sprintExpireAt 未过期
const sprintPlan = pricing.plans.sprint
const sprintResult = await this.userModel.updateMany(
{
plan: 'sprint',
sprintExpireAt: { $gt: now },
},
{ $inc: { gravity: sprintPlan.gravityPerMonth } },
).exec()
if (sprintResult.modifiedCount > 0) {
this.logger.log(`Sprint plan: topped up ${sprintResult.modifiedCount} users with ${sprintPlan.gravityPerMonth} gravity each`)
const sprintUsers = await this.userModel.find(
{ plan: 'sprint', sprintExpireAt: { $gt: now } },
).select('_id').exec()
const sprintIds = sprintUsers.map(u => u._id.toString())
if (sprintIds.length > 0) {
await this.userModel.updateMany(
{ _id: { $in: sprintIds } },
{ $inc: { gravity: sprintPlan.gravityPerMonth } },
).exec()
await this.logBulkTopUp(sprintIds, sprintPlan.gravityPerMonth, 'monthly_topup')
this.logger.log(`Sprint plan: topped up ${sprintIds.length} users with ${sprintPlan.gravityPerMonth} gravity each`)
}
}
}
@@ -0,0 +1,10 @@
import { Module, Global } from '@nestjs/common'
import { MongooseModule } from '@nestjs/mongoose'
import { GravityTransaction, GravityTransactionSchema } from './gravity-transaction.schema'
@Global()
@Module({
imports: [MongooseModule.forFeature([{ name: GravityTransaction.name, schema: GravityTransactionSchema }])],
exports: [MongooseModule],
})
export class GravityTransactionModule {}
@@ -0,0 +1,43 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
import { Document } from 'mongoose'
export type GravityTransactionDocument = GravityTransaction & Document
export type GravityTransactionType =
| 'registration' // 注册赠送
| 'interview_deduct' // AI 面试消耗
| 'optimize_deduct' // 简历优化消耗
| 'download_deduct' // 简历下载消耗
| 'purchase' // 充值购买
| 'monthly_topup' // 月度补给
| 'migration' // 旧额度迁移
| 'plan_set' // 套餐设置
| 'share' // 分享所得
| 'contribution' // 面经贡献奖励
| 'share_credits_fallback' // 分享币后备抵扣
| 'admin_adjust' // 管理员调整
@Schema({ timestamps: true })
export class GravityTransaction {
@Prop({ required: true, index: true })
userId: string
@Prop({ required: true })
amount: number // 变动数量(正=增加,负=减少)
@Prop({ required: true })
balance: number // 变动后余额
@Prop({ required: true })
type: GravityTransactionType
@Prop({ default: '' })
description: string // 描述(如 "AI 模拟面试消耗"
@Prop()
refId?: string // 关联 ID(订单号、面试ID 等)
}
export const GravityTransactionSchema = SchemaFactory.createForClass(GravityTransaction)
GravityTransactionSchema.index({ userId: 1, createdAt: -1 })
+49 -17
View File
@@ -46,29 +46,61 @@ export class TtsController {
const ext = file.originalname ? path.extname(file.originalname) || '.aac' : '.aac'
const dest = path.join(uploadDir, file.filename + ext)
fs.renameSync(file.path, dest)
// 拒绝损坏/空音频文件,避免 whisper 调用 ffmpeg 解码失败刷错误日志
const stat = fs.statSync(dest)
if (!stat.size || stat.size < 500) {
this.logger.warn(`ASR: empty audio upload (size=${stat.size}), ext=${ext}`)
try { fs.unlinkSync(dest) } catch {}
return { text: '' }
}
let wavPath = dest
if (ext.toLowerCase() !== '.wav') {
const potentialWav = dest.replace(/\.[^.]+$/, '.wav')
try {
execSync(`ffmpeg -y -i "${dest}" -ar 16000 -ac 1 -c:a pcm_s16le "${potentialWav}"`, {
timeout: 30000, encoding: 'utf8', stdio: 'pipe',
})
wavPath = potentialWav
} catch (e: any) {
this.logger.warn(`FFmpeg conversion failed: ${e.message}, using original format`)
}
}
try {
let text = ''
if (process.env.OPENAI_API_KEY) {
const result = execSync(
`curl -s -X POST https://api.openai.com/v1/audio/transcriptions \
-H "Authorization: Bearer ${process.env.OPENAI_API_KEY}" \
-H "Content-Type: multipart/form-data" \
-F "file=@${dest}" \
-F "model=whisper-1" \
-F "language=zh"`,
{ encoding: 'utf8', timeout: 30000 },
try {
const result = execSync(
`curl -s -X POST https://api.openai.com/v1/audio/transcriptions \
-H "Authorization: Bearer ${process.env.OPENAI_API_KEY}" \
-H "Content-Type: multipart/form-data" \
-F "file=@${wavPath}" \
-F "model=whisper-1" \
-F "language=zh"`,
{ encoding: 'utf8', timeout: 30000 },
)
const parsed = JSON.parse(result)
if (parsed.text) text = parsed.text.trim()
} catch (e: any) {
this.logger.warn(`OpenAI ASR failed, falling back to local: ${e.message}`)
}
}
if (!text) {
const whisperResult = execSync(
`python3 -c 'import sys, whisper; model = whisper.load_model("tiny"); print(model.transcribe(sys.argv[1], language="zh")["text"].strip())' "${wavPath}"`,
{ encoding: 'utf8', timeout: 60000 },
)
const parsed = JSON.parse(result)
if (parsed.text) return { text: parsed.text.trim() }
}
const whisperResult = execSync(`python3 -c 'import sys, whisper; model = whisper.load_model("tiny"); print(model.transcribe(sys.argv[1], language="zh")["text"].strip())' "${dest}"`, { encoding: 'utf8', timeout: 60000 })
if (whisperResult && whisperResult.trim()) {
return { text: whisperResult.trim() }
if (whisperResult?.trim()) text = whisperResult.trim()
}
return { text }
} catch (e: any) {
this.logger.error(`ASR failed: ${e?.message || e}`)
return { text: '' }
} finally {
try { if (dest) fs.unlinkSync(dest) } catch {}
try { if (wavPath && wavPath !== dest) fs.unlinkSync(wavPath) } catch {}
}
// 清理临时文件
try { fs.unlinkSync(dest) } catch {}
return { text: '' }
}
}
+20 -4
View File
@@ -3,6 +3,7 @@ import { InjectModel } from '@nestjs/mongoose'
import { Model } from 'mongoose'
import { User, UserDocument } from './user.schema'
import { PricingService } from '../schemas/pricing.service'
import { GravityTransaction, GravityTransactionType } from '../schemas/gravity-transaction.schema'
const FREE_OPTIMIZE_LIMIT = 3
@@ -12,9 +13,16 @@ export class QuotaService {
constructor(
@InjectModel(User.name) private userModel: Model<UserDocument>,
@InjectModel(GravityTransaction.name) private gravityTxModel: Model<GravityTransaction>,
private pricingService: PricingService,
) {}
private async logTransaction(userId: string, amount: number, type: GravityTransactionType, description: string, refId?: string) {
const u = await this.userModel.findById(userId).select('gravity').exec()
const balance = u?.gravity ?? 0
await this.gravityTxModel.create({ userId, amount, balance, type, description, refId })
}
/** 仅检查面试引力值是否充足,不扣除(用于先 AI 后扣款模式) */
async checkInterview(userId: string): Promise<number> {
const user = await this.userModel.findById(userId).exec()
@@ -106,19 +114,23 @@ export class QuotaService {
/** 从 gravity 扣除,后备从 shareCredits 扣除(兼容旧数据) */
private async deductGravityOrFallback(userId: string, cost: number): Promise<boolean> {
// 主路径:gravity
const gravResult = await this.userModel.findOneAndUpdate(
{ _id: userId, gravity: { $gte: cost } },
{ $inc: { gravity: -cost } },
).exec()
if (gravResult) return true
if (gravResult) {
await this.logTransaction(userId, -cost, 'interview_deduct', `AI 模拟面试消耗 ${cost} 引力值`)
return true
}
// 后备:旧 shareCredits
const shareResult = await this.userModel.findOneAndUpdate(
{ _id: userId, shareCredits: { $gt: 0 } },
{ $inc: { shareCredits: -1 } },
).exec()
if (shareResult) return true
if (shareResult) {
await this.logTransaction(userId, 0, 'share_credits_fallback', '分享币后备抵扣 1 次')
return true
}
return false
}
@@ -131,6 +143,7 @@ export class QuotaService {
{ $inc: { gravity: amount } },
).exec()
if (!result) throw new HttpException('用户不存在', HttpStatus.NOT_FOUND)
await this.logTransaction(userId, amount, 'purchase', `充值获得 ${amount} 引力值`)
}
/** 设置 VIP 套餐引力值额度 */
@@ -142,6 +155,7 @@ export class QuotaService {
},
}).exec()
if (!result) throw new HttpException('用户不存在', HttpStatus.NOT_FOUND)
await this.logTransaction(userId, gravityAmount, 'plan_set', `套餐开通,获得 ${gravityAmount} 引力值`)
}
/** 是否为非会员用户授予初始引力值 */
@@ -149,6 +163,7 @@ export class QuotaService {
await this.userModel.findByIdAndUpdate(userId, {
$set: { interviewCredits: 1, gravity: 5 },
}).exec()
await this.logTransaction(userId, 5, 'registration', '注册赠送 5 引力值')
}
/** 判断是否有旧额度需要迁移 */
@@ -180,5 +195,6 @@ export class QuotaService {
shareCredits: 0,
},
}).exec()
await this.logTransaction(userId, total, 'migration', `旧额度迁移,获得 ${total} 引力值`)
}
}
+10 -1
View File
@@ -1,4 +1,4 @@
import { Controller, Post, Get, Put, Body, Req, HttpCode, HttpStatus, UseGuards } from '@nestjs/common'
import { Controller, Post, Get, Put, Query, Body, Req, HttpCode, HttpStatus, UseGuards } from '@nestjs/common'
import { UserService } from './user.service'
import { Public } from '../../common/decorators/public.decorator'
import { CurrentUser } from '../../common/decorators/current-user.decorator'
@@ -88,4 +88,13 @@ export class UserController {
async setPassword(@CurrentUser('userId') userId: string, @Body('password') password: string) {
return this.userService.setPassword(userId, password)
}
@Get('gravity-transactions')
async getGravityTransactions(
@CurrentUser('userId') userId: string,
@Query('page') page = '1',
@Query('limit') limit = '20',
) {
return this.userService.getGravityTransactions(userId, parseInt(page), parseInt(limit))
}
}
@@ -4,6 +4,7 @@ import { JwtService } from '@nestjs/jwt'
import { HttpException } from '@nestjs/common'
import { UserService } from './user.service'
import { EmailService } from '../email/email.service'
import { PricingService } from '../schemas/pricing.service'
describe('UserService', () => {
let service: UserService
@@ -44,8 +45,10 @@ describe('UserService', () => {
providers: [
UserService,
{ provide: getModelToken('User'), useValue: mockUserModel },
{ provide: getModelToken('GravityTransaction'), useValue: { create: jest.fn() } },
{ provide: JwtService, useValue: mockJwtService },
{ provide: EmailService, useValue: mockEmailService },
{ provide: PricingService, useValue: { getConfig: jest.fn().mockResolvedValue({ registrationGravity: 50, gravityRates: { interviewPerUse: 5, optimizePerUse: 3, downloadPerUse: 2 }, plans: { growth: { gravityPerMonth: 80 }, sprint: { gravityPerMonth: 200 } } }) } },
],
}).compile()
+36 -1
View File
@@ -2,10 +2,11 @@
import { Injectable, HttpException, HttpStatus, Logger } from '@nestjs/common'
import { InjectModel } from '@nestjs/mongoose'
import { Model } from 'mongoose'
import { JwtService } from '@nestjs/jwt'
import { User, UserDocument } from './user.schema'
import { JwtService } from '@nestjs/jwt'
import { EmailService } from '../email/email.service'
import { PricingService } from '../schemas/pricing.service'
import { GravityTransaction, GravityTransactionType } from '../schemas/gravity-transaction.schema'
/** 通过 IP 查询粗略地理位置(ip-api.com 免费接口) */
async function lookupIpLocation(ip: string): Promise<string> {
@@ -29,11 +30,18 @@ export class UserService {
constructor(
@InjectModel(User.name) private userModel: Model<UserDocument>,
@InjectModel(GravityTransaction.name) private gravityTxModel: Model<GravityTransaction>,
private jwtService: JwtService,
private emailService: EmailService,
private pricingService: PricingService,
) {}
private async logTransaction(userId: string, amount: number, type: GravityTransactionType, description: string) {
const u = await this.userModel.findById(userId).select('gravity').exec()
const balance = u?.gravity ?? 0
await this.gravityTxModel.create({ userId, amount, balance, type, description })
}
async sendCode(phone: string) {
const code = process.env.NODE_ENV === 'production'
? String(Math.floor(100000 + Math.random() * 900000))
@@ -59,11 +67,17 @@ export class UserService {
codeStore.delete(phone)
let user = await this.userModel.findOne({ phone }).exec()
let isNew = false
if (!user) {
isNew = true
user = await this.userModel.create({ phone, nickname: `用户${phone.slice(-4)}`, gravity: (await this.pricingService.getConfig()).registrationGravity })
}
await this.recordLogin(user._id.toString(), ip)
if (isNew) {
const amount = (await this.pricingService.getConfig()).registrationGravity
await this.logTransaction(user._id.toString(), amount, 'registration', '注册赠送引力值')
}
return this.generateAuthResponse(user)
}
@@ -95,11 +109,17 @@ export class UserService {
}
let user = await this.userModel.findOne({ wxOpenid: openid }).exec()
let isNew = false
if (!user) {
isNew = true
user = await this.userModel.create({ wxOpenid: openid, nickname: '微信用户', gravity: (await this.pricingService.getConfig()).registrationGravity })
}
await this.recordLogin(user._id.toString(), ip)
if (isNew) {
const amount = (await this.pricingService.getConfig()).registrationGravity
await this.logTransaction(user._id.toString(), amount, 'registration', '注册赠送引力值')
}
return this.generateAuthResponse(user)
}
@@ -175,6 +195,10 @@ export class UserService {
user = await this.userModel.create({ email, nickname: nick, remaining: 0, gravity: (await this.pricingService.getConfig()).registrationGravity })
}
await this.recordLogin(user._id.toString(), ip)
if (isNew) {
const amount = (await this.pricingService.getConfig()).registrationGravity
await this.logTransaction(user._id.toString(), amount, 'registration', '注册赠送引力值')
}
return { ...this.generateAuthResponse(user), isNew, hasPassword: !!user.password }
}
@@ -211,6 +235,8 @@ export class UserService {
const nick = email.split('@')[0]
const hashed = await bcrypt.hash(password, 10)
const user = await this.userModel.create({ email, nickname: nick, password: hashed, remaining: 0, gravity: (await this.pricingService.getConfig()).registrationGravity })
const amount = (await this.pricingService.getConfig()).registrationGravity
await this.logTransaction(user._id.toString(), amount, 'registration', '注册赠送引力值')
await this.recordLogin(user._id.toString(), ip)
return this.generateAuthResponse(user)
}
@@ -265,6 +291,15 @@ export class UserService {
await user.save()
}
async getGravityTransactions(userId: string, page = 1, limit = 20) {
const skip = (page - 1) * limit
const [items, total] = await Promise.all([
this.gravityTxModel.find({ userId }).sort({ createdAt: -1 }).skip(skip).limit(limit).exec(),
this.gravityTxModel.countDocuments({ userId }),
])
return { items, total, page, limit, totalPages: Math.ceil(total / limit) }
}
private generateAuthResponse(user: UserDocument) {
const payload = { userId: user._id.toString(), phone: user.phone || '', role: user.role || 'user' }
return {
+63 -1
View File
@@ -1,7 +1,26 @@
import { test, expect } from '@playwright/test'
import * as fs from 'fs'
import * as path from 'path'
import * as jwt from 'jsonwebtoken'
const BASE = 'http://localhost:3006/api'
function getJwtSecret(): string {
const envPath = path.resolve(__dirname, '..', '.env')
const envContent = fs.readFileSync(envPath, 'utf8')
const match = envContent.match(/^JWT_SECRET=(.+)$/m)
return match ? match[1].trim() : 'test-jwt-secret-for-e2e-tests'
}
function signToken(payload: object): string {
return jwt.sign(payload, getJwtSecret(), { expiresIn: '1h' })
}
const testUserId = '000000000000000000000001'
const testAdminId = '000000000000000000000002'
const userToken = signToken({ userId: testUserId, phone: '13800138000', role: 'user' })
const adminToken = signToken({ userId: testAdminId, phone: '13800138001', role: 'admin' })
test.describe('Backend API (Playwright)', () => {
test('GET /api/user/info returns 401 without token', async ({ request }) => {
const res = await request.get(`${BASE}/user/info`)
@@ -12,7 +31,7 @@ test.describe('Backend API (Playwright)', () => {
const res = await request.post(`${BASE}/user/send-code`, {
data: { phone: '13800138000' },
})
expect(res.status()).toBe(201)
expect(res.status()).toBe(200)
const body = await res.json()
expect(body.message).toBe('验证码已发送')
})
@@ -45,4 +64,47 @@ test.describe('Backend API (Playwright)', () => {
const res = await request.get(`${BASE}/admin/check`)
expect(res.status()).toBe(401)
})
// --- Feedback API ---
test('POST /api/feedback returns 401 without token', async ({ request }) => {
const res = await request.post(`${BASE}/feedback`, {
data: { type: 'suggestion', content: 'test feedback' },
})
expect(res.status()).toBe(401)
})
test('POST /api/feedback returns 400 with empty content', async ({ request }) => {
const res = await request.post(`${BASE}/feedback`, {
data: { content: '' },
headers: { Authorization: `Bearer ${userToken}` },
})
expect(res.status()).toBe(400)
})
test('POST /api/feedback returns 201 with valid data', async ({ request }) => {
const res = await request.post(`${BASE}/feedback`, {
data: { type: 'bug', content: 'Playwright浏览器端测试提交的问题反馈', contact: 'test@test.com' },
headers: { Authorization: `Bearer ${userToken}` },
})
expect(res.status()).toBe(201)
})
test('GET /api/feedback returns 403 for non-admin', async ({ request }) => {
const res = await request.get(`${BASE}/feedback`, {
headers: { Authorization: `Bearer ${userToken}` },
})
expect(res.status()).toBe(403)
})
test('GET /api/feedback returns 200 for admin', async ({ request }) => {
const res = await request.get(`${BASE}/feedback`, {
headers: { Authorization: `Bearer ${adminToken}` },
})
expect(res.status()).toBe(200)
const body = await res.json()
expect(body.items).toBeDefined()
expect(Array.isArray(body.items)).toBe(true)
expect(body.total).toBeGreaterThanOrEqual(0)
})
})
+4 -2
View File
@@ -1,6 +1,6 @@
# 职引 - 部署文档
> **最后更新**: 2026-06-21
> **最后更新**: 2026-07-04 12:51
> **生产环境**: 已部署(服务器已购 + 域名已配)
## 目录
@@ -227,7 +227,7 @@ node scripts/upload-mp.js
```
### 版本号
当前线上版本:**1.0.17**git tag v1.0.16,脚本自动末位自增 → 上传版本 1.0.17
当前线上版本:**1.0.22**小程序上传版本,git tag v1.0.21 + 脚本末位自增 1
---
@@ -255,3 +255,5 @@ node scripts/upload-mp.js
| 2026-06-09 | 更新生产域名:zhiyinwx.yzrcloud.cnAPI :3006)、zhiyin.yzrcloud.cnH5 静态目录) | 小之 |
| 2026-06-21 | 更新部署版本至 v1.0.16;小程序上传工具使用 git tag 自动获取版本号 | 小之 |
| 2026-06-21 | v4.8 SEO + 分享全面优化:部署新增 robots.txt、sitemap.xml、static/ 目录;版本号自动注入(Vite define);13 页面微信分享全部开启;上传脚本版本号末位自增 1 | AI |
| 2026-07-04 | v4.10 引力值变动记录系统 + 前端 401/错误处理完善;v1.0.21 发布;H5 + 小程序全量部署 | AI |
| 2026-07-04 | ASR 语音识别 AAC→WAV 转换修复 + share.vue 分享记录去重修复;后端 + H5 + 小程序 v1.0.22 部署 | AI |
+6 -4
View File
@@ -1,8 +1,8 @@
# 职引 · 完整功能清单 v4.7
# 职引 · 完整功能清单 v4.10
> **版本**: v4.7
> **日期**: 2026-06-21
> **状态**: Phase 1.5 按量购买引力值 + 全量生产部署
> **版本**: v4.10
> **日期**: 2026-07-04
> **状态**: Phase 1.5 引力值变动记录 + 前端错误处理完善
> **定位**: 应届生/实习生 AI 面试教练
---
@@ -86,6 +86,7 @@
| 简历管理 | ✅ 完成 | 多份简历 CRUD + AI 分析 |
| 面试复盘 | ✅ 完成 | 音频上传 → ASR → AI 评析 → 口语分析 |
| 会员中心 | ✅ 完成 | 套餐对比 + 支付 |
| 引力值明细 | ✅ 完成 | 分页查看引力值变动记录(注册/消耗/购买/补给/迁移) |
---
@@ -193,3 +194,4 @@
| 2026-06-16 | **v4.2**:新增面试复盘功能(whisper.cpp ASR + AI 评析 + 口语分析) | AI |
| 2026-06-17 | **v4.3**:新增 AI 择业顾问功能(专业分析 + 岗位匹配 + 多轮对话) | AI |
| 2026-06-21 | **v4.7**:按量购买引力值重构(¥5/份取代月订阅);微信小程序剪贴板购买链路;客服按钮;管理后台全面完善;生产环境全量部署上线 | AI |
| 2026-07-04 | **v4.10**:引力值变动记录系统(GravityTransaction schema + 全埋点 + 用户端分页明细弹窗);前端 401/错误处理完善;面试创建 201 兼容;AI 错误友好提示 | AI |
+10 -6
View File
@@ -1,8 +1,8 @@
# 职引项目 · 状态报告 v4.9
# 职引项目 · 状态报告 v4.10
> **项目版本**: v4.9
> **更新时间**: 2026-06-22
> **项目状态**: ✅ Mongoose 8 兼容修复 + v1.0.17 发布
> **项目版本**: v4.10
> **更新时间**: 2026-07-04
> **项目状态**: ✅ 引力值变动记录系统 + 前端 401/错误处理完善 + v1.0.21 发布
---
@@ -16,7 +16,7 @@
| 定价 | 免费版 / 按量购买引力值(¥5/份) |
| AI 模型 | DeepSeek V4-Flash(主) + Step-3.5-Flash(备) |
| ASR | whisper.cpp(本地部署,tiny/base 模型,无需 API Key |
| 后端模块 | user, interview, resume, member, payment, positions, ai, analyze, upload, admin, email, progress, contribution, daily-question, schedule, interview-review, career-advice |
| 后端模块 | user, interview, resume, member, payment, positions, ai, analyze, upload, admin, email, progress, contribution, daily-question, schedule, interview-review, career-advice, gravity-transaction |
---
@@ -29,6 +29,7 @@
| AI 面试模拟 | **95%** | 多轮对话 + 评分 + 报告 + 进度追踪 |
| 简历诊断/优化 | **95%** | 文件上传 + AI 分析 + 下载 |
| 支付系统(微信) | **95%** | API v3 完整对接,含真实证书,H5 扫码支付可用 |
| 引力值变动记录 | **100%** | 全量日志(注册/消耗/购买/补给/迁移)+ 前端分页查看 |
| 会员系统 | **100%** | 改为按量购买引力值体系(¥5/份),免费版注册送 5 引力值 |
| 护城河 P0-P5 | **100%** | AI 结构化 / 行业基准 / VIP 过期 / 分享卡片 / 打卡积分 / 岗位匹配 |
| 面试复盘 | **100%** | 音频上传 → whisper.cpp ASR → AI 评析 → 口语分析 |
@@ -182,6 +183,7 @@
| `interview-review` | controller + service + schema + asr service | ✅ | 面试复盘:音频 ASR + AI 评析 + 口语分析 |
| `career-advice` | controller + service + module | ✅ | AI 择业顾问:专业分析 + 岗位匹配 + 多轮对话 |
| `admin` | controller + module | ✅ | 管理后台 |
| `gravity-transaction` | schema (shared) | ✅ | 引力值变动全量日志:注册/面试消耗/购买/月度补给/迁移等 |
| `email` | module + service | ✅ | 邮件发送 |
| `upload` | controller + module | ✅ | 文件上传 |
@@ -196,7 +198,7 @@
| 面试模拟 | interview/interview | ✅ 多轮对话 + 计时 |
| 面试报告 | report/report | ✅ 评分/分析/全文回放/分享卡片 |
| 历史记录 | history/history | ✅ 筛选/统计 |
| 个人中心 | user/user | ✅ 引力值卡片 + 信息/统计/管理员入口 + 面试复盘入口 + 择业顾问入口 + 客服按钮 |
| 个人中心 | user/user | ✅ 引力值卡片(含明细弹窗)+ 信息/统计/管理员入口 + 面试复盘入口 + 择业顾问入口 + 客服按钮 |
| 会员中心 | member/member | ✅ 引力值按量购买(H5 扫码支付/小程序剪贴板链路) |
| 进步轨迹 | progress/progress | ✅ 雷达图 + 打卡日历 |
| 面经贡献 | contribute/contribute | ✅ 表单提交 |
@@ -224,6 +226,8 @@
| 日期 | 版本 | 变更内容 | 操作者 |
|------|------|----------|--------|
| 2026-07-04 | **v4.11** | **ASR 语音识别修复**TTS controller AAC→WAV 转换,解决小程序录音格式不兼容 whisper);**分享记录去重**share.vue loadData 有缓存时不再创建新分享);**引力值明细**后端部署;**用户端 401/错误处理**完善 | AI |
| 2026-07-04 | **v4.10** | **引力值变动记录系统**:新建 GravityTransaction schema + 全量日志埋点(注册/面试消耗/购买/月度补给/迁移/套餐设置等);新增 `GET /user/gravity-transactions` 接口;用户端「引力值明细」弹窗(分页);前端 401/错误处理完善(checkAuth 全局检测);面试创建 201 状态码兼容 fix;AI 错误友好提示 | AI |
| 2026-06-22 | **v4.9** | **Mongoose 8 兼容修复**pre-save hook 回调→async);v1.0.17 tag 发布;测试账号 test@yzrcloud.cn 重建 | AI |
| 2026-06-21 | **v4.8** | **SEO 全量优化**canonical URL、robots.txt、sitemap.xml、结构化数据);**微信分享全面开启**(13 个页面 onShareAppMessage + onShareTimeline);**版本号自动注入**Vite define __APP_VERSION__);**导航栏/Tab标题关键词优化**;manifest 描述更新;页面描述统一增强 | AI |
| 2026-06-21 | v4.7 | 按量购买引力值体系重构(¥5/份取代月订阅);member.vue 完全重写;微信小程序剪贴板购买链路;客服按钮;管理后台字段全面完善;代码清理;测试数据清理;后端/H5/小程序全量部署上线 | AI |
+12 -1
View File
@@ -16,6 +16,17 @@
"urlCheck": false,
"__usePrivacyCheck__": true
},
"usingComponents": true
"usingComponents": true,
"plugins": {
"WechatSI": {
"version": "0.3.6",
"provider": "wx069ba97219f66d99"
}
},
"permission": {
"scope.record": {
"desc": "用于语音输入回答面试问题"
}
}
}
}
+2 -1
View File
@@ -19,7 +19,8 @@
{ "path": "pages/privacy/privacy", "style": { "navigationBarTitleText": "隐私政策" } },
{ "path": "pages/share/share", "style": { "navigationBarTitleText": "我的分享" } },
{ "path": "pages/review/review", "style": { "navigationBarTitleText": "面试复盘分析" } },
{ "path": "pages/career/career", "style": { "navigationBarTitleText": "AI择业顾问" } }
{ "path": "pages/career/career", "style": { "navigationBarTitleText": "AI择业顾问" } },
{ "path": "pages/feedback/feedback", "style": { "navigationBarTitleText": "意见反馈" } }
],
"tabBar": {
"color": "#999999",
+113
View File
@@ -0,0 +1,113 @@
<template>
<view class="page">
<view class="form-card">
<text class="section-title">反馈类型</text>
<view class="type-row">
<view class="type-option" :class="{ active: type === 'bug' }" @click="type = 'bug'">
<text class="type-icon">🐛</text>
<text class="type-label">问题反馈</text>
</view>
<view class="type-option" :class="{ active: type === 'suggestion' }" @click="type = 'suggestion'">
<text class="type-icon">💡</text>
<text class="type-label">改进建议</text>
</view>
<view class="type-option" :class="{ active: type === 'praise' }" @click="type = 'praise'">
<text class="type-icon">👍</text>
<text class="type-label">点赞鼓励</text>
</view>
</view>
</view>
<view class="form-card">
<text class="section-title">反馈内容 <text class="required">*</text></text>
<textarea class="content-input" v-model="content" placeholder="请详细描述您的问题或建议,这将帮助我们持续改进产品..." :maxlength="1000" :auto-height="true" />
<text class="char-count">{{ content.length }}/1000</text>
</view>
<view class="form-card">
<text class="section-title">联系方式选填</text>
<input class="contact-input" v-model="contact" placeholder="手机号或微信号,方便我们联系您" />
</view>
<button class="submit-btn" :class="{ disabled: !content.trim() || submitting }" @click="submitFeedback" :disabled="submitting">
{{ submitting ? '提交中...' : '提交反馈' }}
</button>
<view class="toast-success" v-if="submitted">
<text class="toast-icon"></text>
<text class="toast-text">感谢您的反馈我们会认真处理</text>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { api } from '../../config'
const type = ref('suggestion')
const content = ref('')
const contact = ref('')
const submitting = ref(false)
const submitted = ref(false)
const submitFeedback = async () => {
if (!content.value.trim() || submitting.value) return
submitting.value = true
try {
const token = uni.getStorageSync('token')
const res = await uni.request({
url: api('/feedback'),
method: 'POST',
header: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' },
data: { type: type.value, content: content.value.trim(), contact: contact.value.trim() },
})
if (res.statusCode >= 200 && res.statusCode < 300) {
submitted.value = true
} else {
uni.showToast({ title: res.data?.message || '提交失败', icon: 'none' })
}
} catch {
uni.showToast({ title: '提交失败,请重试', icon: 'none' })
} finally {
submitting.value = false
}
}
// #ifdef MP-WEIXIN
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
onShareAppMessage(() => ({ title: '意见反馈 - 职引', path: '/pages/feedback/feedback' }))
onShareTimeline(() => ({ title: '意见反馈 - 职引' }))
// #endif
</script>
<style scoped>
.page { background: var(--color-bg); min-height: 100vh; padding: 32rpx; }
.form-card { background: #FFF; border-radius: var(--radius-lg); padding: 28rpx 32rpx; margin-bottom: 20rpx; }
.section-title { font-size: 26rpx; font-weight: 600; color: var(--color-text); display: block; margin-bottom: 20rpx; }
.required { color: #EF4444; }
.type-row { display: flex; gap: 16rpx; }
.type-option {
flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8rpx;
padding: 20rpx 12rpx; border-radius: var(--radius-md); border: 2rpx solid var(--color-border);
transition: all 0.2s;
}
.type-option.active { border-color: var(--color-primary); background: #EEF2FF; }
.type-icon { font-size: 36rpx; }
.type-label { font-size: 22rpx; color: var(--color-text-secondary); }
.type-option.active .type-label { color: var(--color-primary); font-weight: 600; }
.content-input { width: 100%; font-size: 26rpx; color: var(--color-text); line-height: 1.7; min-height: 200rpx; padding: 0; }
.char-count { text-align: right; font-size: 20rpx; color: var(--color-text-tertiary); margin-top: 8rpx; }
.contact-input { width: 100%; font-size: 26rpx; color: var(--color-text); padding: 8rpx 0; }
.submit-btn {
width: 100%; height: 88rpx; line-height: 88rpx;
background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-mid));
color: #FFF; border-radius: var(--radius-md); font-size: 28rpx; font-weight: 600; border: none;
}
.submit-btn.disabled { background: var(--color-border); }
.toast-success {
margin-top: 32rpx; background: #ECFDF5; border-radius: var(--radius-md);
padding: 24rpx; display: flex; align-items: center; gap: 12rpx;
}
.toast-icon { font-size: 32rpx; }
.toast-text { font-size: 26rpx; color: #065F46; line-height: 1.5; }
</style>
+116 -62
View File
@@ -38,9 +38,14 @@
<!-- Chat area (both modes) -->
<scroll-view class="chat-area" scroll-y :scroll-into-view="scrollToId" :scroll-with-animation="true" :class="{ 'chat-compact': avatarMode }">
<view v-for="(msg, idx) in messages" :key="idx" :id="'msg-' + idx" class="msg-row" :class="msg.role">
<view class="msg-bubble" :class="msg.role">
<text>{{ msg.content }}</text>
<view v-if="msg.role === 'ai'" class="msg-avatar ai-avatar">🤖</view>
<view class="msg-body">
<view class="msg-label">{{ msg.role === 'ai' ? '面试官' : '我' }}</view>
<view class="msg-bubble" :class="msg.role">
<text>{{ msg.content }}</text>
</view>
</view>
<view v-if="msg.role === 'user'" class="msg-avatar user-avatar">👤</view>
</view>
<view class="msg-row ai" v-if="aiLoading">
@@ -55,14 +60,18 @@
</scroll-view>
<view class="input-bar" v-if="!isComplete">
<view class="mic-btn" :class="{ recording: isRecording }" @touchstart="startRecord" @touchend="stopRecord" @touchcancel="stopRecord" @mousedown="startRecord" @mouseup="stopRecord" @mouseleave="stopRecord">
<text class="mic-icon">🎤</text>
<view class="mic-wrap">
<view class="mic-btn" :class="{ recording: isRecording }" @click="toggleRecord">
<text class="mic-icon">{{ isRecording ? '🔴' : '🎤' }}</text>
<text class="mic-label" v-if="isRecording">{{ recordingDuration }}s</text>
</view>
<text class="mic-hint" v-if="isRecording">点击结束</text>
</view>
<view class="input-box">
<textarea class="input-area" v-model="inputText" placeholder="输入你的回答..." :auto-height="true" :maxlength="2000" :disabled="aiLoading" @confirm="sendAnswer" />
<textarea class="input-area" v-model="inputText" placeholder="点击🎤开始录音或输入回答..." :auto-height="true" :maxlength="2000" :disabled="aiLoading || isRecording" @confirm="sendAnswer" />
</view>
<view class="send-btn" :class="{ disabled: (!inputText.trim() && !isRecording) || aiLoading }" @click="sendAnswer">
<text class="send-icon">{{ isRecording ? '◉' : '➤' }}</text>
<view class="send-btn" :class="{ disabled: !inputText.trim() || isRecording || aiLoading }" @click="sendAnswer">
<text class="send-icon"></text>
</view>
</view>
@@ -146,11 +155,59 @@ const aiAmplitudeData = ref([])
const isSpeaking = ref(false)
const dhRef = ref(null)
const isRecording = ref(false)
let recorder = null
const recordingDuration = ref(0)
let manager = null
let recordTimer = null
function initRecorder() {
// #ifdef MP-WEIXIN
if (manager) return
try {
const plugin = requirePlugin('WechatSI')
manager = plugin.getRecordRecognitionManager()
manager.onStart = () => {
console.log('[WechatSI] start')
isRecording.value = true
inputText.value = ''
recordingDuration.value = 0
recordTimer = setInterval(() => { recordingDuration.value++ }, 1000)
}
manager.onRecognize = (res) => {
if (res?.result?.trim()) inputText.value = res.result.trim()
}
manager.onStop = (res) => {
isRecording.value = false
recordingDuration.value = 0
if (recordTimer) { clearInterval(recordTimer); recordTimer = null }
const text = res?.result?.trim()
if (text && text.length >= 2) {
inputText.value = text
sendAnswer()
} else if (text && text.length === 1) {
uni.showToast({ title: '语音过短,请重试', icon: 'none' })
} else if (!text) {
uni.showToast({ title: '未检测到语音,请重试', icon: 'none' })
}
}
manager.onError = (res) => {
console.error('[WechatSI] error:', JSON.stringify(res))
isRecording.value = false
recordingDuration.value = 0
if (recordTimer) { clearInterval(recordTimer); recordTimer = null }
const msg = res?.errMsg?.includes('permission') ? '请允许录音权限' : '语音识别失败,请重试'
uni.showToast({ title: msg, icon: 'none' })
manager = null
}
} catch (e) {
console.error('WechatSI plugin init failed:', e)
manager = null
}
// #endif
}
let timerSeconds = 0
let timerInterval = null
let MAX_QUESTIONS = 10
const progressPercent = computed(() => Math.min((answeredCount.value / MAX_QUESTIONS) * 100, 100))
const formatTime = computed(() => {
@@ -163,7 +220,7 @@ onLoad((options) => {
if (options?.position) {
const pos = decodeURIComponent(options.position)
position.value = pos
messages.value = [{ role: 'ai', content: `你好!我是你的专属 ${pos} 面试官准备好了就开始吧!` }]
messages.value = [{ role: 'ai', content: `你好!我是你的专属 ${pos} 面试官准备好后发送任意消息,我会立即开始面试并给出第一个问题。` }]
}
})
@@ -185,18 +242,15 @@ const loadPositions = async () => {
const selectPosition = (pos) => {
position.value = pos.name
showPositionPicker.value = false
messages.value = [{ role: 'ai', content: `你好!我是你的专属 ${pos.name} 面试官准备好了就开始吧!` }]
startInterview()
messages.value = [{ role: 'ai', content: `你好!我是你的专属 ${pos.name} 面试官准备好后发送任意消息,我会立即开始面试并给出第一个问题。` }]
}
onMounted(() => {
initRecorder()
timerInterval = setInterval(() => timerSeconds++, 1000)
if (!position.value) {
// 未传入岗位,展示选择弹窗(无论是否登录)
loadPositions()
showPositionPicker.value = true
} else if (token()) {
startInterview()
}
})
@@ -226,9 +280,13 @@ const startInterview = async () => {
})
if (res.statusCode >= 200 && res.statusCode < 300 && res.data) {
interviewId.value = res.data.id
messages.value = res.data.messages || messages.value
answeredCount.value = res.data.questionCount || 0
if (res.data.totalQuestions) MAX_QUESTIONS = res.data.totalQuestions
// 将后端返回的 AI 消息追加入对话,不替换已有消息(保留用户已发的准备消息)
if (res.data.messages?.length) {
const aiMsgs = res.data.messages.filter(m => m.role === 'ai')
if (aiMsgs.length > 0) messages.value.push(...aiMsgs)
}
// Speak first question in avatar mode
if (avatarMode.value && res.data.messages?.length) {
const last = res.data.messages[res.data.messages.length - 1]
@@ -255,14 +313,20 @@ const startInterview = async () => {
}
const sendAnswer = async () => {
if (!inputText.value.trim() || aiLoading.value || isComplete.value) return
if (!inputText.value.trim() || aiLoading.value || isRecording.value || isComplete.value) return
if (!token()) { checkLogin(); return }
const answer = inputText.value.trim()
// 首次发送:不把用户消息当答案提交,而是先创建面试获取第一个问题
if (!interviewId.value) {
messages.value.push({ role: 'user', content: answer })
inputText.value = ''
scrollToBottom()
await startInterview()
if (!interviewId.value) return // creation failed, don't discard answer
// startInterview 成功后已经把第一个问题追加到 messages 了
return
}
const answer = inputText.value.trim()
messages.value.push({ role: 'user', content: answer })
inputText.value = ''
scrollToBottom()
@@ -353,51 +417,28 @@ const confirmExit = () => {
})
}
function startRecord() {
function toggleRecord() {
if (aiLoading.value || isComplete.value) return
// #ifdef MP-WEIXIN
isRecording.value = true
recorder = uni.getRecorderManager()
recorder.onStart(() => {})
recorder.onError(() => { isRecording.value = false; uni.showToast({ title: '录音失败', icon: 'none' }) })
recorder.onStop(async (res) => {
if (!res.tempFilePath) return
const audioPath = res.tempFilePath
try {
const uploadRes = await uni.uploadFile({
url: api(API_ENDPOINTS.TTS.ASR),
filePath: audioPath,
name: 'audio',
header: { 'Authorization': `Bearer ${token()}` },
})
if (uploadRes.statusCode === 200 && uploadRes.data) {
const data = typeof uploadRes.data === 'string' ? JSON.parse(uploadRes.data) : uploadRes.data
if (data.text) {
inputText.value = data.text
uni.vibrateShort({ type: 'light' })
return
}
} else if (checkAuth(uploadRes)) {
return
}
} catch (e) {
console.error('[ASR] upload error:', e?.message || e)
if (!isRecording.value) {
if (!manager) initRecorder()
if (!manager) {
uni.showToast({ title: '语音功能初始化失败', icon: 'none' })
return
}
uni.showToast({ title: '语音识别失败,请手动输入', icon: 'none' })
})
recorder.start({ format: 'aac', sampleRate: 22050, numberOfChannels: 1, encodeBitRate: 16000 })
uni.vibrateShort({ type: 'medium' })
manager.start({ lang: 'zh_CN', duration: 60000 })
uni.vibrateShort({ type: 'medium' })
return
}
if (!manager) { isRecording.value = false; return }
if (recordTimer) { clearInterval(recordTimer); recordTimer = null }
recordingDuration.value = 0
manager.stop()
// #endif
// #ifndef MP-WEIXIN
uni.showToast({ title: '语音输入仅支持小程序', icon: 'none' })
// #endif
}
function stopRecord() {
if (!recorder || !isRecording.value) return
isRecording.value = false
recorder.stop()
}
</script>
<style scoped>
@@ -434,11 +475,20 @@ function stopRecord() {
/* Chat */
.chat-area { flex: 1; padding: 24rpx 20rpx; overflow-y: auto; }
.chat-compact { max-height: 40vh; }
.msg-row { display: flex; margin-bottom: 24rpx; }
.msg-row { display: flex; margin-bottom: 32rpx; align-items: flex-start; gap: 12rpx; }
.msg-row.ai { justify-content: flex-start; }
.msg-row.user { justify-content: flex-end; }
.msg-bubble { max-width: 560rpx; padding: 20rpx 24rpx; line-height: 1.7; font-size: 26rpx; }
.msg-avatar { width: 48rpx; height: 48rpx; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24rpx; flex-shrink: 0; }
.ai-avatar { background: #EEF2FF; }
.user-avatar { background: #FEF3C7; }
.msg-body { max-width: 70%; display: flex; flex-direction: column; gap: 6rpx; }
.msg-row.user .msg-body { align-items: flex-end; }
.msg-label { font-size: 20rpx; color: #9CA3AF; padding: 0 8rpx; }
.msg-bubble { padding: 20rpx 24rpx; line-height: 1.7; font-size: 26rpx; word-break: break-word; }
.msg-bubble.ai {
background: #FFFFFF; color: var(--color-text);
border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
@@ -471,14 +521,18 @@ function stopRecord() {
}
.input-box { flex: 1; background: var(--color-bg); border-radius: var(--radius-md); padding: 12rpx 20rpx; }
.input-area { width: 100%; font-size: 26rpx; color: var(--color-text); max-height: 160rpx; line-height: 1.5; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 4rpx; flex-shrink: 0; }
.mic-btn {
width: 64rpx; height: 64rpx; border-radius: 50%; background: #F3F4F6;
display: flex; align-items: center; justify-content: center; flex-shrink: 0;
transition: all 0.2s;
width: 80rpx; height: 80rpx; border-radius: 50%; background: #F3F4F6;
display: flex; flex-direction: column; align-items: center; justify-content: center;
transition: all 0.2s; gap: 2rpx;
}
.mic-btn:active { transform: scale(0.9); }
.mic-btn.recording { background: #FEE2E2; animation: mic-pulse 1s infinite; }
.mic-icon { font-size: 28rpx; }
.mic-icon { font-size: 28rpx; line-height: 1; }
.mic-label { font-size: 16rpx; color: #9CA3AF; line-height: 1; }
.mic-btn.recording .mic-label { color: #EF4444; font-weight: 600; }
.mic-hint { font-size: 18rpx; color: #EF4444; font-weight: 500; line-height: 1; white-space: nowrap; }
@keyframes mic-pulse {
0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
50% { box-shadow: 0 0 0 16rpx rgba(239, 68, 68, 0); }
+15 -13
View File
@@ -178,20 +178,22 @@ async function loadData() {
if (!token) { uni.showToast({ title: '请先登录', icon: 'none' }); return }
const header = { Authorization: `Bearer ${token}` }
// 先创建分享链接,缓存下来供复制使用
try {
const res = await uni.request({
url: api('/share/create'), method: 'POST',
data: { type: 'app', title: '我在AI磁场·职引练习面试', description: 'AI模拟面试+简历优化,快来一起提升吧' },
header,
})
if (res.statusCode >= 200 && res.statusCode < 300) {
const data = res.data?.data || res.data
if (data.shareCode) {
shareUrlCached.value = `https://zhiyinwx.yzrcloud.cn/api/share/${data.shareCode}`
// 仅在无缓存分享链接时创建新分享记录
if (!shareUrlCached.value) {
try {
const res = await uni.request({
url: api('/share/create'), method: 'POST',
data: { type: 'app', title: '我在AI磁场·职引练习面试', description: 'AI模拟面试+简历优化,快来一起提升吧' },
header,
})
if (res.statusCode >= 200 && res.statusCode < 300) {
const data = res.data?.data || res.data
if (data.shareCode) {
shareUrlCached.value = `https://zhiyinwx.yzrcloud.cn/api/share/${data.shareCode}`
}
}
}
} catch (e) { /* create share is best-effort */ }
} catch (e) { /* create share is best-effort */ }
}
try {
const [statsRes, recordsRes, visitorsRes] = await Promise.all([
+88 -2
View File
@@ -53,7 +53,8 @@
<view class="gravity-actions">
<text class="gravity-btn share" @click="goSharePage">分享得引力值</text>
<text class="gravity-btn contribute" @click="goContributePage">贡献面经</text>
<text class="gravity-btn h5buy" @click="goH5Buy">购买引力值</text>
<text class="gravity-btn h5buy" @click="goH5Buy">购买引力值</text>
<text class="gravity-btn detail" @click="showGravityDetail = true">明细</text>
</view>
</view>
</view>
@@ -103,6 +104,11 @@
</button>
</view>
<!-- #endif -->
<view class="menu-item" @click="goFeedback">
<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" @click="goAbout">
<view class="menu-icon-wrap wrap-gray"><text class="menu-icon"></text></view>
<text class="menu-text">关于</text>
@@ -158,11 +164,40 @@
<text class="modal-close" @click="showGetGravityModal = false">关闭</text>
</view>
</view>
<!-- 引力值明细 -->
<view class="modal-overlay" v-if="showGravityDetail" @click="showGravityDetail = false">
<view class="modal-content detail-content" @click.stop>
<text class="modal-title">引力值明细</text>
<text class="modal-hint">购买消耗补给的引力值变动记录</text>
<scroll-view class="detail-list" scroll-y>
<view v-if="gravityTxs.length === 0" class="detail-empty">暂无记录</view>
<view v-for="tx in gravityTxs" :key="tx._id" class="detail-item">
<view class="detail-item-left">
<text class="detail-item-desc">{{ tx.description }}</text>
<text class="detail-item-time">{{ formatTime(tx.createdAt) }}</text>
</view>
<view class="detail-item-right">
<text :class="['detail-item-amount', tx.amount > 0 ? 'amount-positive' : 'amount-negative']">
{{ tx.amount > 0 ? '+' : '' }}{{ tx.amount }}
</text>
<text class="detail-item-balance">余额 {{ tx.balance }}</text>
</view>
</view>
</scroll-view>
<view v-if="gravityTxTotalPages > 1" class="detail-pagination">
<text class="detail-page-btn" @click="loadGravityTxs(gravityTxPage - 1)" v-if="gravityTxPage > 1">上一页</text>
<text class="detail-page-info">{{ gravityTxPage }} / {{ gravityTxTotalPages }}</text>
<text class="detail-page-btn" @click="loadGravityTxs(gravityTxPage + 1)" v-if="gravityTxPage < gravityTxTotalPages">下一页</text>
</view>
<text class="modal-close" @click="showGravityDetail = false">关闭</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { ref, computed, watch, onMounted } from 'vue'
// #ifdef MP-WEIXIN
import { onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
// #endif
@@ -290,6 +325,36 @@ const goH5Buy = () => {
uni.navigateTo({ url: '/pages/member/member' })
}
// 引力值明细
const showGravityDetail = ref(false)
const gravityTxs = ref([])
const gravityTxPage = ref(1)
const gravityTxTotalPages = ref(1)
const loadGravityTxs = async (page = 1) => {
try {
const res = await uni.request({
url: api(`/user/gravity-transactions?page=${page}&limit=20`),
method: 'GET',
header: { Authorization: `Bearer ${token.value}` },
})
if (res.statusCode >= 200 && res.statusCode < 300 && res.data) {
gravityTxs.value = res.data.items || []
gravityTxPage.value = res.data.page || 1
gravityTxTotalPages.value = res.data.totalPages || 1
} else if (checkAuth(res)) {
return
}
} catch(e) { /* silent */ }
}
const formatTime = (t) => {
if (!t) return ''
const d = new Date(t)
return `${d.getMonth() + 1}/${d.getDate()} ${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`
}
// 点击明细时打开弹窗并加载数据
watch(showGravityDetail, (v) => { if (v) loadGravityTxs() })
const goCareer = () => uni.navigateTo({ url: '/pages/career/career' })
const goHistory = () => uni.switchTab({ url: '/pages/history/history' })
const goReviewReview = () => uni.navigateTo({ url: '/pages/review/review' })
@@ -298,6 +363,7 @@ const goResume = () => uni.navigateTo({ url: '/pages/resume/resume' })
const goSharePage = () => uni.navigateTo({ url: '/pages/share/share' })
const goContributePage = () => uni.navigateTo({ url: '/pages/contribute/contribute' })
const goAdmin = () => uni.navigateTo({ url: '/pages/admin/admin' })
const goFeedback = () => uni.navigateTo({ url: '/pages/feedback/feedback' })
const goAbout = () => uni.navigateTo({ url: '/pages/about/about' })
const doLogout = () => {
@@ -357,6 +423,7 @@ const doLogout = () => {
.gravity-btn.share { background: rgba(255,255,255,0.2); color: #FFFFFF; border: 2rpx solid rgba(255,255,255,0.3); }
.gravity-btn.h5buy { background: #FFFFFF; color: #667eea; }
.gravity-btn.contribute { background: rgba(255,255,255,0.15); color: #FFFFFF; border: 2rpx solid rgba(255,255,255,0.2); }
.gravity-btn.detail { background: rgba(255,255,255,0.15); color: #FFFFFF; border: 2rpx solid rgba(255,255,255,0.2); font-size: 22rpx; padding: 18rpx 16rpx; flex: 0.5; }
.gravity-btn:active { transform: scale(0.96); }
.menu-area { padding: 0 32rpx 32rpx; margin-top: 8rpx; }
@@ -404,4 +471,23 @@ const doLogout = () => {
.gp-method-name { font-size: 26rpx; font-weight: 600; color: var(--color-text); }
.gp-method-desc { font-size: 20rpx; color: #6B7280; line-height: 1.4; }
.gp-method-arrow { font-size: 32rpx; color: #D1D5DB; }
/* 引力值明细弹窗 */
.detail-content { width: 650rpx; max-height: 70vh; }
.detail-list { width: 100%; max-height: 500rpx; }
.detail-empty { text-align: center; padding: 40rpx 0; font-size: 24rpx; color: #9CA3AF; }
.detail-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 20rpx 0; border-bottom: 1rpx solid #F3F4F6; }
.detail-item:last-child { border-bottom: none; }
.detail-item-left { display: flex; flex-direction: column; gap: 4rpx; flex: 1; min-width: 0; }
.detail-item-desc { font-size: 26rpx; color: var(--color-text); font-weight: 500; }
.detail-item-time { font-size: 20rpx; color: #9CA3AF; }
.detail-item-amount { font-size: 30rpx; font-weight: 700; }
.detail-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4rpx; flex-shrink: 0; margin-left: 16rpx; }
.detail-item-balance { font-size: 20rpx; color: #9CA3AF; font-weight: 400; }
.amount-positive { color: #10B981; }
.amount-negative { color: #EF4444; }
.detail-pagination { display: flex; align-items: center; justify-content: center; gap: 24rpx; width: 100%; margin-top: 8rpx; }
.detail-page-btn { font-size: 24rpx; color: var(--color-primary); padding: 8rpx 16rpx; }
.detail-page-btn:active { opacity: 0.6; }
.detail-page-info { font-size: 24rpx; color: #6B7280; }
</style>