主干js查看页面FileUploadoptions和FileTransfer未定义

时间:2018-11-14 14:33:41

标签: cordova backbone.js cordova-plugins cordova-ios

我正在使用适用于iOS的基于主干js(对于MVC)的Cordova应用程序。 在此之上,我们具有用于显示模板文件的视图,在该视图上FileUploadOptions和FileTranfer不起作用。 在此我们定义了如下文件,

define(['backbonelocalstorage', 'templates/createequipment.tpl', 'templates/createequipmentinfo.tpl', 
        'templates/createequipmentid.tpl', 'templates/createadditionalid.tpl', 'templates/createequipmentdetail.tpl', 
        'templates/createpurchaseinfo.tpl', 'templates/createtechnicaldata.tpl', 'templates/createadditionalinfo.tpl', 
        'templates/selectVendorList.tpl', 'templates/selectVendorListScroll.tpl', 'templates/selectSystemId.tpl', 
        'templates/selectSystemIdScrollList.tpl', 'templates/selectServiceProviderList.tpl', 'templates/selectServiceProviderScrollList.tpl', 
        'templates/selectLocationList.tpl','templates/selectLocationScrollList.tpl', 'templates/selectManufacturerList.tpl', 
        'templates/selectManufacturerListScroll.tpl', 'templates/selectCategoriesList.tpl', 'templates/selectCategoriesScrollList.tpl', 
        'templates/selectAlternativeDeviceList.tpl', 'templates/selectAlternativeDeviceScrollList.tpl', 'templates/selectContractList.tpl', 
        'templates/selectContractsScrollList.tpl', 'templates/systemEquipmentList.tpl', 'templates/systemEquipmentListScroll.tpl', 
        'views/header/newheaderview', 'views/aside/asideview', 'models/templatemodel', 'models/equipmentTemplatemodel', 
        'models/equipmentIDmodel', 'models/additionalIDmodel', 'models/equipmentDetailsmodel', 'models/purchaseInfomodel', 
        'models/technicalDatamodel', 'models/additionalInfomodel', 'models/getvendorlistmodel', 'models/getSystemIdListmodel', 
        'models/getserviceproviderlistmodel', 'models/getequipmentmanufacturerlistmodel', 'models/getequipmentlocationlistmodel', 
        'models/getequipmentcategorieslistmodel', 'models/getequipmentaltdevicelistmodel', 'models/getequipmentcontractlistmodel', 
        'models/createsaveequipmentmodel', 'models/productNumberValidationModel', 'models/uniqueManufacturerModel','models/uniqueSystemIdModel', 
        'models/equipmentInventoryLocationModel', 'models/validateSignOffUser', 'models/currentOrganizationRelevantDetails', 
        'models/tNrEquipmentTabModel','models/equipmentAlreadyMappedModel', 'js/childbrowser.js', 'js/vwrdatepicker.js', 
        'handlebars','views/createTasknRequest/ComplianceView','base64', 'bootstrap', 'jqueryUI'], 
        function(Storage, CreateEquipmentTemplate, CreateEquipmentInfoTemplate, CreateEquipmentIdTemplate, CreateAddtionalIdTemplate,
                CreateEquipmentDetailTemplate, CreatePurchaseInfoTemplate, CreateTechnicalDataTemplate, CreateAdditionalInfoTemplate, 
                SelectVendorListTemplate, SelectVendorListScrollTemplate, SelectSystemIdListTemplate, SelectSystemIdScrollListTemplate, 
                SelectServiceProviderListTemplate, SelectServiceProviderScrollListTemplate, SelectLocationListTemplate,
                SelectLocationScrollListTemplate, SelectManufacturerListTemplate, SelectManufacturerListScrollTemplate, 
                SelectCategoriesListTemplate, SelectCategoriesScrollListTemplate, SelectAlternativeDeviceListTemplate, 
                SelectAlternativeDeviceScrollListTemplate, SelectContractList, SelectContractListTemplate, SystemEquipmentList, 
                systemEquipmentListScroll, HeaderView, AsideView, TemplateModel, EquipmentTemplateModel, EquipmentIdModel, 
                AdditionalIdModel, EquipmentDetailsModel, PurchaseInfoModel, TechnicalDataModel, AdditionalInfoModel, GetVendorListModel, 
                GetSystemIdListModel, GetServiceProviderListModel, GetEquipmentManufacturerListModel, GetEquipmentLocationListModel, 
                GetEquipmentCategoriesListModel, GetEquipmentAltDeviceListModel, GetEquipmentContractListModel, CreateSaveEquipmentModel, 
                ProductNumberValidationModel, UniqueManufacturerModel,UniqueSystemIdModel, EquipmentInventoryLocationModel, ValidateSignOffUser, 
                CurrentOrganizationRelevantDetails, EquipmentListModel, equipmentAlreadyMappedModel,childBrowser, vwrDatePicker, Handlebars,ComplianceView, Base64, BootStrap) {

在此页面中,我使用的相机如下所示

var Camera=window.cordova.require("cordova-plugin-camera.camera");

在尝试使用FileUploadOptions和FileTransfer插件上传图片后,我可以使用getpicture进行拍摄或选择。

选择摄像机或文件后,它会重定向到成功方法,如下所示:

uploadPhotoEquipment: function(message) {
            $(".modal.in").modal('hide');
            captured = message;
            imagename = "tempfile"; //message.name;
            //fullPath = message.fullPath;
            var options = new FileUploadOptions();
            options.fileKey = "uploadImage";
            options.fileName = imagename;
            options.mimeType = "image/jpg";
            options.headers = App.getAuthHeaders();
            options.chunkedMode = false;
            var ft = new FileTransfer();
            var url = window.serviceHost + "/uploadEquipmentImageService";
            ft.onprogress = function(progressEvent) {
                $("#processingBody").modal("show");
                $("#processing").show();
            }
            ft.onloadend = function(progressEvent) {
                $("#processingBody").modal("hide");
                $("#processing").hide();
            }                   
            ft.onerror = function(progressEvent) {
                $("#processingBody").modal("hide");
                $("#processing").hide();
            }
            ft.upload(message, url, uploadSucessEquipment, this.uploadFailEquipment, options, true);

}

我收到未定义FileUploadOptions之类的错误,因此将其更改为{},然后我得到FileTransfer未定义。

0 个答案:

没有答案