文件
huaqiapp/pages/consult/index.vue
linda ea2be7af8c style(ui): 图标整体放大并与页面比例协调
按 6 级尺寸阶梯统一放大图标,避免小而散、提升大气感:
- 底部导航 40 -> 48,容器 104 -> 116,标签 22 -> 23
- 首页快捷入口 40 -> 52,容器 96 -> 112、圆角 32 -> 36,标签 22 -> 24
- 首页品牌花标 40 -> 46,牌标容器 72 -> 84
- 今日心语 52 -> 62,提醒 38 -> 46
- 情绪选择 40 -> 50(容器 76),记录 30 -> 36,疗愈内容 34 -> 42
- 健康 Tab 26 -> 32(Tab 76 -> 84),建议项 34 -> 42(容器 84)
- 我的设置项 32 -> 40,头像 108 -> 116
- 备孕/关系/亲子勾选 20 -> 24(容器 40 -> 46),会员勾选 18 -> 22
- 咨询师头像 40 -> 50(容器 100),热线 34/36 -> 42,急救工具 44 -> 54
- 空状态与会员锁 72 -> 96,内容详情头图 64 -> 78,登录花瓣与输入框图标同步放大
- 大尺寸图标描边降至 1.6-1.8,小尺寸保持 1.8-2.4,线宽视觉统一
- 文档补充「图标尺寸阶梯」规范

验证:no_emoji 0 问题 / 契约 84 接口 0 偏差 / Vue 20-20 / SCSS 19-19
2026-11-06 10:25:41 +08:00

507 行
10 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="hq-page">
<view class="head">
<text class="head-title">心理咨询</text>
<text class="head-sub">一对一在线咨询 · 咨询师资质已审核</text>
</view>
<!-- 危机干预 -->
<view class="crisis" @tap="callHotline">
<hq-icon name="phone" :size="42" :stroke="1.7" color="#C9482F" style="margin-right: 20rpx" />
<view class="crisis-body">
<text class="crisis-title">如果此刻很难,请先联系热线</text>
<text class="crisis-sub">全国心理援助热线 12356 · 紧急情况请拨 120</text>
</view>
</view>
<!-- 咨询师 -->
<view class="hq-card counselor" v-for="item in counselors" :key="item.id">
<view class="counselor-head">
<view class="counselor-avatar">
<hq-icon :name="counselorIcon(item)" :size="50" :stroke="1.7" color="#C9482F" />
</view>
<view class="counselor-info">
<view class="counselor-name-row">
<text class="counselor-name">{{ item.name }}</text>
<text class="counselor-cert" v-if="item.cert_verify === 'passed'">已认证</text>
</view>
<text class="counselor-title">{{ item.title }}</text>
<view class="counselor-tags">
<text class="counselor-tag" v-for="t in item.tags" :key="t">{{ t }}</text>
</view>
</view>
</view>
<text class="counselor-intro">{{ item.intro }}</text>
<view class="modes">
<view
v-for="mode in modes"
:key="mode.key"
class="mode"
:class="{ 'mode-active': activeMode[item.id] === mode.key }"
@tap="setMode(item.id, mode.key)"
>
<text class="mode-text" :class="{ 'mode-text-active': activeMode[item.id] === mode.key }">
{{ mode.label }} ¥{{ priceOf(item, mode.key) }}
</text>
</view>
</view>
<view class="slots">
<text
v-for="slot in item.slots"
:key="slot"
class="slot"
:class="{ 'slot-active': activeSlot[item.id] === slot }"
@tap="setSlot(item.id, slot)"
>{{ slot }}</text>
</view>
<view class="hq-btn book" @tap="book(item)">
<text class="book-text">{{ booking === item.id ? '提交中…' : '预约咨询' }}</text>
</view>
</view>
<!-- 我的预约 -->
<view class="hq-section-head">
<text class="hq-section-title">我的预约</text>
<text class="hq-section-more">{{ orders.length }} 条</text>
</view>
<view class="hq-card" v-if="orders.length">
<view class="order" v-for="item in orders" :key="item.id">
<view class="order-body">
<text class="order-title">{{ item.counselor }} · {{ item.mode_text }}</text>
<text class="order-time">{{ item.start_time }}</text>
<text class="order-no">订单 {{ item.order_no }}</text>
</view>
<view class="order-right">
<text class="order-status">{{ item.status_text }}</text>
<text class="order-cancel" v-if="item.status !== 'finished' && item.status !== 'canceled'" @tap="cancel(item)">取消</text>
</view>
</view>
</view>
<view class="hq-card" v-else>
<view class="hq-empty">
<hq-icon name="chat-heart" :size="96" :stroke="1.6" color="#E6D3C9" />
<text class="hq-empty-text">还没有咨询预约</text>
</view>
</view>
<!-- 量表测评 -->
<view class="hq-section-head">
<text class="hq-section-title">心理测评</text>
<text class="hq-section-more">基础测评免费</text>
</view>
<view class="hq-card test" v-for="item in assessments" :key="'a' + item.id" @tap="startTest(item)">
<view class="test-body">
<text class="test-title">{{ item.title }}</text>
<text class="test-sub">{{ item.intro }}</text>
<text class="test-meta" v-if="item.last_date">上次 {{ item.last_date }} · {{ item.last_score }} 分</text>
</view>
<text class="test-action">开始 ›</text>
</view>
<view class="footer">
<text class="footer-text">咨询内容加密保存,仅你与咨询师可见;测评结果不等同诊断</text>
</view>
</view>
</template>
<script>
import api from '@/utils/api.js'
import store from '@/utils/store.js'
import { resolveIcon } from '@/utils/icons.js'
import hqIcon from '@/components/hq-icon/hq-icon.vue'
export default {
components: { hqIcon },
data() {
return {
counselors: [],
assessments: [],
orders: [],
modes: [
{ key: 'text', label: '文字' },
{ key: 'voice', label: '语音' },
{ key: 'video', label: '视频' }
],
activeMode: {},
activeSlot: {},
booking: 0
}
},
onShow() {
if (!store.token) {
uni.reLaunch({ url: '/pages/login/index' })
return
}
this.load()
},
methods: {
async load() {
try {
const data = await api.consultIndex()
this.counselors = (data && data.counselors) || []
this.assessments = (data && data.assessments) || []
this.orders = (data && data.orders) || []
this.counselors.forEach((c) => {
if (!this.activeMode[c.id]) this.activeMode[c.id] = 'text'
if (!this.activeSlot[c.id] && c.slots && c.slots.length) this.activeSlot[c.id] = c.slots[0]
})
} catch (e) {}
},
counselorIcon(item) {
return resolveIcon(item && (item.icon || item.emoji), 'flower')
},
priceOf(item, key) {
const price = (item.price && item.price[key]) || 0
return Math.round(price * (item.discount || 1))
},
setMode(id, key) {
this.activeMode[id] = key
},
setSlot(id, slot) {
this.activeSlot[id] = slot
},
async book(item) {
if (this.booking) return
const slot = this.activeSlot[item.id]
if (!slot) {
uni.showToast({ title: '请选择时间', icon: 'none' })
return
}
// slot 形如 "2026-11-08 10:00"
const startTime = slot
this.booking = item.id
try {
const res = await api.consultOrder({
counselor_id: item.id,
mode: this.activeMode[item.id],
start_time: startTime
})
uni.showModal({
title: '预约已提交',
content: res.order_no + '\n' + res.start_time + '\n金额 ¥' + res.amount + '\n' + (res.pay_hint || ''),
showCancel: false,
confirmColor: '#E8604C'
})
this.load()
} catch (e) {
} finally {
this.booking = 0
}
},
cancel(item) {
uni.showModal({
title: '取消预约',
content: '确定取消这次咨询预约吗?',
confirmColor: '#E8604C',
success: async (res) => {
if (!res.confirm) return
try {
await api.consultCancel(item.id)
this.load()
} catch (e) {}
}
})
},
startTest(item) {
uni.navigateTo({ url: '/pages/assessment/index?id=' + item.id })
},
callHotline() {
uni.makePhoneCall({
phoneNumber: '12356',
fail: () => uni.showToast({ title: '请拨打 12356', icon: 'none' })
})
}
}
}
</script>
<style lang="scss" scoped>
.head {
padding: 28rpx 0 20rpx;
}
.head-title {
font-size: 44rpx;
font-weight: 600;
color: #3E2C27;
}
.head-sub {
display: block;
margin-top: 8rpx;
font-size: 24rpx;
color: #8C7367;
}
.crisis {
display: flex;
align-items: center;
padding: 28rpx 30rpx;
border-radius: 28rpx;
background: linear-gradient(135deg, #FFF1E0 0%, #FFE3D3 100%);
border: 2rpx solid #F7DCC8;
margin-bottom: 20rpx;
}
.crisis-icon {
margin-right: 16rpx;
}
.crisis-body {
flex: 1;
display: flex;
flex-direction: column;
}
.crisis-title {
font-size: 26rpx;
color: #A8452F;
font-weight: 500;
}
.crisis-sub {
margin-top: 4rpx;
font-size: 22rpx;
color: #B5715B;
}
.counselor {
padding: 28rpx;
}
.counselor-head {
display: flex;
align-items: center;
}
.counselor-avatar {
width: 100rpx;
height: 100rpx;
border-radius: 30rpx;
background-color: #FFF1E9;
display: flex;
align-items: center;
justify-content: center;
}
.counselor-info {
flex: 1;
margin-left: 18rpx;
display: flex;
flex-direction: column;
}
.counselor-name-row {
display: flex;
align-items: center;
}
.counselor-name {
font-size: 30rpx;
font-weight: 600;
color: #3E2C27;
}
.counselor-cert {
margin-left: 10rpx;
font-size: 18rpx;
color: #2F7A4F;
background-color: #E9F5EC;
padding: 4rpx 12rpx;
border-radius: 999rpx;
}
.counselor-title {
margin-top: 4rpx;
font-size: 22rpx;
color: #8C7367;
}
.counselor-tags {
display: flex;
flex-wrap: wrap;
margin-top: 8rpx;
}
.counselor-tag {
font-size: 18rpx;
color: #B5715B;
background-color: #FFF4EE;
padding: 4rpx 12rpx;
border-radius: 999rpx;
margin-right: 8rpx;
}
.counselor-intro {
display: block;
margin-top: 14rpx;
font-size: 22rpx;
color: #8C7367;
line-height: 1.7;
}
.modes {
display: flex;
margin-top: 16rpx;
}
.mode {
flex: 1;
height: 68rpx;
border-radius: 20rpx;
background-color: #FFF9F5;
margin-right: 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.mode:last-child {
margin-right: 0;
}
.mode-active {
background: linear-gradient(135deg, #F58C7C 0%, #E8604C 100%);
}
.mode-text {
font-size: 22rpx;
color: #8C7367;
}
.mode-text-active {
color: #FFFFFF;
font-weight: 500;
}
.slots {
display: flex;
flex-wrap: wrap;
margin-top: 14rpx;
}
.slot {
font-size: 20rpx;
color: #8C7367;
background-color: #FFF4EE;
padding: 8rpx 16rpx;
border-radius: 999rpx;
margin: 0 10rpx 10rpx 0;
}
.slot-active {
background-color: #FFE6DC;
color: #C9482F;
font-weight: 600;
}
.book {
height: 80rpx;
margin-top: 8rpx;
}
.book-text {
font-size: 28rpx;
color: #FFFFFF;
}
.order {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16rpx 0;
}
.order + .order {
border-top: 2rpx solid #F5E7DF;
}
.order-body {
flex: 1;
display: flex;
flex-direction: column;
}
.order-title {
font-size: 26rpx;
color: #3E2C27;
}
.order-time {
margin-top: 4rpx;
font-size: 22rpx;
color: #8C7367;
}
.order-no {
margin-top: 2rpx;
font-size: 18rpx;
color: #C9B4AA;
}
.order-right {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.order-status {
font-size: 22rpx;
color: #E8604C;
}
.order-cancel {
margin-top: 8rpx;
font-size: 20rpx;
color: #C9B4AA;
}
.test {
display: flex;
align-items: center;
padding: 24rpx 26rpx;
}
.test-body {
flex: 1;
display: flex;
flex-direction: column;
}
.test-title {
font-size: 26rpx;
color: #3E2C27;
}
.test-sub {
margin-top: 4rpx;
font-size: 22rpx;
color: #8C7367;
}
.test-meta {
margin-top: 4rpx;
font-size: 18rpx;
color: #C9B4AA;
}
.test-action {
font-size: 22rpx;
color: #E8604C;
}
.footer {
padding: 16rpx 0 24rpx;
text-align: center;
}
.footer-text {
font-size: 20rpx;
color: #C9B4AA;
}
</style>