diff --git a/src/api/httpRequest3.js b/src/api/httpRequest3.js index bed2d06..8bb9a74 100644 --- a/src/api/httpRequest3.js +++ b/src/api/httpRequest3.js @@ -13,7 +13,7 @@ function service(options = {}) { // requestUrl = getApp().globalData.request_url // } var requestUrl = "" - requestUrl =config.request_url + requestUrl = uni.getStorageSync("requestUrl")? uni.getStorageSync("requestUrl"):config.request_url options.header = { "content-type": "application/json", diff --git a/src/pages.json b/src/pages.json index 3877143..77bb3c5 100644 --- a/src/pages.json +++ b/src/pages.json @@ -31,13 +31,28 @@ } } }, + { + "path": "pages/setter/config", + "style": { + "navigationBarTitleText": "配置信息", + "titleNView": { + // "autoBackButton": "true", + "buttons": [{}] + } + } + }, { "path": "pages/login/index", "style": { "navigationBarTitleText": "登录", "titleNView": { // "autoBackButton": "true", - "buttons": [{}] + "buttons": [{ + "float": "right", + "fontSize": "52rpx", //按钮上文字的大小 + "text": "\ue706", + "fontSrc": "/static/ali_icon/iconfont.ttf" + }] } } }, diff --git a/src/pages/appUpdate/appUpdate.js b/src/pages/appUpdate/appUpdate.js index 8603f89..ad5c475 100644 --- a/src/pages/appUpdate/appUpdate.js +++ b/src/pages/appUpdate/appUpdate.js @@ -1,4 +1,5 @@ +import config from '@/static/config.js' export function checkVersion(isShowHint){ let curversionCode = 0; plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) { @@ -14,8 +15,10 @@ export function checkVersion(isShowHint){ title:"加载中", mask:true }) + var appUpdateUrl =uni.getStorageSync("appUpdateUrl")? uni.getStorageSync("appUpdateUrl"):config.appUpdateUrl + console.log("更新地址", appUpdateUrl) uni.request({ - url:"http://192.168.0.105:9527/appUpdate.json", + url:appUpdateUrl, method:"GET" }).then(res=>{ uni.hideLoading() diff --git a/src/pages/foam/check.vue b/src/pages/foam/check.vue index c3f6689..12d1b1a 100644 --- a/src/pages/foam/check.vue +++ b/src/pages/foam/check.vue @@ -107,7 +107,7 @@ worker: this.$store.state.user.name, lastTime: null, // 最后一次点击的时间 currentTime: null, // 当前点击的时间 - timeOut: config.pageTimeOut, + timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 dataList: [], formData: [{ type: "stateSelect", @@ -243,7 +243,7 @@ touchScreen() { this.currentTime = new Date().getTime() // 记录这次点击的时间 console.log("当前时间", this.currentTime) - if (this.currentTime - this.lastTime > this.timeOut) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 + if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 console.log("当前时间跳转") uni.reLaunch({ url: "../login/index" diff --git a/src/pages/foam/downLink.vue b/src/pages/foam/downLink.vue index b0ea468..5109ac2 100644 --- a/src/pages/foam/downLink.vue +++ b/src/pages/foam/downLink.vue @@ -111,7 +111,7 @@ scanCheckCode:"", lastTime: null, // 最后一次点击的时间 currentTime: null, // 当前点击的时间 - timeOut: config.pageTimeOut + timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 } }, @@ -124,7 +124,7 @@ touchScreen() { this.currentTime = new Date().getTime() // 记录这次点击的时间 console.log("当前时间", this.currentTime) - if (this.currentTime - this.lastTime > this.timeOut) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 + if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 console.log("当前时间跳转") uni.reLaunch({ url: "../login/index" diff --git a/src/pages/foam/foamNoGood.vue b/src/pages/foam/foamNoGood.vue index 49bd100..e2e9033 100644 --- a/src/pages/foam/foamNoGood.vue +++ b/src/pages/foam/foamNoGood.vue @@ -181,7 +181,7 @@ typeRange: ["隔离", "报废"], lastTime: null, // 最后一次点击的时间 currentTime: null, // 当前点击的时间 - timeOut: config.pageTimeOut + timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 } }, @@ -194,7 +194,7 @@ touchScreen() { this.currentTime = new Date().getTime() // 记录这次点击的时间 console.log("当前时间", this.currentTime) - if (this.currentTime - this.lastTime > this.timeOut) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 + if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 console.log("当前时间跳转") uni.reLaunch({ url: "../login/index" diff --git a/src/pages/foam/input.vue b/src/pages/foam/input.vue index 156f5b2..e89f34f 100644 --- a/src/pages/foam/input.vue +++ b/src/pages/foam/input.vue @@ -134,7 +134,7 @@ planList: [], lastTime: null, // 最后一次点击的时间 currentTime: null, // 当前点击的时间 - timeOut: config.pageTimeOut + timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 } @@ -148,7 +148,7 @@ touchScreen() { this.currentTime = new Date().getTime() // 记录这次点击的时间 console.log("当前时间", this.currentTime) - if (this.currentTime - this.lastTime > this.timeOut) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 + if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 console.log("当前时间跳转") uni.reLaunch({ url: "../login/index" diff --git a/src/pages/foam/upLink.vue b/src/pages/foam/upLink.vue index a61d52b..de255c4 100644 --- a/src/pages/foam/upLink.vue +++ b/src/pages/foam/upLink.vue @@ -131,7 +131,7 @@ scanCheckCode:"", lastTime: null, // 最后一次点击的时间 currentTime: null, // 当前点击的时间 - timeOut: config.pageTimeOut + timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 } }, @@ -144,7 +144,7 @@ touchScreen() { this.currentTime = new Date().getTime() // 记录这次点击的时间 console.log("当前时间", this.currentTime) - if (this.currentTime - this.lastTime > this.timeOut) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 + if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 console.log("当前时间跳转") uni.reLaunch({ url: "../login/index" diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 1a61697..cde1634 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -95,7 +95,7 @@ backButtonPress: 0, lastTime: null, // 最后一次点击的时间 currentTime: null, // 当前点击的时间 - timeOut:config.pageTimeOut,// 设置超时时间:30分钟 + timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 } }, @@ -159,7 +159,7 @@ touchScreen() { this.currentTime = new Date().getTime() // 记录这次点击的时间 console.log("当前时间", this.currentTime) - if (this.currentTime - this.lastTime > this.timeOut) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 + if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 console.log("当前时间跳转") uni.reLaunch({ url: "../login/index" diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index c12cae6..6d879ad 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -6,6 +6,7 @@ 您好,欢迎使用
投入产出管理系统 +
@@ -21,13 +22,15 @@ --> + 用户名 - + @@ -35,9 +38,9 @@ 密码 - - + + @@ -70,6 +73,7 @@ + + \ No newline at end of file diff --git a/src/pages/setter/index.vue b/src/pages/setter/index.vue index 94a3963..e1c10e6 100644 --- a/src/pages/setter/index.vue +++ b/src/pages/setter/index.vue @@ -9,6 +9,8 @@ {{userName}} {{requestUrl}} + {{timeOut}}(分钟) + {{appUpdateUrl}} {{version}} {{version}} @@ -48,59 +50,37 @@ return { userName: "", requestUrl: "", + appUpdateUrl:"", version: "", - pageTimeOut: config.pageTimeOut, - timerCount: null, + lastTime: null, // 最后一次点击的时间 + currentTime: null, // 当前点击的时间 + timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// 设置超时时间:30分钟 } }, onShow(){ - // this.startTimer(); + this.lastTime = new Date().getTime() }, - onHide() { - console.log('当前页面被关闭onHide'); - setTimeout(res=>{ - this.clearTimeout(); - },500) - - }, - onUnload() { - console.log('当前页面被关闭onUnload'); - this.clearTimeout(); - }, onLoad() { this.userName = this.$store.state.user.name - this.requestUrl =config.request_url + this.requestUrl =uni.getStorageSync("requestUrl")? uni.getStorageSync("requestUrl"):config.request_url + this.appUpdateUrl =uni.getStorageSync("appUpdateUrl")? uni.getStorageSync("appUpdateUrl"):config.appUpdateUrl this.getAppVersion() }, methods: { - startTimer() { - var that = this; - this.timerCount = setInterval(() => { - console.log("记时_setting", that.pageTimeOut) - if (that.pageTimeOut > 0 && that.pageTimeOut <= config.pageTimeOut) { - that.pageTimeOut--; - } else { - console.log("停止", that.pageTimeOut) - this.clearTimeout() - uni.reLaunch({ - url: "../login/index" - }) - } - }, 1000) - }, - clearTimeout() { - console.log("清除", this.timerCount) - if (this.timerCount) { - clearInterval(this.timerCount); - this.timerCount = null; - } - }, + touchScreen() { - this.pageTimeOut = config.pageTimeOut - this.clearTimeout() - this.startTimer(); - console.log("页面点击touchScreen", this.pageTimeOut) + this.currentTime = new Date().getTime() // 记录这次点击的时间 + console.log("当前时间", this.currentTime) + if (this.currentTime - this.lastTime > this.timeOut*60*1000) { // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟 + console.log("当前时间跳转") + uni.reLaunch({ + url: "../login/index" + }) + } else { + this.lastTime = new Date().getTime() // 如果在30分钟内点击,则把这次点击的时间记录覆盖掉之前存的最后一次点击的时间 + console.log("当前时间跳转赋值,没跳转" + this.lastTime) + } }, getAppVersion() { const systemInfo = uni.getSystemInfoSync(); @@ -118,7 +98,7 @@ }, handlerlogout() { - clearStorage(); + // this.clearStorage(); // #ifdef H5 uni.reLaunch({ url: '../login/index' diff --git a/src/router/index.js b/src/router/index.js index f9cb9bc..d4b4e36 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,7 +4,8 @@ import versionTool from '@/libs/versionUpdate.js'; const whiteList = [ '/pages/login/index', - '/pages/appUpdate/upgrade' + '/pages/appUpdate/upgrade', + '/pages/setter/config' ] let apages = getCurrentPages() console.log("getCurrentPages",apages) diff --git a/src/router/my_router.js b/src/router/my_router.js index 8a8abc2..67d002f 100644 --- a/src/router/my_router.js +++ b/src/router/my_router.js @@ -2,7 +2,8 @@ // 页面白名单,不受拦截 const whiteList = [ '/pages/login/index', - '/pages/appUpdate/upgrade' + '/pages/appUpdate/upgrade', + '/pages/setter/config' ] function hasPermission(url) { diff --git a/src/static/config.js b/src/static/config.js index 77a4ee0..9200dc7 100644 --- a/src/static/config.js +++ b/src/static/config.js @@ -1,12 +1,16 @@ -let request_url = "http://123.56.115.74:8088/api" +let request_url = "http://10.117.133.80:8088/api" // let request_url = "http://192.168.0.113:12080/admin-api" +let appUpdateUrl = "http://10.117.133.80:8088/appUpdate.json" + let isDevelopment = true //30分钟 -let pageTimeOut =30*60*1000 +let pageTimeOut =30 export default { request_url, + appUpdateUrl, isDevelopment, pageTimeOut + } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 6d0bee4..6712303 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -49,6 +49,7 @@ const user = { }, actions: { + // 登录 Login({ commit @@ -59,17 +60,17 @@ const user = { return new Promise((resolve, reject) => { login(username, password).then(res => { if(res){ - res.Result.Powers =[ - "PDA0000001", - "PDA0000002", - "PDA0000003", - "PDA0000004", - "PDA0000005", - "SPDA000001", - "SPDA000002", - "SPDA000003", - "SPDA000004" - ] + // res.Result.Powers =[ + // "PDA0000001", + // "PDA0000002", + // "PDA0000003", + // "PDA0000004", + // "PDA0000005", + // "SPDA000001", + // "SPDA000002", + // "SPDA000003", + // "SPDA000004" + // ] commit('SET_ID',res.Result.LoginUserID) commit('SET_NAME',res.Result.UserName) commit('SET_POWERS',res.Result.Powers)