define(function(require) { var $ = require("jquery"); var justep = require("$UI/system/lib/justep"); var base = require('$UI/system/api/native/base'); var scan = require('$UI/system/api/native/scan'); //var allData = require("./js/loadData");
var Model = function() { this.callParent(); this.ready = justep.Bind.observable(false); }; Model.prototype.modelLoad = function(event){ var self = this; base.ready(function() { self.ready.set(true); }); }; Model.prototype.scanQRCode0Click = function(event) { scan.scanQRCode(); }; Model.prototype.scanQRCode1Click = function(event) { scan.scanQRCode({ needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有 success: function (res) { var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果 } }); }; Model.prototype.checkJsApiClick = function(event){ base.checkJsApi({ jsApiList : [ 'scanQRCode'], success : function(res) { alert(JSON.stringify(res)); } }); }; return Model; });
|