Prechádzať zdrojové kódy

修改VPN配置和日志相关BUG

dygapp 4 rokov pred
rodič
commit
ba6239771f

+ 8 - 7
src/store/index.js

@@ -50,7 +50,7 @@ const api = {
 export default new Vuex.Store({
   state: {
     username: sessionStorage.getItem('username'),
-    devinfo: {},
+    devinfo: { profile: sessionStorage.getItem('profile') },
     cpudata: {},
     memorydata: {},
     vpnstate: null,
@@ -69,6 +69,7 @@ export default new Vuex.Store({
       sessionStorage.setItem('token', token)
     },
     devinfo (state, payload) {
+      sessionStorage.setItem('profile', payload.data.profile)
       state.devinfo = payload.data
     },
     memory (state, payload) {
@@ -95,10 +96,10 @@ export default new Vuex.Store({
     sigcacertquery (state, payload) {
       state.sigdata = payload.data
     },
-    sslquery (state, payload) {
+    getSSLClient (state, payload) {
       state.ssldata = payload.data
     },
-    sslserverquery (state, payload) {
+    getSSLServer (state, payload) {
       state.ssldata = payload.data
     },
     getIPSecServer (state, payload) {
@@ -247,15 +248,15 @@ export default new Vuex.Store({
       return res.data
     },
     // 查询sslvpn客户端
-    async sslquery ({ commit }) {
+    async getSSLClient ({ commit }) {
       const res = await axios.get(`${api.sslClient}`)
-      commit('sslquery', res)
+      commit('getSSLClient', res)
       return res.data
     },
     // 查询sslvpn服务端
-    async sslserverquery ({ commit }) {
+    async getSSLServer ({ commit }) {
       const res = await axios.get(`${api.sslServer}`)
-      commit('sslserverquery', res)
+      commit('getSSLServer', res)
       return res.data
     },
     // sslvpn客户端添加

+ 17 - 19
src/views/log.vue

@@ -1,14 +1,12 @@
 <template>
   <el-container>
-    <el-header class="header">
+    <el-header class="headers">
       <h3>{{ title }}</h3>
+      <el-button class="topbtn" type="primary" @click="logdw" size="small">下载日志</el-button>
+      <el-button class="topbtn" type="primary" @click="query" size="small">刷新日志</el-button>
     </el-header>
     <el-main class="main">
-      <div class="btnbox">
-        <el-button type="primary" @click="logdw">下载日志</el-button>
-        <el-button type="primary" @click="query">刷新日志</el-button>
-      </div>
-      <div class="per">{{ logdata }}</div>
+      <pre>{{ logdata }}</pre>
     </el-main>
   </el-container>
 </template>
@@ -69,31 +67,31 @@ export default {
 }
 </script>
 <style lang="less" scoped>
+.headers {
+  display: flex;
+  width: 100%;
+  border-bottom: 1px solid #999;
+}
 h3 {
   width: 90%;
   text-align: left;
   text-indent: 1em;
-  line-height: 3em;
-  border-bottom: 2px solid #999;
+}
+.topbtn {
+  line-height: 1em;
+  height: 3em;
+  margin-top: 1%;
 }
 .main {
-  width: 70%;
+  width: 100%;
   margin: 0 auto;
-  .per {
+  pre {
     width: 100%;
     height: 85%;
     margin: 0 auto;
     border: 1px solid #999;
     overflow-y: auto;
-  }
-  .btnbox {
-    margin: 2% 0;
-    width: 100%;
-    overflow: hidden;
-    .el-button {
-      float: right;
-      margin-left: 2%;
-    }
+    padding: 5px;
   }
 }
 </style>

+ 3 - 3
src/views/network/wan.vue

@@ -80,16 +80,16 @@ export default {
     // 提交数据
     async onSubmit () {
       const res = await this.setwan(this.ruleForm)
-      if (res.errcode && res.errcode === 0) {
+      if (res && res.errcode === 0) {
         this.$message.success('设置成功')
       }
     },
     // 重启网卡  (先调用停止,在调用启动)
     async reboot () {
       const dw = await this.wandown()
-      if (dw.errcode === 0) {
+      if (dw && dw.errcode === 0) {
         const up = await this.wanup()
-        if (up.errcode === 0) {
+        if (up && up.errcode === 0) {
           this.$message.success('重启成功')
         }
       }

+ 3 - 3
src/views/vpn/ipsec-client.vue

@@ -83,7 +83,7 @@ export default {
   async mounted () {
     await this.sigcacertquery()
     const res = await this.getIPSecClient()
-    if (res.errcode === 0) {
+    if (res && res.errcode === 0) {
       this.ruleForm = res.data
     }
   },
@@ -94,7 +94,7 @@ export default {
       this.$refs.form.validate(async (valid) => {
         if (!valid) return false
         const res = await this.setIPSecClient(this.ruleForm)
-        if (res.errcode === 0) {
+        if (res && res.errcode === 0) {
           this.$message.success('设置成功')
         }
       })
@@ -102,7 +102,7 @@ export default {
     // 启动停止重启
     async reboot (e) {
       const dw = await this.ipsecState({ type: e })
-      if (dw.errcode === 0) {
+      if (dw && dw.errcode === 0) {
         this.$message.success('操作成功')
       }
     }

+ 2 - 2
src/views/vpn/ipsec-server.vue

@@ -89,8 +89,8 @@ export default {
   async mounted () {
     await this.caquery()
     await this.sigcacertquery()
-    const res = this.getIPSecServer()
-    if (res.errcode === 0) {
+    const res = await this.getIPSecServer()
+    if (res && res.errcode === 0) {
       this.ruleForm = res.data
     }
   },

+ 5 - 5
src/views/vpn/ssl-client.vue

@@ -92,19 +92,19 @@ export default {
   async mounted () {
     await this.caquery()
     await this.sigcacertquery()
-    const res = await this.sslquery()
-    if (res.errcode === 0) {
+    const res = await this.getSSLServer()
+    if (res && res.errcode === 0) {
       this.ruleForm = res.data
     }
   },
   methods: {
-    ...mapActions(['sigcacertquery', 'sslState', 'caquery', 'setSSLClient', 'sslquery']),
+    ...mapActions(['sigcacertquery', 'sslState', 'caquery', 'setSSLClient', 'getSSLServer']),
     // 提交数据
     async onSubmit () {
       this.$refs.form.validate(async (valid) => {
         if (!valid) return false
         const res = await this.setSSLClient(this.ruleForm)
-        if (res.errcode === 0) {
+        if (res && res.errcode === 0) {
           this.$message.success('设置成功')
         }
       })
@@ -112,7 +112,7 @@ export default {
     // 启动停止重启
     async reboot (e) {
       const dw = await this.sslState({ type: e })
-      if (dw.errcode === 0) {
+      if (dw && dw.errcode === 0) {
         this.$message.success('操作成功')
       }
     }

+ 6 - 6
src/views/vpn/ssl-server.vue

@@ -64,7 +64,7 @@
 <script>
 import { mapState, mapActions } from 'vuex'
 export default {
-  name: 'lan',
+  name: 'ssl-server',
   components: {},
   computed: {
     ...mapState(['cadata', 'sigdata', 'ssldata'])
@@ -113,19 +113,19 @@ export default {
   async mounted () {
     await this.caquery()
     await this.sigcacertquery()
-    const res = await this.sslserivcequery()
-    if (res.errcode === 0) {
+    const res = await this.getSSLServer()
+    if (res && res.errcode === 0) {
       this.ruleForm = res.data
     }
   },
   methods: {
-    ...mapActions(['sigcacertquery', 'sslState', 'caquery', 'setSSLServer', 'sslserivcequery']),
+    ...mapActions(['sigcacertquery', 'sslState', 'caquery', 'setSSLServer', 'getSSLServer']),
     // 提交数据
     async onSubmit () {
       this.$refs.form.validate(async (valid) => {
         if (!valid) return false
         const res = await this.setSSLServer(this.ruleForm)
-        if (res.errcode === 0) {
+        if (res && res.errcode === 0) {
           this.$message.success('设置成功')
         }
       })
@@ -133,7 +133,7 @@ export default {
     // 启动停止重启
     async reboot (e) {
       const dw = await this.sslState({ type: e })
-      if (dw.errcode === 0) {
+      if (dw && dw.errcode === 0) {
         this.$message.success('操作成功')
       }
     }