Commit a3e54f75 by liimin

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

2 parents 93d61dc9 aa939457
Showing 54 changed files with 349 additions and 270 deletions
<script lang="uts">
// #ifdef APP
import { layoutService } from "@/services/LayoutService.uts";
import { recordService } from "@/services/recorder";
// #endif
let firstBackTime = 0;
......@@ -15,11 +16,11 @@ export default {
setTimeout(() => {
// 模拟接待开始
console.log("Simulating reception start...");
// recordService.startAudio();
recordService.startAudio();
// 模拟接待结束
console.log("Simulating reception end...");
setTimeout(() => {
// recordService.stopAudio();
recordService.stopAudio();
}, 10_000);
}, 1000);
},
......
......@@ -6,15 +6,7 @@ export async function getToken(params: UTSJSONObject): Promise<UTSJSONObject> {
projectName: "boutique",
...params
};
console.log("🚀 ~ getToken ~ data:", data);
try {
const d = await http.fetch("dj.api.smartcarlife.recepiton.customer.oss.getToken", data, false, "dj");
console.log("🚀 ~ getToken ~ d:", d);
return d;
} catch (error) {
console.log("🚀 ~ getToken ~ error:", error);
return {};
}
return http.fetch("dj.api.smartcarlife.recepiton.customer.oss.getToken", data, false, "dj");
}
export async function saveRecCustomer(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
......
<template>
<view v-if="visible" class="popup-mask" @tap="close">
<view class="popup-box" @tap.stop="">
<view class="popup-title">
<text class="popup-title-text">{{ title }}</text>
<view class="popup-close" @tap="close">
<text class="close-icon">×</text>
<view v-if="visible"
class="popup-mask"
@tap="close">
<view class="popup-box" @tap.stop="">
<view class="popup-title">
<image class="popup-title-bg-img"
mode="aspectFill"
src="/static/images/boutique/customer-type-bg.webp" />
<text class="popup-title-text">{{ title }}</text>
<view class="popup-close" @tap="close">
<text class="close-icon">×</text>
</view>
</view>
<view class="popup-content">
<view v-for="(item, index) in list"
:key="index"
class="popup-item"
@tap="handleChoose(index)">
<view class="item-icon">
{{ (item as UTSJSONObject).icon ?? '' }}
</view>
<view class="item-text">
<text class="item-title">{{ (item as UTSJSONObject).title ?? '' }}</text>
<text class="item-describe">{{ (item as UTSJSONObject).describe ?? '' }}</text>
</view>
</view>
</view>
</view>
</view>
<view class="popup-content">
<view
v-for="(item, index) in list"
:key="index"
class="popup-item"
@tap="handleChoose(index)"
>
<view class="item-icon">{{ (item as UTSJSONObject)['icon'] ?? '' }}</view>
<view class="item-text">
<text class="item-title">{{ (item as UTSJSONObject)['title'] ?? '' }}</text>
<text class="item-describe">{{ (item as UTSJSONObject)['describe'] ?? '' }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, defineExpose } from 'vue'
import { computed, defineExpose, ref } from "vue";
const props = defineProps<{
list?: any[]
title?: string
}>()
/** 受控显示,父组件传 true 即打开 */
visible?: boolean
}>();
const emit = defineEmits<{
choose: [index: number]
}>()
"update:visible": [value: boolean]
}>();
const visible = ref(false)
const internalVisible = ref(false);
const visible = computed((): boolean => {
if (props.visible != null) return props.visible === true;
return internalVisible.value;
});
function open(): void {
visible.value = true
if (props.visible != null) {
emit("update:visible", true);
} else {
internalVisible.value = true;
}
}
function close(): void {
visible.value = false
internalVisible.value = false;
emit("update:visible", false);
}
function handleChoose(index: number): void {
emit('choose', index)
close()
emit("choose", index);
close();
}
defineExpose({
open,
close
})
open,
close
});
</script>
<style scoped lang="scss">
......@@ -92,9 +109,24 @@ defineExpose({
justify-content: center;
position: relative;
flex-shrink: 0;
background-image: url('@/assets/images/boutique/customer-type-bg.webp');
background-repeat: no-repeat;
background-size: 100% 100%;
overflow: hidden;
background-image: linear-gradient(to right, #e8f0fe, #f5f7fa);
}
.popup-title-bg-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.popup-title .popup-title-text,
.popup-title .popup-close {
position: relative;
z-index: 1;
}
.popup-title-text {
......
......@@ -24,17 +24,35 @@
</template>
<script setup lang="uts">
import { ref, defineExpose } from 'vue'
import { computed, ref, defineExpose } from 'vue'
const visible = ref(false)
const props = defineProps<{
/** 受控显示,父组件传 true 即打开 */
visible?: boolean
}>()
const emit = defineEmits<{
'update:visible': [value: boolean]
}>()
const internalVisible = ref(false)
const version = ref('1.0.0')
const visible = computed((): boolean => {
if (props.visible != null) return props.visible === true
return internalVisible.value
})
function open(): void {
visible.value = true
if (props.visible != null) {
emit('update:visible', true)
} else {
internalVisible.value = true
}
}
function close(): void {
visible.value = false
internalVisible.value = false
emit('update:visible', false)
}
function handleCheck(): void {
......
......@@ -333,7 +333,6 @@ class TempRecord {
this.timer = null;
}
}
/**
* 清除已保存的录音文件
* @param {object} options - 配置参数
......
......@@ -5,92 +5,92 @@
* - values: 分辨率 -> 值;未列出的分辨率用 baseWidth 线性缩放
*/
export const LAYOUT_VARS: UTSJSONObject = {
'spacingXs': {
'css': '--l-spacing-xs',
'values': { '1024': 8, '1174': 8, '1920': 15 } as UTSJSONObject
} as UTSJSONObject,
'spacingSm': {
'css': '--l-spacing-sm',
'values': { '1024': 12, '1174': 12, '1920': 23 } as UTSJSONObject
} as UTSJSONObject,
'spacingMd': {
'css': '--l-spacing-md',
'values': { '1024': 16, '1174': 16, '1920': 30 } as UTSJSONObject
} as UTSJSONObject,
'spacingLg': {
'css': '--l-spacing-lg',
'values': { '1024': 24, '1174': 24, '1920': 45 } as UTSJSONObject
} as UTSJSONObject,
'spacingXl': {
'css': '--l-spacing-xl',
'values': { '1024': 32, '1174': 32, '1920': 60 } as UTSJSONObject
} as UTSJSONObject,
'spacing2xl': {
'css': '--l-spacing-2xl',
'values': { '1024': 40, '1174': 40, '1920': 75 } as UTSJSONObject
} as UTSJSONObject,
'fontXs': {
'css': '--l-font-xs',
'values': { '1024': 12, '1174': 12, '1920': 23 } as UTSJSONObject
} as UTSJSONObject,
'fontSm': {
'css': '--l-font-sm',
'values': { '1024': 14, '1174': 14, '1920': 26 } as UTSJSONObject
} as UTSJSONObject,
'fontBase': {
'css': '--l-font-base',
'values': { '1024': 16, '1174': 16, '1920': 30 } as UTSJSONObject
} as UTSJSONObject,
'fontLg': {
'css': '--l-font-lg',
'values': { '1024': 18, '1174': 18, '1920': 34 } as UTSJSONObject
} as UTSJSONObject,
'fontXl': {
'css': '--l-font-xl',
'values': { '1024': 20, '1174': 20, '1920': 38 } as UTSJSONObject
} as UTSJSONObject,
'font2xl': {
'css': '--l-font-2xl',
'values': { '1024': 24, '1174': 24, '1920': 45 } as UTSJSONObject
} as UTSJSONObject,
'radiusSm': {
'css': '--l-radius-sm',
'values': { '1024': 4, '1174': 4, '1920': 8 } as UTSJSONObject
} as UTSJSONObject,
'radiusMd': {
'css': '--l-radius-md',
'values': { '1024': 8, '1174': 8, '1920': 15 } as UTSJSONObject
} as UTSJSONObject,
'radiusLg': {
'css': '--l-radius-lg',
'values': { '1024': 12, '1174': 12, '1920': 23 } as UTSJSONObject
} as UTSJSONObject,
'radiusXl': {
'css': '--l-radius-xl',
'values': { '1024': 16, '1174': 16, '1920': 30 } as UTSJSONObject
} as UTSJSONObject,
'sidebarWidth': {
'css': '--l-sidebar-width',
'values': { '1024': 120, '1174': 120, '1920': 225 } as UTSJSONObject
} as UTSJSONObject,
'contentLeftWidth': {
'css': '--l-content-left-width',
'values': { '1024': 605, '1174': 605, '1920': 1134 } as UTSJSONObject
} as UTSJSONObject,
'moduleBoxHeight': {
'css': '--l-module-box-height',
'values': { '1024': 332, '1174': 332, '1920': 623 } as UTSJSONObject
} as UTSJSONObject,
'toolBoxMinHeight': {
'css': '--l-tool-box-min-height',
'values': { '1024': 120, '1174': 120, '1920': 225 } as UTSJSONObject
} as UTSJSONObject,
'commonTitleHeight': {
'css': '--l-common-title-height',
'values': { '1024': 60, '1174': 60, '1920': 113 } as UTSJSONObject
} as UTSJSONObject,
'storeFooterHeight': {
'css': '--l-store-footer-height',
'values': { '1024': 60, '1174': 60, '1920': 113 } as UTSJSONObject
} as UTSJSONObject
}
"spacingXs": {
"css": "--l-spacing-xs",
"values": { "1024": 8, "1174": 8, "1920": 15 } as UTSJSONObject
} as UTSJSONObject,
"spacingSm": {
"css": "--l-spacing-sm",
"values": { "1024": 12, "1174": 12, "1920": 23 } as UTSJSONObject
} as UTSJSONObject,
"spacingMd": {
"css": "--l-spacing-md",
"values": { "1024": 16, "1174": 16, "1920": 30 } as UTSJSONObject
} as UTSJSONObject,
"spacingLg": {
"css": "--l-spacing-lg",
"values": { "1024": 24, "1174": 24, "1920": 45 } as UTSJSONObject
} as UTSJSONObject,
"spacingXl": {
"css": "--l-spacing-xl",
"values": { "1024": 32, "1174": 32, "1920": 60 } as UTSJSONObject
} as UTSJSONObject,
"spacing2xl": {
"css": "--l-spacing-2xl",
"values": { "1024": 40, "1174": 40, "1920": 75 } as UTSJSONObject
} as UTSJSONObject,
"fontXs": {
"css": "--l-font-xs",
"values": { "1024": 12, "1174": 12, "1920": 23 } as UTSJSONObject
} as UTSJSONObject,
"fontSm": {
"css": "--l-font-sm",
"values": { "1024": 14, "1174": 14, "1920": 26 } as UTSJSONObject
} as UTSJSONObject,
"fontBase": {
"css": "--l-font-base",
"values": { "1024": 16, "1174": 16, "1920": 30 } as UTSJSONObject
} as UTSJSONObject,
"fontLg": {
"css": "--l-font-lg",
"values": { "1024": 18, "1174": 18, "1920": 34 } as UTSJSONObject
} as UTSJSONObject,
"fontXl": {
"css": "--l-font-xl",
"values": { "1024": 20, "1174": 20, "1920": 38 } as UTSJSONObject
} as UTSJSONObject,
"font2xl": {
"css": "--l-font-2xl",
"values": { "1024": 24, "1174": 24, "1920": 45 } as UTSJSONObject
} as UTSJSONObject,
"radiusSm": {
"css": "--l-radius-sm",
"values": { "1024": 4, "1174": 4, "1920": 8 } as UTSJSONObject
} as UTSJSONObject,
"radiusMd": {
"css": "--l-radius-md",
"values": { "1024": 8, "1174": 8, "1920": 15 } as UTSJSONObject
} as UTSJSONObject,
"radiusLg": {
"css": "--l-radius-lg",
"values": { "1024": 12, "1174": 12, "1920": 23 } as UTSJSONObject
} as UTSJSONObject,
"radiusXl": {
"css": "--l-radius-xl",
"values": { "1024": 16, "1174": 16, "1920": 30 } as UTSJSONObject
} as UTSJSONObject,
"sidebarWidth": {
"css": "--l-sidebar-width",
"values": { "1024": 120, "1174": 120, "1920": 225 } as UTSJSONObject
} as UTSJSONObject,
"contentLeftWidth": {
"css": "--l-content-left-width",
"values": { "1024": 605, "1174": 605, "1920": 1134 } as UTSJSONObject
} as UTSJSONObject,
"moduleBoxHeight": {
"css": "--l-module-box-height",
"values": { "1024": 332, "1174": 332, "1920": 623 } as UTSJSONObject
} as UTSJSONObject,
"toolBoxMinHeight": {
"css": "--l-tool-box-min-height",
"values": { "1024": 120, "1174": 120, "1920": 225 } as UTSJSONObject
} as UTSJSONObject,
"commonTitleHeight": {
"css": "--l-common-title-height",
"values": { "1024": 60, "1174": 60, "1920": 113 } as UTSJSONObject
} as UTSJSONObject,
"storeFooterHeight": {
"css": "--l-store-footer-height",
"values": { "1024": 60, "1174": 60, "1920": 113 } as UTSJSONObject
} as UTSJSONObject
};
import { createSSRApp } from "vue";
import { appMixin } from "./utilsApi";
import { logger } from "./composables/logger";
import App from "./App.uvue";
import DBRecord from './composables/recorder/DBRecord.uts'
import { logger } from "@/services/logger";
import DBRecord from "@/services/recorder/DBRecord.uts";
import { appMixin } from "./utilsApi";
export function createApp() {
const app = createSSRApp(App);
// 挂载日志模块到 uni.$logger
// logger.mount();
initDB()
// 挂载日志模块到 uni.$logger
// logger.mount();
initDB();
appMixin(app);
return {
......@@ -18,10 +19,10 @@ initDB()
}
function initDB() {
// 数据库初始化
DBRecord.getInstance().init().then((res): void => {
logger.info('〖数据库初始化完成〗', "Main")
}).catch((e): void => {
logger.error(`〖数据库初始化失败〗: ${e}`, "Main")
})
// 数据库初始化
DBRecord.getInstance().init().then((res): void => {
logger.info("〖数据库初始化完成〗", "Main");
}).catch((error): void => {
logger.error(`〖数据库初始化失败〗: ${error}`, "Main");
});
}
......@@ -8,7 +8,7 @@
```typescript
// 直接导入单例对象和枚举
import { recordService, BusinessDataType } from '@/composables/recorder/index.uts'
import { recordService, BusinessDataType } from '@/services/recorder/index.uts'
```
### 开始接待/录音
......@@ -80,7 +80,7 @@ recordService.updateBusinessData(
### 3.1 定义新策略
创建 `composables/recorder/strategies/RealEstateStrategy.uts`:
创建 `services/recorder/strategies/RealEstateStrategy.uts`:
```typescript
import { IRecorderStrategy } from "../types/strategy.uts";
......
import { RecordService } from '@/composables/recorder/index.uts'
import TempRecord from '@/composables/recorder/TempRecord.uts'
import { RecordData } from '@/composables/recorder/types/index.uts'
import { state as storeState, commit } from '@/store/index.uts'
import { RecordService } from "@/services/recorder/index.uts";
import TempRecord from "@/services/recorder/TempRecord.uts";
import { RecordData } from "@/services/recorder/types/index.uts";
import { commit } from "@/store/index.uts";
/**
* 测试 RecordService 的监听器功能
......@@ -12,120 +12,120 @@ import { state as storeState, commit } from '@/store/index.uts'
* testRecordWatchers()
*/
export function testRecordWatchers() {
console.log('=== 开始测试 RecordService 监听器 ===')
console.log("=== 开始测试 RecordService 监听器 ===");
const service = RecordService.getInstance()
// 1. 模拟 isReceptioning 为 true,使 handler 能执行回调
// 只有在接待中 (isReceptioning() == true) 才会响应状态变化
// 我们通过设置一个 endReasonType=1 (异常结束/暂存状态?) 的伪造记录来模拟此条件
// 或者更直接地,我们可以临时覆盖 isReceptioning 方法(如果 UTS 允许)
// 方案 A: 构造伪造数据让 isReceptioning 返回 true
// isReceptioning() => (audioManager?.isRecording) || (record?.currentRecord?.endReasonType == 1)
const mockRecordData = {
id: 'mock_test_id',
endReasonType: 1
} as RecordData
// 创建 TempRecord 实例并注入
// 注意:TempRecord 构造函数可能依赖 uni.$dbRecord,但在测试环境下可能未初始化
// 如果报错,可能需要 Mock DBRecord.getInstance()
try {
const mockTempRecord = new TempRecord(mockRecordData, null, null)
service.record = mockTempRecord
console.log(`[Test] 注入 Mock Record, isReceptioning 当前状态: ${service.isReceptioning()}`)
} catch (e) {
console.error('[Test] 注入 Mock Record 失败:', e)
return
}
const service = RecordService.getInstance();
// 1. 模拟 isReceptioning 为 true,使 handler 能执行回调
// 只有在接待中 (isReceptioning() == true) 才会响应状态变化
// 我们通过设置一个 endReasonType=1 (异常结束/暂存状态?) 的伪造记录来模拟此条件
// 或者更直接地,我们可以临时覆盖 isReceptioning 方法(如果 UTS 允许)
// 方案 A: 构造伪造数据让 isReceptioning 返回 true
// isReceptioning() => (audioManager?.isRecording) || (record?.currentRecord?.endReasonType == 1)
const mockRecordData = {
id: "mock_test_id",
endReasonType: 1
} as RecordData;
// 创建 TempRecord 实例并注入
// 注意:TempRecord 构造函数可能依赖 uni.$dbRecord,但在测试环境下可能未初始化
// 如果报错,可能需要 Mock DBRecord.getInstance()
try {
const mockTempRecord = new TempRecord(mockRecordData, null, null);
service.record = mockTempRecord;
console.log(`[Test] 注入 Mock Record, isReceptioning 当前状态: ${service.isReceptioning()}`);
} catch (error) {
console.error("[Test] 注入 Mock Record 失败:", error);
return;
}
// 2. Mock 目标方法以验证调用
// 使用 any 类型绕过类型检查进行方法覆写 (Monkey Patching)
const serviceAny = service as any
// 备份原方法,以便测试后恢复
const originalUpdateCustomerInfo = serviceAny.updateCustomerInfo
const originalUpdateReceptionStatus = serviceAny.updateReceptionStatus
const originalUpdateBookList = serviceAny.updateBookList
const originalUpdateMaterialPointList = serviceAny.updateMaterialPointList
// 计数器
let customerInfoCount = 0
let receptionStatusCount = 0
let bookListCount = 0
let materialPointListCount = 0
// 覆写方法 (Spy)
serviceAny.updateCustomerInfo = (val: any) => {
console.log(`[Test] updateCustomerInfo 被调用,参数: ${JSON.stringify(val)}`)
customerInfoCount++
}
serviceAny.updateReceptionStatus = (val: any) => {
console.log(`[Test] updateReceptionStatus 被调用,参数: ${val}`)
receptionStatusCount++
}
serviceAny.updateBookList = (val: any) => {
console.log(`[Test] updateBookList 被调用`)
bookListCount++
}
serviceAny.updateMaterialPointList = (val: any) => {
console.log(`[Test] updateMaterialPointList 被调用`)
materialPointListCount++
}
// 3. 触发 Store 变化
console.log('[Test] 正在触发 Store 变化...')
// --- 测试 updateCustomerInfo (debounce 1000ms) ---
// 监听的是 customerKey 变化,回调中使用 customerInfo
const testCustomerInfo = { customerName: '测试客户', phoneNumber: '13800000000' }
commit('updateCustomerInfo', testCustomerInfo)
// 触发 watcher
commit('updateCustomerKey', 'KEY_' + Date.now())
// --- 测试 updateReceptionStatus (debounce 200ms) ---
commit('updateReceptionStatus', '1') // 状态变更
// --- 测试 updateBookList (debounce 1500ms) ---
const testBookList = [{ id: 'book1', imgUrl: 'url1' }]
commit('updateBookList', testBookList) // 数组变更可能不触发 watcher?
// 注意:监听的是 storeState.booksList 引用变化。commit 会替换数组,应该能触发。
// --- 测试 updateMaterialPointList (debounce 1000ms) ---
// 监听 receptionKey,回调中使用 receptionTrack
const testTrack = [{ id: 'point1', x: 10, y: 20 }]
commit('updateReceptionTrack', testTrack)
// 触发 watcher
commit('updateReceptionKey', 'REC_KEY_' + Date.now())
// 4. 等待 Debounce 结束
// 最长 delay 是 1500ms,我们等待 2000ms
console.log('[Test] 等待防抖结束 (2000ms)...')
setTimeout(() => {
console.log('=== 测试结果报告 ===')
// 2. Mock 目标方法以验证调用
// 使用 any 类型绕过类型检查进行方法覆写 (Monkey Patching)
const serviceAny = service as any;
// 备份原方法,以便测试后恢复
const originalUpdateCustomerInfo = serviceAny.updateCustomerInfo;
const originalUpdateReceptionStatus = serviceAny.updateReceptionStatus;
const originalUpdateBookList = serviceAny.updateBookList;
const originalUpdateMaterialPointList = serviceAny.updateMaterialPointList;
// 计数器
let customerInfoCount = 0;
let receptionStatusCount = 0;
let bookListCount = 0;
let materialPointListCount = 0;
// 覆写方法 (Spy)
serviceAny.updateCustomerInfo = (val: any) => {
console.log(`[Test] updateCustomerInfo 被调用,参数: ${JSON.stringify(val)}`);
customerInfoCount++;
};
serviceAny.updateReceptionStatus = (val: any) => {
console.log(`[Test] updateReceptionStatus 被调用,参数: ${val}`);
receptionStatusCount++;
};
serviceAny.updateBookList = (val: any) => {
console.log(`[Test] updateBookList 被调用`);
bookListCount++;
};
serviceAny.updateMaterialPointList = (val: any) => {
console.log(`[Test] updateMaterialPointList 被调用`);
materialPointListCount++;
};
// 3. 触发 Store 变化
console.log("[Test] 正在触发 Store 变化...");
// --- 测试 updateCustomerInfo (debounce 1000ms) ---
// 监听的是 customerKey 变化,回调中使用 customerInfo
const testCustomerInfo = { customerName: "测试客户", phoneNumber: "13800000000" };
commit("updateCustomerInfo", testCustomerInfo);
// 触发 watcher
commit("updateCustomerKey", `KEY_${ Date.now()}`);
// --- 测试 updateReceptionStatus (debounce 200ms) ---
commit("updateReceptionStatus", "1"); // 状态变更
// --- 测试 updateBookList (debounce 1500ms) ---
const testBookList = [{ id: "book1", imgUrl: "url1" }];
commit("updateBookList", testBookList); // 数组变更可能不触发 watcher?
// 注意:监听的是 storeState.booksList 引用变化。commit 会替换数组,应该能触发。
// --- 测试 updateMaterialPointList (debounce 1000ms) ---
// 监听 receptionKey,回调中使用 receptionTrack
const testTrack = [{ id: "point1", x: 10, y: 20 }];
commit("updateReceptionTrack", testTrack);
// 触发 watcher
commit("updateReceptionKey", `REC_KEY_${ Date.now()}`);
// 4. 等待 Debounce 结束
// 最长 delay 是 1500ms,我们等待 2000ms
console.log("[Test] 等待防抖结束 (2000ms)...");
setTimeout(() => {
console.log("=== 测试结果报告 ===");
const check = (name: string, count: number) => {
const pass = count >= 1
console.log(`${name}: ${pass ? 'PASS ✅' : 'FAIL ❌'} (调用次数: ${count})`)
}
const check = (name: string, count: number) => {
const pass = count >= 1;
console.log(`${name}: ${pass ? "PASS ✅" : "FAIL ❌"} (调用次数: ${count})`);
};
check('updateCustomerInfo', customerInfoCount)
check('updateReceptionStatus', receptionStatusCount)
check('updateBookList', bookListCount)
check('updateMaterialPointList', materialPointListCount)
check("updateCustomerInfo", customerInfoCount);
check("updateReceptionStatus", receptionStatusCount);
check("updateBookList", bookListCount);
check("updateMaterialPointList", materialPointListCount);
// 5. 恢复环境
serviceAny.updateCustomerInfo = originalUpdateCustomerInfo
serviceAny.updateReceptionStatus = originalUpdateReceptionStatus
serviceAny.updateBookList = originalUpdateBookList
serviceAny.updateMaterialPointList = originalUpdateMaterialPointList
service.record = null // 重置 record
// 5. 恢复环境
serviceAny.updateCustomerInfo = originalUpdateCustomerInfo;
serviceAny.updateReceptionStatus = originalUpdateReceptionStatus;
serviceAny.updateBookList = originalUpdateBookList;
serviceAny.updateMaterialPointList = originalUpdateMaterialPointList;
service.record = null; // 重置 record
console.log('=== 测试结束,环境已恢复 ===')
}, 2000)
console.log("=== 测试结束,环境已恢复 ===");
}, 2000);
}
// uni_modules/permission-handler-plus 根入口
export * from "./utssdk/index.uts";
// permission-handler-plus 统一入口,按平台导出实现
export type { SuccessCallBack, FailCallBack, PermissionObject } from "./interface.uts";
export { permissionStatusName, permissionIdByName, permissionNameById } from "./interface.uts";
// #ifdef APP-ANDROID
export { checkPermission, requestPermissions } from "./app-android/index.uts";
// #endif
// #ifdef APP-IOS
export { checkPermission, requestPermissions } from "./app-ios/index.uts";
// #endif
// #ifdef APP-HARMONY
export { checkPermission, requestPermissions } from "./app-harmony/index.uts";
// #endif
// #ifndef APP-ANDROID || APP-IOS || APP-HARMONY
// Web 等非 App 平台:导出 stub,避免运行时 "does not provide an export named 'checkPermission'" 报错
import type { PermissionObject } from "./interface.uts";
export function checkPermission(permission: string, complete: (result: string) => void): void {
complete("granted")
}
export function requestPermissions(permission: PermissionObject): void {
const nameMap = new Map<string, string>()
if (permission.names != null && permission.names.length > 0) {
permission.names.forEach((name: string) => {
nameMap.set(name, "granted")
})
}
permission.success(nameMap)
}
// #endif
......@@ -18,7 +18,7 @@ export default defineConfig({
],
resolve: {
alias: {
"@": resolve("src")
"@": resolve(".")
}
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!