Task files
This commit is contained in:
@@ -118,12 +118,15 @@
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col style="text-align: left;">
|
||||
<ion-button fill="outline" size="small" color="secondary" (click)="startCamera(100)">
|
||||
<ion-icon slot="icon-only" name="camera-reverse-outline"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button fill="outline"size="small" style="margin-left: 10px;" (click)="startCamera(0)">
|
||||
<ion-icon slot="icon-only" name="folder-outline"></ion-icon>
|
||||
<ion-button fill="outline" size="small" color="secondary" (click)="pickFiles(100)">
|
||||
<ion-icon name="document-attach-outline"></ion-icon> Send File
|
||||
</ion-button>
|
||||
<!-- <ion-button fill="outline" size="small" color="secondary" (click)="startCamera(100)">-->
|
||||
<!-- <ion-icon slot="icon-only" name="camera-reverse-outline"></ion-icon>-->
|
||||
<!-- </ion-button>-->
|
||||
<!-- <ion-button fill="outline"size="small" style="margin-left: 10px;" (click)="startCamera(0)">-->
|
||||
<!-- <ion-icon slot="icon-only" name="folder-outline"></ion-icon>-->
|
||||
<!-- </ion-button>-->
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-button style="margin-left: 20px;"
|
||||
|
||||
@@ -5,6 +5,8 @@ import {SessionDataProviderService} from "../../store/session-data-provider.serv
|
||||
import {WrenchService} from "../../services/wrench.service";
|
||||
import {Camera, CameraResultType, CameraSource} from "@capacitor/camera";
|
||||
import {SocketToolsService} from "../../services/socket-tools.service";
|
||||
import {FilePicker} from "@capawesome/capacitor-file-picker";
|
||||
import {MediaConnectService} from "../../services/media-connect.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-jobactive',
|
||||
@@ -27,7 +29,8 @@ export class JobactivePage implements OnInit {
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService,
|
||||
private socketToolsService: SocketToolsService,
|
||||
private loadingCtrl: LoadingController
|
||||
private loadingCtrl: LoadingController,
|
||||
private mediaConnectService: MediaConnectService
|
||||
) {
|
||||
this.jobData = this.router.getCurrentNavigation().extras.state;
|
||||
this.item_banner = this.jobData.banner;
|
||||
@@ -49,37 +52,6 @@ export class JobactivePage implements OnInit {
|
||||
this.navctr.back();
|
||||
}
|
||||
|
||||
// contrData: {
|
||||
// action:number,
|
||||
// member_id: number,
|
||||
// uid: string,
|
||||
// sessionid: string,
|
||||
// limit:20,
|
||||
// contract:string,
|
||||
// offset: 0
|
||||
// };
|
||||
// msgListTotalData:any;
|
||||
// msgListData: [];
|
||||
// activeJobMsgList(){
|
||||
// this.contrData = {
|
||||
// action:14011,
|
||||
// member_id: this.sessionDataProviderService.member_id,
|
||||
// uid: this.sessionDataProviderService.member_uid,
|
||||
// sessionid: this.sessionDataProviderService.session ,
|
||||
// limit:20,
|
||||
// contract: this.jobData.contract,
|
||||
// offset: 0}
|
||||
//
|
||||
// this.wrenchService.activeJobMsgList(this.contrData).subscribe(
|
||||
// msgListTotalData => {
|
||||
// this.msgListTotalData = msgListTotalData;
|
||||
// // console.log("REFER RETURN->", this.referTotalData);
|
||||
// this.msgListData = this.msgListTotalData.result_list;
|
||||
// console.log("REFER RETURN DATA->", this.msgListData);
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// }
|
||||
|
||||
reqData: {
|
||||
action:number, member_id: number, uid: string, sessionid: string, msg_type:string,
|
||||
@@ -189,5 +161,58 @@ export class JobactivePage implements OnInit {
|
||||
// console.log( this.uploadData);
|
||||
}
|
||||
}
|
||||
uploadFormData: {
|
||||
action:number,
|
||||
member_id: number,
|
||||
uid: string,
|
||||
contract: string,
|
||||
sessionid: string,
|
||||
msg_type:'FILE'
|
||||
};
|
||||
|
||||
async pickFiles (fileMode) {
|
||||
const result = await FilePicker.pickFiles({
|
||||
types: ['image/png','image/jpeg','video/mp4'],
|
||||
multiple: false,
|
||||
readData:true
|
||||
});
|
||||
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Uploading...',
|
||||
duration: 5000,
|
||||
});
|
||||
|
||||
if(result){
|
||||
console.log(result);
|
||||
// debugger;
|
||||
this.uploadFormData={
|
||||
action:14010,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
contract: this.jobData.contract,
|
||||
sessionid: this.sessionDataProviderService.session ,
|
||||
msg_type:'FILE'
|
||||
};
|
||||
|
||||
console.log(this.uploadFormData);
|
||||
for (const [key, value] of Object.entries( this.uploadFormData )) {
|
||||
console.log(`${key}: ${value}`);
|
||||
}
|
||||
|
||||
var blob = new Blob([ result.files[0].data ], { type: result.files[0].mimeType });
|
||||
var file = new File([blob], result.files[0].name, {type: result.files[0].mimeType });
|
||||
//return;
|
||||
await loading.present();
|
||||
this.mediaConnectService.uploadtaskFile(this.uploadFormData, file).subscribe(
|
||||
uploadResult => {
|
||||
loading.dismiss();
|
||||
this.uploadResult = uploadResult;
|
||||
console.log("this.mediaConnectService.uploadFile RETURN DATA->", this.uploadFormData);
|
||||
const event = new Event("app-taskactivities-refresh");
|
||||
// Dispatch the event.
|
||||
dispatchEvent(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user