<template>
|
<view class="content">
|
<uni-nav-bar left-icon="back" left-text="返回" @clickLeft="goBack" title="通用设置" statusBar="true"></uni-nav-bar>
|
<view class="setting-content">
|
<view class="title">
|
服务器设置
|
</view>
|
<view class="uni-form-item uni-column">
|
<view class="title">地址:</view>
|
<input class="uni-input" v-model="mq_ip"/>
|
<!-- <IPInput :ip="sys_ip" @on-blur="sys_ip= arguments[0]"></IPInput> -->
|
</view>
|
<view class="uni-form-item uni-column">
|
<view class="title">端口:</view>
|
<input class="uni-input" v-model="mq_port" />
|
</view>
|
</view>
|
<view class="setting-content">
|
<view class="title">
|
视频及图片服务设置
|
</view>
|
<view class="uni-form-item uni-column">
|
<view class="title">地址:</view>
|
<!-- <input class="uni-input" focus placeholder="IP地址" /> --><input class="uni-input" v-model="pic_ip"/>
|
<!-- <IPInput :ip="pic_ip" @on-blur="pic_ip= arguments[0]"></IPInput> -->
|
</view>
|
<view class="uni-form-item uni-column">
|
<view class="title">端口:</view>
|
<input class="uni-input" v-model="pic_port" placeholder="" />
|
</view>
|
</view>
|
<button type="default" @tap="commit">确认</button>
|
<!-- <uni-popup ref="popup" type="center" background-color="#fff" :animation="false">中间弹出 Popup</uni-popup> -->
|
<uni-popup ref="popup" type="message">
|
<uni-popup-message type="success" message="修改成功" :duration="2000"></uni-popup-message>
|
</uni-popup>
|
<uni-popup ref="popup1" type="message">
|
<uni-popup-message type="error" message="连接失败" :duration="2000"></uni-popup-message>
|
</uni-popup>
|
</view>
|
</template>
|
|
<script>
|
import imagePopper from "@/components/imagePopper.vue"
|
import IPInput from "@/components/IPInput.vue"
|
export default {
|
components: {
|
imagePopper,
|
IPInput
|
},
|
data() {
|
return {
|
mq_ip: "",
|
pic_ip: "",
|
mq_port: "",
|
pic_port:""
|
}
|
},
|
onShow() {
|
[this.mq_ip, this.mq_port] = getApp().globalData.mqUrl.split(":");
|
console.log(this.mq_ip, this.mq_port);
|
[this.pic_ip, this.pic_port] = getApp().globalData.resourseUrl.split(":");
|
console.log(this.pic_ip, this.pic_port);
|
},
|
mounted() {
|
|
uni.$on("connectStatus", (data) => {
|
console.log('connectStatus')
|
// data.status ? this.$refs.popup.open('top') :
|
// this.$refs.popup1.open('top')
|
})
|
},
|
onBackPress(e) {
|
console.log(e);
|
uni.navigateTo({
|
url: '/pages/index/index'
|
})
|
// return true
|
},
|
|
methods: {
|
goBack() {
|
uni.navigateTo({
|
url: "../index/index"
|
})
|
},
|
commit() {
|
uni.$emit('changeClientIP', {
|
host: `${this.mq_ip}:${this.mq_port}`
|
})
|
getApp().globalData.resourseUrl = `${this.pic_ip}:${this.pic_port}`
|
getApp().globalData.requestVideoUrl = `${this.pic_ip}:9000`
|
uni.setStorage({
|
key:"mqUrl",
|
data: `${this.mq_ip}:${this.mq_port}`,
|
success: () => {
|
console.log("mqUrl存入数据库")
|
}
|
})
|
uni.setStorage({
|
key: 'resourseUrl',
|
data:`${this.pic_ip}:${this.pic_port}`,
|
success: function () {
|
console.log('resourseUrl存入数据库');
|
}
|
});
|
uni.setStorage({
|
key: 'requestVideoUrl',
|
data:`${this.pic_ip}:9000`,
|
success: function () {
|
console.log('requestVideoUrl存入数据库');
|
}
|
});
|
this.$refs.popup.open('top')
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.uni-input {
|
border: 1px solid black;
|
}
|
|
page {
|
background-color: rgba(243, 244, 246, 1);
|
}
|
|
.uni-form-item {
|
display: flex;
|
align-items: center;
|
// justify-content: space-around;
|
margin-top: 20px;
|
}
|
|
.setting-content {
|
padding: 40rpx 40rpx;
|
|
.title {
|
min-width: 80rpx;
|
}
|
|
.uni-input {
|
border: 1px solid #dcdfe6;
|
background: #fff;padding:0 20rpx; width: 72%;
|
|
}
|
|
uni-input {
|
display: block;
|
font-size: 16px;
|
line-height: 1.8em;
|
height: 1.8em;
|
min-height: 1.8em;
|
overflow: hidden;
|
}
|
|
.uni-input-input {
|
padding-left: 20rpx;
|
}
|
}
|
|
uni-button[type=default] {
|
color: #fff;
|
|
background-color: rgba(239, 128, 72, 1);
|
/* position: absolute; */
|
/* bottom: 0; */
|
position: absolute;
|
bottom: 50px;
|
left: calc(50% - 40%);
|
width: 80%;
|
}
|
|
uni-button:after {
|
border: 0;
|
}
|
|
uni-button {
|
font-size: 16px;
|
line-height: 2.4;
|
border-radius: 15px;
|
}
|
</style>
|