修改QRCode问题
diff --git a/www/js/qrcode.js b/www/js/qrcode.js
index 35fe7a3..4664a9b 100644
--- a/www/js/qrcode.js
+++ b/www/js/qrcode.js
@@ -7,17 +7,58 @@
onDeviceReady: function() {
var uid = window.localStorage.getItem("token");
- var qrcode = new QRCode(document.getElementById("qrcode"), {
- text: uid,
- width: 150,
- height: 150,
- colorDark : "#000000",
- colorLight : "#ffffff",
- correctLevel : QRCode.CorrectLevel.L
- });
+ this.loadQrcode();
+ setInterval(function () {
+ window.location.reload();
+ },100000);
},
- toBillDetail :function(refno){
-
+ loadQrcode: function() {
+ $.showLoading("加载中");
+ V1Qrcode(function(ok, ret) {
+ if (ok) {
+ console.log(ret)
+ if (ret.code == 200) {
+ $.hideLoading();
+ var qrcode = new QRCode(document.getElementById("qrcode"), {
+ text: ret.qrcode,
+ width: 150,
+ height: 150,
+ colorDark: "#000000",
+ colorLight: "#ffffff",
+ correctLevel: QRCode.CorrectLevel.L
+ });
+ } else {
+ $.hideLoading();
+ $.alert("请求失败,请稍后再试", "错误");
+ }
+ } else {
+ $.hideLoading();
+ $.alert("请求失败了:" + ret.status + "请稍后再试", "错误");
+ }
+ })
+ },
+ refresh:function(){
+ V1Qrcode(function(ok, ret) {
+ if (ok) {
+ if (ret.code == 200) {
+ $.hideLoading();
+ var qrcode = new QRCode(document.getElementById("qrcode"), {
+ text: ret.qrcode,
+ width: 150,
+ height: 150,
+ colorDark: "#000000",
+ colorLight: "#ffffff",
+ correctLevel: QRCode.CorrectLevel.L
+ });
+ } else {
+ $.hideLoading();
+ $.alert("请求失败,请稍后再试", "错误");
+ }
+ } else {
+ $.hideLoading();
+ $.alert("请求失败了:" + ret.status + "请稍后再试", "错误");
+ }
+ })
}
};
app.initialize();
\ No newline at end of file