Commit 39bfb0f6 by liimin

feat(uploader): 重构文件上传模块为策略模式并优化录音记录处理

- 新增上传策略接口 IUploadStrategy 及阿里云 OSS 和 uni.uploadFile 两种实现
- 引入统一的文件上传服务 FileUploadService,支持运行时切换上传策略
- 重构 RecordSave 服务,使用新的上传服务替代旧的 FileUploadManager
- 优化录音记录处理逻辑,移除 tempFilePath 字段并修复文件路径处理
- 支持 .m4a 格式音频文件上传,增强错误日志记录
- 清理无用代码,移除已注释的迁移逻辑和调试日志
1 parent 41234954
Showing 24 changed files with 307 additions and 241 deletions
import http from '@/api/request/http.uts'
export function getToken(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return http.fetch('dj.api.smartcarlife.recepiton.customer.oss.getToken', data) as Promise<UTSJSONObject>
}
...@@ -90,6 +90,8 @@ class Request { ...@@ -90,6 +90,8 @@ class Request {
const formData = formPairs.join('&'); const formData = formPairs.join('&');
const hostUrl = HOST[finalHostType] as string; const hostUrl = HOST[finalHostType] as string;
console.log("🚀 ~ Request ~ request ~ hostUrl:", hostUrl)
uni.request({ uni.request({
url: `${hostUrl}${path}router?method=${requestData["method"]}`, url: `${hostUrl}${path}router?method=${requestData["method"]}`,
data: formData, data: formData,
......
...@@ -38,7 +38,7 @@ const TABLE_COLUMNS = [ ...@@ -38,7 +38,7 @@ const TABLE_COLUMNS = [
'carBrandId INTEGER', 'carBrandId INTEGER',
'oneCarBrand TEXT', 'oneCarBrand TEXT',
'oneCarBrandId INTEGER', 'oneCarBrandId INTEGER',
'tempFilePath TEXT', // 'tempFilePath TEXT',
'recordStatus INTEGER DEFAULT 1' // 0: recording, 1: completed 'recordStatus INTEGER DEFAULT 1' // 0: recording, 1: completed
] ]
...@@ -126,60 +126,6 @@ class DBRecord extends DBBase { ...@@ -126,60 +126,6 @@ class DBRecord extends DBBase {
} }
/** /**
* 将旧的临时表数据迁移到正式表
*/
// async migrateTempRecords() {
// const tempTableName = 'temp_records'
// try {
// const exists = await this.db!.isTableExists(tempTableName)
// if (!exists) return
//
// logger.warn('DBRecord: Found temp_records table, starting migration...', "DBRecord")
//
// // 获取所有临时记录
// const tempRecords = await this.db!.selectSql(`SELECT * FROM ${tempTableName}`)
//
// if (tempRecords.length > 0) {
// for (const record of tempRecords) {
// const recObj = record as UTSJSONObject
// const id = recObj['id']
// if (id == null) continue
//
// // 标记为进行中
// recObj['recordStatus'] = 0
//
// // 检查是否已存在
// // id 可能是 string 或 number,这里转为 number 还是保持原样?
// // 假设 id 是 TEXT,保持原样。getRecordById 参数改为 any 或 string?
// // DBManager.getRecordById 接受 number。这里需要确认 id 类型。
// // table definition: id TEXT PRIMARY KEY. So it's string.
// // DBManager.getRecordById(id: number) -> need to change DBManager to accept string id?
// // Or convert here if it's numeric string.
//
// // 暂时注释掉 migrateTempRecords,因为涉及 id 类型不匹配和逻辑复杂性,且看起来是一次性迁移代码
// /*
// const existing = await this.getRecordById(record.id)
// if (existing) {
// // 如果存在,说明正式表已有记录,temp_records 中的是残留数据,直接跳过
// logger.warn(`DBRecord: Temp record ${record.id} already exists in records, skipping migration.`)
// } else {
// // 如果不存在,插入它
// await this.addRecord(record)
// logger.info(`DBRecord: Migrated temp record ${record.id}`)
// }
// */
// }
// }
// // 迁移完成后删除旧表
// await this.db!.drop(tempTableName)
// logger.warn('DBRecord: Migration completed, temp_records table dropped.', "DBRecord")
//
// } catch (e) {
// logger.error('DBRecord: Migration failed ' + e, "DBRecord")
// }
// }
/**
* 获取已完成的接待记录 (recordStatus = 1) * 获取已完成的接待记录 (recordStatus = 1)
*/ */
async getCompletedRecords(): Promise<any[]> { async getCompletedRecords(): Promise<any[]> {
......
import { UploadOptions, upload, initConfig, OSSConfig } from "@/uni_modules/uts-alioss";
import { logger } from "../logger/index.uts";
import { FileStatus } from "./common/constants.uts";
type UploadCallback = (result: UTSJSONObject) => void;
export class FileUploadManager {
static uploadManager: any | null = null; // 占位,实际可能不需要这个静态属性如果全是静态方法
private static _isInit = false;
static async waitForInit() {
// 简单模拟初始化完成
FileUploadManager._isInit = true
}
static get isInit(): boolean {
return FileUploadManager._isInit
}
// 模拟 ready 方法
static async ready() {
return true
}
static async uploadRecord(record: UTSJSONObject, callback: UploadCallback) {
// 提取文件信息
const fileName = record['fileName'] as string
const filePath = record['filePath'] as string
const recordId = record['recordId'] as string
if (fileName == "" || filePath == "") {
const res = {
status: FileStatus.Error,
recordId: recordId,
fileName: fileName,
filePath: filePath,
error: "File path or name is empty"
}
callback(res)
return
}
// 构造 OSS 上传参数
// 注意:这里需要 OSS 配置,通常从服务端获取或全局配置
// 假设全局配置已经初始化,或者在这里初始化
// 为了简化,这里假设 uts-alioss 已经配置好
const options = {
filePath: filePath,
objectKey: `records/${recordId}/${fileName}`, // 假设的 objectKey 规则
success: (res) => {
logger.info(`Upload success: ${res.url}`, "FileUploadManager")
const result = {
status: FileStatus.Uploaded,
recordId: recordId,
fileName: fileName,
filePath: filePath,
detail: {
data: [{
code: 0,
message: "success",
data: {
oss: {
res: {
requestUrls: [res.url]
}
}
}
}]
}
}
callback(result)
},
fail: (err) => {
logger.error(`Upload failed: ${err.errMsg}`, "FileUploadManager")
const result = {
status: FileStatus.Error,
recordId: recordId,
fileName: fileName,
filePath: filePath,
error: err.errMsg,
detail: {
data: [{
code: -1,
message: err.errMsg
}]
}
}
callback(result)
}
} as UploadOptions
upload(options)
}
}
export default FileUploadManager
...@@ -157,9 +157,7 @@ class RecordService { ...@@ -157,9 +157,7 @@ class RecordService {
attributesProvider(): UTSJSONObject { attributesProvider(): UTSJSONObject {
try { try {
console.log("🚀 ~ RecordService ~ attributesProvider ~ userInfo:")
const userInfo = storage.get('userInfo') as string const userInfo = storage.get('userInfo') as string
console.log("🚀 ~ RecordService ~ attributesProvider ~ userInfo:", userInfo)
const obj:UTSJSONObject = userInfo!='' ? JSON.parse(userInfo) as UTSJSONObject : {} const obj:UTSJSONObject = userInfo!='' ? JSON.parse(userInfo) as UTSJSONObject : {}
const sceneType = obj.get('sceneType') const sceneType = obj.get('sceneType')
const dynamicAttrs = { const dynamicAttrs = {
......
...@@ -110,14 +110,12 @@ class TempRecord { ...@@ -110,14 +110,12 @@ class TempRecord {
// ...restoredData // 合并恢复的大字段数据 // ...restoredData // 合并恢复的大字段数据
// } // }
logger.info('〖接待记录Record〗 == 更新文件,保存记录!', "TempRecord") logger.info('〖接待记录Record〗 == 更新文件,保存记录!', "TempRecord")
// 直接更新原记录,不再插入新记录 // 直接更新原记录,不再插入新记录
await this.db.updateRecord(toUpdateData, { id: record['id'] }) await this.db.updateRecord(toUpdateData, { id: record['id'] })
// 删除本地临时文件 (不再删除数据库记录,因为已经转正) // 删除本地临时文件 (不再删除数据库记录,因为已经转正)
// await this.clearLocalRecord(record, false) // 传入 false 表示不删除数据库记录 await this.clearLocalRecord(record, false) // 传入 false 表示不删除数据库记录
// this.triggleRecordNumChanged() this.triggleRecordNumChanged()
// 触发轮询开始事件,通知上传管理重新开始轮询 // 触发轮询开始事件,通知上传管理重新开始轮询
// UploadService.startPolling()
RecordSave.startPolling(false) RecordSave.startPolling(false)
} catch (error) { } catch (error) {
logger.info('〖接待记录Record〗 == 保存记录异常' + error, "TempRecord") logger.info('〖接待记录Record〗 == 保存记录异常' + error, "TempRecord")
...@@ -163,7 +161,6 @@ class TempRecord { ...@@ -163,7 +161,6 @@ class TempRecord {
// 从缓存恢复大字段数据 // 从缓存恢复大字段数据
const restoredData = await RecordCache.consumeAll(record) const restoredData = await RecordCache.consumeAll(record)
const recordLongList = await this.analysisUrlList(recordUrlList) const recordLongList = await this.analysisUrlList(recordUrlList)
console.log("🚀 ~ TempRecord ~ __save ~ recordLongList:", recordLongList)
const updateData = toUpdateData // shallow copy? const updateData = toUpdateData // shallow copy?
updateData['recordStatus'] = 1 updateData['recordStatus'] = 1
...@@ -202,7 +199,7 @@ class TempRecord { ...@@ -202,7 +199,7 @@ class TempRecord {
const baseName = parts[parts.length - 1] // pop const baseName = parts[parts.length - 1] // pop
list.push({ list.push({
status: FileStatus.Waiting, status: FileStatus.Waiting,
file: PathUtils.join(basePath, baseName) file: filePath//PathUtils.join(basePath, baseName)
}) })
} else { } else {
logger.warn('〖接待记录Record〗 == 有文件为空路径,舍弃!! ==', "TempRecord") logger.warn('〖接待记录Record〗 == 有文件为空路径,舍弃!! ==', "TempRecord")
...@@ -295,10 +292,10 @@ class TempRecord { ...@@ -295,10 +292,10 @@ class TempRecord {
if (rec == null) return if (rec == null) return
const id = rec['id'] as string const id = rec['id'] as string
const tempFilePath = rec['tempFilePath'] as string // const tempFilePath = rec['tempFilePath'] as string
logger.info('〖接待记录Record〗 == 删除临时文件' + tempFilePath, "TempRecord") // logger.info('〖接待记录Record〗 == 删除临时文件' + tempFilePath, "TempRecord")
await this.removeFile(tempFilePath) // await this.removeFile(tempFilePath)
if (id != "" && removeDbRecord) { if (id != "" && removeDbRecord) {
await this.removeRecord(id) await this.removeRecord(id)
......
import { UploadOptions, upload, initConfig, OSSConfig, UploadSuccessResult, UploadFailResult } from "@/uni_modules/uts-alioss";
import { logger } from '../logger/index.uts'
import { getToken } from '@/api/receiption.uts'
import { IUploadStrategy } from './IUploadStrategy.uts'
/**
* 阿里云 OSS 上传策略
*/
export class AliOSSUploadStrategy implements IUploadStrategy {
async upload(options: UTSJSONObject): Promise<UTSJSONObject> {
const filePath = options.getString('filePath')
if (filePath == null || filePath == "") {
throw new Error("filePath is required")
}
logger.info(`[AliOSSUploadStrategy] 开始上传文件: ${filePath}`, "FileUploadService")
try {
// 获取 OSS Token
const token = await getToken({})
const lsaccessKeySecret = token.getString('lsaccessKeySecret')
const securityToken = token.getString('securityToken')
const lsaccessKeyId = token.getString('lsaccessKeyId')
const bucketName = token.getString('bucketName') ?? 'your-bucket-name'
const region = token.getString('region') ?? 'oss-cn-hangzhou'
// 允许 options 覆盖默认配置
const targetBucket = options.getString('bucketName') ?? bucketName
const targetRegion = options.getString('region') ?? region
// 配置 OSS
const ossConfig = {
endpoint: `https://${targetRegion}.aliyuncs.com`,
bucketName: targetBucket,
accessKeyId: lsaccessKeyId ?? '', // 必填
accessKeySecret: lsaccessKeySecret ?? '', // 必填
securityToken: securityToken // 选填
} as OSSConfig
initConfig(ossConfig)
// 确定 objectKey
let objectKey = options.getString('objectKey')
if (objectKey == null || objectKey == "") {
// 如果未指定,使用文件名
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1)
objectKey = `uploads/${Date.now()}/${fileName}`
}
// 使用 await 等待 Promise 结果
const result = await new Promise<UTSJSONObject>((resolve, reject) => {
const uploadOptions = {
filePath: filePath,
objectKey: objectKey,
success: (res: UploadSuccessResult) => {
logger.info(`[AliOSSUploadStrategy] 上传成功: ${res.url}`, "FileUploadService")
resolve({
url: res.url,
objectKey: res.objectKey,
strategy: 'alioss'
} as UTSJSONObject)
},
fail: (res: UploadFailResult) => {
logger.error(`[AliOSSUploadStrategy] 上传失败: code=${res.errCode}, msg=${res.errMsg}`, "FileUploadService")
reject(new Error(res.errMsg))
}
} as UploadOptions
upload(uploadOptions)
})
return result
} catch (error) {
const errorMsg = typeof error === 'string' ? error : `${error}`
logger.error(`[AliOSSUploadStrategy] 上传异常: ${errorMsg}`, "FileUploadService")
throw error
}
}
}
/*
* @Descripttion: 通用文件上传服务 (策略模式)
* @version: 1.1.0
* @Author: limin
* @Date: 2026-03-01
* @FilePath: \venus\apps\uniappX\uniapp-x-tape\composables\uploader\FileUploadService.uts
*/
import { logger } from '../logger/index.uts'
import { IUploadStrategy } from './IUploadStrategy.uts'
import { AliOSSUploadStrategy } from './AliOSSUploadStrategy.uts'
import { UniUploadStrategy } from './UniUploadStrategy.uts'
/**
* 文件上传服务
* 提供通用的文件上传能力,支持策略切换
*/
class FileUploadService {
private static instance: FileUploadService | null = null
private strategy: IUploadStrategy
private constructor() {
// 默认使用 OSS 策略
this.strategy = new AliOSSUploadStrategy()
}
static getInstance(): FileUploadService {
if (FileUploadService.instance == null) {
FileUploadService.instance = new FileUploadService()
}
return FileUploadService.instance!
}
/**
* 切换上传策略
* @param type 策略类型: 'alioss' | 'uni'
*/
setStrategy(type: string) {
if (type == 'alioss') {
this.strategy = new AliOSSUploadStrategy()
logger.info(`[FileUploadService] 切换策略为: AliOSS`, "FileUploadService")
} else if (type == 'uni') {
this.strategy = new UniUploadStrategy()
logger.info(`[FileUploadService] 切换策略为: uni.uploadFile`, "FileUploadService")
} else {
logger.warn(`[FileUploadService] 未知策略: ${type}, 保持当前策略`, "FileUploadService")
}
}
/**
* 上传文件
* @param options 配置对象
* @returns Promise<UTSJSONObject> 返回上传结果
*/
async upload(options: UTSJSONObject): Promise<UTSJSONObject> {
return this.strategy.upload(options)
}
}
export default FileUploadService.getInstance()
/**
* 上传策略接口
*/
export interface IUploadStrategy {
upload(options: UTSJSONObject): Promise<UTSJSONObject>
}
import { logger } from '../logger/index.uts'
import { IUploadStrategy } from './IUploadStrategy.uts'
/**
* uni.uploadFile 上传策略
*/
export class UniUploadStrategy implements IUploadStrategy {
async upload(options: UTSJSONObject): Promise<UTSJSONObject> {
const filePath = options.getString('filePath')
if (filePath == null || filePath == "") {
throw new Error("filePath is required")
}
const uploadUrl = options.getString('uploadUrl')
if (uploadUrl == null || uploadUrl == "") {
throw new Error("uploadUrl is required for UniUploadStrategy")
}
logger.info(`[UniUploadStrategy] 开始上传文件: ${filePath} to ${uploadUrl}`, "FileUploadService")
try {
const result = await new Promise<UTSJSONObject>((resolve, reject) => {
uni.uploadFile({
url: uploadUrl,
filePath: filePath,
name: options.getString('name') ?? 'file',
formData: options['formData'] as UTSJSONObject,
header: options['header'] as UTSJSONObject,
success: (res) => {
logger.info(`[UniUploadStrategy] 上传成功: ${res.statusCode}`, "FileUploadService")
let data: UTSJSONObject
try {
if (typeof res.data === 'string') {
data = JSON.parse(res.data as string) as UTSJSONObject
} else {
data = res.data as UTSJSONObject
}
} catch (e) {
data = { rawData: res.data }
}
// 统一返回结构,尽量包含 url 字段如果服务端返回了
// 这里假设服务端返回的数据中可能包含 url,或者直接返回整个 data
data['strategy'] = 'uni'
data['statusCode'] = res.statusCode
resolve(data)
},
fail: (err) => {
logger.error(`[UniUploadStrategy] 上传失败: ${err.errMsg}`, "FileUploadService")
reject(new Error(err.errMsg))
}
})
})
return result
} catch (error) {
const errorMsg = typeof error === 'string' ? error : `${error}`
logger.error(`[UniUploadStrategy] 上传异常: ${errorMsg}`, "FileUploadService")
throw error
}
}
}
...@@ -4,93 +4,93 @@ ...@@ -4,93 +4,93 @@
"compiler_version": "4.87" "compiler_version": "4.87"
}, },
"files": { "files": {
"uni_modules/z-paging-x/components/z-paging-x/components/z-paging-refresher.kt": { "components/evaluationForm/TypeTabComponent.kt": {
"md5": "d00deb8ec65ffe26f6731a99a0dbcfa11ea603f9", "class": "GenComponentsEvaluationFormTypeTabComponent",
"class": "GenUniModulesZPagingXComponentsZPagingXComponentsZPagingRefresher" "md5": "0c65870c54770c8dfebb843dc83b547ef7d25a50"
},
"pages/demo/media/index.kt": {
"md5": "d76917918ad2397c0cd8429328b52ab77a83ff4f",
"class": "GenPagesDemoMediaIndex"
}, },
"pages/demo/old/index.kt": { "pages/demo/old/index.kt": {
"md5": "8b8d4a1b49e2ef7592d4e2f958b222392cf46fe8", "class": "GenPagesDemoOldIndex",
"class": "GenPagesDemoOldIndex" "md5": "8b8d4a1b49e2ef7592d4e2f958b222392cf46fe8"
}, },
"pages/common/login/index.kt": { "uni_modules/z-paging-x/components/z-paging-x/components/z-paging-load-more.kt": {
"md5": "165659590e28e0663c371d8606710e0c7fd36859", "class": "GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoadMore",
"class": "GenPagesCommonLoginIndex" "md5": "1e3f265be090ef72c9841a36e09d19bb3abc1a93"
},
"pages/demo/local-store/index.kt": {
"class": "GenPagesDemoLocalStoreIndex",
"md5": "6360b2df10619a70490f9f6f126d91728741e2c2"
},
"components/PublishPopup.kt": {
"class": "GenComponentsPublishPopup",
"md5": "b0c3be2d9836f013bc4b67bbf5fe08a456f6ce18"
}, },
"pages/common/components/NoData.kt": { "pages/common/components/NoData.kt": {
"class": "GenPagesCommonComponentsNoData", "class": "GenPagesCommonComponentsNoData",
"md5": "0608111022dbb7da0f7c3e452b7409d1ec7f5735" "md5": "0608111022dbb7da0f7c3e452b7409d1ec7f5735"
}, },
"pages/index/index.kt": {
"md5": "d8d028fdb9eab322150af58a90c2361ddfea3f18",
"class": "GenPagesIndexIndex"
},
"pages/demo/echarts/index.kt": { "pages/demo/echarts/index.kt": {
"class": "GenPagesDemoEchartsIndex", "md5": "e9c323efac81c50aa4eca12e75586263bacd95fb",
"md5": "e9c323efac81c50aa4eca12e75586263bacd95fb" "class": "GenPagesDemoEchartsIndex"
}, },
"pages/common/components/AccountList.kt": { "pages/common/components/AccountList.kt": {
"md5": "d78e30a9fd29b1bd3fc6451b74a39845095f79ee", "md5": "d78e30a9fd29b1bd3fc6451b74a39845095f79ee",
"class": "GenPagesCommonComponentsAccountList" "class": "GenPagesCommonComponentsAccountList"
}, },
"components/PublishPopup.kt": { "pages/demo/media/index.kt": {
"class": "GenComponentsPublishPopup", "md5": "d76917918ad2397c0cd8429328b52ab77a83ff4f",
"md5": "b0c3be2d9836f013bc4b67bbf5fe08a456f6ce18" "class": "GenPagesDemoMediaIndex"
},
"uni_modules/uni-icons/components/uni-icons/uni-icons.kt": {
"md5": "95aae1ef2b0e8906a602ca5d24eea964329fab31",
"class": "GenUniModulesUniIconsComponentsUniIconsUniIcons"
},
"pages/demo/record/index.kt": {
"class": "GenPagesDemoRecordIndex",
"md5": "46db702d44876c630d91abbce66cfca7cf3b20e9"
}, },
"uni_modules/z-paging-x/components/z-paging-x/z-paging-x.kt": { "uni_modules/z-paging-x/components/z-paging-x/z-paging-x.kt": {
"class": "GenUniModulesZPagingXComponentsZPagingXZPagingX", "md5": "790b2fe11f0d1a339b2a255af60a133b90113a36",
"md5": "4121973f93db5ff4294a93413e8c6e1f6413d356" "class": "GenUniModulesZPagingXComponentsZPagingXZPagingX"
},
"pages/demo/tailwindcss/index.kt": {
"md5": "c427026081cb75ed3d462c5ebf8a3ac0750bfa34",
"class": "GenPagesDemoTailwindcssIndex"
}, },
"pages/demo/permission/index.kt": { "pages/demo/record/index.kt": {
"class": "GenPagesDemoPermissionIndex", "md5": "46db702d44876c630d91abbce66cfca7cf3b20e9",
"md5": "18cb329597e3254e8c67cefdc1f196e3a1260273" "class": "GenPagesDemoRecordIndex"
}, },
"pages/common/accountItems/index.kt": { "pages/common/accountItems/index.kt": {
"md5": "ce7b7aebc25c812bc76446384be7b4ae423373da", "class": "GenPagesCommonAccountItemsIndex",
"class": "GenPagesCommonAccountItemsIndex" "md5": "ce7b7aebc25c812bc76446384be7b4ae423373da"
}, },
"pages/demo/local-store/index.kt": { "pages/common/login/index.kt": {
"md5": "6360b2df10619a70490f9f6f126d91728741e2c2", "class": "GenPagesCommonLoginIndex",
"class": "GenPagesDemoLocalStoreIndex" "md5": "165659590e28e0663c371d8606710e0c7fd36859"
}, },
"components/evaluationForm/TypeTabComponent.kt": { "uni_modules/z-paging-x/components/z-paging-x-empty/z-paging-x-empty.kt": {
"md5": "0c65870c54770c8dfebb843dc83b547ef7d25a50", "md5": "e8fa2621d20e3d4183965c604b60282e40ce5932",
"class": "GenComponentsEvaluationFormTypeTabComponent" "class": "GenUniModulesZPagingXComponentsZPagingXEmptyZPagingXEmpty"
}, },
"uni_modules/z-paging-x/components/z-paging-x/components/z-paging-loading.kt": { "uni_modules/z-paging-x/components/z-paging-x/components/z-paging-loading.kt": {
"md5": "bc2c0931a10ad4eea405d60556ee5e702cc28f62", "md5": "bc2c0931a10ad4eea405d60556ee5e702cc28f62",
"class": "GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoading" "class": "GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoading"
}, },
"index.kt": { "uni_modules/z-paging-x/components/z-paging-x/components/z-paging-refresher.kt": {
"class": "", "class": "GenUniModulesZPagingXComponentsZPagingXComponentsZPagingRefresher",
"md5": "11de582aba43f97fbc5832ac2094c8bdd7584855" "md5": "fc38688c293b8de58280ea7094b45716e5c5d262"
}, },
"uni_modules/z-paging-x/components/z-paging-x/components/z-paging-load-more.kt": { "pages/demo/permission/index.kt": {
"class": "GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoadMore", "class": "GenPagesDemoPermissionIndex",
"md5": "b477e65e495c0a7d8bebd037ce9b3929903fd834" "md5": "18cb329597e3254e8c67cefdc1f196e3a1260273"
},
"pages/demo/tailwindcss/index.kt": {
"md5": "c427026081cb75ed3d462c5ebf8a3ac0750bfa34",
"class": "GenPagesDemoTailwindcssIndex"
}, },
"pages/demo/gl-tape-demo/index.kt": { "pages/demo/gl-tape-demo/index.kt": {
"md5": "0aae13f9001ec4f53db18f232da3b9816d12d620", "md5": "0aae13f9001ec4f53db18f232da3b9816d12d620",
"class": "GenPagesDemoGlTapeDemoIndex" "class": "GenPagesDemoGlTapeDemoIndex"
}, },
"uni_modules/z-paging-x/components/z-paging-x-empty/z-paging-x-empty.kt": { "index.kt": {
"class": "GenUniModulesZPagingXComponentsZPagingXEmptyZPagingXEmpty", "md5": "8fedb508a381a1f5a963a7042637c3bba0946696",
"md5": "e8fa2621d20e3d4183965c604b60282e40ce5932" "class": ""
},
"pages/index/index.kt": {
"md5": "d8d028fdb9eab322150af58a90c2361ddfea3f18",
"class": "GenPagesIndexIndex"
},
"uni_modules/uni-icons/components/uni-icons/uni-icons.kt": {
"md5": "95aae1ef2b0e8906a602ca5d24eea964329fab31",
"class": "GenUniModulesUniIconsComponentsUniIconsUniIcons"
}, },
"uni_modules/lime-echart/components/l-echart/l-echart.kt": { "uni_modules/lime-echart/components/l-echart/l-echart.kt": {
"md5": "23c5a52d57071d3771477b55f910fbe9ccac83fc", "md5": "23c5a52d57071d3771477b55f910fbe9ccac83fc",
......
...@@ -55,16 +55,16 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoadMore : Vu ...@@ -55,16 +55,16 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoadMore : Vu
@Suppress("USELESS_CAST") @Suppress("USELESS_CAST")
override fun data(): Map<String, Any?> { override fun data(): Map<String, Any?> {
return _uM("isDefault" to computed<Boolean>(fun(): Boolean { return _uM("isDefault" to computed<Boolean>(fun(): Boolean {
return this.status === default__1.More.Default return this.status === default__2.More.Default
} }
), "isLoading" to computed<Boolean>(fun(): Boolean { ), "isLoading" to computed<Boolean>(fun(): Boolean {
return this.status === default__1.More.Loading return this.status === default__2.More.Loading
} }
), "isNoMore" to computed<Boolean>(fun(): Boolean { ), "isNoMore" to computed<Boolean>(fun(): Boolean {
return this.status === default__1.More.NoMore return this.status === default__2.More.NoMore
} }
), "isFail" to computed<Boolean>(fun(): Boolean { ), "isFail" to computed<Boolean>(fun(): Boolean {
return this.status === default__1.More.Fail return this.status === default__2.More.Fail
} }
), "statusText" to computed<String>(fun(): String { ), "statusText" to computed<String>(fun(): String {
if (this.isDefault) { if (this.isDefault) {
...@@ -99,7 +99,7 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoadMore : Vu ...@@ -99,7 +99,7 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingLoadMore : Vu
var inheritAttrs = true var inheritAttrs = true
var inject: Map<String, Map<String, Any?>> = _uM() var inject: Map<String, Map<String, Any?>> = _uM()
var emits: Map<String, Any?> = _uM() var emits: Map<String, Any?> = _uM()
var props = _nP(_uM("status" to _uM("type" to "String", "default" to default__1.More.Default), "defaultText" to _uM("type" to "String", "default" to "点击加载更多"), "loadingText" to _uM("type" to "String", "default" to "正在加载..."), "noMoreText" to _uM("type" to "String", "default" to "没有更多了"), "failText" to _uM("type" to "String", "default" to "加载失败,点击重新加载"))) var props = _nP(_uM("status" to _uM("type" to "String", "default" to default__2.More.Default), "defaultText" to _uM("type" to "String", "default" to "点击加载更多"), "loadingText" to _uM("type" to "String", "default" to "正在加载..."), "noMoreText" to _uM("type" to "String", "default" to "没有更多了"), "failText" to _uM("type" to "String", "default" to "加载失败,点击重新加载")))
var propsNeedCastKeys = _uA( var propsNeedCastKeys = _uA(
"status", "status",
"defaultText", "defaultText",
......
...@@ -69,13 +69,13 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingRefresher : V ...@@ -69,13 +69,13 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingRefresher : V
@Suppress("USELESS_CAST") @Suppress("USELESS_CAST")
override fun data(): Map<String, Any?> { override fun data(): Map<String, Any?> {
return _uM("times" to 0, "base64ArrowImg" to base64Arrow, "isDefault" to computed<Boolean>(fun(): Boolean { return _uM("times" to 0, "base64ArrowImg" to base64Arrow, "isDefault" to computed<Boolean>(fun(): Boolean {
return this.status === default__1.Refresher.Default return this.status === default__2.Refresher.Default
} }
), "isReleaseToRefresh" to computed<Boolean>(fun(): Boolean { ), "isReleaseToRefresh" to computed<Boolean>(fun(): Boolean {
return this.status === default__1.Refresher.ReleaseToRefresh return this.status === default__2.Refresher.ReleaseToRefresh
} }
), "isLoading" to computed<Boolean>(fun(): Boolean { ), "isLoading" to computed<Boolean>(fun(): Boolean {
return this.status === default__1.Refresher.Loading return this.status === default__2.Refresher.Loading
} }
), "statusText" to computed<String>(fun(): String { ), "statusText" to computed<String>(fun(): String {
if (this.isDefault) { if (this.isDefault) {
...@@ -111,7 +111,7 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingRefresher : V ...@@ -111,7 +111,7 @@ open class GenUniModulesZPagingXComponentsZPagingXComponentsZPagingRefresher : V
var inheritAttrs = true var inheritAttrs = true
var inject: Map<String, Map<String, Any?>> = _uM() var inject: Map<String, Map<String, Any?>> = _uM()
var emits: Map<String, Any?> = _uM() var emits: Map<String, Any?> = _uM()
var props = _nP(_uM("status" to _uM("type" to "String", "default" to default__1.Refresher.Default), "defaultText" to _uM("type" to "String", "default" to "继续下拉刷新"), "pullingText" to _uM("type" to "String", "default" to "松开立即刷新"), "refreshingText" to _uM("type" to "String", "default" to "正在刷新..."), "showUpdateTime" to _uM("type" to "Boolean", "default" to false), "updateTimeKey" to _uM("type" to "String", "default" to "default"), "timeTextTimestamp" to _uM("type" to "Number", "default" to 0))) var props = _nP(_uM("status" to _uM("type" to "String", "default" to default__2.Refresher.Default), "defaultText" to _uM("type" to "String", "default" to "继续下拉刷新"), "pullingText" to _uM("type" to "String", "default" to "松开立即刷新"), "refreshingText" to _uM("type" to "String", "default" to "正在刷新..."), "showUpdateTime" to _uM("type" to "Boolean", "default" to false), "updateTimeKey" to _uM("type" to "String", "default" to "default"), "timeTextTimestamp" to _uM("type" to "Number", "default" to 0)))
var propsNeedCastKeys = _uA( var propsNeedCastKeys = _uA(
"status", "status",
"defaultText", "defaultText",
......
...@@ -376,7 +376,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent { ...@@ -376,7 +376,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent {
open var listItemIs: String by `$data` open var listItemIs: String by `$data`
@Suppress("USELESS_CAST") @Suppress("USELESS_CAST")
override fun data(): Map<String, Any?> { override fun data(): Map<String, Any?> {
return _uM("\$zpxList" to null as UniElement?, "refresherStatus" to default__1.Refresher.Default, "refresherTriggered" to false, "refresherNodeHeight" to 0 as Number, "refresherTimeTextTimestamp" to 0, "loadMoreStatus" to default__1.More.Default, "queryFrom" to "", "isLoadFailed" to false, "customNoMore" to -1, "forceHideLoadMore" to false, "contentWidth" to 0, "isLoading" to true, "scrollTop" to 0, "oldScrollTop" to 0, "pageNo" to 1, "totalData" to _uA<Any>(), "base64BackToTopImg" to base64BackToTop, "backToTopClass" to "zpx-back-to-top zpx-back-to-top-hide", "lastBackToTopShowTime" to 0, "showBackToTopClass" to false, "privateScrollWithAnimation" to -1, "isFirstPage" to computed<Boolean>(fun(): Boolean { return _uM("\$zpxList" to null as UniElement?, "refresherStatus" to default__2.Refresher.Default, "refresherTriggered" to false, "refresherNodeHeight" to 0 as Number, "refresherTimeTextTimestamp" to 0, "loadMoreStatus" to default__2.More.Default, "queryFrom" to "", "isLoadFailed" to false, "customNoMore" to -1, "forceHideLoadMore" to false, "contentWidth" to 0, "isLoading" to true, "scrollTop" to 0, "oldScrollTop" to 0, "pageNo" to 1, "totalData" to _uA<Any>(), "base64BackToTopImg" to base64BackToTop, "backToTopClass" to "zpx-back-to-top zpx-back-to-top-hide", "lastBackToTopShowTime" to 0, "showBackToTopClass" to false, "privateScrollWithAnimation" to -1, "isFirstPage" to computed<Boolean>(fun(): Boolean {
return this.pageNo === this.defaultPageNo return this.pageNo === this.defaultPageNo
} }
), "finalRefresherThreshold" to computed<Number>(fun(): Number { ), "finalRefresherThreshold" to computed<Number>(fun(): Number {
...@@ -433,7 +433,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent { ...@@ -433,7 +433,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent {
if (this.scrollToTopWhenReload) { if (this.scrollToTopWhenReload) {
this.scrollToTop(false) this.scrollToTop(false)
} }
this.queryFrom = default__1.QueryFrom.Reload this.queryFrom = default__2.QueryFrom.Reload
this._emitQuery(this.pageNo, this.defaultPageSize) this._emitQuery(this.pageNo, this.defaultPageSize)
} }
open var complete = ::gen_complete_fn open var complete = ::gen_complete_fn
...@@ -448,13 +448,13 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent { ...@@ -448,13 +448,13 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent {
val currentData: UTSArray<Any> = finalData.slice() val currentData: UTSArray<Any> = finalData.slice()
if (this.customNoMore != -1) { if (this.customNoMore != -1) {
if (this.customNoMore == 1 || (this.customNoMore != 0 && finalData.length == 0)) { if (this.customNoMore == 1 || (this.customNoMore != 0 && finalData.length == 0)) {
this.loadMoreStatus = default__1.More.NoMore this.loadMoreStatus = default__2.More.NoMore
} }
} else { } else {
if (finalData.length == 0 || (finalData.length > 0 && finalData.length < this.defaultPageSize)) { if (finalData.length == 0 || (finalData.length > 0 && finalData.length < this.defaultPageSize)) {
this.loadMoreStatus = default__1.More.NoMore this.loadMoreStatus = default__2.More.NoMore
} else { } else {
this.loadMoreStatus = default__1.More.Default this.loadMoreStatus = default__2.More.Default
} }
} }
if (this.isFirstPage) { if (this.isFirstPage) {
...@@ -519,7 +519,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent { ...@@ -519,7 +519,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent {
open var endRefresh = ::gen_endRefresh_fn open var endRefresh = ::gen_endRefresh_fn
open fun gen_endRefresh_fn() { open fun gen_endRefresh_fn() {
this.refresherTriggered = false this.refresherTriggered = false
this.refresherStatus = default__1.Refresher.Default this.refresherStatus = default__2.Refresher.Default
this.isLoading = false this.isLoading = false
} }
open var scrollToTop = ::gen_scrollToTop_fn open var scrollToTop = ::gen_scrollToTop_fn
...@@ -559,9 +559,9 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent { ...@@ -559,9 +559,9 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent {
this.`$emit`("refresherpulling", e.detail.dy) this.`$emit`("refresherpulling", e.detail.dy)
if (!this.isLoading) { if (!this.isLoading) {
this.refresherStatus = if (e.detail.dy < this.finalRefresherThreshold) { this.refresherStatus = if (e.detail.dy < this.finalRefresherThreshold) {
default__1.Refresher.Default default__2.Refresher.Default
} else { } else {
default__1.Refresher.ReleaseToRefresh default__2.Refresher.ReleaseToRefresh
} }
} }
} }
...@@ -573,7 +573,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent { ...@@ -573,7 +573,7 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent {
open var _onRefresherrestore = ::gen__onRefresherrestore_fn open var _onRefresherrestore = ::gen__onRefresherrestore_fn
open fun gen__onRefresherrestore_fn(e: RefresherEvent) { open fun gen__onRefresherrestore_fn(e: RefresherEvent) {
this.`$emit`("refresherrestore", e) this.`$emit`("refresherrestore", e)
this.refresherStatus = default__1.Refresher.Default this.refresherStatus = default__2.Refresher.Default
} }
open var _onRefresherabort = ::gen__onRefresherabort_fn open var _onRefresherabort = ::gen__onRefresherabort_fn
open fun gen__onRefresherabort_fn(e: RefresherEvent) { open fun gen__onRefresherabort_fn(e: RefresherEvent) {
...@@ -596,20 +596,20 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent { ...@@ -596,20 +596,20 @@ open class GenUniModulesZPagingXComponentsZPagingXZPagingX : VueComponent {
} }
open var _handleRefresh = ::gen__handleRefresh_fn open var _handleRefresh = ::gen__handleRefresh_fn
open fun gen__handleRefresh_fn() { open fun gen__handleRefresh_fn() {
this.refresherStatus = default__1.Refresher.Loading this.refresherStatus = default__2.Refresher.Loading
this.refresherTriggered = true this.refresherTriggered = true
this.pageNo = this.defaultPageNo this.pageNo = this.defaultPageNo
this.queryFrom = default__1.QueryFrom.UserPullDown this.queryFrom = default__2.QueryFrom.UserPullDown
this._emitQuery(this.pageNo, this.defaultPageSize) this._emitQuery(this.pageNo, this.defaultPageSize)
} }
open var _handleLoadMore = ::gen__handleLoadMore_fn open var _handleLoadMore = ::gen__handleLoadMore_fn
open fun gen__handleLoadMore_fn() { open fun gen__handleLoadMore_fn() {
if (!this.loadMoreEnabled || this.isLoading || this.loadMoreStatus === default__1.More.NoMore) { if (!this.loadMoreEnabled || this.isLoading || this.loadMoreStatus === default__2.More.NoMore) {
return return
} }
this.loadMoreStatus = default__1.More.Loading this.loadMoreStatus = default__2.More.Loading
this.pageNo++ this.pageNo++
this.queryFrom = default__1.QueryFrom.LoadMore this.queryFrom = default__2.QueryFrom.LoadMore
this._emitQuery(this.pageNo, this.defaultPageSize) this._emitQuery(this.pageNo, this.defaultPageSize)
} }
open var _emitQuery = ::gen__emitQuery_fn open var _emitQuery = ::gen__emitQuery_fn
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!