Browse Source

增加超时退出功能

master
lijuncheng 6 months ago
parent
commit
b12ff22723
  1. 1
      src/common/utils.js
  2. 28
      src/pages/foam/check.vue
  3. 26
      src/pages/foam/downLink.vue
  4. 27
      src/pages/foam/foamNoGood.vue
  5. 27
      src/pages/foam/input.vue
  6. 26
      src/pages/foam/upLink.vue
  7. 58
      src/pages/index/index.vue
  8. 1
      src/pages/login/index.vue
  9. 25
      src/pages/plastics/check.vue
  10. 25
      src/pages/plastics/input.vue
  11. 26
      src/pages/plastics/plasticsNoGood.vue
  12. 28
      src/pages/plastics/scanCode.vue
  13. 195
      src/pages/setter/index.vue
  14. 173
      src/pages/setter/index_bat.vue
  15. 4
      src/static/config.js

1
src/common/utils.js

@ -15,3 +15,4 @@ export function showConfirmMsg(title, content,showCancel, callback) {
} }
}) })
} }

28
src/pages/foam/check.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper" > <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
<!-- <view class="flex u-col-center space-between"> --> <!-- <view class="flex u-col-center space-between"> -->
@ -79,6 +79,7 @@
<script> <script>
import customerFrom from "@/mycomponents/form/customerFrom.vue" import customerFrom from "@/mycomponents/form/customerFrom.vue"
import winScanNormal from "@/mycomponents/scan/winScanNormal.vue" import winScanNormal from "@/mycomponents/scan/winScanNormal.vue"
import config from '@/static/config.js'
import { import {
getCurrDateTime, getCurrDateTime,
deepCopyData deepCopyData
@ -104,6 +105,9 @@
deviceCheckCode: "", deviceCheckCode: "",
deviceName: "", deviceName: "",
worker: this.$store.state.user.name, worker: this.$store.state.user.name,
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut,
dataList: [], dataList: [],
formData: [{ formData: [{
type: "stateSelect", type: "stateSelect",
@ -226,13 +230,29 @@
} }
}, },
computed: {}, computed: {},
onLoad() {
onShow() {
this.lastTime = new Date().getTime()
}, },
mounted() { mounted() {
this.$refs.inputDevice.focused = true this.$refs.inputDevice.focused = true
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
getScanResult(result) { getScanResult(result) {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
@ -305,8 +325,8 @@
this.deviceName = ""; this.deviceName = "";
this.dateTime = ""; this.dateTime = "";
this.dateTime = "", this.dateTime = "",
this.deviceName = "", this.deviceName = "",
this.worker = "" this.worker = ""
this.dataList = [] this.dataList = []
// this.reset(); // this.reset();
}, },

26
src/pages/foam/downLink.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
@ -90,6 +90,7 @@
getCurrDateTime, getCurrDateTime,
} from "@/common/basic.js" } from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue" import selectClickList from "@/mycomponents/popup/selectClickList.vue"
import config from '@/static/config.js'
export default { export default {
components: { components: {
@ -108,18 +109,31 @@
planList: [], planList: [],
scanCode: "", scanCode: "",
scanCheckCode:"", scanCheckCode:"",
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
} }
}, },
computed: {}, computed: {},
onLoad() {}, onShow(){
onUnload() {}, this.lastTime = new Date().getTime()
onReady() {
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
submit() { submit() {
if (this.scanCheckCode == "") { if (this.scanCheckCode == "") {
this.scanCheckCode="" this.scanCheckCode=""

27
src/pages/foam/foamNoGood.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
@ -151,6 +151,7 @@
getCurrDateTime, getCurrDateTime,
} from "@/common/basic.js" } from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue" import selectClickList from "@/mycomponents/popup/selectClickList.vue"
import config from '@/static/config.js'
export default { export default {
components: { components: {
@ -176,19 +177,33 @@
type: "", type: "",
typeCode:"", typeCode:"",
mode: 'selector', mode: 'selector',
reasonRange: ['破损', '返工与返修'], reasonRange: [],
typeRange: ["隔离", "报废"], typeRange: ["隔离", "报废"],
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
} }
}, },
computed: {}, computed: {},
onLoad() {}, onShow(){
onUnload() {}, this.lastTime = new Date().getTime()
onReady() {
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
showTypePicker() { showTypePicker() {
this.showType = true; this.showType = true;

27
src/pages/foam/input.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
<!-- <view class="flex u-col-center space-between"> <!-- <view class="flex u-col-center space-between">
@ -111,6 +111,7 @@
getCurrDateTime, getCurrDateTime,
} from "@/common/basic.js" } from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue" import selectClickList from "@/mycomponents/popup/selectClickList.vue"
import config from '@/static/config.js'
export default { export default {
components: { components: {
@ -130,19 +131,33 @@
origin: [] origin: []
}, },
materialList: [], materialList: [],
planList: [] planList: [],
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
} }
}, },
computed: {}, computed: {},
onLoad() {}, onShow(){
onUnload() {}, this.lastTime = new Date().getTime()
onReady() {
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
submit() { submit() {
if (this.planNumber == "") { if (this.planNumber == "") {
this.showMessage("请选择计划单号") this.showMessage("请选择计划单号")

26
src/pages/foam/upLink.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
</view> </view>
@ -109,6 +109,7 @@
getCurrDateTime, getCurrDateTime,
} from "@/common/basic.js" } from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue" import selectClickList from "@/mycomponents/popup/selectClickList.vue"
import config from '@/static/config.js'
export default { export default {
components: { components: {
@ -128,18 +129,31 @@
planList: [], planList: [],
scanCode: "", scanCode: "",
scanCheckCode:"", scanCheckCode:"",
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
} }
}, },
computed: {}, computed: {},
onLoad() {}, onShow(){
onUnload() {}, this.lastTime = new Date().getTime()
onReady() {
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
submit() { submit() {
if (this.planNumber == "") { if (this.planNumber == "") {
this.showMessage("请选择计划单号") this.showMessage("请选择计划单号")

58
src/pages/index/index.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="u-wrap" @touchstart="touchScreen" @touchcancel="touchMove"> <view class="u-wrap" @touchstart="touchScreen">
<!-- <view class="serch txt-16"> <!-- <view class="serch txt-16">
<uni-search-bar class="flex1" placeholder="请输入菜单名称" @confirm="search" @input="input" cancelButton="none" <uni-search-bar class="flex1" placeholder="请输入菜单名称" @confirm="search" @input="input" cancelButton="none"
@clear="clearfilterlist"> @clear="clearfilterlist">
@ -69,7 +69,7 @@
<script> <script>
import classifyData from '@/common/classify.data.js'; import classifyData from '@/common/classify.data.js';
import config from '../../static/config.js' import config from '@/static/config.js'
export default { export default {
components: {}, components: {},
data() { data() {
@ -93,16 +93,16 @@
filterList: [], filterList: [],
serchval: "", serchval: "",
backButtonPress: 0, backButtonPress: 0,
pageTimeOut: config.pageTimeOut, lastTime: null, //
timeCount: null currentTime: null, //
timeOut:config.pageTimeOut,// :30
} }
}, },
onLoad() { onLoad() {
var test = "" var test = ""
if (uni.getStorageSync("hasLogin")) { if (uni.getStorageSync("hasLogin")) {
this.tabbar = this.getPowersByRoles(); this.tabbar = this.getPowersByRoles();
this.startTimer();
} else { } else {
this.tabbar = [] this.tabbar = []
} }
@ -113,13 +113,7 @@
} }
}, },
beforeDestroy() {
if (this.timeCount) {
clearInterval(this.timeCount);
this.timeCount = null;
}
},
onHide() {}, onHide() {},
onShow() { onShow() {
if (uni.getStorageSync("hasLogin") == null || uni.getStorageSync("hasLogin") == false) { if (uni.getStorageSync("hasLogin") == null || uni.getStorageSync("hasLogin") == false) {
@ -142,9 +136,10 @@
} }
} }
}) })
} else {
this.lastTime = new Date().getTime()
} }
}, },
onUnload() {},
// onBackPress(e) { // onBackPress(e) {
// // returntrue // // returntrue
// this.backButtonPress++; // this.backButtonPress++;
@ -160,35 +155,19 @@
// }, // },
mounted() {}, mounted() {},
methods: { methods: {
startTimer(){
var that = this;
this.timeCount = setInterval(()=> {
console.log("记时", that.pageTimeOut)
if(that.pageTimeOut>0&&that.pageTimeOut<=config.pageTimeOut){
that.pageTimeOut--;
}else {
console.log("停止", that.pageTimeOut)
clearInterval(this.timeCount);
this.timeCount = null;
uni.reLaunch({
url: "../login/index"
})
}
}, 1000)
},
touchScreen() { touchScreen() {
this.pageTimeOut = config.pageTimeOut this.currentTime = new Date().getTime() //
if (this.timeCount) { console.log("当前时间", this.currentTime)
clearInterval(this.timeCount); if (this.currentTime - this.lastTime > this.timeOut) { // 30
this.timeCount = null; console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
} }
this.startTimer();
console.log("页面点击touchScreen", this.pageTimeOut)
},
touchMove(){
this.pageTimeOut = config.pageTimeOut
console.log("页面点击touchMove", this.pageTimeOut)
}, },
getPowersByRoles() { getPowersByRoles() {
@ -345,7 +324,6 @@
uni.navigateTo({ uni.navigateTo({
url: url url: url
}); });
}, },

1
src/pages/login/index.vue

@ -132,6 +132,7 @@
}, },
onLoad() { onLoad() {
uni.setStorageSync("hasLogin",false)
// #ifdef APP-PLUS // #ifdef APP-PLUS
// checkVersion(false) // checkVersion(false)
// #endif // #endif

25
src/pages/plastics/check.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
<!-- <view class="flex u-col-center space-between"> --> <!-- <view class="flex u-col-center space-between"> -->
@ -85,6 +85,7 @@
<script> <script>
import customerFrom from "@/mycomponents/form/customerFrom.vue" import customerFrom from "@/mycomponents/form/customerFrom.vue"
import winScanNormal from "@/mycomponents/scan/winScanNormal.vue" import winScanNormal from "@/mycomponents/scan/winScanNormal.vue"
import config from '@/static/config.js'
import { import {
getCurrDateTime, getCurrDateTime,
deepCopyData deepCopyData
@ -109,6 +110,9 @@
deviceCheckCode:"", deviceCheckCode:"",
deviceName: "", deviceName: "",
worker: this.$store.state.user.name, worker: this.$store.state.user.name,
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut,
dataList: [], dataList: [],
formData: [{ formData: [{
type: "stateSelect", type: "stateSelect",
@ -231,13 +235,28 @@
} }
}, },
computed: {}, computed: {},
onLoad() { onShow(){
this.lastTime = new Date().getTime()
}, },
mounted() { mounted() {
this.$refs.inputDevice.focused = true this.$refs.inputDevice.focused = true
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
getScanResult(result) { getScanResult(result) {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",

25
src/pages/plastics/input.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
<!-- <view class="flex u-col-center space-between"> <!-- <view class="flex u-col-center space-between">
@ -126,6 +126,7 @@
} from "@/common/basic.js" } from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue" import selectClickList from "@/mycomponents/popup/selectClickList.vue"
import config from '@/static/config.js'
export default { export default {
components: { components: {
@ -149,14 +150,32 @@
referenceCode: "", referenceCode: "",
supplierCode: "", supplierCode: "",
weight: "", weight: "",
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
} }
}, },
computed: {}, computed: {},
onLoad() {}, onShow(){
this.lastTime = new Date().getTime()
},
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
itemClear() { itemClear() {
this.itemCode = "" this.itemCode = ""
this.itemCheckCode = ""; this.itemCheckCode = "";

26
src/pages/plastics/plasticsNoGood.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
@ -150,6 +150,7 @@
getCurrDateTime, getCurrDateTime,
} from "@/common/basic.js" } from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue" import selectClickList from "@/mycomponents/popup/selectClickList.vue"
import config from '@/static/config.js'
export default { export default {
components: { components: {
@ -177,17 +178,32 @@
mode: 'selector', mode: 'selector',
reasonRange: [], reasonRange: [],
typeRange: ["隔离", "报废"], typeRange: ["隔离", "报废"],
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
} }
}, },
computed: {}, computed: {},
onLoad() {}, onShow(){
onUnload() {}, this.lastTime = new Date().getTime()
onReady() {
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
showTypePicker() { showTypePicker() {
this.showType = true; this.showType = true;
}, },

28
src/pages/plastics/scanCode.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper" @touchstart="touchScreen">
<view class="page-header flex" <view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;"> style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
@ -88,6 +88,7 @@
getCurrDateTime, getCurrDateTime,
} from "@/common/basic.js" } from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue" import selectClickList from "@/mycomponents/popup/selectClickList.vue"
import config from '@/static/config.js'
export default { export default {
components: { components: {
@ -104,19 +105,32 @@
origin: [] origin: []
}, },
scanCode: "", scanCode: "",
scanCheckCode:"" scanCheckCode:"",
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
} }
}, },
computed: {}, computed: {},
onLoad() {}, onShow(){
onUnload() {}, this.lastTime = new Date().getTime()
onReady() {
}, },
methods: { methods: {
touchScreen() {
this.currentTime = new Date().getTime() //
console.log("当前时间", this.currentTime)
if (this.currentTime - this.lastTime > this.timeOut) { // 30
console.log("当前时间跳转")
uni.reLaunch({
url: "../login/index"
})
} else {
this.lastTime = new Date().getTime() // 30
console.log("当前时间跳转赋值,没跳转" + this.lastTime)
}
},
submit() { submit() {
if (this.scanCheckCode == "") { if (this.scanCheckCode == "") {
this.showMessage("请扫描产品码") this.showMessage("请扫描产品码")

195
src/pages/setter/index.vue

@ -1,18 +1,15 @@
<template> <template>
<view class="personal"> <view class="personal" @touchstart="touchScreen">
<view class="txbox"> <view class="txbox">
<image src="/static/avatar.png" class="tx"></image> <image src="/static/avatar.png" class="tx"></image>
<!-- <view class="text">admin</view> --> <!-- <view class="text">admin</view> -->
</view> </view>
<view class=""> <view class="">
<u-cell-group > <u-cell-group>
<u-cell-item icon="account-fill" title="姓名" :arrow="false">{{userName}}</u-cell-item> <u-cell-item icon="account-fill" title="姓名" :arrow="false">{{userName}}</u-cell-item>
<u-cell-item v-if="userInfo!=null" icon="file-text" title="部门" :arrow="false">{{userInfo.dept.name}}</u-cell-item>
<u-cell-item v-if="userInfo!=null" icon="photo" title="岗位" :arrow="false">{{(userInfo.posts || []).map(post => post.name).join(',')}}</u-cell-item>
<u-cell-item icon="level" v-if="userInfo!=null" title="角色" :arrow="false">{{(userInfo.roles || []).map(role => role.name).join(',')}}</u-cell-item>
<!-- <u-cell-item icon="trash" title="清除缓存" @click="clear()" ></u-cell-item> --> <!-- <u-cell-item icon="trash" title="清除缓存" @click="clear()" ></u-cell-item> -->
<u-cell-item icon="file-text" title="访问地址" :arrow="false">{{requestUrl}}</u-cell-item> <u-cell-item icon="file-text" title="访问地址" :arrow="false">{{requestUrl}}</u-cell-item>
<u-cell-item icon="order" title="版本号" :arrow="false" @click="test111" >{{version}}</u-cell-item> <u-cell-item icon="order" title="版本号" :arrow="false">{{version}}</u-cell-item>
<!-- #ifdef APP --> <!-- #ifdef APP -->
<u-cell-item icon="reload" title="检查更新" @click="update">{{version}}</u-cell-item> <u-cell-item icon="reload" title="检查更新" @click="update">{{version}}</u-cell-item>
<!-- #endif --> <!-- #endif -->
@ -21,13 +18,13 @@
</view> </view>
<view> <view>
<button type="primary" style="margin:70rpx;" @click="handlerlogout">退出登录</button> <button type="primary" style="margin:70rpx;" @click="handlerlogout">退出登录</button>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script>
import { import {
logout, logout,
getUserProfile getUserProfile
@ -41,99 +38,105 @@
} from '@/common/utils/auth' } from '@/common/utils/auth'
import config from '@/static/config.js' import config from '@/static/config.js'
// #ifdef APP-PLUS // #ifdef APP-PLUS
import { import {
checkVersion checkVersion
} from "@/pages/appUpdate/appUpdate.js" } from "@/pages/appUpdate/appUpdate.js"
// #endif // #endif
import { export default {
ref, data() {
reactive, return {
nextTick, userName: "",
createApp requestUrl: "",
} from "vue"; version: "",
import { pageTimeOut: config.pageTimeOut,
onLoad timerCount: null,
} from "@dcloudio/uni-app"; }
const app = createApp({}); },
// app.component({ onShow(){
// }); // this.startTimer();
const userName = ref(store.state.user.name); },
let version = ref(); onHide() {
let userInfo = ref(null); console.log('当前页面被关闭onHide');
let requestUrl =ref(null) setTimeout(res=>{
onLoad(() => { this.clearTimeout();
requestUrl =config.request_url },500)
getAppVersion()
getUserProfile().then(res => { },
userInfo.value = res.data
// nextTick(()=>{ onUnload() {
// const userInfo = res.data.nickname console.log('当前页面被关闭onUnload');
// console.log("",userInfo) this.clearTimeout();
// }) },
onLoad() {
}) this.userName = this.$store.state.user.name
}); this.requestUrl =config.request_url
this.getAppVersion()
},
function handlerlogout() { methods: {
clearStorage(); startTimer() {
// #ifdef H5 var that = this;
uni.reLaunch({ this.timerCount = setInterval(() => {
url: '../login/index' console.log("记时_setting", that.pageTimeOut)
}) if (that.pageTimeOut > 0 && that.pageTimeOut <= config.pageTimeOut) {
// #endif that.pageTimeOut--;
} else {
// #ifdef APP console.log("停止", that.pageTimeOut)
plus.runtime.quit() this.clearTimeout()
// #endif uni.reLaunch({
url: "../login/index"
})
}; }
}, 1000)
function clearStorage() { },
uni.clearStorageSync() clearTimeout() {
removeToken(); console.log("清除", this.timerCount)
if (this.timerCount) {
}; clearInterval(this.timerCount);
this.timerCount = null;
function test111(){ }
uni.navigateTo({ },
url:"./test" touchScreen() {
}) this.pageTimeOut = config.pageTimeOut
this.clearTimeout()
this.startTimer();
console.log("页面点击touchScreen", this.pageTimeOut)
},
getAppVersion() {
const systemInfo = uni.getSystemInfoSync();
// #ifdef H5
this.version = systemInfo.appVersion;
console.log(systemInfo.appVersion, '版本号');
// #endif
// #ifdef APP
this.version = systemInfo.appWgtVersion;
// #endif
},
update() {
checkVersion(true)
},
handlerlogout() {
clearStorage();
// #ifdef H5
uni.reLaunch({
url: '../login/index'
})
// #endif
// #ifdef APP
plus.runtime.quit()
// #endif
},
clearStorage() {
uni.clearStorageSync()
removeToken();
}
}
} }
function clear() {
clearCacheData()
uni.showToast({
title: "清理缓存成功"
})
}
function getAppVersion() {
const systemInfo = uni.getSystemInfoSync();
// #ifdef H5
version.value = systemInfo.appVersion;
console.log(systemInfo.appVersion, '版本号');
// #endif
// #ifdef APP
version.value = systemInfo.appWgtVersion;
// #endif
}
function update() {
console.log("update");
checkVersion(true)
}
function modifiedPassWord() {
uni.navigateTo({
url:"./passwordpage"
})
}
</script> </script>
<style> <style>

173
src/pages/setter/index_bat.vue

@ -0,0 +1,173 @@
<template>
<view class="personal">
<view class="txbox">
<image src="/static/avatar.png" class="tx"></image>
<!-- <view class="text">admin</view> -->
</view>
<view class="">
<u-cell-group >
<u-cell-item icon="account-fill" title="姓名" :arrow="false">{{userName}}</u-cell-item>
<u-cell-item v-if="userInfo!=null" icon="file-text" title="部门" :arrow="false">{{userInfo.dept.name}}</u-cell-item>
<u-cell-item v-if="userInfo!=null" icon="photo" title="岗位" :arrow="false">{{(userInfo.posts || []).map(post => post.name).join(',')}}</u-cell-item>
<u-cell-item icon="level" v-if="userInfo!=null" title="角色" :arrow="false">{{(userInfo.roles || []).map(role => role.name).join(',')}}</u-cell-item>
<!-- <u-cell-item icon="trash" title="清除缓存" @click="clear()" ></u-cell-item> -->
<u-cell-item icon="file-text" title="访问地址" :arrow="false">{{requestUrl}}</u-cell-item>
<u-cell-item icon="order" title="版本号" :arrow="false" @click="test111" >{{version}}</u-cell-item>
<!-- #ifdef APP -->
<u-cell-item icon="reload" title="检查更新" @click="update">{{version}}</u-cell-item>
<!-- #endif -->
</u-cell-group>
</view>
<view>
<button type="primary" style="margin:70rpx;" @click="handlerlogout">退出登录</button>
</view>
</view>
</template>
<script setup>
import {
logout,
getUserProfile
} from '@/api/request2.js';
import store from '@/store'
import {
clearCacheData
} from '@/common/directory.js';
import {
removeToken
} from '@/common/utils/auth'
import config from '@/static/config.js'
// #ifdef APP-PLUS
import {
checkVersion
} from "@/pages/appUpdate/appUpdate.js"
// #endif
import {
ref,
reactive,
nextTick,
createApp
} from "vue";
import {
onLoad
} from "@dcloudio/uni-app";
const app = createApp({});
// app.component({
// });
const userName = ref(store.state.user.name);
let version = ref();
let userInfo = ref(null);
let requestUrl =ref(null)
onLoad(() => {
requestUrl =config.request_url
getAppVersion()
getUserProfile().then(res => {
userInfo.value = res.data
// nextTick(()=>{
// const userInfo = res.data.nickname
// console.log("",userInfo)
// })
})
});
function handlerlogout() {
clearStorage();
// #ifdef H5
uni.reLaunch({
url: '../login/index'
})
// #endif
// #ifdef APP
plus.runtime.quit()
// #endif
};
function clearStorage() {
uni.clearStorageSync()
removeToken();
};
function test111(){
uni.navigateTo({
url:"./test"
})
}
function clear() {
clearCacheData()
uni.showToast({
title: "清理缓存成功"
})
}
function getAppVersion() {
const systemInfo = uni.getSystemInfoSync();
// #ifdef H5
version.value = systemInfo.appVersion;
console.log(systemInfo.appVersion, '版本号');
// #endif
// #ifdef APP
version.value = systemInfo.appWgtVersion;
// #endif
}
function update() {
console.log("update");
checkVersion(true)
}
function modifiedPassWord() {
uni.navigateTo({
url:"./passwordpage"
})
}
</script>
<style>
.txbox {
display: flex;
flex-direction: column;
align-items: center;
}
.tx {
width: 200rpx;
height: 200rpx;
margin: 30rpx 0 30rpx;
border-radius: 150upx;
}
.text {
font-size: 20upx;
text-align: center;
}
.footbox {
display: flex;
align-items: center;
}
.footbtn {
margin-top: 120rpx;
width: 300rpx;
border-radius: 50rpx;
background-color: #fff;
font-size: .825rem;
color: #333;
line-height: 90rpx;
}
</style>

4
src/static/config.js

@ -2,8 +2,8 @@ let request_url = "http://123.56.115.74:8088/api"
// let request_url = "http://192.168.0.113:12080/admin-api" // let request_url = "http://192.168.0.113:12080/admin-api"
let isDevelopment = true let isDevelopment = true
//10秒 //30分钟
let pageTimeOut =30 let pageTimeOut =30*60*1000
export default { export default {
request_url, request_url,

Loading…
Cancel
Save