forked from floraachy/xiuos_IoT
add webnet data get & save
This commit is contained in:
parent
15bc202629
commit
a22dad62c7
|
@ -131,7 +131,7 @@
|
|||
<el-input v-model="form.username" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码:" prop="password">
|
||||
<el-input v-model="form.password" />
|
||||
<el-input v-model="form.password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户端id:" prop="clientid">
|
||||
<el-input v-model="form.clientid" />
|
||||
|
@ -152,7 +152,7 @@
|
|||
<el-input v-model="form.privateserverusername" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码:" prop="privateserverpassword">
|
||||
<el-input v-model="form.privateserverpassword" />
|
||||
<el-input v-model="form.privateserverpassword" show-password />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -170,6 +170,7 @@
|
|||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { remove, getList, add, active } from '@/api/terminal/add'
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
@ -303,6 +304,33 @@ export default {
|
|||
this.date = new Date().toLocaleDateString()
|
||||
this.getList(0)
|
||||
this.getList(1)
|
||||
axios.get('/cgi-bin/mqtt_get', { headers: {
|
||||
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||
}}).then(res => {
|
||||
this.form.topic = res.data.pub_topic
|
||||
this.form.serveraddr = res.data.server_addr
|
||||
this.form.serverport = res.data.server_port
|
||||
this.form.username = res.data.username
|
||||
this.form.password = res.data.password
|
||||
this.form.clientid = res.data.clientID
|
||||
})
|
||||
axios.get('/cgi-bin/tcpip_get', { headers: {
|
||||
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||
}}).then(res => {
|
||||
this.form.ipaddr = res.data.local_ipaddr
|
||||
this.form.netmask = res.data.netmask_addr
|
||||
this.form.gateway = res.data.gateway_addr
|
||||
this.form.dnsserver0 = res.data.dns_server0
|
||||
this.form.dnsserver1 = res.data.dns_server1
|
||||
})
|
||||
axios.get('/cgi-bin/private_prt_get', { headers: {
|
||||
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||
}}).then(res => {
|
||||
this.form.privateserveraddr = res.data.server_addr
|
||||
this.form.privateserverport = res.data.server_port
|
||||
this.form.privateserverusername = res.data.username
|
||||
this.form.privateserverpassword = res.data.passward
|
||||
})
|
||||
// this.randomData()
|
||||
},
|
||||
methods: {
|
||||
|
@ -368,7 +396,6 @@ export default {
|
|||
},
|
||||
chooseCard(list) {
|
||||
list.forEach(item => {
|
||||
console.log('productList', this.productList)
|
||||
const temp = this.productList.filter(product => product.name === item.productname)
|
||||
item.color = temp[0].color
|
||||
item.src = temp[0].src
|
||||
|
@ -377,7 +404,6 @@ export default {
|
|||
remove(device, index) {
|
||||
remove({ no: device.no }).then(res => {
|
||||
if (res.code === '200000') {
|
||||
console.log('activatedDevice', this.$refs.activatedDevice[index])
|
||||
this.$refs.activatedDevice[index].classList.add('fadeOut')
|
||||
setTimeout(() => {
|
||||
this.activeList.splice(index, 1)
|
||||
|
@ -408,7 +434,7 @@ export default {
|
|||
},
|
||||
handleTabClick(tab, event) {},
|
||||
submit() {
|
||||
this.$refs.form.validate(valid => {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
const { src, productname, type, no, devicedesc, color } = this.form
|
||||
const temp = {
|
||||
|
@ -435,11 +461,34 @@ export default {
|
|||
privateserverport: this.form.privateserverport || '9898',
|
||||
privateserverusername: this.form.privateserverusername || 'admin'
|
||||
}
|
||||
add({
|
||||
productname, type, no, devicedesc, activestatus: this.form.activestatus, ...dataTemplate
|
||||
}).then(res => {
|
||||
}).catch(err => {
|
||||
})
|
||||
await add({ productname, type, no, devicedesc, activestatus: this.form.activestatus, ...dataTemplate })
|
||||
await axios.post('/cgi-bin/tcpip_save', {
|
||||
local_ipaddr: this.form.ipaddr,
|
||||
netmask_addr: this.form.netmask,
|
||||
gateway_addr: this.form.gateway,
|
||||
dns_server0: this.form.dnsserver0,
|
||||
dns_server1: this.form.dnsserver1
|
||||
}, { headers: {
|
||||
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||
}})
|
||||
await axios.post('/cgi-bin/mqtt_save', {
|
||||
pub_topic: this.form.topic,
|
||||
server_addr: this.form.serveraddr,
|
||||
server_port: this.form.serverport,
|
||||
username: this.form.username,
|
||||
password: this.form.password,
|
||||
clientID: this.form.clientid
|
||||
}, { headers: {
|
||||
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||
}})
|
||||
await axios.post('/cgi-bin/private_prt_save', {
|
||||
server_addr: this.form.privateserveraddr,
|
||||
server_port: this.form.privateserverport,
|
||||
username: this.form.privateserverusername,
|
||||
passward: this.form.privateserverpassword
|
||||
}, { headers: {
|
||||
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||
}})
|
||||
if (this.form.activestatus === 0) {
|
||||
this.disactiveList.push(temp)
|
||||
} else {
|
||||
|
|
|
@ -37,6 +37,13 @@ module.exports = {
|
|||
pathRewrite: {
|
||||
'^/dashengda': ''
|
||||
}
|
||||
},
|
||||
'/cgi-bin': {
|
||||
target: 'http://192.168.131.29/', // webnet
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/cgi-bin': '/cgi-bin'
|
||||
}
|
||||
}
|
||||
},
|
||||
open: true,
|
||||
|
|
Loading…
Reference in New Issue