Commit 798f61d0 by liimin

Merge branch 'feature/rework' of http://192.168.3.233:8090/monorepo/venus into feature/rework

2 parents 7f886019 bcb34a47
Showing 26 changed files with 63 additions and 2207 deletions
<!-- 退出弹框 -->
<template>
<MessageBox ref="finishRef" :content="finishContene" :isFooter="false">
<view class="footer">
<view class="footer-btn confirm flex" @click="$emit('openStep')">
<template v-if="finishDoneText">
{{ finishDoneText }}
</template>
<template v-else>
完成接待
<text>
(推荐)
</text>
</template>
</view>
<view class="footer-btn cancel flex" @click="$emit('backHome')">
仍要退出
<text>
(不推荐)
</text>
</view>
</view>
</MessageBox>
</template>
<script setup lang="uts">
import MessageBox from './MessageBox.uvue'
import { ComponentPublicInstance } from 'vue'
const props = defineProps({
finishDoneText: String,
finishContene: {
type: String,
default: '当前操作视为强制退出接待,若需正常流程完成接待请点击「完成接待」'
}
})
const finishRef = ref(null)
function open(): void {
(finishRef.value as ComponentPublicInstance).$callMethod('open')
}
function hide(): void {
(finishRef.value as ComponentPublicInstance).$callMethod('close')
}
const emit = defineEmits(['openStep', 'backHome'])
defineExpose({ open, hide })
</script>
<style lang="scss">
.footer {
border-top: 2rpx solid #eff0f2;
font-weight: 600;
font-size: 32rpx;
margin-top: 48rpx;
.footer-btn {
justify-content: center;
margin: 16rpx auto 0;
flex-direction: row;
align-items: center;
}
.confirm {
width: 608rpx;
height: 80rpx;
background: #2c66f7;
border-radius: 40rpx;
color: #fff;
}
.cancel {
width: 608rpx;
height: 80rpx;
background: #ffffff00;
border-radius: 40rpx;
color: #2c66f7;
}
text {
font-size: 24rpx;
}
}
</style>
\ No newline at end of file \ No newline at end of file
# CustomPopup 公共弹窗组件
高度可配置的公共弹窗组件,支持多种定位模式、丰富的自定义选项及完善的交互体验。
## 过渡效果
- **遮罩**:淡入淡出
- **居中弹窗**:缩放 + 透明度(scale 0.9→1)
- **底部/顶部弹窗**:垂直滑入滑出
- **左侧/右侧弹窗**:水平滑入滑出
- **时长**:通过 `transitionDuration` 配置,默认 2000ms
## 使用方式
```vue
<template>
<custom-popup
v-model:visible="showPopup"
position="center"
title="提示"
@confirm="onConfirm"
@cancel="onCancel"
>
<text>弹窗内容</text>
</custom-popup>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const showPopup = ref(false)
function onConfirm() {
// 确认逻辑
}
function onCancel() {
// 取消逻辑
}
</script>
```
## Props
| 属性 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| visible | boolean | false | 受控显示,支持 v-model:visible |
| position | 'center' \| 'bottom' \| 'top' \| 'left' \| 'right' | 'center' | 定位模式 |
| radiusPreset | 'sm' \| 'md' \| 'lg' \| 'full' | 'md' | 圆角预设:小(4px)、中(8px)、大(12px)、全圆角 |
| borderRadius | string | - | 自定义圆角值,优先级高于 radiusPreset |
| bottomHeight | string | '50%' | 底部/顶部弹窗高度 |
| sideWidth | string | '80%' | 侧边弹窗宽度 |
| showMask | boolean | true | 是否显示遮罩 |
| maskClosable | boolean | true | 遮罩点击是否关闭 |
| maskOpacity | number | 0.5 | 遮罩透明度 |
| showHeader | boolean | true | 是否显示标题栏 |
| title | string | '' | 标题文本 |
| showClose | boolean | true | 是否显示关闭按钮 |
| closePosition | 'top-right' \| 'top-left' \| 'bottom-right' \| 'bottom-left' | 'top-right' | 关闭按钮位置 |
| headerBorder | boolean | true | 标题栏底部分隔线 |
| showFooter | boolean | true | 是否显示底部按钮区 |
| showCancelBtn | boolean | true | 是否显示取消按钮 |
| cancelText | string | '取消' | 取消按钮文案 |
| confirmText | string | '确认' | 确认按钮文案 |
| confirmLoadingText | string | '加载中...' | 确认按钮加载中文案 |
| buttonOrder | 'cancel-first' \| 'confirm-first' | 'cancel-first' | 按钮顺序 |
| confirmLoading | boolean | false | 确认按钮加载中 |
| confirmDisabled | boolean | false | 确认按钮禁用 |
| cancelDisabled | boolean | false | 取消按钮禁用 |
| customStyle | object | null | 自定义容器样式 |
| transitionDuration | number | 2000 | 过渡时长(毫秒),遮罩与容器的动画时长 |
## Slots
| 插槽名 | 说明 |
|--------|------|
| default | 主体内容 |
| header | 自定义标题栏,替换默认标题+关闭 |
| close-icon | 自定义关闭图标 |
| footer | 自定义底部区域,替换默认按钮组 |
## Events
| 事件 | 说明 |
|------|------|
| update:visible | v-model 同步 |
| close | 弹窗关闭时 |
| cancel | 点击取消按钮 |
| confirm | 点击确认按钮 |
## 方法(defineExpose)
| 方法 | 说明 |
|------|------|
| open() | 打开弹窗 |
| close() | 关闭弹窗 |
## CSS 变量(主题化)
父级可通过以下变量覆盖样式:
- `--popup-primary-color` 主色
- `--popup-border-radius` 圆角
- `--popup-shadow` 阴影
- `--popup-spacing` 间距
- `--popup-font-size` 字体大小
- `--popup-mask-color` 遮罩颜色
- `--popup-mask-opacity` 遮罩透明度
## 结构类名
- `.popup-mask` 遮罩层
- `.popup-container` 弹窗容器
- `.popup-header` 标题栏
- `.popup-body` 内容区
- `.popup-footer` 底部操作区
<template>
<view :class="['customer-box',{'is-show':showCustomerBox}]">
<view class="customer-title">
客户档案的记录
</view>
<scroll-view
scroll-y
class="scroll-box"
>
<template v-if="loading">
<view class="loading flex">
<uni-icons
type="refreshempty"
:size="46"
color="#3773F8"
class="icon"
>
</uni-icons>
</view>
</template>
<template v-else>
<template v-if="searchList.length">
<template v-for="(i,index) in searchList" :key="index">
<view
class="item flex"
hover-class="active"
@click="chooseItem(i)"
>
{{ `${showType == 'tel'?i.ownerPhone:i.ownerName}`}}
</view>
</template>
</template>
<template v-else>
<view class="nothing flex">
<view class="icon">
</view>
未匹配到客户信息
</view>
</template>
</template>
</scroll-view>
</view>
</template>
<script setup lang="uts">
import { storage } from '@/utils/storage.uts'
import { state } from '@/store/index.uts'
import { getCustomerInfoListApi } from '@/api/customer-api.uts'
type CustomerInfo = UTSJSONObject
type UserInfo = UTSJSONObject
type SearchParams = {
merchantId: string
bussinessScene: number
ownerPhone?: string
ownerName?: string
}
const props = defineProps({
searchValue: String,
showType: String,
show: Boolean
})
const emit = defineEmits(['choose'])
const loading = ref<boolean>(true)
const searchList = ref<Array<CustomerInfo>>([])
const showCustomerBox = computed<boolean>(() => {
const searchValue = props.searchValue ?? ''
return props.show == true && (state.user?.haveCustomerAccess ?? false) && (searchValue !== '' && searchValue !== null)
})
async function getCustomerInfoList(val: string, type: string): Promise<void> {
try {
loading.value = true
const userInfo: UserInfo | null = storage.get("userInfo") as UTSJSONObject | null
const userInfoObj = userInfo ?? { shopMerchantId: '', sceneType: 0 }
const shopMerchantId = userInfoObj.shopMerchantId
const params: SearchParams = {
merchantId: shopMerchantId as String,
bussinessScene: userInfoObj.sceneType == 0 ? 1 : 2
}
if (type == 'tel') {
params.ownerPhone= val
} else {
params.ownerName = val
}
const result = await getCustomerInfoListApi(params as UTSJSONObject)
searchList.value = result as UTSArray<UTSJSONObject>
loading.value = false
} catch (error) {
loading.value = false
}
}
watch(showCustomerBox.value , (newVal: boolean) => {
if (newVal == true) {
getCustomerInfoList(props.searchValue ?? '', props.showType ?? '')
}
}, { immediate: true })
function chooseItem(item: CustomerInfo): void {
emit('choose', item)
}
</script>
<style scoped lang='scss'>
.customer-box {
position: absolute;
left: 0;
top: 88rpx;
width: 100%;
height: 352rpx;
background: #ffffff;
border-radius: 16rpx;
z-index: -1;
opacity: 0;
.customer-title {
font-size: 24rpx;
color: #999999;
line-height: 40rpx;
padding: 16rpx 24rpx 8rpx;
}
.scroll-box {
height: calc(100% - 64rpx);
.loading {
width: 100%;
height: 100%;
justify-content: center;
.icon {
animation: rotate-loading 1s linear infinite;
}
}
.nothing {
width: 100%;
height: 100%;
font-size: 24rpx;
color: #c7ccd7;
flex-direction: column;
.icon {
margin-top: 52rpx;
width: 96rpx;
height: 96rpx;
/* background-image: url('@/assets/images/common/nothing.webp'); */
background-size: 100%;
}
}
.item {
width: 100%;
height: 48rpx;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
padding-left: 24rpx;
margin-bottom: 8rpx;
}
.active {
background: #ecf1ff;
}
@keyframes rotate-loading {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
}
}
.is-show {
z-index: 1;
opacity: 1;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -479,8 +479,9 @@ const open = (): void => { ...@@ -479,8 +479,9 @@ const open = (): void => {
recordService.getBusinessData().then((data: any) => { recordService.getBusinessData().then((data: any) => {
console.log('[FinishStep] getBusinessData 成功', data); console.log('[FinishStep] getBusinessData 成功', data);
const customerInfo = (data != null ? data as UTSJSONObject : null); const customerInfo = (data != null ? data as UTSJSONObject : null);
console.log("customerInfo", customerInfo);
// 无当前录音记录时 getBusinessData 会返回 null,仍应打开弹窗并用空表单承接填写
if (customerInfo != null) { if (customerInfo != null) {
// 填充表单数据
formData.value = { formData.value = {
customerName: customerInfo.customerName != null && customerInfo.customerName != "null" ? customerInfo.customerName : "", customerName: customerInfo.customerName != null && customerInfo.customerName != "null" ? customerInfo.customerName : "",
carModel: customerInfo.carModel != null && customerInfo.carModel != "null" ? customerInfo.carModel : "", carModel: customerInfo.carModel != null && customerInfo.carModel != "null" ? customerInfo.carModel : "",
...@@ -489,13 +490,22 @@ const open = (): void => { ...@@ -489,13 +490,22 @@ const open = (): void => {
staffName: customerInfo.staffName != null && customerInfo.staffName != "null" ? customerInfo.staffName : "", staffName: customerInfo.staffName != null && customerInfo.staffName != "null" ? customerInfo.staffName : "",
salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != "null" ? customerInfo.salesUuid : "", salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != "null" ? customerInfo.salesUuid : "",
}; };
} else {
formData.value = {
customerName: "",
carModel: "",
carModelId: "",
phoneNumber: "",
staffName: "",
salesUuid: "",
} as UTSJSONObject;
}
console.log("[FinishStep] formData", formData.value); console.log("formData", formData.value);
const _sceneType = props.sceneType; const _sceneType = props.sceneType;
const _customerType = props.customerType; const _customerType = props.customerType;
let stepValue = 1; let stepValue = 1;
// 检查必填字段
const keys = ["customerName", "carModel", "phoneNumber"]; const keys = ["customerName", "carModel", "phoneNumber"];
for (const key of keys) { for (const key of keys) {
const value = formData.value[key] as null | string; const value = formData.value[key] as null | string;
...@@ -528,18 +538,9 @@ const open = (): void => { ...@@ -528,18 +538,9 @@ const open = (): void => {
} }
step.value = stepValue; step.value = stepValue;
console.log('[FinishStep] step 设置为:', stepValue); syncWindowSize();
// iOS 兼容:使用 nextTick 确保 DOM 更新后再显示弹窗
nextTick(() => {
console.log('[FinishStep] nextTick 中设置 showPopup = true');
showPopup.value = true; showPopup.value = true;
updateViewKey.value = Date.now(); updateViewKey.value = Date.now();
console.log('[FinishStep] showPopup 当前值:', showPopup.value);
});
} else {
console.warn('[FinishStep] customerInfo 为空');
}
isLoading.value = false; isLoading.value = false;
}).catch((error) => { }).catch((error) => {
......
<template>
<view class="wn-canvas">
<zoom-pan
:class="['canvas-box', { fill: custom }]"
:disabled="(drawStatus == true || scaleSwitch == false)"
:scale-max="3"
:scale-min="1"
@scale="onScale"
>
<template #content>
<!-- <canvas
:class="['board-canvas', { 'draw-canvas': drawStatus }]"
:canvas-id="canvasId"
:disable-scroll="drawStatus"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
>
</canvas> -->
<template v-if="custom">
<slot name="customContent">
</slot>
</template>
<template v-else>
<template v-if="aspectRatio">
<view
class="under-image"
:style="{ backgroundImage: `URL(${drawImage})`, aspectRatio: aspectRatio }"
>
</view>
</template>
<template v-else>
<view class="skeleton-box">
</view>
</template>
</template>
</template>
</zoom-pan>
</view>
</template>
<script setup lang="uts">
import zoomPan from './zoom-pan.uvue'
import { state } from "@/store/index.uts"
type HistoryItemStyle = {
color: string
width: number
}
type HistoryItemCoordinate = {
type: string
mode: string
x: number
y: number
}
type HistoryItem = {
style: HistoryItemStyle
coordinates: Array<HistoryItemCoordinate>
}
type ColorPickObj = {
color: string
}
const props = defineProps({
drawImage: {
type: String,
default: ''
},
saveImageType: {
type: String,
default: '1'
},
drawStatus: Boolean,
canvasId: {
type: String,
default: 'drawCanvas'
},
custom: Boolean,
scaleSwitch: {
type: Boolean,
default: true
}
})
const emit = defineEmits(['scale',])
const colorShow = ref<boolean>(false)
// Canvas 相关 - 已注释
// let canvasContext: CanvasContext | null = null
// let renderingContext: CanvasRenderingContext2D | null = null
const historyList = ref<Array<HistoryItem>>([])
const startX = ref<number>(0)
const startY = ref<number>(0)
const lastX = ref<number>(0)
const lastY = ref<number>(0)
const mode = ref<string>('pen')
const currentColor = ref<string>('red')
const bgColor = ref<string>('#fff')
const lineWidth = ref<number>(2)
const lastRect = ref<UTSObject>({})
const lastCircle = ref<UTSObject>({})
const isLandScape = ref<boolean>(false)
const aspectRatio = ref<number | null>(null)
const height = ref<number | string | null>(null)
const scaleValue = ref<number>(1)
const defaultScaleValue = ref<number>(1)
const viewX = ref<number>(0)
const viewY = ref<number>(0)
const touchX = ref<number>(0)
const touchY = ref<number>(0)
const begin = ref<boolean>(false)
const isUnderBkg = ref<boolean>(false)
const watchStatus = computed(() => {
const status = state.user?.historyStatus
if (status == null) {
return false
} else if (status == 1) {
return true
} else {
return false
}
})
function onScale(e: number): void {
scaleValue.value = e
emit('scale', e)
}
onMounted(() => {
// initBoard()
// uni.createCanvasContextAsync({
// id: props.canvasId as string,
// component: getCurrentInstance()?.proxy,
// success: (context : CanvasContext) => {
// canvasContext = context
// renderingContext = context.getContext('2d')!
// }
// })
})
watch(watchStatus, (newval: boolean) => {
if (newval != null) {
// clearBoard()
}
}, { immediate: true })
watch(props.drawImage, (n: string) => {
if (n != null) {
// initBoard()
}
})
</script>
<style lang="scss">
.wn-canvas {
height: 100%;
width: 100%;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
.under-image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-size: cover;
background-repeat: no-repeat;
z-index: -1;
}
.skeleton-box {
width: 100%;
height: 100%;
background: #f0f0f0;
}
@media screen and (orientation: portrait) {
.canvas-box {
width: 100%;
position: relative;
.board-canvas {
height: 100%;
width: 100%;
position: absolute;
background: rgba(0, 0, 0, 0);
}
}
}
@media screen and (orientation: landscape) {
.canvas-box {
width: 100%;
position: relative;
z-index: 99;
.board-canvas {
height: 100%;
width: 100%;
position: absolute;
background: rgba(0, 0, 0, 0);
pointer-events: none;
z-index: 99;
}
.draw-canvas {
pointer-events: auto;
}
}
.fill {
height: 100% !important;
}
}
</style>
<template>
<view
class="zoom-pan-container"
:style="{ 'overflow': 'hidden', 'position': 'relative', 'touch-action': 'none' }"
>
<!-- @touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd" -->
<view
class="content"
:style="contentStyle"
>
<slot name="content">
</slot>
</view>
</view>
</template>
<script setup lang="uts">
import { throttle } from '@/utils/common.uts'
import { state } from "@/store/index.uts"
type Point = {
x: number
y: number
}
type TouchPoint = {
pageX: number
pageY: number
clientX: number
clientY: number
x: number
y: number
}
type TouchEvent = {
touches: Array<TouchPoint>
changedTouches: Array<TouchPoint>
}
const props = defineProps({
disabled: Boolean,
scaleMax: {
type: Number,
default: 10
},
scaleMin: {
type: Number,
default: 1
}
})
const scale = ref<number>(1)
const isScaling = ref<boolean>(false)
const initialDistance = ref<number>(0)
const initialScale = ref<number>(1)
const translateX = ref<number>(0)
const translateY = ref<number>(0)
const lastTouchCenter = ref<Point>({ x: 0, y: 0 })
const currentTouchCenter = ref<Point>({ x: 0, y: 0 })
const contentStyle = computed(() => {
return {
'transform': `translate(${translateX.value}px, ${translateY.value}px) scale(${scale.value})`,
'transform-origin': 'center center',
'transition': isScaling.value ? 'none' : 'transform 0.3s ease-out',
'will-change': 'transform',
'position': 'absolute',
'left': '0',
'top': '0',
'width': '100%',
'height': '100%'
}
})
const watchStatus = computed(() => {
const status = state.user?.historyStatus
if (status == null) {
return false
} else if (status == 1) {
return true
} else {
return false
}
})
watch(watchStatus.value , () => {
if (scale.value != 1) {
scale.value = 1
translateX.value = 0
translateY.value = 0
}
}, { immediate: true })
// function handleTouchStart(e: TouchEvent): void {
// if (props.disabled == true) return
// if (e.touches.length === 2) {
// isScaling.value = true
// initialDistance.value = getTouchDistance(e.touches)
// initialScale.value = scale.value
// const center = getTouchCenter(e.touches)
// lastTouchCenter.value = center
// currentTouchCenter.value = center
// }
// }
// const handleTouchMove = throttle(function(e: TouchEvent): void {
// if (props.disabled == true) return
// if (isScaling.value && e.touches.length === 2) {
// const currentDistance = getTouchDistance(e.touches)
// const newScale = Math.max(
// props.scaleMin,
// Math.min(
// props.scaleMax,
// initialScale.value * (currentDistance / initialDistance.value)
// )
// )
// scale.value = newScale
// const center = getTouchCenter(e.touches)
// currentTouchCenter.value = center
// if (scale.value > 1) {
// const deltaX = center.x - lastTouchCenter.value.x
// const deltaY = center.y - lastTouchCenter.value.y
// translateX.value += deltaX
// translateY.value += deltaY
// }
// lastTouchCenter.value = center
// emit('scale', scale.value)
// }
// }, 16)
// function handleTouchEnd(): void {
// if (isScaling.value) {
// isScaling.value = false
// adjustPosition()
// }
// }
function adjustPosition(): void {
if (scale.value <= 1) {
translateX.value = 0
translateY.value = 0
scale.value = 1
}
}
function getTouchDistance(touches: Array<TouchPoint>): number {
const dx = touches[0].pageX - touches[1].pageX
const dy = touches[0].pageY - touches[1].pageY
return Math.sqrt(dx * dx + dy * dy)
}
function getTouchCenter(touches: Array<TouchPoint>): Point {
const centerX = (touches[0].pageX + touches[1].pageX) / 2
const centerY = (touches[0].pageY + touches[1].pageY) / 2
return { x: centerX, y: centerY }
}
const emit = defineEmits(['scale'])
</script>
<style lang="scss">
.zoom-pan-container {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
touch-action: none;
}
.content {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
transform-origin: center center;
}
</style>
<template>
<view v-if="isShow" class="publish-popup-mask" @click="closePopup">
<view class="publish-popup-container" @click.stop>
<slot name="content"></slot>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue';
// Props
const props = defineProps<{
type?: string;
isShowFooter?: boolean;
showTitle?: boolean;
}>();
// 响应式数据
const isShow = ref<boolean>(false);
// 方法
const openPopup = () => {
isShow.value = true;
};
const closePopup = () => {
isShow.value = false;
};
// 暴露方法供父组件调用
defineExpose({
openPopup,
closePopup
});
</script>
<style>
.publish-popup-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
z-index: 9999;
}
.publish-popup-container {
background-color: #ffffff;
border-radius: 8px;
max-width: 90%;
max-height: 80%;
overflow: hidden;
}
</style>
<template>
<view class="skeleton-wrap">
<un-skeleton :animate="animate"
:loading="loading"
:rows="rows"
:title="title"
:avatar="avatar"
:avatar-shape="avatarShape"
:avatar-size="avatarSize">
</un-skeleton>
<view :style="{ height: spacing + 'px' }"></view>
<un-skeleton :animate="animate"
:loading="loading"
:rows="rows"
:title="title"
:avatar="avatar"
:avatar-shape="avatarShape"
:avatar-size="avatarSize">
</un-skeleton>
<view :style="{ height: spacing + 'px' }"></view>
<un-skeleton :animate="animate"
:loading="loading"
:rows="rows"
:title="title"
:avatar="avatar"
:avatar-shape="avatarShape"
:avatar-size="avatarSize">
</un-skeleton>
</view>
</template>
<script setup lang="uts">
defineProps({
loading: {
type: Boolean,
default: true
},
animate: {
type: Boolean,
default: true
},
rows: {
type: Number,
default: 2
},
title: {
type: Boolean,
default: true
},
avatar: {
type: Boolean,
default: true
},
avatarShape: {
type: String,
default: 'circle' // 'circle' or 'square'
},
avatarSize: {
type: Number,
default: 48
},
spacing: {
type: Number,
default: 24
}
});
</script>
<style scoped lang="scss">
.skeleton-wrap {
padding: 24px;
width: 100%;
box-sizing: border-box;
}
</style>
<template>
<view class="type-tab">
<template v-if="styleV2">
<!-- 样式一:固定宽度 tab,滑动背景滑块 -->
<view class="type-box">
<view
:class="['slider-block', getSliderBlockClass()]"
:style="{ left: blockLeft, width: sliderBlockWidth }"
></view>
<view
:class="['tab-item', { active: tabIndex == idx }]"
v-for="(item, idx) in typeList"
:key="idx"
:style="{ width: getTabItemWidth(idx) }"
@click="handleTabClick(idx)"
>
<view
class="text-wrap"
:class="{ active: tabIndex == idx }"
:style="{ width: getTabItemWidth(idx) }"
>
<text class="tab-text">{{ getItemName(item) }}</text>
<view v-if="tabIndex == idx" class="underline-wrap"></view>
</view>
</view>
</view>
<!-- <view class="mask-box"></view> -->
</template>
<template v-else>
<!-- 样式二:横向滚动 tab,切换时平滑滑动到选中项 -->
<scroll-view
scroll-x
enable-flex
class="scroll-box"
:scroll-into-view="`tab-id-${tabIndex}`"
scroll-with-animation
>
<view class="type-box-v2">
<view
:class="['tab-item-v2', { active: tabIndex == idx }]"
v-for="(item, idx) in typeList"
:key="idx"
:style="getTabItemV2Style(idx)"
@click="handleTabClick(idx)"
:id="`tab-id-${idx}`"
>
<template v-if="idx == 0">
<view class="sprite-icon icon-first-right"></view>
</template>
<template v-else>
<view class="sprite-icon icon-second-left"></view>
<view class="sprite-icon icon-second-right"></view>
</template>
<view class="text-wrap-v2">
<text class="tab-text-v2">{{ getItemName(item) }}</text>
</view>
<view
v-if="tabIndex == idx"
class="underline-bar"
></view>
</view>
</view>
</scroll-view>
</template>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
/** Tab 项数据类型 */
type TabItem = UTSJSONObject;
const props = withDefaults(
defineProps<{
/** Tab 数据列表 */
typeList?: TabItem[]
/** 当前选中索引 */
tabIndex?: number
/** 显示名称的字段 key,默认 tabName */
nameKey?: string
/** 是否使用样式二(横向滚动) */
styleV2?: boolean
}>(),
{
typeList: () => [],
tabIndex: 0,
nameKey: "tabName",
styleV2: false
}
);
const emit = defineEmits<{
"update:tabIndex": [number]
tabClick: [number]
}>();
const FIRST_TAB_ITEM_WIDTH = 152
const TAB_ITEM_WIDTH = 208
function getTabItemWidth(index: number): string {
if (index == 0) {
return `${FIRST_TAB_ITEM_WIDTH}px`
}
return `${TAB_ITEM_WIDTH}px`
}
const sliderBlockWidth = computed((): string => {
return getTabItemWidth(props.tabIndex)
})
/** 滑块位置(样式一) */
const blockLeft = computed((): string => {
const idx = props.tabIndex
if (idx <= 0) {
return "0px"
}
const left = FIRST_TAB_ITEM_WIDTH + (idx - 1) * TAB_ITEM_WIDTH
return `${left}px`
});
/** 获取 tab 项显示名称 */
function getItemName(item: TabItem): string {
const key = props.nameKey
if (key == null || key == "") {
return ""
}
const val = item[key]
if (val == null) {
return ""
}
return `${val}`
}
/** 获取滑块圆角 class(样式一) */
function getSliderBlockClass(): string {
const idx = props.tabIndex
const len = props.typeList != null ? props.typeList.length : 0
if (len <= 1) {
return "slider-only"
}
if (idx == 0) {
return "slider-first"
}
if (idx == len - 1) {
return "slider-last"
}
return "slider-middle"
}
/** 获取 tab-item-v2 的内联样式,tabIndex == 1 时非激活项追加左下/右下圆角及红色背景 */
function getTabItemV2Style(idx: number): UTSJSONObject {
if (props.tabIndex == 1 && idx != props.tabIndex) {
return {
width: getTabItemWidth(idx),
borderBottomLeftRadius: '24px',
borderBottomRightRadius: '24px',
backgroundColor: '#eef4fe'
}
}
return { width: getTabItemWidth(idx) }
}
/** 点击 tab */
function handleTabClick(index: number): void {
if (props.tabIndex == index) {
return
}
emit("update:tabIndex", index)
emit("tabClick", index)
}
</script>
<style scoped lang="scss">
/* 遵循 uni-app x 规范:px 单位、无 vh/calc/gap、font-weight 仅 400|700、伪元素改为真实节点 */
.type-tab {
position: relative;
}
.type-box {
position: relative;
display: flex;
flex-direction: row;
width: 100%;
background-color: #eef4fe;
height: 80px;
border-radius: 24px 24px 0 0;
overflow: hidden;
z-index: 0;
}
.tab-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.tab-item .text-wrap {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.tab-item .text-wrap.active {
position: relative;
z-index: 1;
}
.tab-item .tab-text {
font-size: 20px;
font-weight: 400;
color: #1f2133;
text-align: center;
}
.tab-item .text-wrap.active .tab-text {
font-weight: 700;
color: #2c66f7;
}
.tab-item .underline-wrap {
position: absolute;
bottom: 0;
left: 50%;
margin-left: -12px;
width: 24px;
height: 4px;
background-color: #2c66f7;
border-radius: 8px;
}
/* 样式一:滑动背景滑块,left 由 :style 动态绑定,切换时平滑过渡 */
.type-box .slider-block {
position: absolute;
top: 0;
height: 80px;
z-index: 0;
background-color: #fff;
transition: left 0.2s ease-out;
}
.slider-block.slider-first {
border-radius: 24px 0 0 0;
}
.slider-block.slider-last {
border-radius: 0 24px 0 0;
}
.slider-block.slider-middle {
border-radius: 0;
}
.slider-block.slider-only {
border-radius: 24px 24px 0 0;
}
// .mask-box {
// position: absolute;
// height: 100%;
// width: 100%;
// background: #fff;
// left: 0;
// top: 80px;
// border-radius: 24px;
// overflow: hidden;
// }
.scroll-box {
width: 100%;
}
.type-box-v2 {
position: relative;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
width: 100%;
background-color: #eef4fe;
height: 48px;
border-radius: 24px 24px 0 0;
z-index: 0;
}
.tab-item-v2 {
padding: 0 20px;
margin-right: 0;
flex-shrink: 0;
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background-color: #eef4fe;
transition: background-color 0.25s ease-out;
}
.tab-item-v2:first-child {
padding-left: 20px;
}
.tab-item-v2 .text-wrap-v2 {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
z-index: 2;
}
.tab-item-v2 .tab-text-v2 {
color: #292d33;
font-size: 16px;
}
.tab-item-v2.active .tab-text-v2 {
color: #3b73ff;
font-weight: 400;
}
.tab-item-v2 .underline-bar {
position: absolute;
bottom: 0;
left: 50%;
margin-left: -10px;
width: 20px;
height: 3px;
border-radius: 2px;
background: #3b73ff;
}
.tab-item-v2 .sprite-icon {
position: absolute;
display: none;
}
.tab-item-v2.active .sprite-icon {
display: block;
}
.tab-item-v2.active {
background: #fff;
border-radius: 24px 24px 0 0;
overflow: hidden;
z-index: 1;
}
.icon-first-right {
right: -50px;
}
.icon-second-left {
left: -50px;
}
.icon-second-right {
right: -50px;
background-color: #eef4fe;
}
</style>
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
import { defineExpose, onMounted, ref } from "vue"; import { defineExpose, onMounted, ref } from "vue";
import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts"; import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts";
import NoData from "./NoData.uvue";
import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue"; import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
import { defineExpose, ref } from "vue"; import { defineExpose, ref } from "vue";
import { apiGetSceneMerchantRefStoreList, apiGetYqMerchantSceneConfigAPI, apiSelectMerchantScene } from "@/api/user-api.uts"; import { apiGetSceneMerchantRefStoreList, apiGetYqMerchantSceneConfigAPI, apiSelectMerchantScene } from "@/api/user-api.uts";
import NoData from "./NoData.uvue";
import MerchantListSkeleton from "./Skeleton/MerchantListSkeleton.uvue"; import MerchantListSkeleton from "./Skeleton/MerchantListSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
import { defineExpose, ref } from "vue"; import { defineExpose, ref } from "vue";
import { apiGetMerchantBrand, apiSelectMerchantScene } from "@/api/user-api.uts"; import { apiGetMerchantBrand, apiSelectMerchantScene } from "@/api/user-api.uts";
import NoData from "./NoData.uvue";
import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue"; import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
......
<template>
<view class="type-tab">
<scroll-view class="type-box" scroll-x="true" :show-scrollbar="false" scroll-with-animation>
<view class="type-scroll-content">
<view
class="tab-item"
:class="[tabClass(index)]"
v-for="(i, index) in typeList"
:key="index"
@click.stop="tabClick(index, i)"
>
<view class="text flex justify-center align-center" :class="[tabIndex == index ? 'active' : '']">
<text class="tab-name">{{ getTabName(i) }}</text>
<text v-if="isShowCount" class="count ml-8">{{ (getTabCount(i) > 99) ? '99+' : getTabCount(i).toString() }}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from 'vue';
import { get } from '@/utils/common.uts';
// Props 类型:使用 any[] 避免响应式对象类型转换问题
const props = withDefaults(defineProps<{
typeList: any[];
tabIndex: number;
nameKey?: string;
isShowCount?: boolean;
}>(), {
nameKey: 'tabName',
isShowCount: false
});
// Emits
const emit = defineEmits<{
(e: 'tabClick', index: number, item: any): void;
}>();
// 辅助方法:安全访问响应式对象的属性
// 响应式对象在 app 端无法通过 get() 访问,使用 JSON 序列化/反序列化解包
const getTabName = (item: any): string => {
// 先尝试 get()
let name = get(item, props.nameKey);
if (name != null) {
return name as string;
}
// get() 失败,尝试 JSON 序列化/反序列化解包响应式对象
try {
const jsonStr = JSON.stringify(item);
const parsed = JSON.parse(jsonStr) as any;
if (parsed != null) {
const name1 = get(parsed, props.nameKey);
if (name1 != null) {
return name1 as string;
}
const name2 = get(parsed, 'tabName');
if (name2 != null) {
return name2 as string;
}
}
} catch (e: any) {
// 静默失败
}
return '未知';
};
const getTabCount = (item: any): number => {
// 先尝试 get()
let count = get(item, 'count');
if (count != null) {
return count as number;
}
// get() 失败,尝试 JSON 序列化/反序列化解包响应式对象
try {
const jsonStr = JSON.stringify(item);
const parsed = JSON.parse(jsonStr) as any;
if (parsed != null) {
const countValue = get(parsed, 'count');
if (countValue != null) {
return countValue as number;
}
}
} catch (e: any) {
// 静默失败
}
return 0;
};
// 方法
const tabClass = (index: number): string => {
let className = '';
if (props.tabIndex == index) {
className = 'active ';
if (index == 0) className += 'first-nav';
else className += 'second-nav';
}
return className;
};
const tabClick = (index: number, item: any) => {
emit('tabClick', index, item);
};
</script>
<style>
.type-tab {
position: relative;
overflow: hidden;
}
.type-box {
position: relative;
width: 100%;
background-color: #eef4fe;
height: 48px;
border-radius: 24px 24px 0 0;
overflow: hidden;
z-index: 0;
}
.type-scroll-content {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
}
.tab-item {
flex-shrink: 0;
position: relative;
margin-right: 8px;
}
.tab-item .text {
position: relative;
height: 48px;
padding: 0 32px;
transition: all 0.15s;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.tab-item .text .tab-name {
font-weight: 400;
font-size: 14px;
color: #292d33;
text-align: center;
}
.tab-item .text.active .tab-name {
font-weight: 500;
font-size: 16px;
color: #3b73ff;
}
.tab-item .text .count {
font-size: 12px;
margin-left: 4px;
color: #292d33;
}
.flex {
display: flex;
flex-direction: row;
}
.justify-center {
justify-content: center;
}
.align-center {
align-items: center;
}
.ml-8 {
margin-left: 8px;
}
</style>
...@@ -78,14 +78,13 @@ ...@@ -78,14 +78,13 @@
"autoscan": true, "autoscan": true,
"custom": { "custom": {
"^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.uvue", "^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.uvue",
"^account-list$": "@/pages/common/components/AccountList.uvue", "^account-list$": "@/components/common/AccountList.uvue",
"^merchant-list$": "@/pages/common/components/MerchantList.uvue", "^merchant-list$": "@/components/common/MerchantList.uvue",
"^scene$": "@/pages/common/components/Scene.uvue", "^scene$": "@/components/common/Scene.uvue",
"^no-data$": "@/pages/common/components/NoData.uvue", "^no-data$": "@/components/common/NoData.uvue",
"^home-frame$": "@/components/HomeFrame/index.uvue", "^home-frame$": "@/components/HomeFrame/index.uvue",
"^layout-root$": "@/components/LayoutRoot/index.uvue", "^layout-root$": "@/components/LayoutRoot/index.uvue",
"^Layout$": "@/components/Layout/index.uvue", "^Layout$": "@/components/Layout/index.uvue",
"^segment-tab$": "@/pages/receptionCenter/SegmentTab.uvue",
"^reception-detail$": "@/pages/receptionCenter/receptionDetail.uvue", "^reception-detail$": "@/pages/receptionCenter/receptionDetail.uvue",
"^app-navbar$": "@/components/AppNavbar/index.uvue" "^app-navbar$": "@/components/AppNavbar/index.uvue"
} }
......
...@@ -83,9 +83,9 @@ ...@@ -83,9 +83,9 @@
<script setup lang="uts"> <script setup lang="uts">
import { ComponentPublicInstance, nextTick, ref, computed, type Ref } from "vue"; import { ComponentPublicInstance, nextTick, ref, computed, type Ref } from "vue";
import AccountList from "@/pages/common/components/AccountList.uvue"; import AccountList from "@/components/common/AccountList.uvue";
import MerchantList from "@/pages/common/components/MerchantList.uvue"; import MerchantList from "@/components/common/MerchantList.uvue";
import Scene from "@/pages/common/components/Scene.uvue"; import Scene from "@/components/common/Scene.uvue";
import { useScreenVars } from '@/services/adapter/hooks/index.uts' import { useScreenVars } from '@/services/adapter/hooks/index.uts'
import pageVars from './styles/index.vars' import pageVars from './styles/index.vars'
......
...@@ -33,28 +33,9 @@ ...@@ -33,28 +33,9 @@
@choose="choose" @choose="choose"
@finish="open" @finish="open"
@to-pay="toPay" /> @to-pay="toPay" />
<!-- <view
class="pen-box"
@click="drawStatus = !drawStatus"
>
<view :class="['sprite-icon', `${!drawStatus ? 'icon-pen' : 'icon-pen-active'}`]">
</view>
</view> -->
</template> </template>
</template> </template>
<!-- <pay-pop
ref="payRef"
:paymentType="paymentTypeList"
@jumpPay="showPayPage = true"
>
</pay-pop>
<informationEntry
v-model:showPayPage="showPayPage"
@finish="open"
/> -->
</view> </view>
<!-- <BackPress ref="backpressRef" @openStep="openStep" @backHome="backHome" /> -->
<FinishStep ref="stepRef" <FinishStep ref="stepRef"
:title-tips="finishTips" :title-tips="finishTips"
...@@ -64,7 +45,6 @@ ...@@ -64,7 +45,6 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
// import { receptionTrackMixin } from '@/mixin/index.js'
import { ComponentPublicInstance, ref } from "vue"; import { ComponentPublicInstance, ref } from "vue";
import { findPayInfo as findPayInfoApi } from "@/api/common-api.uts"; import { findPayInfo as findPayInfoApi } from "@/api/common-api.uts";
...@@ -86,14 +66,9 @@ import { storage } from "@/utils/storage.uts"; ...@@ -86,14 +66,9 @@ import { storage } from "@/utils/storage.uts";
import ModuleSwipeStack from "./components/ModuleSwipeStack.uvue"; import ModuleSwipeStack from "./components/ModuleSwipeStack.uvue";
import Reception from "./components/Reception.uvue"; import Reception from "./components/Reception.uvue";
type BackPressEvent = {
from: string
}
const backZindex = ref<number>(9); const backZindex = ref<number>(9);
const drawStatus = ref<boolean>(false); const drawStatus = ref<boolean>(false);
const scaleValueObject = ref<UTSJSONObject>({}); const scaleValueObject = ref<UTSJSONObject>({});
const showPayPage = ref<boolean>(false);
const productModelStatus = ref<boolean>(false); const productModelStatus = ref<boolean>(false);
const pageToolList = ref<Array<any>>([]); const pageToolList = ref<Array<any>>([]);
const moduleList = ref<Array<any>>([]); const moduleList = ref<Array<any>>([]);
...@@ -109,6 +84,8 @@ const toolRef = ref<ComponentRef>(null); ...@@ -109,6 +84,8 @@ const toolRef = ref<ComponentRef>(null);
const payRef = ref<ComponentRef>(null); const payRef = ref<ComponentRef>(null);
const stepRef = ref<ComponentRef>(null); const stepRef = ref<ComponentRef>(null);
const backpressRef = ref<ComponentRef>(null); const backpressRef = ref<ComponentRef>(null);
const toolRef = ref(null);
const stepRef = ref(null);
// 用于存储动态ref 的对象 // 用于存储动态ref 的对象
const mediaRefs = ref<UTSJSONObject>({}); const mediaRefs = ref<UTSJSONObject>({});
...@@ -153,13 +130,6 @@ const watchStatus = computed(() => { ...@@ -153,13 +130,6 @@ const watchStatus = computed(() => {
} }
}); });
const isPreview = computed<boolean>(() => {
return type.value == "preview";
});
const penSwitch = computed<boolean>(() => {
return isPreview.value == false && drawStatus.value == true;
});
function getModuleDisplayTitle(obj: UTSJSONObject): string { function getModuleDisplayTitle(obj: UTSJSONObject): string {
const title = const title =
getStringProp(obj, "detailTitle") getStringProp(obj, "detailTitle")
...@@ -362,14 +332,6 @@ async function setPageData() { ...@@ -362,14 +332,6 @@ async function setPageData() {
const storageName = `source_${sceneType.value}_${shopMerchantId.value}_${carBrandId}_${carChildsBrandId}`; const storageName = `source_${sceneType.value}_${shopMerchantId.value}_${carBrandId}_${carChildsBrandId}`;
const data = uni.getStorageSync(storageName); const data = uni.getStorageSync(storageName);
console.log(data); console.log(data);
// try {
// console.log('try',currentCarInfo.value)
// let requestData = await getSoureData(shopMerchantId.value ?? '', sceneType.value ?? 0, params)
// if (requestData != null) setViewInfo(requestData)
// } catch (error) {
// console.log(error)
// if (data != null) setViewInfo(data)
// }
} }
watch(viewKey, () => { watch(viewKey, () => {
...@@ -540,16 +502,6 @@ function backHome():void{ ...@@ -540,16 +502,6 @@ function backHome():void{
uni.navigateBack(); uni.navigateBack();
} }
function back(): void { function back(): void {
// if(showPayPage.value === true) {
// showPayPage.value = false
// return
// }
// if(isPreview.value === false) {
// if (backpressRef.value != null) {
// (backpressRef.value as ComponentPublicInstance).$callMethod('open')
// }
// return
// }
backHome(); backHome();
} }
...@@ -603,15 +555,4 @@ onBackPress((options: OnBackPressOptions) => { ...@@ -603,15 +555,4 @@ onBackPress((options: OnBackPressOptions) => {
height: 100%; height: 100%;
margin: 0 auto; margin: 0 auto;
} }
.pen-box {
position: fixed;
right: 20px;
top: 5%;
width: 60px;
height: 60px;
z-index: 10;
box-shadow: 0 2px 6px 0 #00000033;
border-radius: 8px;
overflow: hidden;
}
</style> </style>
<template>
<view class="page">
<view class="header">
<view class="back-btn" @click="goBack">
<text class="back-text">← 返回</text>
</view>
<text class="title">接待录音</text>
</view>
<view class="content flex-col">
<view class="status-row">
<text class="status-label">状态:</text>
<text class="status-text">{{ statusText }}</text>
</view>
<view class="btn-row">
<view class="btn start-btn"
:class="{ disabled: isRecording }"
@click="onStartRecord">
<text class="btn-text">开始录音</text>
</view>
<view class="btn stop-btn"
:class="{ disabled: !isRecording }"
@click="onStopRecord">
<text class="btn-text">停住录音</text>
</view>
</view>
<view class="btn-row">
<view class="btn play-btn"
:class="{ disabled: recordFilePath == null }"
@click="onPlayRecord">
<text class="btn-text">播放刚刚的录音</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import type { StartRecordOptions, StartRecordSuccess, StopRecordOptions, StopRecordSuccess } from "@/uni_modules/uts-recorder";
import { computed, ref } from "vue";
import { startRecord, stopRecord } from "@/uni_modules/uts-recorder";
const isRecording = ref(false);
const recordFilePath = ref<null | string>(null);
const statusText = computed((): string => {
if (isRecording.value) return "录音中…";
if (recordFilePath.value !== null) return "已停止,可播放";
return "暂无录音";
});
function goBack(): void {
uni.navigateBack();
}
function onStartRecord(): void {
if (isRecording.value) return;
isRecording.value = true;
recordFilePath.value = null;
const options: StartRecordOptions = {
sampleRate: 16_000,
numberOfChannels: 1,
success: (_res: StartRecordSuccess) => {
// 录音已开始,文件路径在 stop 时才有
},
fail: (_err: UniError) => {
isRecording.value = false;
uni.showToast({ title: "开始录音失败", icon: "none" });
}
};
startRecord(options);
uni.showToast({ title: "开始录音", icon: "none" });
}
function onStopRecord(): void {
if (!isRecording.value) return;
const options: StopRecordOptions = {
success: (res: StopRecordSuccess) => {
isRecording.value = false;
const filePath = res.filePath !== null && res.filePath !== "" ? res.filePath : res.tempFilePath;
recordFilePath.value = filePath !== null && filePath !== "" ? filePath : null;
uni.showToast({ title: "已停止录音", icon: "success" });
},
fail: (_err: UniError) => {
isRecording.value = false;
uni.showToast({ title: "停止录音失败", icon: "none" });
}
};
stopRecord(options);
}
function onPlayRecord(): void {
const path = recordFilePath.value;
if (path === null || path === "") {
uni.showToast({ title: "没有可播放的录音", icon: "none" });
return;
}
const audio = uni.createInnerAudioContext();
audio.src = path;
audio.play();
audio.onPlay(() => {
uni.showToast({ title: "开始播放", icon: "none" });
});
audio.onError((err) => {
const msg = err.errMsg !== "" ? err.errMsg : "播放失败";
uni.showToast({ title: msg, icon: "none" });
});
}
</script>
<style scoped lang="scss">
.page {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
background: #f5f7fa;
}
.header {
display: flex;
flex-direction: row;
align-items: center;
padding: 24px 16px;
background: #fff;
border-bottom: 1px solid #eee;
}
.back-btn {
padding: 8px 12px;
}
.back-text {
font-size: 16px;
color: #3773f8;
}
.title {
font-size: 18px;
font-weight: 500;
color: #1a1a1a;
margin-left: 12px;
}
.content {
padding: 24px 16px;
}
.status-row {
margin-bottom: 24px;
}
.status-label {
font-size: 14px;
color: #666;
}
.status-text {
font-size: 14px;
color: #1a1a1a;
margin-left: 8px;
}
.btn-row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 16px;
}
.btn {
padding: 12px 24px;
border-radius: 8px;
margin-right: 12px;
margin-bottom: 8px;
}
.btn.disabled {
opacity: 0.5;
}
.start-btn {
background: #3773f8;
}
.stop-btn {
background: #e74c3c;
}
.play-btn {
background: #27ae60;
}
.btn-text {
font-size: 15px;
color: #fff;
}
</style>
<template>
<view class="detail-info-container">
<view class="detail-info-item">
<view class="item-title">
<image class="detail-info-item-img" src="@/assets/images/reception/icon-pen.png" mode="aspectFit" />
<text class="detail-info-item-text">话术标签</text>
</view>
<view class="item-content">
<view
class="speech-tag-item"
:class="idx % 3 == 2 ? 'speech-tag-item-row-end' : ''"
v-for="(tag, idx) in speechTagList"
:key="idx"
>
<text class="speech-tag-text">{{ tag }}</text>
</view>
</view>
</view>
<view class="detail-info-item">
<view class="item-title">
<image class="detail-info-item-img" src="@/assets/images/reception/icon-title-tag.png" mode="aspectFit" />
<text class="detail-info-item-text">质检明细</text>
</view>
<view class="item-content item-content-quality-table">
<view class="quality-table-wrap">
<view class="quality-table-header">
<view class="quality-th quality-th-col1">
<text class="quality-th-text">一级分类</text>
</view>
<view class="quality-th quality-th-col2">
<text class="quality-th-text">质检得分</text>
</view>
<view class="quality-th quality-th-col3">
<text class="quality-th-text">命中文本</text>
</view>
</view>
<view class="quality-table-body">
<view
class="quality-table-row"
v-for="(row, rIdx) in qualityDetailList"
:key="rIdx"
>
<view class="quality-td quality-td-col1">
<text class="quality-td-text">{{ row.category }}</text>
</view>
<view class="quality-td quality-td-col2">
<text class="quality-td-text">{{ row.score }}</text>
</view>
<view class="quality-td quality-td-col3">
<text class="quality-td-text">{{ row.matchedText }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
const props = defineProps<{
qualityRows?: UTSJSONObject[]
}>();
const speechTagList: string[] = [
"场景塑造-优秀",
"逼单技巧-薄弱",
"场景塑造-优秀",
"场景塑造-优秀",
"场景塑造-优秀",
"场景塑造-薄弱",
"场景塑造-优秀",
"场景塑造-优秀",
];
type QualityDetailRow = {
category: string;
score: string;
matchedText: string;
};
function dimTagGroupName(dim: UTSJSONObject | null): string {
if (dim == null) {
return "";
}
const v = dim["tagGroupName"] as string | null;
return v != null ? v : "";
}
function dimFormatScore(dim: UTSJSONObject | null): string {
if (dim == null) {
return "";
}
const format = dim["formatScore"] as string | null;
if (format != null && format != "") {
return format;
}
const score = dim["score"];
const sumScore = dim["sumScore"];
if (score != null && sumScore != null) {
return `${score}/${sumScore}`;
}
return "";
}
function parseStringArray(rawValue: any | null): string[] {
const out: string[] = [];
if (rawValue == null) {
return out;
}
if (rawValue instanceof Array) {
const arr = rawValue as any[];
let i = 0;
while (i < arr.length) {
const item = arr[i];
if (item != null) {
const s = `${item}`.trim();
if (s != "") {
out.push(s);
}
}
i++;
}
return out;
}
const text = `${rawValue}`.trim();
if (text == "" || text == "[]") {
return out;
}
if (text.substring(0, 1) == "[" && text.substring(text.length - 1, text.length) == "]") {
try {
const parsed = JSON.parse(text) as any;
if (parsed != null && parsed instanceof Array) {
const arr = parsed as any[];
let i = 0;
while (i < arr.length) {
const item = arr[i];
if (item != null) {
const s = `${item}`.trim();
if (s != "") {
out.push(s);
}
}
i++;
}
return out;
}
} catch (e) {
if (`${e}` == "") {
// 占位分支:显式消费异常对象,规避 UTS 未使用告警
}
}
}
out.push(text);
return out;
}
const qualityDetailList = computed((): QualityDetailRow[] => {
const sourceRows = props.qualityRows != null ? props.qualityRows : [];
const out: QualityDetailRow[] = [];
let i = 0;
while (i < sourceRows.length) {
const row = sourceRows[i];
const hitTextList = parseStringArray(row["hitText"]);
out.push({
category: dimTagGroupName(row),
score: dimFormatScore(row),
matchedText: hitTextList.length > 0 ? hitTextList.join(";") : "--"
});
i++;
}
return out;
});
</script>
<style>
.detail-info-container {
display: flex;
flex-direction: column;
width: 100%;
height: auto;
box-sizing: border-box;
padding: 14px 14px;
border-radius: 16.1px;
opacity: 1;
background: #ffffff;
}
.detail-info-item {
display: flex;
flex-direction: column;
}
.item-title {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
height: 20px;
}
.detail-info-item-img {
width: 18px;
height: 18px;
flex-shrink: 0;
}
.detail-info-item-text {
margin-left: 6px;
color: #333333;
font-size: 16px;
font-weight: 500;
line-height: 20px;
}
.item-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: flex-start;
width: 100%;
min-width: 0;
margin-top: 12px;
}
.speech-tag-item {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex-grow: 0;
flex-shrink: 0;
flex-basis: 31%;
width: 31%;
min-width: 0;
box-sizing: border-box;
margin-right: 3.5%;
margin-bottom: 8px;
padding: 6px 6px;
border-radius: 8px;
opacity: 1;
background: #edf3ff;
}
.speech-tag-item-row-end {
margin-right: 0;
}
.speech-tag-text {
color: #4673ff;
font-size: 14px;
font-weight: 400;
text-align: center;
}
.item-content-quality-table {
flex-direction: column;
flex-wrap: nowrap;
}
.quality-table-wrap {
display: flex;
flex-direction: column;
width: 100%;
min-width: 0;
border-radius: 8px;
overflow: hidden;
border-width: 1px;
border-style: solid;
border-color: #e8ecf2;
}
.quality-table-header {
display: flex;
flex-direction: row;
flex-shrink: 0;
width: 100%;
min-width: 0;
background-color: #edf3ff;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #dce6ff;
}
.quality-th {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
min-width: 0;
box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 20rpx;
padding-left: 24rpx;
padding-right: 24rpx;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #dce6ff;
}
.quality-th-col1 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
.quality-th-col2 {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 176rpx;
}
.quality-th-col3 {
flex-grow: 2;
flex-shrink: 1;
flex-basis: 0;
border-right-width: 0;
}
.quality-th-text {
color: #333333;
font-size: 13px;
font-weight: 700;
text-align: center;
line-height: 18px;
}
.quality-table-body {
display: flex;
flex-direction: column;
flex-shrink: 0;
width: 100%;
min-width: 0;
background-color: #f7f8fa;
}
.quality-table-row {
display: flex;
flex-direction: row;
width: 100%;
min-width: 0;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #ebecef;
}
.quality-td {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
min-width: 0;
box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 20rpx;
padding-left: 24rpx;
padding-right: 24rpx;
background-color: #f7f8fa;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #ebecef;
}
.quality-td-col1 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
.quality-td-col2 {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 176rpx;
}
.quality-td-col3 {
flex-grow: 2;
flex-shrink: 1;
flex-basis: 0;
border-right-width: 0;
align-items: flex-start;
justify-content: flex-start;
}
.quality-td-text {
color: #333333;
font-size: 13px;
font-weight: 400;
line-height: 18px;
text-align: center;
}
.quality-td-col3 .quality-td-text {
text-align: left;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -173,7 +173,6 @@ ...@@ -173,7 +173,6 @@
</view> </view>
</template> </template>
</view> </view>
<!-- <DetailData :qualityRows="qualityRows" /> -->
</scroll-view> </scroll-view>
<!-- 横屏:左右分栏(左 1/3:客户卡片+质检;右 2/3:AI 导师) --> <!-- 横屏:左右分栏(左 1/3:客户卡片+质检;右 2/3:AI 导师) -->
......
// 约定式命名:必须叫 index.vars.uts // 约定式命名:必须叫 index.vars.uts
export default { // 与首页/我的页一致:先合并 HomeFrame 的 layout 变量(含 --tabbar-icon-size 等),再叠接待中心专用变量;
// 否则在接待中心路由下缺少 HomeFrame 的 resolutions 覆盖,底部 Tab 图标会与首页不一致(忽大忽小)。
import homeFramePageVars from "@/components/HomeFrame/styles/index.vars";
import { merge } from "@/utils/common";
function mergeResolutionMaps(hfRes: UTSJSONObject | null, localRes: UTSJSONObject | null): UTSJSONObject {
const out: UTSJSONObject = {}
if (hfRes != null) {
for (const k in hfRes) {
out[k] = hfRes[k]
}
}
if (localRes != null) {
for (const k in localRes) {
const base = out[k] as UTSJSONObject | null
const add = localRes[k] as UTSJSONObject
if (base != null) {
out[k] = merge(base, add)
} else {
out[k] = add
}
}
}
return out
}
const hf = homeFramePageVars as UTSJSONObject
const receptionPageVarsOnly = {
common: { common: {
'--home-box-bg': '#FF4444', '--home-box-bg': '#FF4444',
// receptionCenter: tabs 默认字体(可被 resolutions 覆盖) // receptionCenter: tabs 默认字体(可被 resolutions 覆盖)
...@@ -188,8 +215,8 @@ export default { ...@@ -188,8 +215,8 @@ export default {
'--test-view-height': '60px', '--test-view-height': '60px',
'--test-view-bg': 'blue', '--test-view-bg': 'blue',
// 'padding': '10px' // 'padding': '10px'
'--reception-tabs-container-padding': '8px 12px 60px' '--reception-tabs-container-padding': '8px 12px 60px',
'--reception-tabs-container-margin-top': '30px' '--reception-tabs-container-margin-top': '30px',
'--reception-tabs-container-bgc': '#ffffff', '--reception-tabs-container-bgc': '#ffffff',
// 针对 768x1174 竖屏:tabs 字体自适应增大 // 针对 768x1174 竖屏:tabs 字体自适应增大
'--reception-main-tabs-active-font-size': '22px', '--reception-main-tabs-active-font-size': '22px',
...@@ -367,3 +394,10 @@ export default { ...@@ -367,3 +394,10 @@ export default {
}, },
}, },
} }
export default {
common: merge(hf["common"] as UTSJSONObject, receptionPageVarsOnly.common as UTSJSONObject),
portrait: merge(hf["portrait"] as UTSJSONObject, receptionPageVarsOnly.portrait as UTSJSONObject),
landscape: merge(hf["landscape"] as UTSJSONObject, receptionPageVarsOnly.landscape as UTSJSONObject),
resolutions: mergeResolutionMaps(hf["resolutions"] as UTSJSONObject, receptionPageVarsOnly.resolutions as UTSJSONObject),
}
<template>
<view class="page">
<text class="title">测试页面</text>
<button class="btn" @click="runTest">运行 Store 测试 (V2)</button>
</view>
</template>
<script setup lang="uts">
// import { onLoad } from "@dcloudio/uni-app";
import { runStoreTest } from "../../test/test_store_v2.uts";
onLoad((options: OnLoadOptions) => {
console.log("测试页面加载");
});
const runTest = () => {
runStoreTest();
}
</script>
<style>
.page {
width: 750rpx;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #f5f5f5;
}
.title {
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
}
.btn {
margin-top: 20px;
background-color: #007aff;
color: #ffffff;
padding: 10px 20px;
border-radius: 5px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!