You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
3.3 KiB

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