feat(escort): 陪诊服务图标改为柔和双色调并三页共用
首页宫格、下单页与详情页原先各画一套图标,图形与风格不统一。 抽出 styles/service-icons.wxss 统一维护 8 枚服务图标(暖橙描边 + 浅橙块面), 首页按服务 id 取图,下单页与详情页同步引用;并加深表盘与半天半填充、 放大配送车厢,保证 30px 真实显示下仍可辨识。
This commit is contained in:
@@ -11,7 +11,7 @@ Page({
|
||||
services: [],
|
||||
serviceIndex: 0,
|
||||
service: {},
|
||||
serviceIcon: 'user-business',
|
||||
serviceIconClass: 'assist-icon-1',
|
||||
servicePanelOpen: false,
|
||||
serviceOptionsHeight: 0,
|
||||
totalPrice: '0.00',
|
||||
@@ -69,8 +69,8 @@ Page({
|
||||
const requestedIndex = services.findIndex((item) => item.id === this.requestedServiceId)
|
||||
const consultationIndex = services.findIndex((item) => item.title.includes('问诊'))
|
||||
const serviceIndex = requestedIndex >= 0 ? requestedIndex : (consultationIndex >= 0 ? consultationIndex : 0)
|
||||
// 每个项目带上展示图标,供下拉列表逐项渲染
|
||||
const serviceList = services.map((item) => ({ ...item, icon: this.getServiceIcon(item.title) }))
|
||||
// 每个项目带上图标类名,供下拉列表逐项渲染(与首页宫格同一套图形)
|
||||
const serviceList = services.map((item) => ({ ...item, iconClass: this.getServiceIconClass(item) }))
|
||||
this.setData({
|
||||
services: serviceList,
|
||||
serviceOptionsHeight: this.getServiceOptionsHeight(serviceList.length)
|
||||
@@ -117,7 +117,7 @@ Page({
|
||||
this.setData({
|
||||
service,
|
||||
serviceIndex,
|
||||
serviceIcon: service.icon || this.getServiceIcon(service.title),
|
||||
serviceIconClass: service.iconClass || this.getServiceIconClass(service),
|
||||
servicePanelOpen: false,
|
||||
totalPrice: service.price,
|
||||
minAppointmentDate: formatDate(minDate),
|
||||
@@ -174,10 +174,15 @@ Page({
|
||||
this.applyService(service, index)
|
||||
},
|
||||
|
||||
getServiceIcon(title) {
|
||||
if (title.includes('夜间')) return 'moon'
|
||||
if (title.includes('陪诊')) return 'time'
|
||||
return 'user-business'
|
||||
// 图标与首页宫格共用 styles/service-icons.wxss,按后端服务 id 取图;
|
||||
// id 超出 1~8 时按名称兜底,避免新增服务落到没有图形的空类名上
|
||||
getServiceIconClass(service) {
|
||||
const id = Number(service && service.id)
|
||||
if (Number.isInteger(id) && id >= 1 && id <= 8) return 'assist-icon-' + id
|
||||
const title = (service && service.title) || ''
|
||||
if (title.includes('夜间')) return 'assist-icon-7'
|
||||
if (title.includes('陪诊')) return 'assist-icon-1'
|
||||
return 'assist-icon-3'
|
||||
},
|
||||
|
||||
async ensureLogin() {
|
||||
|
||||
Reference in New Issue
Block a user