feat: 新增工单中心、房间巡查、失物招领等业务模块
- 新增工单中心(ticket_center)与工单工作台(ticket_workbench)页面 - 新增房间巡查(room_inspection)与失物招领发布(lost_found_publish)页面 - 预约看样流程新增房型/楼栋/楼层选择器组件 - 新增工具模块: booking-entry、privacy、reservation-flow - api/index.js 补充楼层列表、看样提交等接口 - locales/messages.js 补充多语言文案 - manifest.json 开启微信小程序隐私检查 - 完善登录、注册、申请详情、账单等相关页面交互
This commit is contained in:
@@ -19,10 +19,16 @@
|
||||
<view class="section-header">
|
||||
<text class="section-title">{{ t('storeIntro') }}</text>
|
||||
</view>
|
||||
<view class="store-desc" :class="{'store-desc--collapsed': isDescCollapsed}">
|
||||
{{ displayDescription }}
|
||||
<view
|
||||
class="store-desc"
|
||||
:class="{
|
||||
'store-desc--collapsed': !isRichDescription && isDescCollapsed
|
||||
}"
|
||||
>
|
||||
<rich-text v-if="isRichDescription" class="store-desc-rich" :nodes="displayDescriptionNodes"></rich-text>
|
||||
<text v-else>{{ displayDescription }}</text>
|
||||
</view>
|
||||
<view class="expand-btn tn-flex tn-flex-row-center tn-flex-col-center" @click="toggleDesc">
|
||||
<view v-if="shouldShowToggle" class="expand-btn tn-flex tn-flex-row-center tn-flex-col-center" @click="toggleDesc">
|
||||
<text>{{ isDescCollapsed ? t('expandAll') : t('collapse') }}</text>
|
||||
<text :class="isDescCollapsed ? 'tn-icon-down' : 'tn-icon-up'" class="expand-icon"></text>
|
||||
</view>
|
||||
@@ -31,6 +37,33 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { normalizeRichTextImages } from '../../../utils/rich-text'
|
||||
|
||||
function hasHtmlTag(value = '') {
|
||||
return /<\/?(p|div|img|br|span|h[1-6]|ul|li|ol|table|td|tr|strong|em|section|article|blockquote)[^>]*>/i.test(String(value || ''))
|
||||
}
|
||||
|
||||
function normalizeRichDescription(value = '') {
|
||||
let html = String(value || '').trim()
|
||||
if (!html) {
|
||||
return ''
|
||||
}
|
||||
|
||||
html = normalizeRichTextImages(
|
||||
html,
|
||||
'display:block;width:100%;max-width:100%;height:auto;box-sizing:border-box;border-radius:16rpx;margin:16rpx 0;vertical-align:top;'
|
||||
)
|
||||
html = html.replace(/<p\b([^>]*)>/gi, '<p$1 style="line-height:1.9;color:rgba(255,255,255,0.78);margin:0 0 20rpx;word-break:break-word;">')
|
||||
html = html.replace(/<div\b([^>]*)>/gi, '<div$1 style="line-height:1.9;color:rgba(255,255,255,0.78);margin:0 0 20rpx;word-break:break-word;">')
|
||||
html = html.replace(/<ul\b([^>]*)>/gi, '<ul$1 style="padding-left:28rpx;margin:0 0 20rpx;color:rgba(255,255,255,0.78);line-height:1.9;">')
|
||||
html = html.replace(/<ol\b([^>]*)>/gi, '<ol$1 style="padding-left:32rpx;margin:0 0 20rpx;color:rgba(255,255,255,0.78);line-height:1.9;">')
|
||||
html = html.replace(/<li\b([^>]*)>/gi, '<li$1 style="margin-bottom:12rpx;">')
|
||||
html = html.replace(/<h([1-6])\b([^>]*)>/gi, '<h$1$2 style="color:#FFFFFF;line-height:1.5;margin:0 0 20rpx;font-weight:600;">')
|
||||
html = html.replace(/<strong\b([^>]*)>/gi, '<strong$1 style="color:#FFFFFF;font-weight:600;">')
|
||||
html = html.replace(/<a\b([^>]*)>/gi, '<a$1 style="color:#9EC5FF;text-decoration:underline;">')
|
||||
return html
|
||||
}
|
||||
|
||||
export default {
|
||||
props: {
|
||||
storeData: {
|
||||
@@ -54,6 +87,18 @@ export default {
|
||||
}
|
||||
return this.storeData.description || this.storeData.descriptionEn || ''
|
||||
},
|
||||
isRichDescription() {
|
||||
return hasHtmlTag(this.displayDescription)
|
||||
},
|
||||
displayDescriptionNodes() {
|
||||
return this.isRichDescription ? normalizeRichDescription(this.displayDescription) : ''
|
||||
},
|
||||
shouldShowToggle() {
|
||||
if (this.isRichDescription) {
|
||||
return false
|
||||
}
|
||||
return String(this.displayDescription || '').length > 90
|
||||
},
|
||||
shortAddress() {
|
||||
const addr = this.language === 'en'
|
||||
? (this.storeData.addressEnDisplay || this.storeData.addressEn || this.storeData.address || '')
|
||||
@@ -176,6 +221,7 @@ export default {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
line-height: 1.6;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.store-desc--collapsed {
|
||||
@@ -185,6 +231,10 @@ export default {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.store-desc-rich {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.expand-btn {
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
Reference in New Issue
Block a user