|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2020-04-21 09:27
- * 描 述:扫码报到
- */
- (function () {
- var page = {
- grid: null,
- init: function ($page) {
- $page.find('#btnscan').on('tap', function () {
- var ua = navigator.userAgent.toLowerCase();
- if (/(html5plus)/i.test(ua)) {
- //if (false) {
- $('.bcidBox').css('display', 'block');
- var scan = new plus.barcode.Barcode('bcid');
- scan.onmarked = function onmarked(type, result) {
- scan.close();
- $('.bcidBox').css('display', 'none');
- learun.layer.loading(true, '正在读取学生数据');
- learun.nav.closeCurrent();
- learun.nav.go({ path: 'WelcomNewStudents/ConfirmStudentsCheckIn/form', title: '确认报到', param: { StuNo: result }, isBack: true, isHead: true });
- };
- scan.start();
- } else if (/micromessenger/.test(ua)) {
- $.ajax({
- url: config.webapi + "weixinapi/getweixinwebaccess_token?url=" + encodeURIComponent(window.location.href),
- type: "get",
- success: function (res) {
- wx.config({
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: res.data.appid, // 必填,公众号的唯一标识
- timestamp: res.data.timestamp, // 必填,生成签名的时间戳
- nonceStr: res.data.noncestr, // 必填,生成签名的随机串
- signature: res.data.certificate, // 必填,签名
- jsApiList: ["scanQRCode"] // 必填,需要使用的JS接口列表
- });
-
- wx.ready(function () {
- wx.scanQRCode({
- needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
- scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
- success: function (res) {
- learun.layer.loading(true, '正在读取学生数据');
- learun.nav.closeCurrent();
- learun.nav.go({ path: 'WelcomNewStudents/ConfirmStudentsCheckIn/form', title: '确认报到', param: { StuNo: res.resultStr }, isBack: true, isHead: true });
- }
- });
- });
- }
- });
- } else {
- learun.layer.warning('请下载app或者到微信浏览器打开网页');
- }
- });
-
- }
- };
- return page;
- })();
|