Files
GX.O3.WMS/APK/APP_O3/pages/myinfo/setting/setting.vue
T

183 lines
4.5 KiB
Vue
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<view class="s-main">
<view class="s-content">
<view class="s-title"><text style="color:red;">*</text>网络地址</view>
<view class="s-part">
<input class="uni-input" placeholder="请输入网址/Ip" v-model="ip"
@input="ipInput" focus="ipFocus"/>
</view>
</view>
<view class="s-content">
<view class="s-title">网络端口</view>
<view class="s-part">
<input class="uni-input" placeholder="请输入端口" v-model="post"
@input="partInput" focus="postFocus"/>
</view>
</view>
<view class="s-content">
<view class="s-title">虚拟目录</view>
<view class="s-part">
<input class="uni-input" placeholder="请输入网址" v-model="virtualPath"
@input="pathInput" focus="virtualFocus"/>
</view>
</view>
<!-- <view class="s-content">
<view class="s-title"><text style="color:red;">*</text>数据账套</view>
<view class="s-part">
<view class="uni-list-cell-db">
<picker @change="bindDBAliseChange" :value="index" :range="dbAliseArry" range-key="key">
<view class="uni-input">{{dbAliseArry[index].name}}</view>
</picker>
</view>
</view>
</view> -->
</view>
<!-- <text style="padding-left:9%; font-size: 30upx;">当前账套:{{current}}</text> -->
<view class="s-btn">
<button class="btnSearch" :disabled="btnDisable" @click="ConfirmClick">确定</button>
</view>
</view>
</template>
<script>
import {
mapState,
mapMutations
} from 'vuex';
export default {
data() {
return {
reportUrl: '',
//testfor测试
// ip: '127.0.0.1',
// post: '80',
// virtualPath: 'APWMS',
ip: '',
post: '',
virtualPath: '',
dbAlise: '',
index: 0,
dbAliseArry: [{
name: '请选择',
key: ''
}],
btnDisable: true,
current: '',
ipFocus: true,
postFocus: true,
virtualFocus: true
}
},
computed: {
...mapState(['hasConnect', 'dbInfo'])
},
onLoad: function() {
this.ShowData();
},
methods: {
ShowData: function() {
// var url = this.$global.globalData.requestUrl;
// console.log(this.$global.globalData)
// if (url.length > 0) {
// var spliturl = url.split('//');
// var argnew = spliturl[1].split('/');
// var ippost = argnew[0];
// var arg=argnew[0].split(':');
// this.virtualPath = argnew[1];
// if(arg.length>1)
// {
// this.ip=arg[0]
// this.post=arg[1]
// }
// else
// {
// this.ip=ippost
// this.post=80
// }
// }
this.post = uni.getStorageSync('requestPort');
this.ip = uni.getStorageSync('requestIp');
this.virtualPath = uni.getStorageSync('requestPath');
console.log("uni.getStorageSync('requestPath')", uni.getStorageSync('requestPath'));
this.checkInput();
},
checkInput: function() {
if (this.ip.length > 0) {
this.btnDisable = false;
} else {
this.btnDisable = true;
}
},
ConfirmClick: function() {
var _self = this;
setTimeout(
function function_name () {
_self.$nextTick(function(){
_self.ipFocus = true;
_self.postFocus = true;
_self.virtualFocus = true;
setTimeout(
function function_name () {
_self.save();
},
300
);
})
},
100
);
},
ipInput: function(event) {
this.ip = event.target.value;
this.checkInput();
},
partInput: function(event) {
this.post = event.target.value;
this.checkInput();
},
pathInput: function(event) {
this.virtualPath = event.target.value;
this.checkInput();
},
save: function() {
var request = 'http://'+this.ip
if(this.post!='80') {
request += ':' + this.post
}
if(this.virtualPath) {
request += '/' + this.virtualPath
}
request += '/PhoneAPI.ashx';
this.reportUrl = request;
//缓存账套配置
this.$global.setGlobalObj({
requestUrl: this.reportUrl
});
uni.setStorageSync('requestPort',this.post);
uni.setStorageSync('requestIp',this.ip);
uni.setStorageSync('requestPath',this.virtualPath);
console.log("uni.getStorageSync('requestPath')", this.virtualPath);
uni.showToast({
title: '保存成功'
});
},
...mapMutations(['connectDB'])
}
}
</script>
<style>
page {
background: #F2F2F2;
}
</style>