|
|
|
@@ -8,14 +8,15 @@ const SELECT_TYPE = { |
|
|
|
IMAGE: 1, |
|
|
|
VIDEO: 2, |
|
|
|
}; |
|
|
|
let timer = null |
|
|
|
|
|
|
|
Page({ |
|
|
|
data: { |
|
|
|
showtoast: false, |
|
|
|
showOverlay: true, |
|
|
|
showSelect: false, |
|
|
|
SELECT_TYPE: SELECT_TYPE, |
|
|
|
selectType: 0, |
|
|
|
|
|
|
|
//CRS配置 |
|
|
|
config: { |
|
|
|
apiKey: 'a9abd99b2dfb3a5bee964cbb0bced0ae', // EasyAR开发中心 - API KEY - API Key |
|
|
|
@@ -50,16 +51,15 @@ Page({ |
|
|
|
last: undefined, |
|
|
|
|
|
|
|
onLoad: function () { |
|
|
|
|
|
|
|
this.daojishi() // 默认进入页面10S后退出 |
|
|
|
}, |
|
|
|
onReady: function () { |
|
|
|
if (systemInfo.platform === "devtools") { //开发工具不会触发initdone事件,于是在onReady手动触发 |
|
|
|
this.onCameraInit(); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取token |
|
|
|
this.queryToken().then(msg => { |
|
|
|
console.log('token1') |
|
|
|
console.log(msg) |
|
|
|
this.data.config.token = msg; |
|
|
|
}).catch(err => { |
|
|
|
@@ -67,27 +67,32 @@ Page({ |
|
|
|
}); |
|
|
|
}, |
|
|
|
onHide(){ |
|
|
|
console.log('tuichu') |
|
|
|
clearInterval(timer); |
|
|
|
this.setData({ |
|
|
|
runningCrs: false |
|
|
|
}) |
|
|
|
}, |
|
|
|
daojishi(){ |
|
|
|
var t = 10; |
|
|
|
var timer = setInterval(function(){ |
|
|
|
t--; |
|
|
|
if(t<2){ |
|
|
|
wx.showToast({ |
|
|
|
icon: 'none', |
|
|
|
title: '扫描时间过长,请退出后重新扫描!', |
|
|
|
}) |
|
|
|
daojishi: function(){ |
|
|
|
let that = this |
|
|
|
let seconds = 10 |
|
|
|
timer = setInterval(function(){ |
|
|
|
seconds--; |
|
|
|
if(seconds<2){ |
|
|
|
that.setData({ |
|
|
|
showtoast: true |
|
|
|
}) |
|
|
|
} |
|
|
|
if(t<0){ |
|
|
|
if(seconds<0){ |
|
|
|
that.setData({ |
|
|
|
showtoast: false |
|
|
|
}) |
|
|
|
clearInterval(timer); |
|
|
|
wx.navigateBack({ |
|
|
|
delta: 1, |
|
|
|
}) |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
}, |
|
|
|
}, |
|
|
|
showLoading(text) { |
|
|
|
this.setData({ |
|
|
|
showLoading: true, |
|
|
|
|