Browse Source

修改配置

master
lijuncheng 6 months ago
parent
commit
8df7f7ea7d
  1. 2
      src/api/httpRequest3.js
  2. 17
      src/pages.json
  3. 5
      src/pages/appUpdate/appUpdate.js
  4. 4
      src/pages/foam/check.vue
  5. 4
      src/pages/foam/downLink.vue
  6. 4
      src/pages/foam/foamNoGood.vue
  7. 4
      src/pages/foam/input.vue
  8. 4
      src/pages/foam/upLink.vue
  9. 4
      src/pages/index/index.vue
  10. 26
      src/pages/login/index.vue
  11. 4
      src/pages/plastics/check.vue
  12. 4
      src/pages/plastics/input.vue
  13. 4
      src/pages/plastics/plasticsNoGood.vue
  14. 4
      src/pages/plastics/scanCode.vue
  15. 233
      src/pages/setter/config.vue
  16. 58
      src/pages/setter/index.vue
  17. 3
      src/router/index.js
  18. 3
      src/router/my_router.js
  19. 8
      src/static/config.js
  20. 23
      src/store/modules/user.js

2
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",

17
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"
}]
}
}
},

5
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()

4
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"

4
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"

4
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"

4
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"

4
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"

4
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"

26
src/pages/login/index.vue

@ -6,6 +6,7 @@
<text>您好欢迎使用</text><br>
投入产出管理系统
</view>
<view class="bgf login_wrap">
<view class="loginbox">
<form>
@ -21,13 +22,15 @@
</view>
</view> -->
<view class="mybox" v-if="tapstyle == 2">
<view class="conone">
<view class="title uni-flex">
<image class="icon_normal" src="@/static/icons_ui/icon_login_user.svg"></image>
用户名
</view>
<view>
<input class="uni-input" style="padding:25rpx" placeholder="请输入用户名" v-model="username" />
<input class="uni-input" style="padding:25rpx" placeholder="请输入用户名"
v-model="username" />
</view>
</view>
<view class="conone">
@ -36,8 +39,8 @@
密码
</view>
<view class="uni-input-wrapper">
<input class="uni-input" style="padding:25rpx" placeholder="请输入密码" :password="showPassword"
v-model="password" />
<input class="uni-input" style="padding:25rpx" placeholder="请输入密码"
:password="showPassword" v-model="password" />
<text class="uni-icon" :class="[!showPassword ? 'uni-eye-active' : '']"
@click="changePassword">&#xe568;</text>
</view>
@ -70,6 +73,7 @@
</template>
<script>
import config from '@/static/config.js'
// #ifdef APP-PLUS
import {
checkVersion
@ -99,8 +103,8 @@
// computed: mapState(['forcedLogin', 'hasLogin']),
mounted() {
uni.clearStorageSync()
uni.clearStorage(); //
// uni.clearStorageSync()
// uni.clearStorage(); //
if (process.env.NODE_ENV === 'development') {
this.username = "admin"
this.password = "qmm";
@ -123,18 +127,24 @@
onNavigationBarButtonTap(e) {
if (e.index === 0) {
uni.navigateTo({
url: "/pages/config/config"
url: "/pages/setter/config"
})
}
},
onShow() {
uni.setStorageSync("hasLogin", false)
console.log("请求地址1:"+ uni.getStorageSync("requestUrl"))
var url = uni.getStorageSync("requestUrl") ? uni.getStorageSync("requestUrl") : config.request_url
console.log("请求地址2:" + url)
},
onLoad() {
uni.setStorageSync("hasLogin",false)
// #ifdef APP-PLUS
// checkVersion(false)
//
checkVersion(false)
// #endif
},
methods: {

4
src/pages/plastics/check.vue

@ -112,7 +112,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",
@ -246,7 +246,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"

4
src/pages/plastics/input.vue

@ -152,7 +152,7 @@
weight: "",
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// :30
}
},
@ -166,7 +166,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"

4
src/pages/plastics/plasticsNoGood.vue

@ -180,7 +180,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"

4
src/pages/plastics/scanCode.vue

@ -108,7 +108,7 @@
scanCheckCode:"",
lastTime: null, //
currentTime: null, //
timeOut: config.pageTimeOut
timeOut:uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut,// :30
}
},
@ -121,7 +121,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"

233
src/pages/setter/config.vue

@ -0,0 +1,233 @@
<template>
<view class="">
<view class="bgf login_wrap">
<view class="loginbox">
<form>
<view class="mybox" >
<view class="conone">
<view class="title uni-flex">
<uni-icons type="paperplane-filled" size="25"></uni-icons>
<text style="font-size: 30rpx;">请求地址</text>
</view>
<view>
<input class="uni-input" style="padding:25rpx" placeholder="请输入请求地址" v-model="requestUrl" />
</view>
</view>
<view class="conone">
<view class="title uni-flex">
<uni-icons type="gear-filled" size="25"></uni-icons>
<text style="font-size: 30rpx;">应用无操作退出时间(分钟)</text>
</view>
<view>
<input class="uni-input" type="number" style="padding:25rpx" placeholder="请输入超时时间" v-model="timeOut" />
</view>
</view>
<view class="conone">
<view class="title uni-flex">
<uni-icons type="download-filled" size="25"></uni-icons>
<text style="font-size: 30rpx;">app更新地址</text>
</view>
<view>
<input class="uni-input" style="padding:25rpx" placeholder="请输入app更新地址" v-model="appUpdateUrl" />
</view>
</view>
</view>
<view class="loginbtnbox">
<button @click="confirm()" class="loginbtn">确认修改</button>
</view>
</form>
</view>
</view>
</view>
</template>
<script>
import config from '@/static/config.js'
export default {
data() {
return {
requestUrl:"",
timeOut:30,
appUpdateUrl:""
}
},
onLoad() {
console.log("请求地址1:"+ uni.getStorageSync("requestUrl"))
this.requestUrl = uni.getStorageSync("requestUrl")? uni.getStorageSync("requestUrl"):config.request_url
console.log("请求地址2:"+ this.requestUrl)
this.timeOut = uni.getStorageSync("timeOut")?uni.getStorageSync("timeOut"):config.pageTimeOut
this.appUpdateUrl =uni.getStorageSync("appUpdateUrl")? uni.getStorageSync("appUpdateUrl"):config.appUpdateUrl
},
methods: {
confirm(){
if(!this.requestUrl ){
uni.showModal({
title:"地址不能为空"
})
return;
}
if(!this.timeOut ){
uni.showModal({
title:"时间不能为空"
})
return;
}
if(this.timeOut<=0 ){
uni.showModal({
title:"时间不能小于0"
})
return;
}
if(!this.appUpdateUrl){
uni.showModal({
title:"地址不能为空"
})
return;
}
uni.setStorageSync("requestUrl",this.requestUrl)
uni.setStorageSync("timeOut",this.timeOut)
uni.setStorageSync("appUpdateUrl",this.appUpdateUrl)
uni.showToast({
title:"修改成功"
})
uni.navigateBack()
}
}
}
</script>
<style>
page {
background-color: #fff;
}
.content {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #FFFFFF;
}
.cs {
margin-bottom: 20upx;
}
.mytab {
display: flex;
}
.mytabline {
flex: 1;
text-align: center;
padding: 20rpx 0;
color: #666;
position: relative;
font-size: 0.875rem;
}
.active_in {
color: #101010;
font-weight: bold;
}
.active_in::after {
content: "";
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
height: 8rpx;
background-color: #007AFF;
width: 40rpx;
border-radius: 8rpx;
}
.loginbox {
box-sizing: border-box;
padding: 30rpx;
}
.loginimg {
width: 100%;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.conone {
margin: 30rpx 0;
align-items: center;
}
.conone .uni-input-wrapper {
position: relative;
}
.conone .uni-input {
background-color: #F7F9FF;
height: 90rpx;
line-height: 90rpx;
padding: 0 0 0 20rpx;
}
.conone .title {
font-size: .875rem;
align-items: center;
margin-bottom: 20rpx;
letter-spacing: 1rpx;
}
.conone .title image {
margin-right: 6rpx;
}
.uni-easyinput .is-input-border {
border-color: transparent !important;
}
.loginbtnbox {
margin-top: 40rpx;
}
.loginbtn {
color: #fff;
font-size: 0.875rem;
height: 100rpx;
line-height: 100rpx;
background: #3C9CFF;
border-radius: 8rpx;
border: none;
outline: none;
}
.conone .uni-icon {
float: right;
position: absolute;
right: 20rpx;
color: #ccc;
font-size: 1.25rem;
}
.conone .uni-eye-active {
color: #5a7cf3;
}
</style>

58
src/pages/setter/index.vue

@ -9,6 +9,8 @@
<u-cell-item icon="account-fill" title="姓名" :arrow="false">{{userName}}</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">{{timeOut}}(分钟)</u-cell-item>
<u-cell-item icon="file-text" title="app更新地址" :arrow="false">{{appUpdateUrl}}</u-cell-item>
<u-cell-item icon="order" title="版本号" :arrow="false">{{version}}</u-cell-item>
<!-- #ifdef APP -->
<u-cell-item icon="reload" title="检查更新" @click="update">{{version}}</u-cell-item>
@ -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()
touchScreen() {
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)
}
}, 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)
},
getAppVersion() {
const systemInfo = uni.getSystemInfoSync();
@ -118,7 +98,7 @@
},
handlerlogout() {
clearStorage();
// this.clearStorage();
// #ifdef H5
uni.reLaunch({
url: '../login/index'

3
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)

3
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) {

8
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
}

23
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)

Loading…
Cancel
Save