起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1499|回复: 2

[结贴] 注册的时候上传身份证的图片路径

[复制链接]

13

主题

18

帖子

40

积分

新手上路

Rank: 1

积分
40
QQ
发表于 2017-1-3 11:19:12 | 显示全部楼层 |阅读模式
define(function(require) {
        var $ = require("jquery");
        var justep = require("$UI/system/lib/justep");
        var wx = require("http://res.wx.qq.com/open/js/jweixin-1.0.0.js");
        var baas = require("$UI/dbank/common/js/baas");

        // 图像信息数据
        var imgStr;
        var imgId;
        var certContrary = certContrary;
        var certFront = certFront;
        var filePath;
        var Model = function() {
                this.callParent();
        };

        Model.prototype.backBtnClick = function(event) {
        };

        Model.prototype.registerBtnClick = function(event) {
        debugger;
                baas.sendRequest({
                        "type" : "post",
                        "url" : baas.URL.register,
                        "async" : true,
                        "params" : {
                                certType : this.comp('certType').val(),
                                certNo : this.comp('certNo').val(),
                                realName : this.comp('realName').val(),
                                mobileNo : this.comp('mobileNo').val(),
                                certValidity : this.comp('certValidity').val(),
//                                取不到值
                                certFront :filePath,
                                //                                取不到值
                                certContrary : certContrary,
                                veriCode : 1
                        // veriCode :this.comp("veriCode").val()
                        },
                        "success" : function(data) {
                        debugger;
                          var append = event.options && event.options.append;
                            dataModel.setTotal(data.amount);
                        dataModel.loadData(data.result, append);
//                                alert("ok");
                        }
                });
        };

        Model.prototype.modelLoad = function(event) {

        };

        Model.prototype.photoInputChange = function(event) {
                imgId = 1;
                this.comp("picCutDialog").open({
                        "src" : "$UI/dbank/common/picCut/picCut.w",
                        data : {
                                file : event.target.files[0],
                                width : 120,
                                height : 120
                        }
                });
        };
        Model.prototype.photoInputChange1 = function(event) {
                imgId = 2;
                this.comp("picCutDialog").open({
                        "src" : "$UI/dbank/common/picCut/picCut.w",
                        data : {
                                file : event.target.files[0],
                                width : 120,
                                height : 120
                        }
                });
        };

        Model.prototype.picCutDialogReceive = function(event,filePath) {
                debugger;
        var filePath;
                if (imgId == 1) {
                        $(this.getElementByXid("certFront")).attr("src", event.data.data);
                        this.upImage(event.data.data,filePath);

                } else {
                        $(this.getElementByXid("certContrary")).attr("src", event.data.data);
                        this.upImage2(event.data.data,filePath);
                }
        };
        Model.prototype.upImage = function(imgStr) {
                debugger;
                baas.sendRequest({
                        "type" : "post",
                        "url" : baas.URL.upImage,
                        "async" : true,
                        "params" : {
                                imgStr : imgStr,
                        },
                        "success" : function(data) {
//               attachData.setValue("filePath", data.result.filePath);
                        }
                });
        };
        Model.prototype.upImage2 = function(imgStr,attachData) {
                debugger;
                baas.sendRequest({
                        "type" : "post",
                        "url" : baas.URL.upImage,
                        "async" : true,
                        "params" : {
                                imgStr : imgStr,
                        },
                        "success" : function(data) {
//                                 attachData.setValue("filePath", data.result.filePath);
                        }
                });
        };

        return Model;
});
发表于 2017-1-3 14:25:03 | 显示全部楼层
请问遇到什么问题呢??
上传可以使用attachmentSimple组件实现,也可以参考其他案例,cordova插件实现

http://bbs.wex5.com/forum.php?mod=viewthread&tid=68669   http://bbs.wex5.com/forum.php?mo ... 8&pid=165225779
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

13

主题

18

帖子

40

积分

新手上路

Rank: 1

积分
40
QQ
 楼主| 发表于 2017-1-4 10:40:18 | 显示全部楼层
问题已经解决了,谢谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-6-26 18:34 , Processed in 0.059085 second(s), 28 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表