acs
This commit is contained in:
68
main.js
Normal file
68
main.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import App from './App'
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
|
||||
Vue.directive('enterNumber', {
|
||||
inserted: function (el) {
|
||||
el.addEventListener("keypress",function(e){
|
||||
e = e || window.event;
|
||||
let charcode = typeof e.charCode == 'number' ? e.charCode : e.keyCode;
|
||||
// if (parseInt(e.target.value) == 0) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
parseInt(e.target.value) == 0 && e.preventDefault();
|
||||
let re = /\d/;
|
||||
if(!re.test(String.fromCharCode(charcode)) && charcode > 9 && !e.ctrlKey){
|
||||
if(e.preventDefault){
|
||||
e.preventDefault();
|
||||
}else{
|
||||
e.returnValue = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Vue.prototype.$globalData = {
|
||||
timer: null,
|
||||
timerDuration: 900000,
|
||||
startTimer: function() {
|
||||
const self = this;
|
||||
self.timer = setTimeout(function() {
|
||||
clearTimeout(self.timer);
|
||||
self.timer = null;
|
||||
// console.log('延时器结束1');
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '路线锁定未释放,请操作完成再退出!',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
self.timerDuration = 30000;
|
||||
Vue.prototype.$globalData.startTimer();
|
||||
}
|
||||
}
|
||||
})
|
||||
}, self.timerDuration);
|
||||
},
|
||||
stopTimer: function() {
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
// console.log('延时器结束2');
|
||||
this.timerDuration = 900000;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
import store from '@/vuex/store.js'
|
||||
|
||||
const app = new Vue({
|
||||
...App,
|
||||
store
|
||||
})
|
||||
|
||||
|
||||
app.$mount()
|
||||
Reference in New Issue
Block a user