| | |
| | | // #endif |
| | | loadInitialPolicies() |
| | | }) |
| | | // 政策内容只展示一行:先把换行/连续空格压成单个空格,再由样式的单行省略号收尾, |
| | | // 否则文本里的 \n 会被 text 组件渲染成换行,一行放不下。 |
| | | const policyPreview = (value: any): string => { |
| | | if (value == null) return '' |
| | | return ('' + value).replace(/\s+/g, ' ').trim() |
| | | } |
| | | const mapPolicies = (records: any[]): any[] => { |
| | | const mapped: any[] = [] |
| | | for (let index = 0; index < records.length; index++) { |
| | |
| | | mapped.push({ |
| | | id: '' + item.id, |
| | | title: item.title != null ? item.title as string : '人才政策', |
| | | description: item.contentPreview != null ? item.contentPreview as string : '', |
| | | description: policyPreview(item.contentPreview), |
| | | tag: item.subtitle != null && (item.subtitle as string).trim() != '' ? item.subtitle as string : '人才政策' |
| | | }) |
| | | } |
| | |
| | | .policy-card { min-height: 220rpx; margin-bottom: 25rpx; box-sizing: border-box; padding: 31rpx 34rpx 25rpx; border-radius: 17rpx; background-color: rgba(255,255,255,.97); } |
| | | .policy-card-active { opacity: .78; } |
| | | .policy-title { display: block; color: #222326; font-size: 34rpx; font-weight: 700; } |
| | | .policy-desc { display: block; margin-top: 19rpx; color: #84868A; font-size: 27rpx; line-height: 39rpx; } |
| | | /* 政策内容只显示一行,超出用省略号。 */ |
| | | .policy-desc { display: block; margin-top: 19rpx; color: #84868A; font-size: 27rpx; line-height: 39rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } |
| | | .policy-foot { display: flex; margin-top: 18rpx; flex-direction: row; align-items: center; justify-content: space-between; } |
| | | .policy-tag { padding: 7rpx 9rpx; border-radius: 5rpx; background-color: #FFF4E7; color: #FF761D; font-size: 21rpx; } |
| | | .policy-detail { color: #77797D; font-size: 25rpx; } |