|
@@ -31,7 +31,6 @@ export struct ScanFilePage{
|
|
|
@State lockPath:string = ''
|
|
@State lockPath:string = ''
|
|
|
@Consume isShowDrawer: boolean;
|
|
@Consume isShowDrawer: boolean;
|
|
|
@Consume offsetX: number;
|
|
@Consume offsetX: number;
|
|
|
- @State strText:string = ''
|
|
|
|
|
@State textVisi:Visibility=Visibility.Hidden
|
|
@State textVisi:Visibility=Visibility.Hidden
|
|
|
@State isStart:boolean = false
|
|
@State isStart:boolean = false
|
|
|
@State isStartCover:boolean = false
|
|
@State isStartCover:boolean = false
|
|
@@ -105,15 +104,13 @@ export struct ScanFilePage{
|
|
|
const eventData: emitter.EventData = {};
|
|
const eventData: emitter.EventData = {};
|
|
|
emitter.emit({ eventId: 101 }, eventData); // 发送视频打开广播事件
|
|
emitter.emit({ eventId: 101 }, eventData); // 发送视频打开广播事件
|
|
|
this.watchStatus(false)
|
|
this.watchStatus(false)
|
|
|
|
|
+ this.currentFilePath = '扫描文件入库成功!'
|
|
|
if(isOnekey){
|
|
if(isOnekey){
|
|
|
this.isStartCover = false
|
|
this.isStartCover = false
|
|
|
- this.strText = '获取成功!'
|
|
|
|
|
}else{
|
|
}else{
|
|
|
if(this.isStartSync){
|
|
if(this.isStartSync){
|
|
|
this.isStartSync = false
|
|
this.isStartSync = false
|
|
|
- this.strText = '校正数据成功!'
|
|
|
|
|
}else{
|
|
}else{
|
|
|
- this.strText = '扫描文件入库成功!'
|
|
|
|
|
this.isStart = false
|
|
this.isStart = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -142,10 +139,8 @@ export struct ScanFilePage{
|
|
|
this.textVisi = Visibility.Visible
|
|
this.textVisi = Visibility.Visible
|
|
|
this.initLottie(this.path,true)
|
|
this.initLottie(this.path,true)
|
|
|
if(isOnekey){
|
|
if(isOnekey){
|
|
|
- this.strText = '正在获取'
|
|
|
|
|
this.isStartCover = true
|
|
this.isStartCover = true
|
|
|
}else{
|
|
}else{
|
|
|
- this.strText = Utility.resourceToString(getContext(this),$r('app.string.scaning'))
|
|
|
|
|
this.isStart = true
|
|
this.isStart = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -161,12 +156,10 @@ export struct ScanFilePage{
|
|
|
task.onReceiveData((path: string, count: number) => {
|
|
task.onReceiveData((path: string, count: number) => {
|
|
|
this.currentFilePath = path
|
|
this.currentFilePath = path
|
|
|
this.currentInsertCount = count
|
|
this.currentInsertCount = count
|
|
|
- console.info( "onecold onReceiveData path = "+path);
|
|
|
|
|
- console.info( "onecold onReceiveData count = "+count);
|
|
|
|
|
})
|
|
})
|
|
|
taskpool.execute(task, taskpool.Priority.HIGH).then(()=>{
|
|
taskpool.execute(task, taskpool.Priority.HIGH).then(()=>{
|
|
|
this.endScan(isOnekey)
|
|
this.endScan(isOnekey)
|
|
|
- // taskpool.terminateTask(task);
|
|
|
|
|
|
|
+ taskpool.terminateTask(task);
|
|
|
}).catch((e:object)=>{
|
|
}).catch((e:object)=>{
|
|
|
console.info("onecold task1 catch e: " + JSON.stringify(e));
|
|
console.info("onecold task1 catch e: " + JSON.stringify(e));
|
|
|
})
|
|
})
|
|
@@ -251,15 +244,24 @@ export struct ScanFilePage{
|
|
|
.fontColor($r('app.color.text_color'))
|
|
.fontColor($r('app.color.text_color'))
|
|
|
.fontWeight(480)
|
|
.fontWeight(480)
|
|
|
.visibility(this.textVisi)
|
|
.visibility(this.textVisi)
|
|
|
|
|
+ .animation({
|
|
|
|
|
+ duration: 666,
|
|
|
|
|
+ curve: 'ease-in-out' // 可选动画曲线
|
|
|
|
|
+ })
|
|
|
Text(this.currentFilePath)
|
|
Text(this.currentFilePath)
|
|
|
.height(38)
|
|
.height(38)
|
|
|
- .fontSize(12)
|
|
|
|
|
|
|
+ .fontSize(!this.isStart?15:12)
|
|
|
.maxLines(3)
|
|
.maxLines(3)
|
|
|
.margin({bottom:6})
|
|
.margin({bottom:6})
|
|
|
.width('86%')
|
|
.width('86%')
|
|
|
|
|
+ .textAlign(this.isStart?TextAlign.Start:TextAlign.Center)
|
|
|
.fontColor($r('app.color.text_color'))
|
|
.fontColor($r('app.color.text_color'))
|
|
|
.fontWeight(480)
|
|
.fontWeight(480)
|
|
|
.visibility(this.textVisi)
|
|
.visibility(this.textVisi)
|
|
|
|
|
+ .animation({
|
|
|
|
|
+ duration: 666,
|
|
|
|
|
+ curve: 'ease-in-out' // 可选动画曲线
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
Row(){
|
|
Row(){
|
|
@@ -518,7 +520,7 @@ async function scanDirectoryTask(context: Context, dirPath: string,
|
|
|
await Promise.all(files.map(async (file) => {
|
|
await Promise.all(files.map(async (file) => {
|
|
|
|
|
|
|
|
const fPath = `${currentPath}/${file}`;
|
|
const fPath = `${currentPath}/${file}`;
|
|
|
- console.info('onecold scanDirectoryTask fPath = ' + fPath)
|
|
|
|
|
|
|
+ // console.info('onecold scanDirectoryTask fPath = ' + fPath)
|
|
|
if (fPath === lockPath) return;
|
|
if (fPath === lockPath) return;
|
|
|
|
|
|
|
|
if (FileUtil.isDirectory(fPath)) {
|
|
if (FileUtil.isDirectory(fPath)) {
|
|
@@ -533,12 +535,12 @@ async function scanDirectoryTask(context: Context, dirPath: string,
|
|
|
insertCount++
|
|
insertCount++
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- console.info('onecold scanDirectoryTask fPath = ' + fPath)
|
|
|
|
|
- console.info('onecold scanDirectoryTask insertCount = ' + insertCount)
|
|
|
|
|
|
|
+ // console.info('onecold scanDirectoryTask fPath = ' + fPath)
|
|
|
|
|
+ // console.info('onecold scanDirectoryTask insertCount = ' + insertCount)
|
|
|
taskpool.Task.sendData(fPath,insertCount);
|
|
taskpool.Task.sendData(fPath,insertCount);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
let err = error as BusinessError;
|
|
let err = error as BusinessError;
|
|
|
- // hilog.warn(0x000, 'testTag', `sendData failed, code=${err.code}, message=${err.message}`);
|
|
|
|
|
|
|
+ console.warn( `onecold sendData failed, code=${err.code}, message=${err.message}`);
|
|
|
}
|
|
}
|
|
|
table.insert(mediaItem, (id: number) => {
|
|
table.insert(mediaItem, (id: number) => {
|
|
|
|
|
|