- 新增 utils/icons.js:61 个 24x24 线性图标(stroke 1.8,圆角端点), 纯 JS base64 编码生成 data URI,H5/App/小程序一致,任意尺寸不失真 - 新增 components/hq-icon/hq-icon.vue:尺寸/颜色/描边可配置, 并内置 resolveIcon() 兼容后端历史 emoji 字段(自动映射为矢量图标) - 18 个页面与组件全部替换:底部导航、首页快捷入口/心语/提醒、周期心情、 情绪 5 情绪与记录、我的设置项与提醒、会员勾选、备孕任务与同疾锁态、 急救包/咨询热线、关系卡片、亲子活动、健康建议 Tab、登录页花瓣与输入框、 内容详情头图、各页空状态 - 新增 scripts/verify/no_emoji_check.py:拦截 emoji/字符图标、 未定义图标名与未注册组件,纳入回归 - 图标质量已用 SVG 精灵表渲染逐个人工核对;61 图标 XML 解析 100% 通过 验证:no_emoji 0 问题 / 契约 84 接口 0 偏差 / Vue 20-20 / SCSS 19-19
187 行
3.7 KiB
Vue
187 行
3.7 KiB
Vue
<template>
|
||
<view class="hq-page">
|
||
<view class="head">
|
||
<text class="head-title">情绪急救包</text>
|
||
<text class="head-sub">情绪上头时,先照顾身体,再处理问题</text>
|
||
</view>
|
||
|
||
<view class="hotline" @tap="callHotline">
|
||
<hq-icon name="phone" :size="36" color="#C9482F" style="margin-right: 16rpx" />
|
||
<view class="hotline-body">
|
||
<text class="hotline-title">如果可以,先告诉一个人「我现在不太好」</text>
|
||
<text class="hotline-sub">需要专业支持:{{ data.hotline && data.hotline.phone ? data.hotline.phone : '12356' }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="hq-card tool" v-for="item in data.list || []" :key="item.id" @tap="open(item)">
|
||
<view class="tool-head">
|
||
<hq-icon :name="toolIcon(item)" :size="44" color="#E8604C" style="margin-right: 20rpx" />
|
||
<view class="tool-title-wrap">
|
||
<text class="tool-title">{{ item.title }}</text>
|
||
<text class="tool-summary">{{ item.summary }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="tool-foot">
|
||
<text class="tool-action">立即开始 ›</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="hq-card" v-if="!(data.list || []).length">
|
||
<view class="hq-empty">
|
||
<hq-icon name="droplets" :size="72" color="#E6D3C9" />
|
||
<text class="hq-empty-text">加载中…</text>
|
||
</view>
|
||
</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, iconForContentType } from '@/utils/icons.js'
|
||
import hqIcon from '@/components/hq-icon/hq-icon.vue'
|
||
|
||
export default {
|
||
components: { hqIcon },
|
||
data() {
|
||
return {
|
||
data: { list: [] }
|
||
}
|
||
},
|
||
onLoad() {
|
||
if (!store.token) {
|
||
uni.reLaunch({ url: '/pages/login/index' })
|
||
return
|
||
}
|
||
this.load()
|
||
},
|
||
methods: {
|
||
async load() {
|
||
try {
|
||
this.data = await api.moodFirstaid()
|
||
} catch (e) {}
|
||
},
|
||
toolIcon(item) {
|
||
if (item && (item.icon || item.emoji)) {
|
||
return resolveIcon(item.icon || item.emoji)
|
||
}
|
||
return iconForContentType((item && item.type) || 'firstaid')
|
||
},
|
||
open(item) {
|
||
uni.navigateTo({ url: '/pages/content/detail?id=' + item.id })
|
||
},
|
||
callHotline() {
|
||
const phone = (this.data.hotline && this.data.hotline.phone) || '12356'
|
||
uni.makePhoneCall({ phoneNumber: phone, fail: () => {
|
||
uni.showToast({ title: '拨打 ' + phone, 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;
|
||
}
|
||
|
||
.hotline {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 24rpx 28rpx;
|
||
border-radius: 28rpx;
|
||
background: linear-gradient(135deg, #FFF1E0 0%, #FFE3D3 100%);
|
||
border: 2rpx solid #F7DCC8;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.hotline-icon {
|
||
margin-right: 16rpx;
|
||
}
|
||
|
||
.hotline-body {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.hotline-title {
|
||
font-size: 26rpx;
|
||
color: #A8452F;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.hotline-sub {
|
||
margin-top: 4rpx;
|
||
font-size: 22rpx;
|
||
color: #B5715B;
|
||
}
|
||
|
||
.tool {
|
||
padding: 28rpx 32rpx;
|
||
}
|
||
|
||
.tool-head {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
.tool-title-wrap {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.tool-title {
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
color: #3E2C27;
|
||
}
|
||
|
||
.tool-summary {
|
||
margin-top: 6rpx;
|
||
font-size: 24rpx;
|
||
color: #8C7367;
|
||
line-height: 1.7;
|
||
}
|
||
|
||
.tool-foot {
|
||
margin-top: 16rpx;
|
||
padding-top: 16rpx;
|
||
border-top: 2rpx solid #F5E7DF;
|
||
text-align: right;
|
||
}
|
||
|
||
.tool-action {
|
||
font-size: 24rpx;
|
||
color: #E8604C;
|
||
}
|
||
|
||
.footer {
|
||
padding: 24rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.footer-text {
|
||
font-size: 20rpx;
|
||
color: #C9B4AA;
|
||
}
|
||
</style>
|